OSDN Git Service

DO NOT MERGE Relax isUserRunning check and allow in-profile calls
authorMakoto Onuki <omakoto@google.com>
Thu, 28 Jul 2016 20:10:42 +0000 (13:10 -0700)
committerKenny Guy <kennyguy@google.com>
Thu, 23 Feb 2017 11:24:34 +0000 (11:24 +0000)
Bug 30475753
Bug 35667752

Change-Id: I739ee7e259f041f5e133edf048b6b54cb7a770db
(cherry picked from commit 8198deacb52eb082ae9f0a5658d594dc9b689882)

services/core/java/com/android/server/am/ActivityManagerService.java
services/core/java/com/android/server/am/UserController.java

index 8207877..0c31ade 100644 (file)
@@ -21433,8 +21433,9 @@ public final class ActivityManagerService extends ActivityManagerNative
 
     @Override
     public boolean isUserRunning(int userId, int flags) {
-        if (userId != UserHandle.getCallingUserId() && checkCallingPermission(
-                INTERACT_ACROSS_USERS) != PackageManager.PERMISSION_GRANTED) {
+        if (!mUserController.isSameProfileGroup(userId, UserHandle.getCallingUserId())
+                && checkCallingPermission(INTERACT_ACROSS_USERS)
+                    != PackageManager.PERMISSION_GRANTED) {
             String msg = "Permission Denial: isUserRunning() from pid="
                     + Binder.getCallingPid()
                     + ", uid=" + Binder.getCallingUid()
index b685dd3..57dfb7e 100644 (file)
@@ -1453,6 +1453,9 @@ final class UserController {
     }
 
     boolean isSameProfileGroup(int callingUserId, int targetUserId) {
+        if (callingUserId == targetUserId) {
+            return true;
+        }
         synchronized (mUserProfileGroupIdsSelfLocked) {
             int callingProfile = mUserProfileGroupIdsSelfLocked.get(callingUserId,
                     UserInfo.NO_PROFILE_GROUP_ID);