DO NOT MERGE : Allow system process to call getApplicationBlockedAsUser

MDMs in the managed profile needs to be able to call
DPM.isApplicationBlocked without the INTERACT_ACROSS_USERS
permission. DevicePolicyManager checks for appropriate
PROFILE_OWNER permission and then removes callerId, so this
change is needed to prevent a spurious security exception.

Bug: 14400206
Change-Id: Idd1bda6bb234f6cb7cb78a885ae2d7cc5cca4890
(cherry picked from commit c11c67b3e117b4fec3245f87b6d510461c1f8323)
This commit is contained in:
Adam Connors
2014-06-05 10:36:01 +01:00
committed by Kenny Guy
parent ac383e52a9
commit 8f70744221

View File

@@ -7792,13 +7792,9 @@ public class PackageManagerService extends IPackageManager.Stub {
@Override
public boolean getApplicationBlockedSettingAsUser(String packageName, int userId) {
mContext.enforceCallingOrSelfPermission(android.Manifest.permission.MANAGE_USERS, null);
enforceCrossUserPermission(Binder.getCallingUid(), userId, true,
"getApplicationBlocked for user " + userId);
PackageSetting pkgSetting;
final int uid = Binder.getCallingUid();
if (UserHandle.getUserId(uid) != userId) {
mContext.enforceCallingPermission(
android.Manifest.permission.INTERACT_ACROSS_USERS_FULL,
"getApplicationBlocked for user " + userId);
}
long callingId = Binder.clearCallingIdentity();
try {
// writer