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

Commit 9f4125d7 authored by Austin Borger's avatar Austin Borger Committed by Automerger Merge Worker
Browse files

Merge "CameraService: Update rotate and crop dynamically on fold/unfold." into...

Merge "CameraService: Update rotate and crop dynamically on fold/unfold." into tm-qpr-dev am: 0d741de6

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/av/+/20948803



Change-Id: I8b25c25cd01db0af329cb962dcd5ed81871fe5ec
Signed-off-by: default avatarAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
parents bca45511 0d741de6
Loading
Loading
Loading
Loading
+23 −0
Original line number Diff line number Diff line
@@ -342,6 +342,29 @@ void Camera2ClientBase<TClientBase>::notifyError(
          resultExtras.requestId);
}

template <typename TClientBase>
void Camera2ClientBase<TClientBase>::notifyPhysicalCameraChange(const std::string &physicalId) {
    // We're only interested in this notification if overrideToPortrait is turned on.
    if (!TClientBase::mOverrideToPortrait) {
        return;
    }

    String8 physicalId8(physicalId.c_str());
    auto physicalCameraMetadata = mDevice->infoPhysical(physicalId8);
    auto orientationEntry = physicalCameraMetadata.find(ANDROID_SENSOR_ORIENTATION);

    if (orientationEntry.count == 1) {
        int orientation = orientationEntry.data.i32[0];
        int rotateAndCropMode = ANDROID_SCALER_ROTATE_AND_CROP_NONE;

        if (orientation == 0 || orientation == 180) {
            rotateAndCropMode = ANDROID_SCALER_ROTATE_AND_CROP_90;
        }

        static_cast<TClientBase *>(this)->setRotateAndCropOverride(rotateAndCropMode);
    }
}

template <typename TClientBase>
status_t Camera2ClientBase<TClientBase>::notifyActive(float maxPreviewFps) {
    if (!mDeviceActive) {
+1 −0
Original line number Diff line number Diff line
@@ -75,6 +75,7 @@ public:

    virtual void          notifyError(int32_t errorCode,
                                      const CaptureResultExtras& resultExtras);
    virtual void          notifyPhysicalCameraChange(const std::string &physicalId) override;
    // Returns errors on app ops permission failures
    virtual status_t      notifyActive(float maxPreviewFps);
    virtual void          notifyIdle(int64_t /*requestCount*/, int64_t /*resultErrorCount*/,
+4 −0
Original line number Diff line number Diff line
@@ -40,6 +40,10 @@ class NotificationListener : public virtual RefBase {
    // Required for API 1 and 2
    virtual void notifyError(int32_t errorCode,
                             const CaptureResultExtras &resultExtras) = 0;

    // Optional for API 1 and 2
    virtual void notifyPhysicalCameraChange(const std::string &/*physicalId*/) {}

    // May return an error since it checks appops
    virtual status_t notifyActive(float maxPreviewFps) = 0;
    virtual void notifyIdle(int64_t requestCount, int64_t resultError, bool deviceError,
+2 −1
Original line number Diff line number Diff line
@@ -96,7 +96,8 @@ Camera3Device::Camera3Device(const String8 &id, bool overrideForPerfClass, bool
        mLastTemplateId(-1),
        mNeedFixupMonochromeTags(false),
        mOverrideForPerfClass(overrideForPerfClass),
        mOverrideToPortrait(overrideToPortrait)
        mOverrideToPortrait(overrideToPortrait),
        mActivePhysicalId("")
{
    ATRACE_CALL();
    ALOGV("%s: Created device for camera %s", __FUNCTION__, mId.string());
+3 −0
Original line number Diff line number Diff line
@@ -1382,6 +1382,9 @@ class Camera3Device :
    // app compatibility reasons.
    bool mOverrideToPortrait;

    // Current active physical id of the logical multi-camera, if any
    std::string mActivePhysicalId;

    // The current minimum expected frame duration based on AE_TARGET_FPS_RANGE
    nsecs_t mMinExpectedDuration = 0;
    // Whether the camera device runs at fixed frame rate based on AE_MODE and
Loading