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

Commit 321797f2 authored by Mina Granic's avatar Mina Granic
Browse files

Enable letterbox configuration for camera compat freeform.

This was missed in the CL that intruduced `shouldCameraCompatControlOrientation`.

Flag: com.android.window.flags.enable_camera_compat_for_desktop_windowing
Test: atest WmTests:ActivityRecordTests
Bug: 347864073
Change-Id: I4530d3a8b503c835fe770b2ad0f55f9a5f5b5a7d
parent ccfbecea
Loading
Loading
Loading
Loading
+1 −6
Original line number Diff line number Diff line
@@ -33,7 +33,6 @@ import static android.app.ActivityOptions.ANIM_UNDEFINED;
import static android.app.ActivityTaskManager.INVALID_TASK_ID;
import static android.app.AppOpsManager.MODE_ALLOWED;
import static android.app.AppOpsManager.OP_PICTURE_IN_PICTURE;
import static android.app.CameraCompatTaskInfo.CAMERA_COMPAT_FREEFORM_NONE;
import static android.app.WaitResult.INVALID_DELAY;
import static android.app.WindowConfiguration.ACTIVITY_TYPE_ASSISTANT;
import static android.app.WindowConfiguration.ACTIVITY_TYPE_DREAM;
@@ -42,7 +41,6 @@ import static android.app.WindowConfiguration.ACTIVITY_TYPE_RECENTS;
import static android.app.WindowConfiguration.ACTIVITY_TYPE_STANDARD;
import static android.app.WindowConfiguration.ACTIVITY_TYPE_UNDEFINED;
import static android.app.WindowConfiguration.ROTATION_UNDEFINED;
import static android.app.WindowConfiguration.WINDOWING_MODE_FREEFORM;
import static android.app.WindowConfiguration.WINDOWING_MODE_FULLSCREEN;
import static android.app.WindowConfiguration.WINDOWING_MODE_MULTI_WINDOW;
import static android.app.WindowConfiguration.WINDOWING_MODE_PINNED;
@@ -8394,15 +8392,12 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A
        // and back which can cause visible issues (see b/184078928).
        final int parentWindowingMode =
                newParentConfiguration.windowConfiguration.getWindowingMode();
        final boolean isInCameraCompatFreeform = parentWindowingMode == WINDOWING_MODE_FREEFORM
                && mAppCompatController.getAppCompatCameraOverrides().getFreeformCameraCompatMode()
                        != CAMERA_COMPAT_FREEFORM_NONE;

        // Bubble activities should always fill their parent and should not be letterboxed.
        final boolean isFixedOrientationLetterboxAllowed = !getLaunchedFromBubble()
                && (parentWindowingMode == WINDOWING_MODE_MULTI_WINDOW
                        || parentWindowingMode == WINDOWING_MODE_FULLSCREEN
                        || isInCameraCompatFreeform
                        || AppCompatCameraPolicy.shouldCameraCompatControlOrientation(this)
                        // When starting to switch between PiP and fullscreen, the task is pinned
                        // and the activity is fullscreen. But only allow to apply letterbox if the
                        // activity is exiting PiP because an entered PiP should fill the task.