diff options
author | Sudheer Shanka <sudheersai@google.com> | 2017-02-14 18:30:40 -0800 |
---|---|---|
committer | Sudheer Shanka <sudheersai@google.com> | 2017-02-14 18:35:05 -0800 |
commit | f88ebeb2506d3daed3fe0a71f6e1f5cde34406cd (patch) | |
tree | 24d04fc08560de712dceaffcb751149b9ccb0fd3 /cmds/pm | |
parent | d725de1e863db7f001e423b6262c9c7b8b7d1167 (diff) |
Use correct packageName for checking if it belongs to callingUid.
In AccountManagerService.getAccountsAsUser, we check if opPackageName
belongs to calling uid by calling AppOpsManager.checkPackage. But when
AccountManagerService.getAccountsAsUser is called from
AccountManagerService.addSharedAccountsFromParentUser, we're using the
opPackageName from system context instead of calling context.
Bug: 35258008
Test: cts-tradefed run singleCommand cts-dev --module CtsMultiUserHostTestCases \
-t android.host.multiuser.CreateUsersPermissionTest#testCanCreateRestrictedUser
Change-Id: I5c425d9314beb86f7c64a5b5c64b7d879711879a
Diffstat (limited to 'cmds/pm')
-rw-r--r-- | cmds/pm/src/com/android/commands/pm/Pm.java | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/cmds/pm/src/com/android/commands/pm/Pm.java b/cmds/pm/src/com/android/commands/pm/Pm.java index 7015381dc4fb..b336472666bd 100644 --- a/cmds/pm/src/com/android/commands/pm/Pm.java +++ b/cmds/pm/src/com/android/commands/pm/Pm.java @@ -53,6 +53,7 @@ import android.os.Handler; import android.os.HandlerThread; import android.os.IUserManager; import android.os.ParcelFileDescriptor; +import android.os.Process; import android.os.RemoteException; import android.os.ResultReceiver; import android.os.SELinux; @@ -1004,7 +1005,8 @@ public final class Pm { // In non-split user mode, userId can only be SYSTEM int parentUserId = userId >= 0 ? userId : UserHandle.USER_SYSTEM; info = mUm.createRestrictedProfile(name, parentUserId); - mAm.addSharedAccountsFromParentUser(parentUserId, userId); + mAm.addSharedAccountsFromParentUser(parentUserId, userId, + (Process.myUid() == Process.ROOT_UID) ? "root" : "com.android.shell"); } else if (userId < 0) { info = mUm.createUser(name, flags); } else { |