Skip to content

Issue/disabling battery saver theme change on older devices#11480

Merged
marecar3 merged 4 commits intofeature/material-themefrom
issue/disabling-battery-saver-theme-change-on-older-devices
Mar 20, 2020
Merged

Issue/disabling battery saver theme change on older devices#11480
marecar3 merged 4 commits intofeature/material-themefrom
issue/disabling-battery-saver-theme-change-on-older-devices

Conversation

@khaykov
Copy link
Copy Markdown
Contributor

@khaykov khaykov commented Mar 19, 2020

Fixes this issue.

On devices with API 27 and lower, when the app theme is set based on battery saver, toggling battery saver option twice causes activities to lose state (savedInstanceState will be null). This can result in all kinds of fun stuff that we do not want. This all happens on system level, and unless we decide to handle all UI configuration changes manually there is nothing we can do about this.

This PR removes Set by Battery Saver theme option from devices with API 27 and lower. For those devices Light will be the default option.

Battery saver theme switch on API 28 works as expected with the MODE_NIGHT_FOLLOW_SYSTEM flag.

To test 1:

  • Using a device with API <= 27 navigate to App Settings and open Appearance option.
  • Notice that there are only two options Light and Dark. Light should be selected by default.
  • Pick an option and notice that the app theme changes accordingly.
  • Toggle battery saver on and off, and make sure that the app theme does not change.

To test 2:

  • Using a device with API 28 navigate to App Settings and open Appearance option.
  • Notice that there are three options Light and Dark and Set by Battery Saver. Set by Battery Saver should be selected by default.
  • Toggle battery saver on and off, and make sure that the app theme changes.
  • Pick any other option and notice that the app theme changes accordingly.

PR submission checklist:

  • I have considered adding unit tests where possible.
  • I have considered adding accessibility improvements for my changes.
  • I have considered if this change warrants user-facing release notes and have added them to RELEASE-NOTES.txt if necessary.

@peril-wordpress-mobile
Copy link
Copy Markdown

peril-wordpress-mobile bot commented Mar 19, 2020

You can test the changes on this Pull Request by downloading the APK here.

@marecar3
Copy link
Copy Markdown
Contributor

Nice work @khaykov!
It seems that it's fixed.

Copy link
Copy Markdown
Contributor

@marecar3 marecar3 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@marecar3 marecar3 merged commit 8c190de into feature/material-theme Mar 20, 2020
@marecar3 marecar3 deleted the issue/disabling-battery-saver-theme-change-on-older-devices branch March 20, 2020 14:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants