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

Commit f81f69e5 authored by Austin Borger's avatar Austin Borger Committed by Android (Google) Code Review
Browse files

Merge "Fix null pointer dereference in Camera2Client::stopPreviewL" into main

parents 8d6bf910 f170fcc7
Loading
Loading
Loading
Loading
+8 −0
Original line number Original line Diff line number Diff line
@@ -73,6 +73,7 @@ Camera2Client::Camera2Client(
                        overrideForPerfClass, rotationOverride, sharedMode,
                        overrideForPerfClass, rotationOverride, sharedMode,
                        /*legacyClient*/ true),
                        /*legacyClient*/ true),
      mParameters(api1CameraId, cameraFacing),
      mParameters(api1CameraId, cameraFacing),
      mInitialized(false),
      mLatestRequestIds(kMaxRequestIds),
      mLatestRequestIds(kMaxRequestIds),
      mLatestFailedRequestIds(kMaxRequestIds) {
      mLatestFailedRequestIds(kMaxRequestIds) {
    ATRACE_CALL();
    ATRACE_CALL();
@@ -194,6 +195,7 @@ status_t Camera2Client::initializeImpl(TProviderPtr providerPtr, const std::stri
        ALOGD("%s", l.mParameters.paramsFlattened.c_str());
        ALOGD("%s", l.mParameters.paramsFlattened.c_str());
    }
    }


    mInitialized = true;
    return OK;
    return OK;
}
}


@@ -1040,6 +1042,12 @@ void Camera2Client::stopPreview() {


void Camera2Client::stopPreviewL() {
void Camera2Client::stopPreviewL() {
    ATRACE_CALL();
    ATRACE_CALL();

    if (!mInitialized) {
        // If we haven't initialized yet, there's no stream to stop (b/379558387)
        return;
    }

    status_t res;
    status_t res;
    const nsecs_t kStopCaptureTimeout = 3000000000LL; // 3 seconds
    const nsecs_t kStopCaptureTimeout = 3000000000LL; // 3 seconds
    Parameters::State state;
    Parameters::State state;
+4 −0
Original line number Original line Diff line number Diff line
@@ -17,6 +17,8 @@
#ifndef ANDROID_SERVERS_CAMERA_CAMERA2CLIENT_H
#ifndef ANDROID_SERVERS_CAMERA_CAMERA2CLIENT_H
#define ANDROID_SERVERS_CAMERA_CAMERA2CLIENT_H
#define ANDROID_SERVERS_CAMERA_CAMERA2CLIENT_H


#include <atomic>

#include <gui/Flags.h>
#include <gui/Flags.h>
#include <gui/view/Surface.h>
#include <gui/view/Surface.h>
#include <media/RingBuffer.h>
#include <media/RingBuffer.h>
@@ -236,6 +238,8 @@ private:
    sp<camera2::JpegProcessor> mJpegProcessor;
    sp<camera2::JpegProcessor> mJpegProcessor;
    sp<camera2::ZslProcessor> mZslProcessor;
    sp<camera2::ZslProcessor> mZslProcessor;


    std::atomic<bool> mInitialized;

    /** Utility members */
    /** Utility members */
    bool mLegacyMode;
    bool mLegacyMode;