From ec3a9f3346d672e916e83eb2c9c827593d8412c1 Mon Sep 17 00:00:00 2001 From: Christopher Tate Date: Tue, 21 Mar 2017 17:43:47 -0700 Subject: [PATCH] Give shell the CHANGE_DEVICE_IDLE_TEMP_WHITELIST permission Shell needs to have this permission in order for the deviceidle tempwhitelist shell command to exist. Bug 34715096 Test: cts-tradefed run cts -m CtsAppTestCases \ -t android.app.cts.ActivityManagerTest#testBackgroundCheckService Change-Id: Ic1fdd87b6020649705ba0c9349dd00dd096037f3 --- data/etc/privapp-permissions-platform.xml | 1 + packages/Shell/AndroidManifest.xml | 1 + .../core/java/com/android/server/DeviceIdleController.java | 5 +++-- 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/data/etc/privapp-permissions-platform.xml b/data/etc/privapp-permissions-platform.xml index 77a103531d464..040d6c90af76c 100644 --- a/data/etc/privapp-permissions-platform.xml +++ b/data/etc/privapp-permissions-platform.xml @@ -254,6 +254,7 @@ applications that come with the platform + diff --git a/packages/Shell/AndroidManifest.xml b/packages/Shell/AndroidManifest.xml index 3cce2993fc4a1..6bfab78fcd62d 100644 --- a/packages/Shell/AndroidManifest.xml +++ b/packages/Shell/AndroidManifest.xml @@ -103,6 +103,7 @@ + diff --git a/services/core/java/com/android/server/DeviceIdleController.java b/services/core/java/com/android/server/DeviceIdleController.java index 3e2dae55988c7..26b15d8ed4b14 100644 --- a/services/core/java/com/android/server/DeviceIdleController.java +++ b/services/core/java/com/android/server/DeviceIdleController.java @@ -2865,8 +2865,9 @@ public class DeviceIdleController extends SystemService if (arg != null) { try { addPowerSaveTempWhitelistAppChecked(arg, duration, shell.userId, "shell"); - } catch (RemoteException re) { - pw.println("Failed: " + re); + } catch (Exception e) { + pw.println("Failed: " + e); + return -1; } } else { dumpTempWhitelistSchedule(pw, false);