Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit cc6f79fa authored by Austin Borger's avatar Austin Borger Committed by Automerger Merge Worker
Browse files

Merge "CameraService: Check if the camera is disabled via device policy by...

Merge "CameraService: Check if the camera is disabled via device policy by user." into tm-qpr-dev am: a803f790

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/av/+/19887405



Change-Id: I94f92d7f8adea0c2e08e9a9f9228796c331f1596
Signed-off-by: default avatarAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
parents 98031bcf a803f790
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -48,5 +48,5 @@ interface ICameraServiceProxy
    /**
     * Checks if the camera has been disabled via device policy.
     */
    boolean isCameraDisabled();
    boolean isCameraDisabled(int userId);
}
+7 −1
Original line number Diff line number Diff line
@@ -1698,7 +1698,13 @@ Status CameraService::connectDevice(
        return STATUS_ERROR(ERROR_ILLEGAL_ARGUMENT, msg.string());
    }

    if (CameraServiceProxyWrapper::isCameraDisabled()) {
    userid_t clientUserId = multiuser_get_user_id(clientUid);
    int callingUid = CameraThreadState::getCallingUid();
    if (clientUid == USE_CALLING_UID) {
        clientUserId = multiuser_get_user_id(callingUid);
    }

    if (CameraServiceProxyWrapper::isCameraDisabled(clientUserId)) {
        String8 msg =
                String8::format("Camera disabled by device policy");
        ALOGE("%s: %s", __FUNCTION__, msg.string());
+2 −2
Original line number Diff line number Diff line
@@ -262,11 +262,11 @@ void CameraServiceProxyWrapper::logClose(const String8& id, int32_t latencyMs) {
    sessionStats->onClose(latencyMs);
}

bool CameraServiceProxyWrapper::isCameraDisabled() {
bool CameraServiceProxyWrapper::isCameraDisabled(int userId) {
    sp<ICameraServiceProxy> proxyBinder = getCameraServiceProxy();
    if (proxyBinder == nullptr) return true;
    bool ret = false;
    auto status = proxyBinder->isCameraDisabled(&ret);
    auto status = proxyBinder->isCameraDisabled(userId, &ret);
    if (!status.isOk()) {
        ALOGE("%s: Failed during camera disabled query: %s", __FUNCTION__,
                status.exceptionMessage().c_str());
+1 −1
Original line number Diff line number Diff line
@@ -97,7 +97,7 @@ public:
    static int getRotateAndCropOverride(String16 packageName, int lensFacing, int userId);

    // Detect if the camera is disabled by device policy.
    static bool isCameraDisabled();
    static bool isCameraDisabled(int userId);
};

} // android