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
This commit is contained in:
Rhed Jao
2022-12-05 17:24:48 +08:00
parent 90d4a5a5d7
commit dce1a07b2f

View File

@@ -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));