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

Commit a81ce34c authored by Shuzhen Wang's avatar Shuzhen Wang
Browse files

Camera: Make finalizeOutputConfigurations more resilient

There could be race in application where finalizeOutputconfigurations
doesn't include any new surface. Do not fail in this case.

Test: CameraStressTest#testBackCameraSwitchPreview
Bug: 36811459
Bug: 35137641
Change-Id: Ic185e6d8bfcb8af5b81a33fbbd2fd4e49cc647ce
parent 2efd6be6
Loading
Loading
Loading
Loading
+7 −0
Original line number Diff line number Diff line
@@ -1269,6 +1269,13 @@ binder::Status CameraDeviceClient::finalizeOutputConfigurations(int32_t streamId
        surfaceId++;
    }

    // Gracefully handle case where finalizeOutputConfigurations is called
    // without any new surface.
    if (consumerSurfaces.size() == 0) {
        mStreamInfoMap[streamId].finalized = true;
        return res;
    }

    // Finish the deferred stream configuration with the surface.
    status_t err;
    err = mDevice->setConsumerSurfaces(streamId, consumerSurfaces);