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

Commit 1334afec authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge changes from topic "wear_small_battery-master"

* changes:
  Revert device idle timing changes for small battery devices.
  Removing watch specific DeviceIdleController logic in favor of small battery device flag
parents 7827bc93 88871462
Loading
Loading
Loading
Loading
+0 −10
Original line number Diff line number Diff line
@@ -9368,16 +9368,6 @@ public final class Settings {
         */
        public static final String DEVICE_IDLE_CONSTANTS = "device_idle_constants";

        /**
         * Device Idle (Doze) specific settings for watches. See {@code #DEVICE_IDLE_CONSTANTS}
         *
         * <p>
         * Type: string
         * @hide
         * @see com.android.server.DeviceIdleController.Constants
         */
        public static final String DEVICE_IDLE_CONSTANTS_WATCH = "device_idle_constants_watch";

        /**
         * Battery Saver specific settings
         * This is encoded as a key=value list, separated by commas. Ex:
+0 −1
Original line number Diff line number Diff line
@@ -168,7 +168,6 @@ public class SettingsBackupTest {
                    Settings.Global.DEVELOPMENT_SETTINGS_ENABLED,
                    Settings.Global.DEVICE_DEMO_MODE,
                    Settings.Global.DEVICE_IDLE_CONSTANTS,
                    Settings.Global.DEVICE_IDLE_CONSTANTS_WATCH,
                    Settings.Global.BATTERY_SAVER_CONSTANTS,
                    Settings.Global.DEFAULT_SM_DP_PLUS,
                    Settings.Global.DEVICE_NAME,
+0 −3
Original line number Diff line number Diff line
@@ -719,9 +719,6 @@ class SettingsProtoDumpUtil {
        dumpSetting(s, p,
                Settings.Global.DEVICE_IDLE_CONSTANTS,
                GlobalSettingsProto.DEVICE_IDLE_CONSTANTS);
        dumpSetting(s, p,
                Settings.Global.DEVICE_IDLE_CONSTANTS_WATCH,
                GlobalSettingsProto.DEVICE_IDLE_CONSTANTS_WATCH);
        dumpSetting(s, p,
                Settings.Global.APP_IDLE_CONSTANTS,
                GlobalSettingsProto.APP_IDLE_CONSTANTS);
+7 −10
Original line number Diff line number Diff line
@@ -766,17 +766,15 @@ public class DeviceIdleController extends SystemService
        public long NOTIFICATION_WHITELIST_DURATION;

        private final ContentResolver mResolver;
        private final boolean mHasWatch;
        private final boolean mSmallBatteryDevice;
        private final KeyValueListParser mParser = new KeyValueListParser(',');

        public Constants(Handler handler, ContentResolver resolver) {
            super(handler);
            mResolver = resolver;
            mHasWatch = getContext().getPackageManager().hasSystemFeature(
                    PackageManager.FEATURE_WATCH);
            mResolver.registerContentObserver(Settings.Global.getUriFor(
                    mHasWatch ? Settings.Global.DEVICE_IDLE_CONSTANTS_WATCH
                              : Settings.Global.DEVICE_IDLE_CONSTANTS),
            mSmallBatteryDevice = ActivityManager.isSmallBatteryDevice();
            mResolver.registerContentObserver(
                    Settings.Global.getUriFor(Settings.Global.DEVICE_IDLE_CONSTANTS),
                    false, this);
            updateConstants();
        }
@@ -790,8 +788,7 @@ public class DeviceIdleController extends SystemService
            synchronized (DeviceIdleController.this) {
                try {
                    mParser.setString(Settings.Global.getString(mResolver,
                            mHasWatch ? Settings.Global.DEVICE_IDLE_CONSTANTS_WATCH
                                      : Settings.Global.DEVICE_IDLE_CONSTANTS));
                            Settings.Global.DEVICE_IDLE_CONSTANTS));
                } catch (IllegalArgumentException e) {
                    // Failed to parse the settings string, log this and move on
                    // with defaults.
@@ -821,7 +818,7 @@ public class DeviceIdleController extends SystemService
                MIN_DEEP_MAINTENANCE_TIME = mParser.getLong(
                        KEY_MIN_DEEP_MAINTENANCE_TIME,
                        !COMPRESS_TIME ? 30 * 1000L : 5 * 1000L);
                long inactiveTimeoutDefault = (mHasWatch ? 15 : 30) * 60 * 1000L;
                long inactiveTimeoutDefault = (mSmallBatteryDevice ? 15 : 30) * 60 * 1000L;
                INACTIVE_TIMEOUT = mParser.getLong(KEY_INACTIVE_TIMEOUT,
                        !COMPRESS_TIME ? inactiveTimeoutDefault : (inactiveTimeoutDefault / 10));
                SENSING_TIMEOUT = mParser.getLong(KEY_SENSING_TIMEOUT,
@@ -831,7 +828,7 @@ public class DeviceIdleController extends SystemService
                LOCATION_ACCURACY = mParser.getFloat(KEY_LOCATION_ACCURACY, 20);
                MOTION_INACTIVE_TIMEOUT = mParser.getLong(KEY_MOTION_INACTIVE_TIMEOUT,
                        !COMPRESS_TIME ? 10 * 60 * 1000L : 60 * 1000L);
                long idleAfterInactiveTimeout = (mHasWatch ? 15 : 30) * 60 * 1000L;
                long idleAfterInactiveTimeout = (mSmallBatteryDevice ? 15 : 30) * 60 * 1000L;
                IDLE_AFTER_INACTIVE_TIMEOUT = mParser.getLong(KEY_IDLE_AFTER_INACTIVE_TIMEOUT,
                        !COMPRESS_TIME ? idleAfterInactiveTimeout
                                       : (idleAfterInactiveTimeout / 10));