OSDN Git Service

Don't show the battery saver toast when the screen turns on
authorMakoto Onuki <omakoto@google.com>
Mon, 27 Nov 2017 22:05:53 +0000 (14:05 -0800)
committerMakoto Onuki <omakoto@google.com>
Mon, 27 Nov 2017 22:05:53 +0000 (14:05 -0800)
Bug 68769804
Test: manual test

Change-Id: I4eca183f5e61d31d162d3d0914fe2dc94bb8a11e

services/core/java/com/android/server/power/batterysaver/BatterySaverController.java

index ae01ea5..483d518 100644 (file)
@@ -217,13 +217,6 @@ public class BatterySaverController implements BatterySaverPolicyListener {
             pmi.powerHint(PowerHint.LOW_POWER, enabled ? 1 : 0);
         }
 
-        if (enabled) {
-            // STOPSHIP Remove the toast.
-            Toast.makeText(mContext,
-                    com.android.internal.R.string.battery_saver_warning,
-                    Toast.LENGTH_LONG).show();
-        }
-
         if (ArrayUtils.isEmpty(fileValues)) {
             mFileUpdater.restoreDefault();
         } else {
@@ -231,6 +224,13 @@ public class BatterySaverController implements BatterySaverPolicyListener {
         }
 
         if (sendBroadcast) {
+            if (enabled) {
+                // STOPSHIP Remove the toast.
+                Toast.makeText(mContext,
+                        com.android.internal.R.string.battery_saver_warning,
+                        Toast.LENGTH_LONG).show();
+            }
+
             if (DEBUG) {
                 Slog.i(TAG, "Sending broadcasts for mode: " + enabled);
             }