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

Commit 197eaace authored by Mina Karadzic's avatar Mina Karadzic
Browse files

Fix rotate-and-crop setting from refactoring.

This caused landscape cameras to not apply rotate-and-crop correctly.

Flag: EXEMPT BUGFIX
Test: manual, tested on landscape camera
Bug: 432651608
Bug: 365725400
Bug: 414347702
Change-Id: I3424d3f160aaff71e10c44f9f1892ede703416b3
parent d1d01f9c
Loading
Loading
Loading
Loading
+6 −2
Original line number Diff line number Diff line
@@ -1558,6 +1558,10 @@ Status CameraService::makeClient(
                        cameraId.c_str(), deviceVersion);
        }
    }
    ui::Rotation rotation = ui::ROTATION_0;
    if (compatInfo.getRotateAndCropRotation().has_value()) {
        rotation = compatInfo.getRotateAndCropRotation().value();
    }
    if (effectiveApiLevel == API_1) { // Camera1 API route
        sp<ICameraClient> tmp = static_cast<ICameraClient*>(cameraCb.get());
        *client = new Camera2Client(cameraService, tmp, cameraService->mCameraServiceProxyWrapper,
@@ -1567,7 +1571,7 @@ Status CameraService::makeClient(
                                    compatInfo, forceSlowJpegMode, /*sharedMode*/false);
        ALOGV("%s: Camera1 API (legacy), rotateAndCrop %d, sensorOverride: %d,"
              "forceSlowJpegMode %d",
              __FUNCTION__, compatInfo.getRotateAndCropRotation().value(),
              __FUNCTION__, rotation,
              compatInfo.shouldOverrideSensorOrientation(), forceSlowJpegMode);
    } else { // Camera2 API route
        sp<hardware::camera2::ICameraDeviceCallbacks> tmp =
@@ -1579,7 +1583,7 @@ Status CameraService::makeClient(
                overrideForPerfClass, compatInfo, originalCameraId, sharedMode,
                isVendorClient);
        ALOGV("%s: Camera2 API, rotateAndCrop %d, sensorOverride: %d", __FUNCTION__,
              compatInfo.getRotateAndCropRotation().value(),
              rotation,
              compatInfo.shouldOverrideSensorOrientation());
    }
    return Status::ok();
+1 −3
Original line number Diff line number Diff line
@@ -3151,9 +3151,7 @@ status_t CameraProviderManager::ProviderInfo::DeviceInfo3::getCameraInfo(
        } else {
            info->orientation = (360 + info->orientation + 90) % 360;
        }
    }

    if (compatInfo.shouldRotateAndCrop() && !compatInfo.shouldOverrideSensorOrientation()
    } else if (compatInfo.shouldRotateAndCrop() && !compatInfo.shouldOverrideSensorOrientation()
            && (info->orientation == 90 || info->orientation == 270)) {
        // Check device rotation: display rotation will be sandboxed, therefore rotate-and-crop
        // needs to take display rotation into account.