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

Commit b5f16f7d authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Automerger Merge Worker
Browse files

Merge "Camera: Handle the case of calling Uid being cameraserver" into rvc-dev...

Merge "Camera: Handle the case of calling Uid being cameraserver" into rvc-dev am: ec77ef69 am: 45f0b513 am: 3664e9dc am: 6e1da082

Change-Id: Iee8e9874ffe9d57855ed7b6111ea6ae0992ad078
parents a52897b1 6e1da082
Loading
Loading
Loading
Loading
+6 −2
Original line number Diff line number Diff line
@@ -2742,7 +2742,7 @@ CameraService::BasicClient::BasicClient(const sp<CameraService>& cameraService,
        mClientPackageName(clientPackageName), mClientFeatureId(clientFeatureId),
        mClientPid(clientPid), mClientUid(clientUid),
        mServicePid(servicePid),
        mDisconnected(false),
        mDisconnected(false), mUidIsTrusted(false),
        mAudioRestriction(hardware::camera2::ICameraDeviceUser::AUDIO_RESTRICTION_NONE),
        mRemoteBinder(remoteCallback)
{
@@ -2785,6 +2785,8 @@ CameraService::BasicClient::BasicClient(const sp<CameraService>& cameraService,
    if (getCurrentServingCall() != BinderCallType::HWBINDER) {
        mAppOpsManager = std::make_unique<AppOpsManager>();
    }

    mUidIsTrusted = isTrustedCallingUid(mClientUid);
}

CameraService::BasicClient::~BasicClient() {
@@ -2899,7 +2901,9 @@ status_t CameraService::BasicClient::startCameraOps() {
            return PERMISSION_DENIED;
        }

        if (res == AppOpsManager::MODE_IGNORED) {
        // If the calling Uid is trusted (a native service), the AppOpsManager could
        // return MODE_IGNORED. Do not treat such case as error.
        if (!mUidIsTrusted && res == AppOpsManager::MODE_IGNORED) {
            ALOGI("Camera %s: Access for \"%s\" has been restricted",
                    mCameraIdStr.string(), String8(mClientPackageName).string());
            // Return the same error as for device policy manager rejection
+1 −0
Original line number Diff line number Diff line
@@ -324,6 +324,7 @@ public:
        const uid_t                     mClientUid;
        const pid_t                     mServicePid;
        bool                            mDisconnected;
        bool                            mUidIsTrusted;

        mutable Mutex                   mAudioRestrictionLock;
        int32_t                         mAudioRestriction;
+3 −1
Original line number Diff line number Diff line
@@ -197,7 +197,9 @@ status_t CameraOfflineSessionClient::startCameraOps() {
            return PERMISSION_DENIED;
        }

        if (res == AppOpsManager::MODE_IGNORED) {
        // If the calling Uid is trusted (a native service), the AppOpsManager could
        // return MODE_IGNORED. Do not treat such case as error.
        if (!mUidIsTrusted && res == AppOpsManager::MODE_IGNORED) {
            ALOGI("Offline Camera %s: Access for \"%s\" has been restricted",
                    mCameraIdStr.string(), String8(mClientPackageName).string());
            // Return the same error as for device policy manager rejection