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

Commit 22d58d37 authored by Igor Murashkin's avatar Igor Murashkin Committed by Android (Google) Code Review
Browse files

Camera2: Don't change state when reconnect is called

Bug: 7252802
Change-Id: Ibed4f59a96bef75bf84b1aaf1235fb87e94102ef
parent 9f9d7de7
Loading
Loading
Loading
Loading
+8 −3
Original line number Diff line number Diff line
@@ -419,9 +419,6 @@ status_t Camera2Client::connect(const sp<ICameraClient>& client) {
    mCameraClient = client;
    mSharedCameraClient = client;

    SharedParameters::Lock l(mParameters);
    l.mParameters.state = Parameters::STOPPED;

    return OK;
}

@@ -603,6 +600,9 @@ status_t Camera2Client::startPreview() {
status_t Camera2Client::startPreviewL(Parameters &params, bool restart) {
    ATRACE_CALL();
    status_t res;

    ALOGV("%s: state == %d, restart = %d", __FUNCTION__, params.state, restart);

    if (params.state == Parameters::PREVIEW && !restart) {
        // Succeed attempt to re-enter preview state
        ALOGI("%s: Not starting preview; already in preview state.",
@@ -792,6 +792,9 @@ status_t Camera2Client::startRecording() {

status_t Camera2Client::startRecordingL(Parameters &params, bool restart) {
    status_t res;

    ALOGV("%s: state == %d, restart = %d", __FUNCTION__, params.state, restart);

    switch (params.state) {
        case Parameters::STOPPED:
            res = startPreviewL(params, false);
@@ -1430,6 +1433,8 @@ const int32_t Camera2Client::kFirstCaptureRequestId;
status_t Camera2Client::updateRequests(Parameters &params) {
    status_t res;

    ALOGV("%s: Camera %d: state = %d", __FUNCTION__, getCameraId(), params.state);

    res = mStreamingProcessor->updatePreviewRequest(params);
    if (res != OK) {
        ALOGE("%s: Camera %d: Unable to update preview request: %s (%d)",
+2 −0
Original line number Diff line number Diff line
@@ -351,6 +351,8 @@ status_t StreamingProcessor::startStream(StreamType type,
    sp<Camera2Client> client = mClient.promote();
    if (client == 0) return INVALID_OPERATION;

    ALOGV("%s: Camera %d: type = %d", __FUNCTION__, client->getCameraId(), type);

    Mutex::Autolock m(mMutex);

    CameraMetadata &request = (type == PREVIEW) ?