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

Commit 65dc3fc6 authored by Eino-Ville Talvala's avatar Eino-Ville Talvala
Browse files

Camera2: Improve quirks focusing behavior.

- When scene mode is set and the AF quirk is in use, don't change AF
mode and then cancel when AF cancel is received. Just change mode
since that also implies a cancel.

- Only trigger quirks switch when a focusing area is set.

Bug: 7318812
Change-Id: I28d8755553bd78052e774701210cb94d84ee2046
parent fbd60660
Loading
Loading
Loading
Loading
+6 −2
Original line number Diff line number Diff line
@@ -1007,7 +1007,8 @@ status_t Camera2Client::autoFocus() {
         */
        if (l.mParameters.quirks.triggerAfWithAuto &&
                l.mParameters.sceneMode != ANDROID_CONTROL_SCENE_MODE_UNSUPPORTED &&
                l.mParameters.focusMode != Parameters::FOCUS_MODE_AUTO) {
                l.mParameters.focusMode != Parameters::FOCUS_MODE_AUTO &&
                !l.mParameters.focusingAreas[0].isEmpty()) {
            ALOGV("%s: Quirk: Switching from focusMode %d to AUTO",
                    __FUNCTION__, l.mParameters.focusMode);
            l.mParameters.shadowFocusMode = l.mParameters.focusMode;
@@ -1038,13 +1039,16 @@ status_t Camera2Client::cancelAutoFocus() {
        triggerId = ++l.mParameters.afTriggerCounter;

        // When using triggerAfWithAuto quirk, may need to reset focus mode to
        // the real state at this point.
        // the real state at this point. No need to cancel explicitly if
        // changing the AF mode.
        if (l.mParameters.shadowFocusMode != Parameters::FOCUS_MODE_INVALID) {
            ALOGV("%s: Quirk: Restoring focus mode to %d", __FUNCTION__,
                    l.mParameters.shadowFocusMode);
            l.mParameters.focusMode = l.mParameters.shadowFocusMode;
            l.mParameters.shadowFocusMode = Parameters::FOCUS_MODE_INVALID;
            updateRequests(l.mParameters);

            return OK;
        }
    }
    syncWithDevice();
+3 −0
Original line number Diff line number Diff line
@@ -100,6 +100,9 @@ struct Parameters {
        Area(int left, int top, int right, int bottom, int weight):
                left(left), top(top), right(right), bottom(bottom),
                weight(weight) {}
        bool isEmpty() const {
            return (left == 0) && (top == 0) && (right == 0) && (bottom == 0);
        }
    };
    Vector<Area> focusingAreas;