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

Commit dce1a07b authored by Rhed Jao's avatar Rhed Jao
Browse files

Enforce dump permission to the idledevice whitelist command

Bug: 248250674
Bug: 248250734
Test: cmd deviceidle whitelist
Test: cmd deviceidle tempwhitelist
Test: cmd deviceidle sys-whitelist
Test: install and run PoC application
Change-Id: I538019de3d008aa68660a526ce7e2e28fa29881e
parent 90d4a5a5
Loading
Loading
Loading
Loading
+9 −0
Original line number Diff line number Diff line
@@ -4821,6 +4821,9 @@ public class DeviceIdleController extends SystemService
                    Binder.restoreCallingIdentity(token);
                }
            } else {
                if (!DumpUtils.checkDumpPermission(getContext(), TAG, pw)) {
                    return -1;
                }
                synchronized (this) {
                    for (int j=0; j<mPowerSaveWhitelistAppsExceptIdle.size(); j++) {
                        pw.print("system-excidle,");
@@ -4882,6 +4885,9 @@ public class DeviceIdleController extends SystemService
                pw.println("[-r] requires a package name");
                return -1;
            } else {
                if (!DumpUtils.checkDumpPermission(getContext(), TAG, pw)) {
                    return -1;
                }
                dumpTempWhitelistSchedule(pw, false);
            }
        } else if ("except-idle-whitelist".equals(cmd)) {
@@ -4957,6 +4963,9 @@ public class DeviceIdleController extends SystemService
                    Binder.restoreCallingIdentity(token);
                }
            } else {
                if (!DumpUtils.checkDumpPermission(getContext(), TAG, pw)) {
                    return -1;
                }
                synchronized (this) {
                    for (int j = 0; j < mPowerSaveWhitelistApps.size(); j++) {
                        pw.print(mPowerSaveWhitelistApps.keyAt(j));