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

Commit e3d8ae1e authored by Alex Johnston's avatar Alex Johnston
Browse files

Use OP_SYSTEM_EXEMPT_FROM_POWER_RESTRICTIONS for exempting app standby

Replace OP_SYSTEM_EXEMPT_FROM_APP_STANDBY with
OP_SYSTEM_EXEMPT_FROM_POWER_RESTRICTIONS.

OP_SYSTEM_EXEMPT_FROM_POWER_RESTRICTIONS should cover all power
restrictions including app standby.

Bug: 246330879
Test: Testing with adb
Change-Id: I1cf083a33efbd16476cea0f8e37d3c550ece4aa3
parent 223f197e
Loading
Loading
Loading
Loading
+4 −3
Original line number Diff line number Diff line
@@ -286,7 +286,7 @@ public class AppStandbyController

    /**
     * Map of uids to their current app-op mode for
     * {@link AppOpsManager#OPSTR_SYSTEM_EXEMPT_FROM_APP_STANDBY}.
     * {@link AppOpsManager#OPSTR_SYSTEM_EXEMPT_FROM_POWER_RESTRICTIONS}.
     */
    @GuardedBy("mSystemExemptionAppOpMode")
    private final SparseIntArray mSystemExemptionAppOpMode = new SparseIntArray();
@@ -670,7 +670,7 @@ public class AppStandbyController
            IAppOpsService iAppOpsService = mInjector.getAppOpsService();
            try {
                iAppOpsService.startWatchingMode(
                        AppOpsManager.OP_SYSTEM_EXEMPT_FROM_APP_STANDBY,
                        AppOpsManager.OP_SYSTEM_EXEMPT_FROM_POWER_RESTRICTIONS,
                        /*packageName=*/ null,
                        new IAppOpsCallback.Stub() {
                            @Override
@@ -1482,7 +1482,8 @@ public class AppStandbyController
                    }
                } else {
                    int mode = mAppOpsManager.checkOpNoThrow(
                            AppOpsManager.OP_SYSTEM_EXEMPT_FROM_APP_STANDBY, uid, packageName);
                            AppOpsManager.OP_SYSTEM_EXEMPT_FROM_POWER_RESTRICTIONS, uid,
                            packageName);
                    mSystemExemptionAppOpMode.put(uid, mode);
                    if (mode == AppOpsManager.MODE_ALLOWED) {
                        return STANDBY_BUCKET_EXEMPTED;