Loading services/devicepolicy/java/com/android/server/devicepolicy/CallerIdentity.java +12 −3 Original line number Diff line number Diff line Loading @@ -27,18 +27,25 @@ import android.os.UserHandle; */ final class CallerIdentity { private final int mPid; private final int mUid; @Nullable private final String mPackageName; @Nullable private final ComponentName mComponentName; CallerIdentity(int uid, @Nullable String packageName, @Nullable ComponentName componentName) { CallerIdentity(int pid, int uid, @Nullable String packageName, @Nullable ComponentName componentName) { mPid = pid; mUid = uid; mPackageName = packageName; mComponentName = componentName; } public int getPid() { return mPid; } public int getUid() { return mUid; } Loading @@ -51,11 +58,13 @@ final class CallerIdentity { return UserHandle.getUserHandleForUid(mUid); } @Nullable public String getPackageName() { @Nullable public String getPackageName() { return mPackageName; } @Nullable public ComponentName getComponentName() { @Nullable public ComponentName getComponentName() { return mComponentName; } Loading services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java +6 −5 Original line number Diff line number Diff line Loading @@ -2517,6 +2517,7 @@ public class DevicePolicyManagerService extends IDevicePolicyManager.Stub { CallerIdentity getCallerIdentity(@Nullable ComponentName adminComponent, @Nullable String callerPackage) { final int callerUid = mInjector.binderGetCallingUid(); final int callerPid = mInjector.binderGetCallingPid(); if (callerPackage != null) { if (!isCallingFromPackage(callerPackage, callerUid)) { Loading @@ -2543,7 +2544,7 @@ public class DevicePolicyManagerService extends IDevicePolicyManager.Stub { } } return new CallerIdentity(callerUid, callerPackage, adminComponent); return new CallerIdentity(callerPid, callerUid, callerPackage, adminComponent); } /** Loading Loading @@ -16202,17 +16203,17 @@ public class DevicePolicyManagerService extends IDevicePolicyManager.Stub { @Override public boolean isActiveDeviceOwner(int uid) { return isDefaultDeviceOwner(new CallerIdentity(uid, null, null)); return isDefaultDeviceOwner(new CallerIdentity(Process.INVALID_PID, uid, null, null)); } @Override public boolean isActiveProfileOwner(int uid) { return isProfileOwner(new CallerIdentity(uid, null, null)); return isProfileOwner(new CallerIdentity(Process.INVALID_PID, uid, null, null)); } @Override public boolean isActiveSupervisionApp(int uid) { if (!isProfileOwner(new CallerIdentity(uid, null, null))) { if (!isProfileOwner(new CallerIdentity(Process.INVALID_PID, uid, null, null))) { return false; } synchronized (getLockObject()) { Loading Loading @@ -16277,7 +16278,7 @@ public class DevicePolicyManagerService extends IDevicePolicyManager.Stub { return false; } CallerIdentity caller = new CallerIdentity(callerUid, null, null); CallerIdentity caller = new CallerIdentity(Process.INVALID_PID, callerUid, null, null); if (isUserAffiliatedWithDevice(UserHandle.getUserId(callerUid)) && (isActiveProfileOwner(callerUid) || isDefaultDeviceOwner(caller) || isFinancedDeviceOwner(caller))) { Loading
services/devicepolicy/java/com/android/server/devicepolicy/CallerIdentity.java +12 −3 Original line number Diff line number Diff line Loading @@ -27,18 +27,25 @@ import android.os.UserHandle; */ final class CallerIdentity { private final int mPid; private final int mUid; @Nullable private final String mPackageName; @Nullable private final ComponentName mComponentName; CallerIdentity(int uid, @Nullable String packageName, @Nullable ComponentName componentName) { CallerIdentity(int pid, int uid, @Nullable String packageName, @Nullable ComponentName componentName) { mPid = pid; mUid = uid; mPackageName = packageName; mComponentName = componentName; } public int getPid() { return mPid; } public int getUid() { return mUid; } Loading @@ -51,11 +58,13 @@ final class CallerIdentity { return UserHandle.getUserHandleForUid(mUid); } @Nullable public String getPackageName() { @Nullable public String getPackageName() { return mPackageName; } @Nullable public ComponentName getComponentName() { @Nullable public ComponentName getComponentName() { return mComponentName; } Loading
services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java +6 −5 Original line number Diff line number Diff line Loading @@ -2517,6 +2517,7 @@ public class DevicePolicyManagerService extends IDevicePolicyManager.Stub { CallerIdentity getCallerIdentity(@Nullable ComponentName adminComponent, @Nullable String callerPackage) { final int callerUid = mInjector.binderGetCallingUid(); final int callerPid = mInjector.binderGetCallingPid(); if (callerPackage != null) { if (!isCallingFromPackage(callerPackage, callerUid)) { Loading @@ -2543,7 +2544,7 @@ public class DevicePolicyManagerService extends IDevicePolicyManager.Stub { } } return new CallerIdentity(callerUid, callerPackage, adminComponent); return new CallerIdentity(callerPid, callerUid, callerPackage, adminComponent); } /** Loading Loading @@ -16202,17 +16203,17 @@ public class DevicePolicyManagerService extends IDevicePolicyManager.Stub { @Override public boolean isActiveDeviceOwner(int uid) { return isDefaultDeviceOwner(new CallerIdentity(uid, null, null)); return isDefaultDeviceOwner(new CallerIdentity(Process.INVALID_PID, uid, null, null)); } @Override public boolean isActiveProfileOwner(int uid) { return isProfileOwner(new CallerIdentity(uid, null, null)); return isProfileOwner(new CallerIdentity(Process.INVALID_PID, uid, null, null)); } @Override public boolean isActiveSupervisionApp(int uid) { if (!isProfileOwner(new CallerIdentity(uid, null, null))) { if (!isProfileOwner(new CallerIdentity(Process.INVALID_PID, uid, null, null))) { return false; } synchronized (getLockObject()) { Loading Loading @@ -16277,7 +16278,7 @@ public class DevicePolicyManagerService extends IDevicePolicyManager.Stub { return false; } CallerIdentity caller = new CallerIdentity(callerUid, null, null); CallerIdentity caller = new CallerIdentity(Process.INVALID_PID, callerUid, null, null); if (isUserAffiliatedWithDevice(UserHandle.getUserId(callerUid)) && (isActiveProfileOwner(callerUid) || isDefaultDeviceOwner(caller) || isFinancedDeviceOwner(caller))) {