https://github.com/jfhr/disablecamera2”rel=“nofollow noreferer”>https://github.com/jfhr/disablecamera2
这一来源法对我没有作用。
i 持有装置管理人的许可。 但不工作。
ComponentName componentName = new ComponentName(this, CameraPolicyReceiver.class);
DevicePolicyManager policyManager = (DevicePolicyManager) getSystemService(Context.DEVICE_POLICY_SERVICE);
boolean isAdminActive = policyManager.isAdminActive(componentName);
isAdminActive is allways "ture". but when i run
policyManager.setCameraDisabled(componentName, true);
该守则给我带来了错误代码。
java.lang.SecurityException: Caller does not have the required permissions for this user.
Permission required: android.permission.MANAGE_DEVICE_POLICY_CAMERA.
it is work under the android14, but now it is not. i tried adding signature in my test apps. it also not work.
ps. i added MANAGE_DEVICE_POLICY_CAMERA permission like below
it is not work... And Same error
java.lang.SecurityException: Caller does not have the required permissions for this user.
Permission required: android.permission.MANAGE_DEVICE_POLICY_CAMERA.