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

Commit 597da8ad authored by shreerag's avatar shreerag Committed by Michael Kwan
Browse files

Removing watch specific DeviceIdleController logic in favor of small battery device flag

Bug: 28091250
Change-Id: Iaeda3c8249287fec7d17e575071de22cad344cea
(cherry picked from commit b964832da6a6ba0615c1f7606b22b5fd89c45491)
parent 30e7ca0f
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
@@ -760,17 +760,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();
        }
@@ -784,8 +782,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.
@@ -815,7 +812,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 ? 3 : 30) * 60 * 1000L;
                INACTIVE_TIMEOUT = mParser.getLong(KEY_INACTIVE_TIMEOUT,
                        !COMPRESS_TIME ? inactiveTimeoutDefault : (inactiveTimeoutDefault / 10));
                SENSING_TIMEOUT = mParser.getLong(KEY_SENSING_TIMEOUT,
@@ -825,7 +822,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 ? 3 : 30) * 60 * 1000L;
                IDLE_AFTER_INACTIVE_TIMEOUT = mParser.getLong(KEY_IDLE_AFTER_INACTIVE_TIMEOUT,
                        !COMPRESS_TIME ? idleAfterInactiveTimeout
                                       : (idleAfterInactiveTimeout / 10));