Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 1bb480a3 authored by John Spurlock's avatar John Spurlock
Browse files

Battery saver: new policy changes + SystemUI tweaks.

 - Service policy changes: allow the user to turn off (snooze)
   saver mode below the auto-trigger level.  Plugging in the
   device always exits saver mode.
 - Default trigger level is now 0 (never) instead of 15.
 - SystemUI now also listens to a new POWER_SAVE_MODE_CHANGING,
   since waiting for _CHANGED can take seconds.
 - Move shared feature description text into the framework so it
   can be shared.
 - Tweak dialog title + action strings.
 - Remove trigger-level from SystemUI, it no longer needs it.
 - Add the ability to turn off saver mode directly from the
   notification.
 - Migrate saver confirmation dialog to common system UI dialog
   helper, and add a few convenience methods.
 - Fix bug where the status bar area would be orange over the keyguard
   in SHADE_LOCKED mode.

Bug:16214395
Change-Id: I3d1ded1eec9e63e7d97469486f6a320e1bebbccd
parent bc53cb41
Loading
Loading
Loading
Loading
+13 −0
Original line number Diff line number Diff line
@@ -715,6 +715,19 @@ public final class PowerManager {
    public static final String ACTION_POWER_SAVE_MODE_CHANGED
            = "android.os.action.POWER_SAVE_MODE_CHANGED";

    /**
     * Intent that is broadcast when the state of {@link #isPowerSaveMode()} is about to change.
     * This broadcast is only sent to registered receivers.
     *
     * @hide
     */
    @SdkConstant(SdkConstant.SdkConstantType.BROADCAST_INTENT_ACTION)
    public static final String ACTION_POWER_SAVE_MODE_CHANGING
            = "android.os.action.POWER_SAVE_MODE_CHANGING";

    /** @hide */
    public static final String EXTRA_POWER_SAVE_MODE = "mode";

    /**
     * A wake lock is a mechanism to indicate that your application needs
     * to have the device stay on.
+1 −0
Original line number Diff line number Diff line
@@ -75,6 +75,7 @@
    <protected-broadcast android:name="android.intent.action.USER_SWITCHED" />

    <protected-broadcast android:name="android.os.action.POWER_SAVE_MODE_CHANGED" />
    <protected-broadcast android:name="android.os.action.POWER_SAVE_MODE_CHANGING" />

    <protected-broadcast android:name="android.app.action.ENTER_CAR_MODE" />
    <protected-broadcast android:name="android.app.action.EXIT_CAR_MODE" />
+3 −0
Original line number Diff line number Diff line
@@ -4878,4 +4878,7 @@
    <string name="description_krtv_12">12세미만의 청소년이 시청하기에 부적절한 내용이 포함되어 있어 보호자의 시청지도가 필요한 등급을 말한다.</string>
    <string name="description_krtv_15">15세미만의 청소년이 시청하기에 부적절한 내용이 포함되어 있어 보호자의 시청지도가 필요한 등급을 말한다.</string>
    <string name="description_krtv_19">19세미만의 청소년이 시청하기에 부적절한 내용이 포함되어 있어 청소년이 시청할 수 없는 등급을 말한다.</string>

     <!-- [CHAR_LIMIT=NONE] Battery saver: Feature description -->
    <string name="battery_saver_description">To help improve battery life, battery saver will reduce your device’s performance and restrict background data.  Email, messaging, and other apps that rely on syncing may not update unless you open them.\n\nBattery saver turns off automatically when your device is charging.</string>
</resources>
+1 −0
Original line number Diff line number Diff line
@@ -1894,6 +1894,7 @@
  <java-symbol type="string" name="timepicker_numbers_radius_multiplier_normal" />
  <java-symbol type="string" name="timepicker_transition_mid_radius_multiplier" />
  <java-symbol type="string" name="timepicker_transition_end_radius_multiplier" />
  <java-symbol type="string" name="battery_saver_description" />

  <java-symbol type="string" name="item_is_selected" />
  <java-symbol type="string" name="day_of_week_label_typeface" />
+5 −8
Original line number Diff line number Diff line
@@ -86,16 +86,13 @@
    <string name="battery_low_why">Settings</string>

    <!-- Battery saver confirmation dialog title [CHAR LIMIT=NONE]-->
    <string name="battery_saver_confirmation_title">Start battery saver?</string>
    <string name="battery_saver_confirmation_title">Turn on battery saver?</string>

    <!-- Battery saver confirmation dialog ok text [CHAR LIMIT=40]-->
    <string name="battery_saver_confirmation_ok">Start</string>
    <string name="battery_saver_confirmation_ok">Turn on</string>

    <!-- Battery saver notification action [CHAR LIMIT=NONE]-->
    <string name="battery_saver_start_action">Start battery saver</string>

    <!-- Battery saver confirmation dialog text [CHAR LIMIT=NONE]-->
    <string name="battery_saver_confirmation_text">To help improve battery life, Battery saver will reduce your device’s performance.\n\nBattery saver will be disabled when your device is plugged in.</string>
    <string name="battery_saver_start_action">Turn on battery saver</string>

    <!-- Name of the button that links to the Settings app. [CHAR LIMIT=NONE] -->
    <string name="status_bar_settings_settings_button">Settings</string>
@@ -719,10 +716,10 @@
    <string name="battery_saver_notification_title">Battery saver is on</string>

    <!-- Battery saver notification text. [CHAR LIMIT=60] -->
    <string name="battery_saver_notification_text">Device performance is reduced.</string>
    <string name="battery_saver_notification_text">Reduces performance and background data</string>

    <!-- Battery saver notification action text. [CHAR LIMIT=60] -->
    <string name="battery_saver_notification_action_text">Open battery saver settings</string>
    <string name="battery_saver_notification_action_text">Turn off battery saver</string>

    <!-- Battery level for expanded quick settings [CHAR LIMIT=2] -->
    <string name="battery_level_template"><xliff:g id="level" example="45">%d</xliff:g>%%</string>
Loading