Merge "CameraService: Check if the camera is disabled via device policy by user." into tm-qpr-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
1cb77337d4
@@ -582,13 +582,18 @@ public class CameraServiceProxy extends SystemService
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isCameraDisabled() {
|
||||
public boolean isCameraDisabled(int userId) {
|
||||
DevicePolicyManager dpm = mContext.getSystemService(DevicePolicyManager.class);
|
||||
if (dpm == null) {
|
||||
Slog.e(TAG, "Failed to get the device policy manager service");
|
||||
return false;
|
||||
}
|
||||
return dpm.getCameraDisabled(null);
|
||||
try {
|
||||
return dpm.getCameraDisabled(null, userId);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -8178,7 +8178,8 @@ public class DevicePolicyManagerService extends BaseIDevicePolicyManager {
|
||||
}
|
||||
|
||||
final CallerIdentity caller = getCallerIdentity(who);
|
||||
Preconditions.checkCallAuthorization(hasFullCrossUsersPermission(caller, userHandle));
|
||||
Preconditions.checkCallAuthorization(hasFullCrossUsersPermission(caller, userHandle)
|
||||
|| isCameraServerUid(caller));
|
||||
|
||||
if (parent) {
|
||||
Preconditions.checkCallAuthorization(
|
||||
@@ -9689,6 +9690,10 @@ public class DevicePolicyManagerService extends BaseIDevicePolicyManager {
|
||||
return UserHandle.isSameApp(caller.getUid(), Process.SHELL_UID);
|
||||
}
|
||||
|
||||
private boolean isCameraServerUid(CallerIdentity caller) {
|
||||
return UserHandle.isSameApp(caller.getUid(), Process.CAMERASERVER_UID);
|
||||
}
|
||||
|
||||
private @UserIdInt int getCurrentForegroundUserId() {
|
||||
try {
|
||||
UserInfo currentUser = mInjector.getIActivityManager().getCurrentUser();
|
||||
|
||||
Reference in New Issue
Block a user