Loading core/java/android/app/admin/DevicePolicyManager.java +2 −4 Original line number Diff line number Diff line Loading @@ -8394,8 +8394,7 @@ public class DevicePolicyManager { * <p> * The calling device admin must have requested * {@link DeviceAdminInfo#USES_POLICY_DISABLE_CAMERA} to be able to call this method; if it has * not, a security exception will be thrown, or the caller must hold the permission * {@link android.Manifest.permission#MANAGE_DEVICE_POLICY_CAMERA}. * not, a security exception will be thrown. * <p> * <b>Note</b>, this policy type is deprecated for legacy device admins since * {@link android.os.Build.VERSION_CODES#Q}. On Android Loading @@ -8411,8 +8410,7 @@ public class DevicePolicyManager { the caller is not a device admin * @param disabled Whether or not the camera should be disabled. * @throws SecurityException if {@code admin} is not an active administrator or does not use * {@link DeviceAdminInfo#USES_POLICY_DISABLE_CAMERA} and the caller does not hold * the permisisons {@link android.Manifest.permission#MANAGE_DEVICE_POLICY_CAMERA}. * {@link DeviceAdminInfo#USES_POLICY_DISABLE_CAMERA}. */ @RequiresPermission(value = MANAGE_DEVICE_POLICY_CAMERA, conditional = true) public void setCameraDisabled(@Nullable ComponentName admin, boolean disabled) { Loading services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java +10 −5 Original line number Diff line number Diff line Loading @@ -9198,9 +9198,15 @@ public class DevicePolicyManagerService extends IDevicePolicyManager.Stub { MANAGE_DEVICE_POLICY_CAMERA, caller.getPackageName(), getProfileParentUserIfRequested(userId, parent)); try { setBackwardCompatibleUserRestriction( caller, enforcingAdmin, UserManager.DISALLOW_CAMERA, disabled, parent); } catch (IllegalStateException e) { throw new IllegalStateException( "Please use addUserRestriction or addUserRestrictionGlobally using the key" + " UserManager.DISALLOW_CAMERA to disable the camera locally or" + " globally, respectively"); } } else { Objects.requireNonNull(who, "ComponentName is null"); if (parent) { Loading Loading @@ -22752,6 +22758,7 @@ public class DevicePolicyManagerService extends IDevicePolicyManager.Stub { MANAGE_DEVICE_POLICY_AUTOFILL, MANAGE_DEVICE_POLICY_BLUETOOTH, MANAGE_DEVICE_POLICY_CALLS, MANAGE_DEVICE_POLICY_CAMERA, MANAGE_DEVICE_POLICY_DEBUGGING_FEATURES, MANAGE_DEVICE_POLICY_DISPLAY, MANAGE_DEVICE_POLICY_FACTORY_RESET, Loading Loading @@ -22787,7 +22794,6 @@ public class DevicePolicyManagerService extends IDevicePolicyManager.Stub { MANAGE_DEVICE_POLICY_ACROSS_USERS, MANAGE_DEVICE_POLICY_AIRPLANE_MODE, MANAGE_DEVICE_POLICY_APPS_CONTROL, MANAGE_DEVICE_POLICY_CAMERA, MANAGE_DEVICE_POLICY_CERTIFICATES, MANAGE_DEVICE_POLICY_COMMON_CRITERIA_MODE, MANAGE_DEVICE_POLICY_DEFAULT_SMS, Loading Loading @@ -22815,7 +22821,6 @@ public class DevicePolicyManagerService extends IDevicePolicyManager.Stub { private static final List<String> ADDITIONAL_PROFILE_OWNER_ON_USER_0_PERMISSIONS = List.of( MANAGE_DEVICE_POLICY_AIRPLANE_MODE, MANAGE_DEVICE_POLICY_CAMERA, MANAGE_DEVICE_POLICY_DISPLAY, MANAGE_DEVICE_POLICY_FUN, MANAGE_DEVICE_POLICY_LOCK_TASK, Loading
core/java/android/app/admin/DevicePolicyManager.java +2 −4 Original line number Diff line number Diff line Loading @@ -8394,8 +8394,7 @@ public class DevicePolicyManager { * <p> * The calling device admin must have requested * {@link DeviceAdminInfo#USES_POLICY_DISABLE_CAMERA} to be able to call this method; if it has * not, a security exception will be thrown, or the caller must hold the permission * {@link android.Manifest.permission#MANAGE_DEVICE_POLICY_CAMERA}. * not, a security exception will be thrown. * <p> * <b>Note</b>, this policy type is deprecated for legacy device admins since * {@link android.os.Build.VERSION_CODES#Q}. On Android Loading @@ -8411,8 +8410,7 @@ public class DevicePolicyManager { the caller is not a device admin * @param disabled Whether or not the camera should be disabled. * @throws SecurityException if {@code admin} is not an active administrator or does not use * {@link DeviceAdminInfo#USES_POLICY_DISABLE_CAMERA} and the caller does not hold * the permisisons {@link android.Manifest.permission#MANAGE_DEVICE_POLICY_CAMERA}. * {@link DeviceAdminInfo#USES_POLICY_DISABLE_CAMERA}. */ @RequiresPermission(value = MANAGE_DEVICE_POLICY_CAMERA, conditional = true) public void setCameraDisabled(@Nullable ComponentName admin, boolean disabled) { Loading
services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java +10 −5 Original line number Diff line number Diff line Loading @@ -9198,9 +9198,15 @@ public class DevicePolicyManagerService extends IDevicePolicyManager.Stub { MANAGE_DEVICE_POLICY_CAMERA, caller.getPackageName(), getProfileParentUserIfRequested(userId, parent)); try { setBackwardCompatibleUserRestriction( caller, enforcingAdmin, UserManager.DISALLOW_CAMERA, disabled, parent); } catch (IllegalStateException e) { throw new IllegalStateException( "Please use addUserRestriction or addUserRestrictionGlobally using the key" + " UserManager.DISALLOW_CAMERA to disable the camera locally or" + " globally, respectively"); } } else { Objects.requireNonNull(who, "ComponentName is null"); if (parent) { Loading Loading @@ -22752,6 +22758,7 @@ public class DevicePolicyManagerService extends IDevicePolicyManager.Stub { MANAGE_DEVICE_POLICY_AUTOFILL, MANAGE_DEVICE_POLICY_BLUETOOTH, MANAGE_DEVICE_POLICY_CALLS, MANAGE_DEVICE_POLICY_CAMERA, MANAGE_DEVICE_POLICY_DEBUGGING_FEATURES, MANAGE_DEVICE_POLICY_DISPLAY, MANAGE_DEVICE_POLICY_FACTORY_RESET, Loading Loading @@ -22787,7 +22794,6 @@ public class DevicePolicyManagerService extends IDevicePolicyManager.Stub { MANAGE_DEVICE_POLICY_ACROSS_USERS, MANAGE_DEVICE_POLICY_AIRPLANE_MODE, MANAGE_DEVICE_POLICY_APPS_CONTROL, MANAGE_DEVICE_POLICY_CAMERA, MANAGE_DEVICE_POLICY_CERTIFICATES, MANAGE_DEVICE_POLICY_COMMON_CRITERIA_MODE, MANAGE_DEVICE_POLICY_DEFAULT_SMS, Loading Loading @@ -22815,7 +22821,6 @@ public class DevicePolicyManagerService extends IDevicePolicyManager.Stub { private static final List<String> ADDITIONAL_PROFILE_OWNER_ON_USER_0_PERMISSIONS = List.of( MANAGE_DEVICE_POLICY_AIRPLANE_MODE, MANAGE_DEVICE_POLICY_CAMERA, MANAGE_DEVICE_POLICY_DISPLAY, MANAGE_DEVICE_POLICY_FUN, MANAGE_DEVICE_POLICY_LOCK_TASK,