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

Commit 5fa7758e authored by Jyoti Bhayana's avatar Jyoti Bhayana Committed by Android (Google) Code Review
Browse files

Merge "Fixing test failures im SharedCameraTest." into main

parents d188746c 11a68483
Loading
Loading
Loading
Loading
+4 −1
Original line number Diff line number Diff line
@@ -97,6 +97,7 @@ ACameraCaptureSession::stopRepeating() {
    dev->lockDeviceForSessionOps();
    {
        if (dev->isSharedMode() && !dev->isPrimaryClient()) {
            dev->unlockDevice();
            return ACAMERA_ERROR_UNSUPPORTED_OPERATION;
        }
        Mutex::Autolock _l(mSessionLock);
@@ -138,11 +139,11 @@ ACameraCaptureSession::abortCaptures() {
        ALOGE("Error: Device associated with session %p has been closed!", this);
        return ACAMERA_ERROR_SESSION_CLOSED;
    }

    camera_status_t ret;
    dev->lockDeviceForSessionOps();
    {
        if (dev->isSharedMode() && !dev->isPrimaryClient()) {
            dev->unlockDevice();
            return ACAMERA_ERROR_UNSUPPORTED_OPERATION;
        }
        Mutex::Autolock _l(mSessionLock);
@@ -167,6 +168,7 @@ camera_status_t ACameraCaptureSession::updateOutputConfiguration(ACaptureSession
    dev->lockDeviceForSessionOps();
    {
        if (dev->isSharedMode()) {
            dev->unlockDevice();
            return ACAMERA_ERROR_UNSUPPORTED_OPERATION;
        }
        Mutex::Autolock _l(mSessionLock);
@@ -191,6 +193,7 @@ camera_status_t ACameraCaptureSession::prepare(ANativeWindow* window) {
    dev->lockDeviceForSessionOps();
    {
        if (dev->isSharedMode()) {
            dev->unlockDevice();
            return ACAMERA_ERROR_UNSUPPORTED_OPERATION;
        }
        Mutex::Autolock _l(mSessionLock);
+5 −0
Original line number Diff line number Diff line
@@ -711,6 +711,11 @@ CameraDevice::configureStreamsLocked(const ACaptureSessionOutputContainer* outpu
        if (ret != ACAMERA_OK) {
            return ret;
        }
        // Surface sharing cannot be enabled when a camera has been opened
        // in shared mode.
        if (flags::camera_multi_client() && mSharedMode && outConfig.mIsShared) {
            return ACAMERA_ERROR_INVALID_PARAMETER;
        }
        ParcelableSurfaceType pSurface = flagtools::convertSurfaceTypeToParcelable(surface);
        outputSet.insert(std::make_pair(
                anw,
+20 −0
Original line number Diff line number Diff line
@@ -2485,6 +2485,26 @@ void CameraDeviceClient::detachDevice() {
                    camera2::FrameProcessorBase::FRAME_PROCESSOR_LISTENER_MIN_ID,
                    camera2::FrameProcessorBase::FRAME_PROCESSOR_LISTENER_MAX_ID, /*listener*/this);
    }

    if (flags::camera_multi_client() && mSharedMode) {
        for (auto streamInfo : mStreamInfoMap) {
            int streamToDelete = streamInfo.first;
            std::vector<size_t> removedSurfaceIds;
            for (size_t i = 0; i < mStreamMap.size(); ++i) {
                if (streamToDelete == mStreamMap.valueAt(i).streamId()) {
                    removedSurfaceIds.push_back(mStreamMap.valueAt(i).surfaceId());
                }
            }
            status_t err = mDevice->removeSharedSurfaces(streamToDelete, removedSurfaceIds);
            if (err != OK) {
                std::string msg = fmt::sprintf("Camera %s: Unexpected error %s (%d) when removing"
                        "shared surfaces from stream %d", mCameraIdStr.c_str(), strerror(-err),
                        err, streamToDelete);
                ALOGE("%s: %s", __FUNCTION__, msg.c_str());
            }
        }
    }

    if (!flags::camera_multi_client() || !mSharedMode ||
            (mSharedMode && sCameraService->isOnlyClient(this))){
        ALOGV("Camera %s: Stopping processors", mCameraIdStr.c_str());