DokuwikiAndroid icon indicating copy to clipboard operation
DokuwikiAndroid copied to clipboard

Data loss on double screen rotation

Open davirec opened this issue 2 years ago • 1 comments

In the double screen rotation test to detect data loss, an application failure was identified:

  • EditActivity: Text disappears and popup menu disappears
  • MainActivity: information disappears, night mode and normal mode, view property changes (changes from content_description': u'Close navigation drawer' to content_description': u'Open navigation drawer'), search disappears, view property changes (u' visible': True changes to u'visible': False), the text disappears, and returns to the previous page.

A data loss problem occurs when data is accidentally deleted or state variables are accidentally assigned with default or initial values. This issue is related to the activity's lifecycle (1). When a screen rotation occurs, the activity is destroyed and resumed. Data loss will happen if the developer does not save the variables before the destruction and restore them after creation. To avoid this, the developers have to implement both the logic necessary to save the activity state in the onSaveInstanceState() callback method and the logic to resume its state in the onRestoreInstanceState() callback method. Another way to avoid data loss problems is to use the view model, designed to store and manage UI-related data in a lifecycle-conscious way (2).

  • EditActivity:
Before and after double screen rotation
Before and after double screen rotation
  • MainActivity:
Before and after double screen rotation
Before and after double screen rotation
Before and after double screen rotation
Before and after double screen rotation
Before and after double screen rotation

Device:

  • Device: Moto G30 with OS: Android 11
  • Device language: English

Note:

  • Double screen rotation: It is executed twice to reach a state that should be exactly the same as the screen before if no data loss occurred.
  • A data loss problem occurs when data is accidentally deleted or state variables are accidentally assigned with default or initial values.
  1. https://developer.android.com/guide/components/activities/activity-lifecycle
  2. https://developer.android.com/topic/libraries/architecture/viewmodel

davirec avatar Mar 23 '22 21:03 davirec

fix ongoing in the Edit page: https://github.com/fabienli/DokuwikiAndroid/commit/6a879f03281da63cb660068bcad2709700129a39

fabienli avatar Mar 24 '22 10:03 fabienli

testing with latest delivered version, this issue is now fixed

fabienli avatar Aug 29 '24 12:08 fabienli