fenix icon indicating copy to clipboard operation
fenix copied to clipboard

When Battery Saver mode changes, the app crashes

Open jonalmeida opened this issue 7 years ago • 5 comments

STR

  1. Change theme option to 'Set by Battery Saver'.
  2. Enable Battery Saver mode (from the Quick Settings).
  3. Observe the crash.

https://sentry.prod.mozaws.net/operations/firefox-nightly/issues/5486466/

NullPointerException: Attempt to invoke virtual method 'android.os.Looper android.app.ActivityThread.getLooper()' on a null object reference
    at android.app.Activity.recreate(Activity.java:5584)
    at androidx.core.app.ActivityCompat.recreate(ActivityCompat.java:2)
    at androidx.appcompat.app.AppCompatDelegateImpl.applyDayNight(AppCompatDelegateImpl.java:30)
    at androidx.appcompat.app.AppCompatDelegateImpl.attachBaseContext(AppCompatDelegateImpl.java:1)
    at androidx.appcompat.app.AppCompatActivity.attachBaseContext(AppCompatActivity.java:2)
...
(15 additional frame(s) were not displayed)

RuntimeException: Unable to start activity ComponentInfo{org.mozilla.fenix/org.mozilla.fenix.HomeActivity}: java.lang.NullPointerException: Attempt to invoke virtual method 'android.os.Looper android.app.ActivityThread.getLooper()' on a null object reference
    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2951)
    at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3086)
    at android.app.ActivityThread.handleRelaunchActivityInner(ActivityThread.java:4823)
    at android.app.ActivityThread.handleRelaunchActivity(ActivityThread.java:4732)
    at android.app.servertransaction.ActivityRelaunchItem.execute(ActivityRelaunchItem.java:69)
...
(9 additional frame(s) were not displayed)

Unable to start activity ComponentInfo{org.mozilla.fenix/org.mozilla.fenix.HomeActivity}: java.lang.NullPointerException: Attempt to invoke virtual method 'android.os.Looper android.app.ActivityThread.getLooper()' on a null object reference

┆Issue is synchronized with this Jira Task

jonalmeida avatar Apr 05 '19 00:04 jonalmeida

cc: @ekager since it looks like it's still being worked on and this bug might already be addressed in any currently open PRs.

jonalmeida avatar Apr 05 '19 00:04 jonalmeida

Thanks for the cc!

I dug a little deeper and there's a note in the docs under MODE_NIGHT_AUTO_BATTERY

Please note: this mode should only be used when running on devices which do not provide a similar device-wide setting.

I think because Pixels (and other phone's on P+ maybe?) automatically change the system mode to dark on battery saver mode anyway we should remove the battery saver option because "follow system" is doing the same thing (and I think this is related to the crash). If anyone has insight into if any, and which devices should have this setting, please let me know.

ekager avatar Apr 05 '19 02:04 ekager

Tested on 6 different devices but I was not able to reproduce the initial crash on older builds so I can't really confirm if this is fixed or not. @jonalmeida could you confirm this on your device?

I did encounter a different issue while testing and logged #1484 for it. Devices used are also mentioned there.

bsurd avatar Apr 09 '19 10:04 bsurd

Going to close this since you weren't able to reproduce.

ekager avatar Apr 09 '19 19:04 ekager

Going to close this since you weren't able to reproduce.

Yes, this isn't reproducible any more since the option is gone away from the UI.

jonalmeida avatar Apr 09 '19 20:04 jonalmeida