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

Commit 639a67fd authored by Maxim Pleshivenkov's avatar Maxim Pleshivenkov Committed by Gerrit Code Review
Browse files

Merge "Fix powersave/powersave idle whitelist" into main

parents 4cc8f565 77ff25af
Loading
Loading
Loading
Loading
+12 −2
Original line number Diff line number Diff line
@@ -2628,8 +2628,13 @@ public class DeviceIdleController extends SystemService
            for (int i=0; i<allowPowerExceptIdle.size(); i++) {
                String pkg = allowPowerExceptIdle.valueAt(i);
                try {
                    // On some devices (eg. HSUM), some apps may
                    // be not be pre-installed on user 0, but may be
                    // pre-installed on FULL users. Look for pre-installed system
                    // apps across all users to make sure they're properly
                    // allowlisted.
                    ApplicationInfo ai = pm.getApplicationInfo(pkg,
                            PackageManager.MATCH_SYSTEM_ONLY);
                            PackageManager.MATCH_ANY_USER | PackageManager.MATCH_SYSTEM_ONLY);
                    int appid = UserHandle.getAppId(ai.uid);
                    mPowerSaveWhitelistAppsExceptIdle.put(ai.packageName, appid);
                    mPowerSaveWhitelistSystemAppIdsExceptIdle.put(appid, true);
@@ -2640,8 +2645,13 @@ public class DeviceIdleController extends SystemService
            for (int i=0; i<allowPower.size(); i++) {
                String pkg = allowPower.valueAt(i);
                try {
                    // On some devices (eg. HSUM), some apps may
                    // be not be pre-installed on user 0, but may be
                    // pre-installed on FULL users. Look for pre-installed system
                    // apps across all users to make sure they're properly
                    // allowlisted.
                    ApplicationInfo ai = pm.getApplicationInfo(pkg,
                            PackageManager.MATCH_SYSTEM_ONLY);
                            PackageManager.MATCH_ANY_USER | PackageManager.MATCH_SYSTEM_ONLY);
                    int appid = UserHandle.getAppId(ai.uid);
                    // These apps are on both the whitelist-except-idle as well
                    // as the full whitelist, so they apply in all cases.