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

Commit c44d86ec authored by Kweku Adams's avatar Kweku Adams Committed by Android (Google) Code Review
Browse files

Merge "Add config file for battery saver."

parents ca83aa2a 33590c17
Loading
Loading
Loading
Loading
+0 −8
Original line number Original line Diff line number Diff line
@@ -4803,8 +4803,6 @@
    <!-- Size of icon shown beside a preference locked by admin -->
    <!-- Size of icon shown beside a preference locked by admin -->
    <dimen name="config_restrictedIconSize">@dimen/restricted_icon_size_material</dimen>
    <dimen name="config_restrictedIconSize">@dimen/restricted_icon_size_material</dimen>


    <string translatable="false" name="config_batterySaverDeviceSpecificConfig"></string>

    <!-- Component name that should be granted Notification Assistant access -->
    <!-- Component name that should be granted Notification Assistant access -->
    <string name="config_defaultAssistantAccessComponent" translatable="false">android.ext.services/android.ext.services.notification.Assistant</string>
    <string name="config_defaultAssistantAccessComponent" translatable="false">android.ext.services/android.ext.services.notification.Assistant</string>


@@ -4834,12 +4832,6 @@
    <!-- Default value set for battery percentage in status bar false = disabled, true = enabled -->
    <!-- Default value set for battery percentage in status bar false = disabled, true = enabled -->
    <bool name="config_defaultBatteryPercentageSetting">false</bool>
    <bool name="config_defaultBatteryPercentageSetting">false</bool>


    <!-- Whether or not battery saver should be "sticky" when manually enabled. -->
    <bool name="config_batterySaverStickyBehaviourDisabled">false</bool>

    <!-- Config flag to track default disable threshold for Dynamic power savings enabled battery saver. -->
    <integer name="config_dynamicPowerSavingsDefaultDisableThreshold">80</integer>

    <!-- Model of potentially misprovisioned devices. If none is specified in an overlay, an
    <!-- Model of potentially misprovisioned devices. If none is specified in an overlay, an
         empty string is passed in. -->
         empty string is passed in. -->
    <string name="config_misprovisionedDeviceModel" translatable="false"></string>
    <string name="config_misprovisionedDeviceModel" translatable="false"></string>
+90 −0
Original line number Original line Diff line number Diff line
<?xml version="1.0" encoding="utf-8"?>
<!--
/*
** Copyright (C) 2023 The Android Open Source Project
**
** Licensed under the Apache License, Version 2.0 (the "License");
** you may not use this file except in compliance with the License.
** You may obtain a copy of the License at
**
**     http://www.apache.org/licenses/LICENSE-2.0
**
** Unless required by applicable law or agreed to in writing, software
** distributed under the License is distributed on an "AS IS" BASIS,
** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
** See the License for the specific language governing permissions and
** limitations under the License.
*/
-->

<!-- These resources are around just to allow their values to be customized
     for different hardware and product builds.  Do not translate.

     NOTE: The naming convention is "config_camelCaseValue". Some legacy
     entries do not follow the convention, but all new entries should. -->

<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
    <string translatable="false" name="config_batterySaverDeviceSpecificConfig"></string>

    <!-- Whether or not battery saver should be "sticky" when manually enabled. -->
    <bool name="config_batterySaverStickyBehaviourDisabled">false</bool>

    <!-- Config flag to track default disable threshold for Dynamic power savings enabled battery saver. -->
    <integer name="config_dynamicPowerSavingsDefaultDisableThreshold">80</integer>

    <!-- Default for BatterySaverPolicy.DEFAULT_FULL_POLICY.adjustBrightnessFactor -->
    <item name="config_batterySaver_full_adjustBrightnessFactor" format="float" type="dimen">
        .5
    </item>

    <!-- Default for BatterySaverPolicy.DEFAULT_FULL_POLICY.deferFullBackup -->
    <bool name="config_batterySaver_full_deferFullBackup">true</bool>

    <!-- Default for BatterySaverPolicy.DEFAULT_FULL_POLICY.deferKeyValueBackup -->
    <bool name="config_batterySaver_full_deferKeyValueBackup">true</bool>

    <!-- Default for BatterySaverPolicy.DEFAULT_FULL_POLICY.disableAnimation -->
    <bool name="config_batterySaver_full_disableAnimation">false</bool>

    <!-- Default for BatterySaverPolicy.DEFAULT_FULL_POLICY.disableAod -->
    <bool name="config_batterySaver_full_disableAod">true</bool>

    <!-- Default for BatterySaverPolicy.DEFAULT_FULL_POLICY.disableLaunchBoost -->
    <bool name="config_batterySaver_full_disableLaunchBoost">true</bool>

    <!-- Default for BatterySaverPolicy.DEFAULT_FULL_POLICY.disableOptionalSensors -->
    <bool name="config_batterySaver_full_disableOptionalSensors">true</bool>

    <!-- Default for BatterySaverPolicy.DEFAULT_FULL_POLICY.disableVibration -->
    <bool name="config_batterySaver_full_disableVibration">false</bool>

    <!-- Default for BatterySaverPolicy.DEFAULT_FULL_POLICY.enableAdjustBrightness -->
    <bool name="config_batterySaver_full_enableAdjustBrightness">false</bool>

    <!-- Default for BatterySaverPolicy.DEFAULT_FULL_POLICY.enableDataSaver -->
    <bool name="config_batterySaver_full_enableDataSaver">false</bool>

    <!-- Default for BatterySaverPolicy.DEFAULT_FULL_POLICY.enableFirewall -->
    <bool name="config_batterySaver_full_enableFirewall">true</bool>

    <!-- Default for BatterySaverPolicy.DEFAULT_FULL_POLICY.enableNightMode -->
    <bool name="config_batterySaver_full_enableNightMode">true</bool>

    <!-- Default for BatterySaverPolicy.DEFAULT_FULL_POLICY.enableQuickDoze -->
    <bool name="config_batterySaver_full_enableQuickDoze">true</bool>

    <!-- Default for BatterySaverPolicy.DEFAULT_FULL_POLICY.forceAllAppsStandby -->
    <bool name="config_batterySaver_full_forceAllAppsStandby">true</bool>

    <!-- Default for BatterySaverPolicy.DEFAULT_FULL_POLICY.forceBackgroundCheck -->
    <bool name="config_batterySaver_full_forceBackgroundCheck">true</bool>

    <!-- Default for BatterySaverPolicy.DEFAULT_FULL_POLICY.locationMode
       (LOCATION_MODE_FOREGROUND_ONLY) -->
    <integer name="config_batterySaver_full_locationMode">3</integer>

    <!-- Default for BatterySaverPolicy.DEFAULT_FULL_POLICY.soundTriggerMode
       (SOUND_TRIGGER_MODE_CRITICAL_ONLY) -->
    <integer name="config_batterySaver_full_soundTriggerMode">1</integer>
</resources>
+19 −1
Original line number Original line Diff line number Diff line
@@ -3936,7 +3936,6 @@


  <!-- From media projection -->
  <!-- From media projection -->
  <java-symbol type="string" name="config_mediaProjectionPermissionDialogComponent" />
  <java-symbol type="string" name="config_mediaProjectionPermissionDialogComponent" />
  <java-symbol type="string" name="config_batterySaverDeviceSpecificConfig" />


  <!-- Compile SDK check -->
  <!-- Compile SDK check -->
  <java-symbol type="layout" name="unsupported_compile_sdk_dialog_content" />
  <java-symbol type="layout" name="unsupported_compile_sdk_dialog_content" />
@@ -4000,11 +3999,30 @@
  <java-symbol type="string" name="notification_app_name_system" />
  <java-symbol type="string" name="notification_app_name_system" />
  <java-symbol type="string" name="notification_app_name_settings" />
  <java-symbol type="string" name="notification_app_name_settings" />


  <!-- Battery saver config -->
  <java-symbol type="integer" name="config_lowBatteryAutoTriggerDefaultLevel" />
  <java-symbol type="integer" name="config_lowBatteryAutoTriggerDefaultLevel" />
  <java-symbol type="string" name="config_batterySaverDeviceSpecificConfig" />
  <java-symbol type="bool" name="config_batterySaverStickyBehaviourDisabled" />
  <java-symbol type="bool" name="config_batterySaverStickyBehaviourDisabled" />
  <java-symbol type="integer" name="config_dynamicPowerSavingsDefaultDisableThreshold" />
  <java-symbol type="integer" name="config_dynamicPowerSavingsDefaultDisableThreshold" />
  <java-symbol type="string" name="config_batterySaverScheduleProvider" />
  <java-symbol type="string" name="config_batterySaverScheduleProvider" />
  <java-symbol type="string" name="config_powerSaveModeChangedListenerPackage" />
  <java-symbol type="string" name="config_powerSaveModeChangedListenerPackage" />
  <java-symbol type="dimen" name="config_batterySaver_full_adjustBrightnessFactor" />
  <java-symbol type="bool" name="config_batterySaver_full_deferFullBackup" />
  <java-symbol type="bool" name="config_batterySaver_full_deferKeyValueBackup" />
  <java-symbol type="bool" name="config_batterySaver_full_disableAnimation" />
  <java-symbol type="bool" name="config_batterySaver_full_disableAod" />
  <java-symbol type="bool" name="config_batterySaver_full_disableLaunchBoost" />
  <java-symbol type="bool" name="config_batterySaver_full_disableOptionalSensors" />
  <java-symbol type="bool" name="config_batterySaver_full_disableVibration" />
  <java-symbol type="bool" name="config_batterySaver_full_enableAdjustBrightness" />
  <java-symbol type="bool" name="config_batterySaver_full_enableDataSaver" />
  <java-symbol type="bool" name="config_batterySaver_full_enableFirewall" />
  <java-symbol type="bool" name="config_batterySaver_full_enableNightMode" />
  <java-symbol type="bool" name="config_batterySaver_full_enableQuickDoze" />
  <java-symbol type="bool" name="config_batterySaver_full_forceAllAppsStandby" />
  <java-symbol type="bool" name="config_batterySaver_full_forceBackgroundCheck" />
  <java-symbol type="integer" name="config_batterySaver_full_locationMode" />
  <java-symbol type="integer" name="config_batterySaver_full_soundTriggerMode" />


  <!-- For car devices -->
  <!-- For car devices -->
  <java-symbol type="string" name="car_loading_profile" />
  <java-symbol type="string" name="car_loading_profile" />
+30 −23
Original line number Original line Diff line number Diff line
@@ -19,6 +19,7 @@ import android.annotation.IntDef;
import android.app.UiModeManager;
import android.app.UiModeManager;
import android.content.ContentResolver;
import android.content.ContentResolver;
import android.content.Context;
import android.content.Context;
import android.content.res.Resources;
import android.database.ContentObserver;
import android.database.ContentObserver;
import android.net.Uri;
import android.net.Uri;
import android.os.BatterySaverPolicyConfig;
import android.os.BatterySaverPolicyConfig;
@@ -162,26 +163,8 @@ public class BatterySaverPolicy extends ContentObserver implements


    private static final Policy DEFAULT_ADAPTIVE_POLICY = OFF_POLICY;
    private static final Policy DEFAULT_ADAPTIVE_POLICY = OFF_POLICY;


    private static final Policy DEFAULT_FULL_POLICY = new Policy(
    /** The base default full policy for the device. */
            0.5f,  /* adjustBrightnessFactor */
    private final Policy DEFAULT_FULL_POLICY;
            true,  /* advertiseIsEnabled */
            true,  /* deferFullBackup */
            true,  /* deferKeyValueBackup */
            false, /* disableAnimation */
            true,  /* disableAod */
            true,  /* disableLaunchBoost */
            true,  /* disableOptionalSensors */
            false,  /* disableVibration */
            false, /* enableAdjustBrightness */
            false, /* enableDataSaver */
            true,  /* enableFirewall */
            true, /* enableNightMode */
            true, /* enableQuickDoze */
            true, /* forceAllAppsStandby */
            true, /* forceBackgroundCheck */
            PowerManager.LOCATION_MODE_FOREGROUND_ONLY, /* locationMode */
            PowerManager.SOUND_TRIGGER_MODE_CRITICAL_ONLY /* soundTriggerMode */
    );


    private final Object mLock;
    private final Object mLock;
    private final Handler mHandler;
    private final Handler mHandler;
@@ -222,13 +205,13 @@ public class BatterySaverPolicy extends ContentObserver implements
    @GuardedBy("mLock")
    @GuardedBy("mLock")
    private Policy mAdaptivePolicy = DEFAULT_ADAPTIVE_POLICY;
    private Policy mAdaptivePolicy = DEFAULT_ADAPTIVE_POLICY;


    /** The current default full policy. */
    /** The current default full policy. This may be modified by Settings or DeviceConfig flags. */
    @GuardedBy("mLock")
    @GuardedBy("mLock")
    private Policy mDefaultFullPolicy = DEFAULT_FULL_POLICY;
    private Policy mDefaultFullPolicy;


    /** The policy to be used for full battery saver. */
    /** The policy to be used for full battery saver. */
    @GuardedBy("mLock")
    @GuardedBy("mLock")
    private Policy mFullPolicy = DEFAULT_FULL_POLICY;
    private Policy mFullPolicy;


    /**
    /**
     * The current effective policy. This is based on the current policy level's policy, with any
     * The current effective policy. This is based on the current policy level's policy, with any
@@ -273,6 +256,30 @@ public class BatterySaverPolicy extends ContentObserver implements
        mContext = context;
        mContext = context;
        mContentResolver = context.getContentResolver();
        mContentResolver = context.getContentResolver();
        mBatterySavingStats = batterySavingStats;
        mBatterySavingStats = batterySavingStats;

        final Resources res = context.getResources();
        DEFAULT_FULL_POLICY = new Policy(
                res.getFloat(R.dimen.config_batterySaver_full_adjustBrightnessFactor),
                true,  /* advertiseIsEnabled */
                res.getBoolean(R.bool.config_batterySaver_full_deferFullBackup),
                res.getBoolean(R.bool.config_batterySaver_full_deferKeyValueBackup),
                res.getBoolean(R.bool.config_batterySaver_full_disableAnimation),
                res.getBoolean(R.bool.config_batterySaver_full_disableAod),
                res.getBoolean(R.bool.config_batterySaver_full_disableLaunchBoost),
                res.getBoolean(R.bool.config_batterySaver_full_disableOptionalSensors),
                res.getBoolean(R.bool.config_batterySaver_full_disableVibration),
                res.getBoolean(R.bool.config_batterySaver_full_enableAdjustBrightness),
                res.getBoolean(R.bool.config_batterySaver_full_enableDataSaver),
                res.getBoolean(R.bool.config_batterySaver_full_enableFirewall),
                res.getBoolean(R.bool.config_batterySaver_full_enableNightMode),
                res.getBoolean(R.bool.config_batterySaver_full_enableQuickDoze),
                res.getBoolean(R.bool.config_batterySaver_full_forceAllAppsStandby),
                res.getBoolean(R.bool.config_batterySaver_full_forceBackgroundCheck),
                res.getInteger(R.integer.config_batterySaver_full_locationMode),
                res.getInteger(R.integer.config_batterySaver_full_soundTriggerMode)
        );
        mDefaultFullPolicy = DEFAULT_FULL_POLICY;
        mFullPolicy = DEFAULT_FULL_POLICY;
    }
    }


    /**
    /**
+51 −26
Original line number Original line Diff line number Diff line
@@ -47,11 +47,7 @@ public class BatterySaverPolicyTest extends AndroidTestCase {
    private static final float DEFAULT_BRIGHTNESS_FACTOR = 0.5f;
    private static final float DEFAULT_BRIGHTNESS_FACTOR = 0.5f;
    private static final float PRECISION = 0.001f;
    private static final float PRECISION = 0.001f;
    private static final int GPS_MODE = 0; // LOCATION_MODE_NO_CHANGE
    private static final int GPS_MODE = 0; // LOCATION_MODE_NO_CHANGE
    private static final int DEFAULT_GPS_MODE =
            PowerManager.LOCATION_MODE_FOREGROUND_ONLY;
    private static final int SOUND_TRIGGER_MODE = 0; // SOUND_TRIGGER_MODE_ALL_ENABLED
    private static final int SOUND_TRIGGER_MODE = 0; // SOUND_TRIGGER_MODE_ALL_ENABLED
    private static final int DEFAULT_SOUND_TRIGGER_MODE =
            PowerManager.SOUND_TRIGGER_MODE_CRITICAL_ONLY;
    private static final String BATTERY_SAVER_CONSTANTS = "disable_vibration=false,"
    private static final String BATTERY_SAVER_CONSTANTS = "disable_vibration=false,"
            + "advertise_is_enabled=true,"
            + "advertise_is_enabled=true,"
            + "disable_animation=false,"
            + "disable_animation=false,"
@@ -117,7 +113,9 @@ public class BatterySaverPolicyTest extends AndroidTestCase {


    @SmallTest
    @SmallTest
    public void testGetBatterySaverPolicy_PolicyVibration_DefaultValueCorrect() {
    public void testGetBatterySaverPolicy_PolicyVibration_DefaultValueCorrect() {
        testServiceDefaultValue_Off(ServiceType.VIBRATION);
        testDefaultValue(
                com.android.internal.R.bool.config_batterySaver_full_disableVibration,
                ServiceType.VIBRATION);
    }
    }


    @SmallTest
    @SmallTest
@@ -128,27 +126,39 @@ public class BatterySaverPolicyTest extends AndroidTestCase {


    @SmallTest
    @SmallTest
    public void testGetBatterySaverPolicy_PolicySound_DefaultValueCorrect() {
    public void testGetBatterySaverPolicy_PolicySound_DefaultValueCorrect() {
        final int defaultMode = getContext().getResources().getInteger(
                com.android.internal.R.integer.config_batterySaver_full_soundTriggerMode);
        if (defaultMode == PowerManager.SOUND_TRIGGER_MODE_ALL_ENABLED) {
            testServiceDefaultValue_Off(ServiceType.SOUND);
        } else {
            testServiceDefaultValue_On(ServiceType.SOUND);
            testServiceDefaultValue_On(ServiceType.SOUND);
        }


        mBatterySaverPolicy.setPolicyLevel(POLICY_LEVEL_FULL);
        mBatterySaverPolicy.setPolicyLevel(POLICY_LEVEL_FULL);
        PowerSaveState stateOn =
        PowerSaveState stateOn =
                mBatterySaverPolicy.getBatterySaverPolicy(ServiceType.SOUND);
                mBatterySaverPolicy.getBatterySaverPolicy(ServiceType.SOUND);
        assertThat(stateOn.soundTriggerMode).isEqualTo(DEFAULT_SOUND_TRIGGER_MODE);
        assertThat(stateOn.soundTriggerMode).isEqualTo(defaultMode);
    }
    }


    @SmallTest
    @SmallTest
    public void testGetBatterySaverPolicy_PolicyFullBackup_DefaultValueCorrect() {
    public void testGetBatterySaverPolicy_PolicyFullBackup_DefaultValueCorrect() {
        testServiceDefaultValue_On(ServiceType.FULL_BACKUP);
        testDefaultValue(
                com.android.internal.R.bool.config_batterySaver_full_deferFullBackup,
                ServiceType.FULL_BACKUP);
    }
    }


    @SmallTest
    @SmallTest
    public void testGetBatterySaverPolicy_PolicyKeyValueBackup_DefaultValueCorrect() {
    public void testGetBatterySaverPolicy_PolicyKeyValueBackup_DefaultValueCorrect() {
        testServiceDefaultValue_On(ServiceType.KEYVALUE_BACKUP);
        testDefaultValue(
                com.android.internal.R.bool.config_batterySaver_full_deferKeyValueBackup,
                ServiceType.KEYVALUE_BACKUP);
    }
    }


    @SmallTest
    @SmallTest
    public void testGetBatterySaverPolicy_PolicyAnimation_DefaultValueCorrect() {
    public void testGetBatterySaverPolicy_PolicyAnimation_DefaultValueCorrect() {
        testServiceDefaultValue_Off(ServiceType.ANIMATION);
        testDefaultValue(
                com.android.internal.R.bool.config_batterySaver_full_disableAnimation,
                ServiceType.ANIMATION);
    }
    }


    @SmallTest
    @SmallTest
@@ -158,46 +168,53 @@ public class BatterySaverPolicyTest extends AndroidTestCase {


    @SmallTest
    @SmallTest
    public void testGetBatterySaverPolicy_PolicyNetworkFirewall_DefaultValueCorrect() {
    public void testGetBatterySaverPolicy_PolicyNetworkFirewall_DefaultValueCorrect() {
        testServiceDefaultValue_On(ServiceType.NETWORK_FIREWALL);
        testDefaultValue(
                com.android.internal.R.bool.config_batterySaver_full_enableFirewall,
                ServiceType.NETWORK_FIREWALL);
    }
    }


    @SmallTest
    @SmallTest
    public void testGetBatterySaverPolicy_PolicyNightMode_DefaultValueCorrect() {
    public void testGetBatterySaverPolicy_PolicyNightMode_DefaultValueCorrect() {
        testServiceDefaultValue_On(ServiceType.NIGHT_MODE);
        testDefaultValue(
                com.android.internal.R.bool.config_batterySaver_full_enableNightMode,
                ServiceType.NIGHT_MODE);
    }
    }


    @SmallTest
    @SmallTest
    public void testGetBatterySaverPolicy_PolicyDataSaver_DefaultValueCorrect() {
    public void testGetBatterySaverPolicy_PolicyDataSaver_DefaultValueCorrect() {
        mBatterySaverPolicy.updateConstantsLocked("", "");
        testDefaultValue(
        mBatterySaverPolicy.setPolicyLevel(POLICY_LEVEL_FULL);
                com.android.internal.R.bool.config_batterySaver_full_enableDataSaver,
        final PowerSaveState batterySaverStateOn =
                mBatterySaverPolicy.getBatterySaverPolicy(ServiceType.DATA_SAVER);
        assertThat(batterySaverStateOn.batterySaverEnabled).isFalse();

        mBatterySaverPolicy.setPolicyLevel(POLICY_LEVEL_OFF);
        final PowerSaveState batterySaverStateOff = mBatterySaverPolicy.getBatterySaverPolicy(
                ServiceType.DATA_SAVER);
                ServiceType.DATA_SAVER);
        assertThat(batterySaverStateOff.batterySaverEnabled).isFalse();
    }
    }


    @SmallTest
    @SmallTest
    public void testGetBatterySaverPolicy_PolicyScreenBrightness_DefaultValueCorrect() {
    public void testGetBatterySaverPolicy_PolicyScreenBrightness_DefaultValueCorrect() {
        testServiceDefaultValue_Off(ServiceType.SCREEN_BRIGHTNESS);
        testDefaultValue(
                com.android.internal.R.bool.config_batterySaver_full_enableAdjustBrightness,
                ServiceType.SCREEN_BRIGHTNESS);
    }
    }


    @SmallTest
    @SmallTest
    public void testGetBatterySaverPolicy_PolicyGps_DefaultValueCorrect() {
    public void testGetBatterySaverPolicy_PolicyLocation_DefaultValueCorrect() {
        final int defaultMode = getContext().getResources()
                .getInteger(com.android.internal.R.integer.config_batterySaver_full_locationMode);
        if (defaultMode == PowerManager.LOCATION_MODE_NO_CHANGE) {
            testServiceDefaultValue_Off(ServiceType.LOCATION);
        } else {
            testServiceDefaultValue_On(ServiceType.LOCATION);
            testServiceDefaultValue_On(ServiceType.LOCATION);
        }


        mBatterySaverPolicy.setPolicyLevel(POLICY_LEVEL_FULL);
        mBatterySaverPolicy.setPolicyLevel(POLICY_LEVEL_FULL);
        PowerSaveState stateOn =
        PowerSaveState stateOn =
                mBatterySaverPolicy.getBatterySaverPolicy(ServiceType.LOCATION);
                mBatterySaverPolicy.getBatterySaverPolicy(ServiceType.LOCATION);
        assertThat(stateOn.locationMode).isEqualTo(DEFAULT_GPS_MODE);
        assertThat(stateOn.locationMode).isEqualTo(defaultMode);
    }
    }


    @SmallTest
    @SmallTest
    public void testGetBatterySaverPolicy_PolicyQuickDoze_DefaultValueCorrect() {
    public void testGetBatterySaverPolicy_PolicyQuickDoze_DefaultValueCorrect() {
        testServiceDefaultValue_On(ServiceType.QUICK_DOZE);
        testDefaultValue(
                com.android.internal.R.bool.config_batterySaver_full_enableQuickDoze,
                ServiceType.QUICK_DOZE);
    }
    }


    @SmallTest
    @SmallTest
@@ -264,6 +281,14 @@ public class BatterySaverPolicyTest extends AndroidTestCase {
        mBatterySaverPolicy.updateConstantsLocked(null, "");
        mBatterySaverPolicy.updateConstantsLocked(null, "");
    }
    }


    private void testDefaultValue(int boolResId, @ServiceType int type) {
        if (getContext().getResources().getBoolean(boolResId)) {
            testServiceDefaultValue_On(type);
        } else {
            testServiceDefaultValue_Off(type);
        }
    }

    private void testServiceDefaultValue_On(@ServiceType int type) {
    private void testServiceDefaultValue_On(@ServiceType int type) {
        mBatterySaverPolicy.updateConstantsLocked("", "");
        mBatterySaverPolicy.updateConstantsLocked("", "");
        mBatterySaverPolicy.setPolicyLevel(POLICY_LEVEL_FULL);
        mBatterySaverPolicy.setPolicyLevel(POLICY_LEVEL_FULL);