Uploaded image for project: 'Titanium SDK/CLI'
  1. Titanium SDK/CLI
  2. TIMOB-27067

Android: UI sometimes disappears on Android 9.0 and higher when battery saver turns on/off


    • Story Points:
    • Sprint:
      2019 Sprint 11


      On Android 9.0 and higher, a Titanium window's UI may disappear when the system's battery optimizer turn on or off. This can happen if the XML activities defined in the "tiapp.xml" are missing "android:configChanges" value "uiMode".

      This issue can be reproduced consistently in an Android 9 (API 28) emulator.

      Steps to reproduce:

      1. Create a new Titanium Classic "Default Project".
      2. Build and run on an Android 9 (aka: API 28) emulator.
      3. In the Android emulator's toolbar, click the "..." button.
      4. An "Extended Controls" window will open next to the emulator.
      5. Click on the "Battery" tab in this window.
      6. Go to the "Charge level" and lower it to 10%.
      7. Click the "Charge connection" drop-down and change it from "AC charger" to "None" (or vice-versa).
      8. In the emulator, if it asks if you want to enable the battery optimizer, tap "Yes".
      9. Notice that the Titanium app's UI disappears.
      10. Press the Android "Back" button.
      11. Relaunch the app. (The UI will appear as normal.)
      12. Click the emulator's "Charge connection" drop-down and change it back to "AC charger".
      13. Notice that the Titanium app's UI disappears again.

      The "AndroidManifest.xml" that is being generated by Titanium's build system is missing a setting. We need to add "uiMode" to every Titanium <activity/> elements "android:configChanges" attribute.

      You can work-around this issue by adding the following "activity" XML settings to the "tiapp.xml" file. The key thing here is to add all of the missing "configChanges" values. Particularly the "uiMode" value which solves this ticket's specific issue.

      <?xml version="1.0" encoding="UTF-8"?>
      <ti:app xmlns:ti="http://ti.appcelerator.org">
      	<android xmlns:android="http://schemas.android.com/apk/res/android">
      				<activity android:name="org.appcelerator.titanium.TiActivity" android:configChanges="density|fontScale|keyboard|keyboardHidden|layoutDirection|locale|mcc|mnc|navigation|orientation|screenLayout|screenSize|smallestScreenSize|touchscreen|uiMode"/>
      				<activity android:name="org.appcelerator.titanium.TiTranslucentActivity" android:configChanges="density|fontScale|keyboard|keyboardHidden|layoutDirection|locale|mcc|mnc|navigation|orientation|screenLayout|screenSize|smallestScreenSize|touchscreen|uiMode" android:theme="@style/Theme.Titanium.Translucent"/>


          Issue Links



              • Assignee:
                jquick Joshua Quick
                jquick Joshua Quick
                Yordan Banev
                Keerthi Mahalingam (Inactive)
              • Watchers:
                2 Start watching this issue


                • Created:

                  Backbone Issue Sync

                  • Backbone Issue Sync is enabled for your project, but we do not have any synchronization info for this issue.

                    Git Integration