diff --git a/services/core/java/com/android/server/DeviceIdleController.java b/services/core/java/com/android/server/DeviceIdleController.java index 488f0e793c9a8..4405c1b6135a9 100644 --- a/services/core/java/com/android/server/DeviceIdleController.java +++ b/services/core/java/com/android/server/DeviceIdleController.java @@ -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