Merge "CameraService: Check if the camera is disabled via device policy by user." into tm-qpr-dev am: 1cb77337d4
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/19887604 Change-Id: Ib6d792c89c220fe8b239db91ed20d16ed075f1ec Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
@@ -582,13 +582,18 @@ public class CameraServiceProxy extends SystemService
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isCameraDisabled() {
|
public boolean isCameraDisabled(int userId) {
|
||||||
DevicePolicyManager dpm = mContext.getSystemService(DevicePolicyManager.class);
|
DevicePolicyManager dpm = mContext.getSystemService(DevicePolicyManager.class);
|
||||||
if (dpm == null) {
|
if (dpm == null) {
|
||||||
Slog.e(TAG, "Failed to get the device policy manager service");
|
Slog.e(TAG, "Failed to get the device policy manager service");
|
||||||
return false;
|
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);
|
final CallerIdentity caller = getCallerIdentity(who);
|
||||||
Preconditions.checkCallAuthorization(hasFullCrossUsersPermission(caller, userHandle));
|
Preconditions.checkCallAuthorization(hasFullCrossUsersPermission(caller, userHandle)
|
||||||
|
|| isCameraServerUid(caller));
|
||||||
|
|
||||||
if (parent) {
|
if (parent) {
|
||||||
Preconditions.checkCallAuthorization(
|
Preconditions.checkCallAuthorization(
|
||||||
@@ -9689,6 +9690,10 @@ public class DevicePolicyManagerService extends BaseIDevicePolicyManager {
|
|||||||
return UserHandle.isSameApp(caller.getUid(), Process.SHELL_UID);
|
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() {
|
private @UserIdInt int getCurrentForegroundUserId() {
|
||||||
try {
|
try {
|
||||||
UserInfo currentUser = mInjector.getIActivityManager().getCurrentUser();
|
UserInfo currentUser = mInjector.getIActivityManager().getCurrentUser();
|
||||||
|
|||||||
Reference in New Issue
Block a user