diff options
| author | Dianne Hackborn <hackbod@google.com> | 2015-07-06 22:24:50 +0000 |
|---|---|---|
| committer | Android (Google) Code Review <android-gerrit@google.com> | 2015-07-06 22:24:51 +0000 |
| commit | 5c8498db2111ea69566bc43a9e799d0447af789d (patch) | |
| tree | 7edfcb2906dff12126b2d6db4660e3935ef63a47 | |
| parent | 28b4fc76e2da7b93d9ba7ba75a7d0a512d9ff140 (diff) | |
| parent | 1b1396870793574c651553e11b68337a7c128a09 (diff) | |
| download | frameworks_base-5c8498db2111ea69566bc43a9e799d0447af789d.zip frameworks_base-5c8498db2111ea69566bc43a9e799d0447af789d.tar.gz frameworks_base-5c8498db2111ea69566bc43a9e799d0447af789d.tar.bz2 | |
Merge "Add easy way to get device idle whitelist." into mnc-dev
| -rw-r--r-- | services/core/java/com/android/server/DeviceIdleController.java | 53 |
1 files changed, 36 insertions, 17 deletions
diff --git a/services/core/java/com/android/server/DeviceIdleController.java b/services/core/java/com/android/server/DeviceIdleController.java index c8dc565..fde1490 100644 --- a/services/core/java/com/android/server/DeviceIdleController.java +++ b/services/core/java/com/android/server/DeviceIdleController.java @@ -1236,6 +1236,8 @@ public class DeviceIdleController extends SystemService pw.println(" Re-enable device idle mode after it had previously been disabled."); pw.println(" enabled"); pw.println(" Print 1 if device idle mode is currently enabled, else 0."); + pw.println(" whitelist"); + pw.println(" Print currently whitelisted apps."); pw.println(" whitelist [package ...]"); pw.println(" Add (prefix with +) or remove (prefix with -) packages."); pw.println(" tempwhitelist [package ..]"); @@ -1314,25 +1316,42 @@ public class DeviceIdleController extends SystemService long token = Binder.clearCallingIdentity(); try { i++; - while (i < args.length) { - arg = args[i]; - i++; - if (arg.length() < 1 || (arg.charAt(0) != '-' - && arg.charAt(0) != '+')) { - pw.println("Package must be prefixed with + or -: " + arg); - return; - } - char op = arg.charAt(0); - String pkg = arg.substring(1); - if (op == '+') { - if (addPowerSaveWhitelistAppInternal(pkg)) { - pw.println("Added: " + pkg); + if (i < args.length) { + while (i < args.length) { + arg = args[i]; + i++; + if (arg.length() < 1 || (arg.charAt(0) != '-' + && arg.charAt(0) != '+')) { + pw.println("Package must be prefixed with + or -: " + arg); + return; + } + char op = arg.charAt(0); + String pkg = arg.substring(1); + if (op == '+') { + if (addPowerSaveWhitelistAppInternal(pkg)) { + pw.println("Added: " + pkg); + } else { + pw.println("Unknown package: " + pkg); + } } else { - pw.println("Unknown package: " + pkg); + if (removePowerSaveWhitelistAppInternal(pkg)) { + pw.println("Removed: " + pkg); + } + } + } + } else { + synchronized (this) { + for (int j=0; j<mPowerSaveWhitelistApps.size(); j++) { + pw.print("system,"); + pw.print(mPowerSaveWhitelistApps.keyAt(j)); + pw.print(","); + pw.println(mPowerSaveWhitelistApps.valueAt(j)); } - } else { - if (removePowerSaveWhitelistAppInternal(pkg)) { - pw.println("Removed: " + pkg); + for (int j=0; j<mPowerSaveWhitelistUserApps.size(); j++) { + pw.print("user,"); + pw.print(mPowerSaveWhitelistUserApps.keyAt(j)); + pw.print(","); + pw.println(mPowerSaveWhitelistUserApps.valueAt(j)); } } } |
