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

Commit 8c07f8d7 authored by Mina Granic's avatar Mina Granic
Browse files

Check all non-camera-compat-mode-values.

CAMERA_COMPAT_FREEFORM_UNSPECIFIED was added to match atom logging
format, which shifted other values. To check whether app is in
camera compat mode, both CAMERA_COMPAT_FREEFORM_UNSPECIFIED and
_NONE should be excluded.

Also use enum values instead of pure integers to avoid this issue
in the future.

Flag: EXEMPT minor, simple bugfix
Test: manual, on Felix and Tangor.
Fixes: 399297631
Fixes: 384415000
Change-Id: Ib9192bed1b6b8d2addb512f07fded5931b2c05b3
parent a23bc7e5
Loading
Loading
Loading
Loading
+7 −1
Original line number Diff line number Diff line
@@ -1714,7 +1714,7 @@ public final class CameraManager {
                    final TaskInfo taskInfo = appTask.getTaskInfo();
                    final int freeformCameraCompatMode = taskInfo.appCompatTaskInfo
                            .cameraCompatTaskInfo.freeformCameraCompatMode;
                    if (freeformCameraCompatMode != 0
                    if (isInCameraCompatMode(freeformCameraCompatMode)
                            && taskInfo.topActivity != null
                            && taskInfo.topActivity.getPackageName().equals(packageName)) {
                        // WindowManager has requested rotation override.
@@ -1741,6 +1741,12 @@ public final class CameraManager {
                : ICameraService.ROTATION_OVERRIDE_NONE;
    }

    private static boolean isInCameraCompatMode(@CameraCompatTaskInfo.FreeformCameraCompatMode int
            freeformCameraCompatMode) {
        return (freeformCameraCompatMode != CameraCompatTaskInfo.CAMERA_COMPAT_FREEFORM_UNSPECIFIED)
                && (freeformCameraCompatMode != CameraCompatTaskInfo.CAMERA_COMPAT_FREEFORM_NONE);
    }

    private static int getRotationOverrideForCompatFreeform(
            @CameraCompatTaskInfo.FreeformCameraCompatMode int freeformCameraCompatMode) {
        // Only rotate-and-crop if the app and device orientations do not match.