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

Commit f6f9a4b7 authored by Kweku Adams's avatar Kweku Adams
Browse files

Allow modifying minimum consumption limit.

Create separate fields for minimum and initial consumption limits so
that they can be modified independently.

Bug: 255321890
Test: atest frameworks/base/services/tests/mockingservicestests/src/com/android/server/tare
Test: atest frameworks/base/services/tests/servicestests/src/com/android/server/tare
Test: manually change in Developer Options UI
Change-Id: I82c146a18b54a18313de590038f2f807a2310aa0
parent e3e6b7e7
Loading
Loading
Loading
Loading
+6 −2
Original line number Diff line number Diff line
@@ -11613,13 +11613,17 @@
    <!-- Title for the TARE policy factor that determines the initial maximum amount of credits that
    can be consumed by all the apps [CHAR LIMIT=80]-->
    <string name="tare_initial_consumption_limit">Initial Consumption Limit</string>
    <!-- Title for the TARE policy factor that determines the minimum consumption limit the system
     can have [CHAR LIMIT=80]-->
    <string name="tare_min_consumption_limit">Minimum Consumption Limit</string>
    <!-- Title for the TARE policy factor that determines the maximum consumption limit the system
     can have [CHAR LIMIT=80]-->
    <string name="tare_hard_consumption_limit">Maximum Consumption Limit</string>
    <string name="tare_max_consumption_limit">Maximum Consumption Limit</string>
    <!-- Titles for the consumption limits factors. [CHAR LIMIT=40]-->
    <string-array name="tare_consumption_limit_subfactors" translatable="false">
        <item>@string/tare_initial_consumption_limit</item>
        <item>@string/tare_hard_consumption_limit</item>
        <item>@string/tare_min_consumption_limit</item>
        <item>@string/tare_max_consumption_limit</item>
    </string-array>
    <!-- Title for the various modifiers that alter the cost of TARE tasks based on battery status
    (charging, power save mode, etc.) [CHAR LIMIT=40]-->
+2 −1
Original line number Diff line number Diff line
@@ -117,7 +117,8 @@ public class AlarmManagerFragment extends Fragment implements
        mKeys = new String[][]{
                {
                        EconomyManager.KEY_AM_INITIAL_CONSUMPTION_LIMIT,
                        EconomyManager.KEY_AM_HARD_CONSUMPTION_LIMIT
                        EconomyManager.KEY_AM_MIN_CONSUMPTION_LIMIT,
                        EconomyManager.KEY_AM_MAX_CONSUMPTION_LIMIT,
                },
                {
                        EconomyManager.KEY_AM_MAX_SATIATED_BALANCE,
+2 −1
Original line number Diff line number Diff line
@@ -118,7 +118,8 @@ public class JobSchedulerFragment extends Fragment implements
        mKeys = new String[][]{
                {
                        EconomyManager.KEY_JS_INITIAL_CONSUMPTION_LIMIT,
                        EconomyManager.KEY_JS_HARD_CONSUMPTION_LIMIT
                        EconomyManager.KEY_JS_MIN_CONSUMPTION_LIMIT,
                        EconomyManager.KEY_JS_MAX_CONSUMPTION_LIMIT,
                },
                {
                        EconomyManager.KEY_JS_MAX_SATIATED_BALANCE,
+14 −6
Original line number Diff line number Diff line
@@ -117,9 +117,13 @@ public class TareFactorController {
                new TareFactorData(mResources.getString(R.string.tare_initial_consumption_limit),
                        EconomyManager.DEFAULT_AM_INITIAL_CONSUMPTION_LIMIT_CAKES,
                        POLICY_ALARM_MANAGER));
        mAlarmManagerMap.put(EconomyManager.KEY_AM_HARD_CONSUMPTION_LIMIT,
                new TareFactorData(mResources.getString(R.string.tare_hard_consumption_limit),
                        EconomyManager.DEFAULT_AM_HARD_CONSUMPTION_LIMIT_CAKES,
        mAlarmManagerMap.put(EconomyManager.KEY_AM_MIN_CONSUMPTION_LIMIT,
                new TareFactorData(mResources.getString(R.string.tare_min_consumption_limit),
                        EconomyManager.DEFAULT_AM_MIN_CONSUMPTION_LIMIT_CAKES,
                        POLICY_ALARM_MANAGER));
        mAlarmManagerMap.put(EconomyManager.KEY_AM_MAX_CONSUMPTION_LIMIT,
                new TareFactorData(mResources.getString(R.string.tare_max_consumption_limit),
                        EconomyManager.DEFAULT_AM_MAX_CONSUMPTION_LIMIT_CAKES,
                        POLICY_ALARM_MANAGER));
        mAlarmManagerMap.put(EconomyManager.KEY_AM_REWARD_TOP_ACTIVITY_INSTANT,
                new TareFactorData(mResources.getString(R.string.tare_top_activity),
@@ -306,9 +310,13 @@ public class TareFactorController {
                new TareFactorData(mResources.getString(R.string.tare_initial_consumption_limit),
                        EconomyManager.DEFAULT_JS_INITIAL_CONSUMPTION_LIMIT_CAKES,
                        POLICY_JOB_SCHEDULER));
        mJobSchedulerMap.put(EconomyManager.KEY_JS_HARD_CONSUMPTION_LIMIT,
                new TareFactorData(mResources.getString(R.string.tare_hard_consumption_limit),
                        EconomyManager.DEFAULT_JS_HARD_CONSUMPTION_LIMIT_CAKES,
        mJobSchedulerMap.put(EconomyManager.KEY_JS_MIN_CONSUMPTION_LIMIT,
                new TareFactorData(mResources.getString(R.string.tare_min_consumption_limit),
                        EconomyManager.DEFAULT_JS_MIN_CONSUMPTION_LIMIT_CAKES,
                        POLICY_JOB_SCHEDULER));
        mJobSchedulerMap.put(EconomyManager.KEY_JS_MAX_CONSUMPTION_LIMIT,
                new TareFactorData(mResources.getString(R.string.tare_max_consumption_limit),
                        EconomyManager.DEFAULT_JS_MAX_CONSUMPTION_LIMIT_CAKES,
                        POLICY_JOB_SCHEDULER));
        mJobSchedulerMap.put(EconomyManager.KEY_JS_REWARD_APP_INSTALL_INSTANT,
                new TareFactorData(mResources.getString(R.string.tare_app_install),