Merge "Fix policy transparency for camera disabled policy" into udc-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
5ee04a8a1c
@@ -16219,17 +16219,13 @@ public class DevicePolicyManagerService extends IDevicePolicyManager.Stub {
|
||||
deviceOwner.second);
|
||||
return result;
|
||||
}
|
||||
} else if (DevicePolicyManager.POLICY_DISABLE_CAMERA.equals(restriction)
|
||||
|| DevicePolicyManager.POLICY_DISABLE_SCREEN_CAPTURE.equals(restriction)) {
|
||||
} else if (DevicePolicyManager.POLICY_DISABLE_SCREEN_CAPTURE.equals(restriction)) {
|
||||
synchronized (getLockObject()) {
|
||||
final DevicePolicyData policy = getUserData(userId);
|
||||
final int N = policy.mAdminList.size();
|
||||
for (int i = 0; i < N; i++) {
|
||||
final ActiveAdmin admin = policy.mAdminList.get(i);
|
||||
if ((admin.disableCamera &&
|
||||
DevicePolicyManager.POLICY_DISABLE_CAMERA.equals(restriction))
|
||||
|| (admin.disableScreenCapture && DevicePolicyManager
|
||||
.POLICY_DISABLE_SCREEN_CAPTURE.equals(restriction))) {
|
||||
if (admin.disableScreenCapture) {
|
||||
result = new Bundle();
|
||||
result.putInt(Intent.EXTRA_USER_ID, userId);
|
||||
result.putParcelable(DevicePolicyManager.EXTRA_DEVICE_ADMIN,
|
||||
@@ -16237,17 +16233,44 @@ public class DevicePolicyManagerService extends IDevicePolicyManager.Stub {
|
||||
return result;
|
||||
}
|
||||
}
|
||||
// For the camera, a device owner on a different user can disable it globally,
|
||||
// so we need an additional check.
|
||||
if (result == null
|
||||
&& DevicePolicyManager.POLICY_DISABLE_CAMERA.equals(restriction)) {
|
||||
final ActiveAdmin admin = getDeviceOwnerAdminLocked();
|
||||
if (admin != null && admin.disableCamera) {
|
||||
result = new Bundle();
|
||||
result.putInt(Intent.EXTRA_USER_ID, mOwners.getDeviceOwnerUserId());
|
||||
result.putParcelable(DevicePolicyManager.EXTRA_DEVICE_ADMIN,
|
||||
admin.info.getComponent());
|
||||
return result;
|
||||
}
|
||||
} else if (DevicePolicyManager.POLICY_DISABLE_CAMERA.equals(restriction)) {
|
||||
if (isPolicyEngineForFinanceFlagEnabled()) {
|
||||
PolicyDefinition<Boolean> policyDefinition =
|
||||
PolicyDefinition.getPolicyDefinitionForUserRestriction(
|
||||
UserManager.DISALLOW_CAMERA);
|
||||
Boolean value = mDevicePolicyEngine.getResolvedPolicy(policyDefinition, userId);
|
||||
if (value != null && value) {
|
||||
result = new Bundle();
|
||||
result.putInt(Intent.EXTRA_USER_ID, userId);
|
||||
return result;
|
||||
}
|
||||
} else {
|
||||
synchronized (getLockObject()) {
|
||||
final DevicePolicyData policy = getUserData(userId);
|
||||
final int N = policy.mAdminList.size();
|
||||
for (int i = 0; i < N; i++) {
|
||||
final ActiveAdmin admin = policy.mAdminList.get(i);
|
||||
if (admin.disableCamera) {
|
||||
result = new Bundle();
|
||||
result.putInt(Intent.EXTRA_USER_ID, userId);
|
||||
result.putParcelable(DevicePolicyManager.EXTRA_DEVICE_ADMIN,
|
||||
admin.info.getComponent());
|
||||
return result;
|
||||
}
|
||||
}
|
||||
// For the camera, a device owner on a different user can disable it globally,
|
||||
// so we need an additional check.
|
||||
if (result == null
|
||||
&& DevicePolicyManager.POLICY_DISABLE_CAMERA.equals(restriction)) {
|
||||
final ActiveAdmin admin = getDeviceOwnerAdminLocked();
|
||||
if (admin != null && admin.disableCamera) {
|
||||
result = new Bundle();
|
||||
result.putInt(Intent.EXTRA_USER_ID, mOwners.getDeviceOwnerUserId());
|
||||
result.putParcelable(DevicePolicyManager.EXTRA_DEVICE_ADMIN,
|
||||
admin.info.getComponent());
|
||||
return result;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user