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

Commit 337da697 authored by Jayant Chowdhary's avatar Jayant Chowdhary
Browse files

cameraserver: Correct camera1 -> api2 shim layer handling for video stabilization.



For cases where devices support PREVIEW_STABILIZATION but not
VIDEO_STABILIZATION, map PREVIEW_STABILIZATION to the camera2 api.

For cases where both are supported, still map to VIDEO_STABILIZATION.

Bug: 254856553

Test: Make back camera on cuttlefish support only PREVIEW_STABILIZATION;
      atest ExtendCameraCharacteristicsTest.java#testLegacyCameraDeviceParity
      atest CameraTest.java#testStabilizationOneShotPreviewCallback

Change-Id: Iec3870557bfee36e23d92b451affd39118990b40
Signed-off-by: default avatarJayant Chowdhary <jchowdhary@google.com>
parent 037845be
Loading
Loading
Loading
Loading
+9 −1
Original line number Original line Diff line number Diff line
@@ -953,6 +953,12 @@ status_t Parameters::initialize(CameraDeviceBase *device) {
                false);
                false);


    if (availableVideoStabilizationModes.count > 1) {
    if (availableVideoStabilizationModes.count > 1) {
        for (size_t i = 0; i < availableVideoStabilizationModes.count; i++) {
            if (availableVideoStabilizationModes.data.u8[i] ==
                ANDROID_CONTROL_VIDEO_STABILIZATION_MODE_ON) {
                videoStabilizationOnSupported = true;
            }
        }
        params.set(CameraParameters::KEY_VIDEO_STABILIZATION_SUPPORTED,
        params.set(CameraParameters::KEY_VIDEO_STABILIZATION_SUPPORTED,
                CameraParameters::TRUE);
                CameraParameters::TRUE);
    } else {
    } else {
@@ -2373,9 +2379,11 @@ status_t Parameters::updateRequest(CameraMetadata *request) const {
            reqCropRegion, 4);
            reqCropRegion, 4);
    if (res != OK) return res;
    if (res != OK) return res;


    uint8_t reqVstabMode = videoStabilization ?
    uint8_t reqVstabMode = videoStabilization ? videoStabilizationOnSupported ?
            ANDROID_CONTROL_VIDEO_STABILIZATION_MODE_ON :
            ANDROID_CONTROL_VIDEO_STABILIZATION_MODE_ON :
                    ANDROID_CONTROL_VIDEO_STABILIZATION_MODE_PREVIEW_STABILIZATION :
            ANDROID_CONTROL_VIDEO_STABILIZATION_MODE_OFF;
            ANDROID_CONTROL_VIDEO_STABILIZATION_MODE_OFF;

    res = request->update(ANDROID_CONTROL_VIDEO_STABILIZATION_MODE,
    res = request->update(ANDROID_CONTROL_VIDEO_STABILIZATION_MODE,
            &reqVstabMode, 1);
            &reqVstabMode, 1);
    if (res != OK) return res;
    if (res != OK) return res;
+1 −0
Original line number Original line Diff line number Diff line
@@ -147,6 +147,7 @@ struct Parameters {


    bool recordingHint;
    bool recordingHint;
    bool videoStabilization;
    bool videoStabilization;
    bool videoStabilizationOnSupported = false;


    CameraParameters2 params;
    CameraParameters2 params;
    String8 paramsFlattened;
    String8 paramsFlattened;