3

I just updated my OG Pixel 1 to Android 10. I normally use light mode (not dark mode), but my phone just hit the threshold to turn on battery saver mode, and now it has forced my phone into dark mode. I can't toggle this in settings while battery saver is on, and I don't see any settings in battery saver to prevent this force theme change. I find it incomprehensible that this wouldn't be an option, given that there are plenty of phones (like the OG Pixel) that still use LCD screens, and thus whose screen colors don't affect the battery usage.

Are there any settings, hidden or otherwise, that prevent dark mode from activating during battery saver on Android 10?

1
  • I wish I could give this a bounty. It is really annoying that it changes to dark mode. I hate dark mode and never use it, even when I'm reading in a dark room I just reduce the brightness. I don't mind being reminded that I'm at the low power threshold; I would even be fine with a modal notification. But don't change to dark mode! – Ross Presser Feb 5 at 17:20
2

According to the source code file

frameworks/base/core/java/android/provider/Settings.java

there is a global setting in the user profile called battery_saver_constants, which can hold several comma separated parameters. These parameters are applied when battery saver is on. Here's the list:

/**
 * Battery Saver specific settings
 * This is encoded as a key=value list, separated by commas. Ex:
 *
 * "vibration_disabled=true,adjust_brightness_factor=0.5"
 *
 * The following keys are supported:
 *
 * <pre>
 * advertise_is_enabled              (boolean)
 * datasaver_disabled                (boolean)
 * enable_night_mode                 (boolean)
 * launch_boost_disabled             (boolean)
 * vibration_disabled                (boolean)
 * animation_disabled                (boolean)
 * soundtrigger_disabled             (boolean)
 * fullbackup_deferred               (boolean)
 * keyvaluebackup_deferred           (boolean)
 * firewall_disabled                 (boolean)
 * gps_mode                          (int)
 * adjust_brightness_disabled        (boolean)
 * adjust_brightness_factor          (float)
 * force_all_apps_standby            (boolean)
 * force_background_check            (boolean)
 * optional_sensors_disabled         (boolean)
 * aod_disabled                      (boolean)
 * quick_doze_enabled                (boolean)
 * </pre>
 * @hide
 * @see com.android.server.power.batterysaver.BatterySaverPolicy
 */

On recent Android's, the global settings configuration file has XML format and is located here

/data/system/users/0/settings_global.xml

So you can add this new parameter called battery_saver_constants with its value enable_night_mode=false like this:

<setting id="9999" name="battery_saver_constants" value="enable_night_mode=false" defaultValue="enable_night_mode=false" package="android" defaultSysSet="true" />

Notice the id parameter, it can be any number but should be unique in this configuration file.

P.S. You need root to edit this file.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.