Merge "Fix issue #31403654: Elevation of privilege vulnerability in deviceidle service" into nyc-mr1-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
c26c98cd4a
@@ -2726,12 +2726,12 @@ public class DeviceIdleController extends SystemService
|
||||
}
|
||||
}
|
||||
} else if ("whitelist".equals(cmd)) {
|
||||
long token = Binder.clearCallingIdentity();
|
||||
try {
|
||||
String arg = shell.getNextArg();
|
||||
if (arg != null) {
|
||||
getContext().enforceCallingOrSelfPermission(
|
||||
android.Manifest.permission.DEVICE_POWER, null);
|
||||
String arg = shell.getNextArg();
|
||||
if (arg != null) {
|
||||
getContext().enforceCallingOrSelfPermission(
|
||||
android.Manifest.permission.DEVICE_POWER, null);
|
||||
long token = Binder.clearCallingIdentity();
|
||||
try {
|
||||
do {
|
||||
if (arg.length() < 1 || (arg.charAt(0) != '-'
|
||||
&& arg.charAt(0) != '+' && arg.charAt(0) != '=')) {
|
||||
@@ -2754,30 +2754,30 @@ public class DeviceIdleController extends SystemService
|
||||
pw.println(getPowerSaveWhitelistAppInternal(pkg));
|
||||
}
|
||||
} while ((arg=shell.getNextArg()) != null);
|
||||
} else {
|
||||
synchronized (this) {
|
||||
for (int j=0; j<mPowerSaveWhitelistAppsExceptIdle.size(); j++) {
|
||||
pw.print("system-excidle,");
|
||||
pw.print(mPowerSaveWhitelistAppsExceptIdle.keyAt(j));
|
||||
pw.print(",");
|
||||
pw.println(mPowerSaveWhitelistAppsExceptIdle.valueAt(j));
|
||||
}
|
||||
for (int j=0; j<mPowerSaveWhitelistApps.size(); j++) {
|
||||
pw.print("system,");
|
||||
pw.print(mPowerSaveWhitelistApps.keyAt(j));
|
||||
pw.print(",");
|
||||
pw.println(mPowerSaveWhitelistApps.valueAt(j));
|
||||
}
|
||||
for (int j=0; j<mPowerSaveWhitelistUserApps.size(); j++) {
|
||||
pw.print("user,");
|
||||
pw.print(mPowerSaveWhitelistUserApps.keyAt(j));
|
||||
pw.print(",");
|
||||
pw.println(mPowerSaveWhitelistUserApps.valueAt(j));
|
||||
}
|
||||
} finally {
|
||||
Binder.restoreCallingIdentity(token);
|
||||
}
|
||||
} else {
|
||||
synchronized (this) {
|
||||
for (int j=0; j<mPowerSaveWhitelistAppsExceptIdle.size(); j++) {
|
||||
pw.print("system-excidle,");
|
||||
pw.print(mPowerSaveWhitelistAppsExceptIdle.keyAt(j));
|
||||
pw.print(",");
|
||||
pw.println(mPowerSaveWhitelistAppsExceptIdle.valueAt(j));
|
||||
}
|
||||
for (int j=0; j<mPowerSaveWhitelistApps.size(); j++) {
|
||||
pw.print("system,");
|
||||
pw.print(mPowerSaveWhitelistApps.keyAt(j));
|
||||
pw.print(",");
|
||||
pw.println(mPowerSaveWhitelistApps.valueAt(j));
|
||||
}
|
||||
for (int j=0; j<mPowerSaveWhitelistUserApps.size(); j++) {
|
||||
pw.print("user,");
|
||||
pw.print(mPowerSaveWhitelistUserApps.keyAt(j));
|
||||
pw.print(",");
|
||||
pw.println(mPowerSaveWhitelistUserApps.valueAt(j));
|
||||
}
|
||||
}
|
||||
} finally {
|
||||
Binder.restoreCallingIdentity(token);
|
||||
}
|
||||
} else if ("tempwhitelist".equals(cmd)) {
|
||||
String opt;
|
||||
|
||||
Reference in New Issue
Block a user