From 7dba93c0874a96ddeb617c93ad2ca454626acd34 Mon Sep 17 00:00:00 2001 From: Todd Kennedy Date: Wed, 14 Jan 2015 15:25:13 -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/ActivityStack.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/services/java/com/android/server/am/ActivityStack.java b/services/java/com/android/server/am/ActivityStack.java index c344023070a0..73068005300d 100644 --- a/services/java/com/android/server/am/ActivityStack.java +++ b/services/java/com/android/server/am/ActivityStack.java @@ -3208,6 +3208,8 @@ final class ActivityStack { aInfo, resultTo, resultWho, requestCode, callingPid, callingUid, callingPackage, startFlags, options, componentSpecified, null); + Binder.restoreCallingIdentity(origId); + if (mConfigWillChange && mMainStack) { // If the caller also wants to switch to a new configuration, // do so now. This allows a clean switch, as we are waiting @@ -3221,8 +3223,6 @@ final class ActivityStack { mService.updateConfigurationLocked(config, null, false, false); } - Binder.restoreCallingIdentity(origId); - if (outResult != null) { outResult.result = res; if (res == ActivityManager.START_SUCCESS) { -- cgit v1.2.3-59-g8ed1b