From 8719f683d2e601501487c03cc5866b29925ddc0b Mon Sep 17 00:00:00 2001 From: Todd Kennedy Date: Wed, 14 Jan 2015 15:40:46 -0800 Subject: DO NOT MERGE Restore calling identity before checking permission Using the system service identity to check the CHANGE_CONFIGURATION permission isn't likely to catch a security violation. Changing back to the original caller and then checking permissions is preferred. Cherry picked from lmp. Fixes bug 15989465. Change-Id: Iff08d04422bcc052a487194154f1fd0d727d38f4 --- services/java/com/android/server/am/ActivityStackSupervisor.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/services/java/com/android/server/am/ActivityStackSupervisor.java b/services/java/com/android/server/am/ActivityStackSupervisor.java index d616f1b..fb5fe5c 100644 --- a/services/java/com/android/server/am/ActivityStackSupervisor.java +++ b/services/java/com/android/server/am/ActivityStackSupervisor.java @@ -742,6 +742,8 @@ public final class ActivityStackSupervisor { aInfo, resultTo, resultWho, requestCode, callingPid, callingUid, callingPackage, startFlags, options, componentSpecified, null); + Binder.restoreCallingIdentity(origId); + if (stack.mConfigWillChange) { // If the caller also wants to switch to a new configuration, // do so now. This allows a clean switch, as we are waiting @@ -755,8 +757,6 @@ public final class ActivityStackSupervisor { mService.updateConfigurationLocked(config, null, false, false); } - Binder.restoreCallingIdentity(origId); - if (outResult != null) { outResult.result = res; if (res == ActivityManager.START_SUCCESS) { -- cgit v1.1