Loading core/java/android/app/admin/DevicePolicyManager.java +5 −4 Original line number Diff line number Diff line Loading @@ -3421,12 +3421,13 @@ public class DevicePolicyManager { } /** * Called by profile or device owners to check whether a user has been blocked from * uninstalling a package. * Check whether the current user has been blocked by device policy from uninstalling a package. * Requires the caller to be the profile owner if checking a specific admin's policy. * * @param admin Which {@link DeviceAdminReceiver} this request is associated with. * @param admin The name of the admin component whose blocking policy will be checked, or null * to check if any admin has blocked the uninstallation. * @param packageName package to check. * @return true if the user shouldn't be able to uninstall the package. * @return true if uninstallation is blocked. */ public boolean isUninstallBlocked(ComponentName admin, String packageName) { if (mService != null) { Loading services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java +5 −3 Original line number Diff line number Diff line Loading @@ -5040,13 +5040,15 @@ public class DevicePolicyManagerService extends IDevicePolicyManager.Stub { @Override public boolean isUninstallBlocked(ComponentName who, String packageName) { // This function should return true if and only if the package is blocked by // setUninstallBlocked(). It should still return false for other cases of blocks, such as // when the package is a system app, or when it is an active device admin. final int userId = UserHandle.getCallingUserId(); synchronized (this) { if (who == null) { throw new NullPointerException("ComponentName is null"); } if (who != null) { getActiveAdminForCallerLocked(who, DeviceAdminInfo.USES_POLICY_PROFILE_OWNER); } long id = Binder.clearCallingIdentity(); try { Loading Loading
core/java/android/app/admin/DevicePolicyManager.java +5 −4 Original line number Diff line number Diff line Loading @@ -3421,12 +3421,13 @@ public class DevicePolicyManager { } /** * Called by profile or device owners to check whether a user has been blocked from * uninstalling a package. * Check whether the current user has been blocked by device policy from uninstalling a package. * Requires the caller to be the profile owner if checking a specific admin's policy. * * @param admin Which {@link DeviceAdminReceiver} this request is associated with. * @param admin The name of the admin component whose blocking policy will be checked, or null * to check if any admin has blocked the uninstallation. * @param packageName package to check. * @return true if the user shouldn't be able to uninstall the package. * @return true if uninstallation is blocked. */ public boolean isUninstallBlocked(ComponentName admin, String packageName) { if (mService != null) { Loading
services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java +5 −3 Original line number Diff line number Diff line Loading @@ -5040,13 +5040,15 @@ public class DevicePolicyManagerService extends IDevicePolicyManager.Stub { @Override public boolean isUninstallBlocked(ComponentName who, String packageName) { // This function should return true if and only if the package is blocked by // setUninstallBlocked(). It should still return false for other cases of blocks, such as // when the package is a system app, or when it is an active device admin. final int userId = UserHandle.getCallingUserId(); synchronized (this) { if (who == null) { throw new NullPointerException("ComponentName is null"); } if (who != null) { getActiveAdminForCallerLocked(who, DeviceAdminInfo.USES_POLICY_PROFILE_OWNER); } long id = Binder.clearCallingIdentity(); try { Loading