Loading core/java/android/app/admin/DevicePolicyManager.java +4 −1 Original line number Original line Diff line number Diff line Loading @@ -10335,11 +10335,14 @@ public class DevicePolicyManager { * @return the current credential manager policy if null then this policy has not been * @return the current credential manager policy if null then this policy has not been * configured. * configured. */ */ @UserHandleAware( enabledSinceTargetSdkVersion = UPSIDE_DOWN_CAKE, requiresPermissionIfNotCaller = INTERACT_ACROSS_USERS) public @Nullable PackagePolicy getCredentialManagerPolicy() { public @Nullable PackagePolicy getCredentialManagerPolicy() { throwIfParentInstance("getCredentialManagerPolicy"); throwIfParentInstance("getCredentialManagerPolicy"); if (mService != null) { if (mService != null) { try { try { return mService.getCredentialManagerPolicy(); return mService.getCredentialManagerPolicy(myUserId()); } catch (RemoteException e) { } catch (RemoteException e) { throw e.rethrowFromSystemServer(); throw e.rethrowFromSystemServer(); } } Loading core/java/android/app/admin/IDevicePolicyManager.aidl +1 −1 Original line number Original line Diff line number Diff line Loading @@ -346,7 +346,7 @@ interface IDevicePolicyManager { boolean hasManagedProfileCallerIdAccess(int userId, String packageName); boolean hasManagedProfileCallerIdAccess(int userId, String packageName); void setCredentialManagerPolicy(in PackagePolicy policy); void setCredentialManagerPolicy(in PackagePolicy policy); PackagePolicy getCredentialManagerPolicy(); PackagePolicy getCredentialManagerPolicy(int userId); void setManagedProfileContactsAccessPolicy(in PackagePolicy policy); void setManagedProfileContactsAccessPolicy(in PackagePolicy policy); PackagePolicy getManagedProfileContactsAccessPolicy(); PackagePolicy getManagedProfileContactsAccessPolicy(); Loading services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java +6 −2 Original line number Original line Diff line number Diff line Loading @@ -16017,16 +16017,20 @@ public class DevicePolicyManagerService extends IDevicePolicyManager.Stub { } } @Override @Override public PackagePolicy getCredentialManagerPolicy() { public PackagePolicy getCredentialManagerPolicy(int userId) { if (!mHasFeature) { if (!mHasFeature) { return null; return null; } } final CallerIdentity caller = getCallerIdentity(); final CallerIdentity caller = getCallerIdentity(); Preconditions.checkCallAuthorization( Preconditions.checkCallAuthorization( canWriteCredentialManagerPolicy(caller) || canQueryAdminPolicy(caller)); canWriteCredentialManagerPolicy(caller) || canQueryAdminPolicy(caller)); if (userId != caller.getUserId()) { Preconditions.checkCallAuthorization( hasCallingOrSelfPermission(permission.INTERACT_ACROSS_USERS)); } synchronized (getLockObject()) { synchronized (getLockObject()) { ActiveAdmin admin = getProfileOwnerOrDeviceOwnerLocked(caller.getUserId()); ActiveAdmin admin = getProfileOwnerOrDeviceOwnerLocked(userId); return (admin != null) ? admin.mCredentialManagerPolicy : null; return (admin != null) ? admin.mCredentialManagerPolicy : null; } } } } Loading
core/java/android/app/admin/DevicePolicyManager.java +4 −1 Original line number Original line Diff line number Diff line Loading @@ -10335,11 +10335,14 @@ public class DevicePolicyManager { * @return the current credential manager policy if null then this policy has not been * @return the current credential manager policy if null then this policy has not been * configured. * configured. */ */ @UserHandleAware( enabledSinceTargetSdkVersion = UPSIDE_DOWN_CAKE, requiresPermissionIfNotCaller = INTERACT_ACROSS_USERS) public @Nullable PackagePolicy getCredentialManagerPolicy() { public @Nullable PackagePolicy getCredentialManagerPolicy() { throwIfParentInstance("getCredentialManagerPolicy"); throwIfParentInstance("getCredentialManagerPolicy"); if (mService != null) { if (mService != null) { try { try { return mService.getCredentialManagerPolicy(); return mService.getCredentialManagerPolicy(myUserId()); } catch (RemoteException e) { } catch (RemoteException e) { throw e.rethrowFromSystemServer(); throw e.rethrowFromSystemServer(); } } Loading
core/java/android/app/admin/IDevicePolicyManager.aidl +1 −1 Original line number Original line Diff line number Diff line Loading @@ -346,7 +346,7 @@ interface IDevicePolicyManager { boolean hasManagedProfileCallerIdAccess(int userId, String packageName); boolean hasManagedProfileCallerIdAccess(int userId, String packageName); void setCredentialManagerPolicy(in PackagePolicy policy); void setCredentialManagerPolicy(in PackagePolicy policy); PackagePolicy getCredentialManagerPolicy(); PackagePolicy getCredentialManagerPolicy(int userId); void setManagedProfileContactsAccessPolicy(in PackagePolicy policy); void setManagedProfileContactsAccessPolicy(in PackagePolicy policy); PackagePolicy getManagedProfileContactsAccessPolicy(); PackagePolicy getManagedProfileContactsAccessPolicy(); Loading
services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java +6 −2 Original line number Original line Diff line number Diff line Loading @@ -16017,16 +16017,20 @@ public class DevicePolicyManagerService extends IDevicePolicyManager.Stub { } } @Override @Override public PackagePolicy getCredentialManagerPolicy() { public PackagePolicy getCredentialManagerPolicy(int userId) { if (!mHasFeature) { if (!mHasFeature) { return null; return null; } } final CallerIdentity caller = getCallerIdentity(); final CallerIdentity caller = getCallerIdentity(); Preconditions.checkCallAuthorization( Preconditions.checkCallAuthorization( canWriteCredentialManagerPolicy(caller) || canQueryAdminPolicy(caller)); canWriteCredentialManagerPolicy(caller) || canQueryAdminPolicy(caller)); if (userId != caller.getUserId()) { Preconditions.checkCallAuthorization( hasCallingOrSelfPermission(permission.INTERACT_ACROSS_USERS)); } synchronized (getLockObject()) { synchronized (getLockObject()) { ActiveAdmin admin = getProfileOwnerOrDeviceOwnerLocked(caller.getUserId()); ActiveAdmin admin = getProfileOwnerOrDeviceOwnerLocked(userId); return (admin != null) ? admin.mCredentialManagerPolicy : null; return (admin != null) ? admin.mCredentialManagerPolicy : null; } } } }