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

Commit a7fc4310 authored by Graciela Putri's avatar Graciela Putri Committed by Android (Google) Code Review
Browse files

Merge "Add flag for immersive app repositioning" into 24D1-dev

parents dbcd9525 2e488358
Loading
Loading
Loading
Loading
+10 −0
Original line number Diff line number Diff line
@@ -69,6 +69,16 @@ flag {
  is_fixed_read_only: true
}

flag {
  name: "immersive_app_repositioning"
  namespace: "large_screen_experiences_app_compat"
  description: "Fix immersive apps changing size when repositioning"
  bug: "334076352"
  metadata {
    purpose: PURPOSE_BUGFIX
  }
}

flag {
  name: "camera_compat_for_freeform"
  namespace: "large_screen_experiences_app_compat"
+18 −4
Original line number Diff line number Diff line
@@ -8538,7 +8538,7 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A
        // If activity in fullscreen mode is letterboxed because of fixed orientation then bounds
        // are already calculated in resolveFixedOrientationConfiguration.
        // Don't apply aspect ratio if app is overridden to fullscreen by device user/manufacturer.
        if (!isLetterboxedForFixedOrientationAndAspectRatio()
        if (Flags.immersiveAppRepositioning() && !isLetterboxedForFixedOrientationAndAspectRatio()
                && !mLetterboxUiController.hasFullscreenOverride()) {
            resolveAspectRatioRestriction(newParentConfiguration);
        }
@@ -8555,6 +8555,14 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A
                computeConfigByResolveHint(resolvedConfig, newParentConfiguration);
            }
        }
        // If activity in fullscreen mode is letterboxed because of fixed orientation then bounds
        // are already calculated in resolveFixedOrientationConfiguration, or if in size compat
        // mode, it should already be calculated in resolveSizeCompatModeConfiguration.
        // Don't apply aspect ratio if app is overridden to fullscreen by device user/manufacturer.
        if (!Flags.immersiveAppRepositioning() && !isLetterboxedForFixedOrientationAndAspectRatio()
                && !mInSizeCompatModeForBounds && !mLetterboxUiController.hasFullscreenOverride()) {
            resolveAspectRatioRestriction(newParentConfiguration);
        }
        if (isFixedOrientationLetterboxAllowed || compatDisplayInsets != null
                // In fullscreen, can be letterboxed for aspect ratio.
@@ -8880,7 +8888,11 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A
    }
    boolean isImmersiveMode(@NonNull Rect parentBounds) {
        if (!mResolveConfigHint.mUseOverrideInsetsForStableBounds) {
        if (!Flags.immersiveAppRepositioning()) {
            return false;
        }
        if (!mResolveConfigHint.mUseOverrideInsetsForStableBounds
                && mWmService.mFlags.mInsetsDecoupledConfiguration) {
            return false;
        }
        final Insets navBarInsets = mDisplayContent.getInsetsStateController()
@@ -9229,10 +9241,12 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A
        // orientation bounds (stored in resolved bounds) instead of parent bounds since the
        // activity will be displayed within them even if it is in size compat mode. They should be
        // saved here before resolved bounds are overridden below.
        final Rect containerBounds = isAspectRatioApplied()
        final boolean useResolvedBounds = Flags.immersiveAppRepositioning()
                ? isAspectRatioApplied() : isLetterboxedForFixedOrientationAndAspectRatio();
        final Rect containerBounds = useResolvedBounds
                ? new Rect(resolvedBounds)
                : newParentConfiguration.windowConfiguration.getBounds();
        final Rect containerAppBounds = isAspectRatioApplied()
        final Rect containerAppBounds = useResolvedBounds
                ? new Rect(resolvedConfig.windowConfiguration.getAppBounds())
                : newParentConfiguration.windowConfiguration.getAppBounds();
+3 −0
Original line number Diff line number Diff line
@@ -107,6 +107,7 @@ import android.graphics.Rect;
import android.os.Binder;
import android.os.RemoteException;
import android.os.UserHandle;
import android.platform.test.annotations.EnableFlags;
import android.platform.test.annotations.Presubmit;
import android.platform.test.annotations.RequiresFlagsDisabled;
import android.provider.DeviceConfig;
@@ -401,6 +402,7 @@ public class SizeCompatTests extends WindowTestsBase {
    // TODO(b/333663877): Enable test after fix
    @Test
    @RequiresFlagsDisabled({Flags.FLAG_INSETS_DECOUPLED_CONFIGURATION})
    @EnableFlags(Flags.FLAG_IMMERSIVE_APP_REPOSITIONING)
    public void testRepositionLandscapeImmersiveAppWithDisplayCutout() {
        final int dw = 2100;
        final int dh = 2000;
@@ -4020,6 +4022,7 @@ public class SizeCompatTests extends WindowTestsBase {
    }

    @Test
    @EnableFlags(Flags.FLAG_IMMERSIVE_APP_REPOSITIONING)
    public void testImmersiveLetterboxAlignedToBottom_OverlappingNavbar() {
        assertLandscapeActivityAlignedToBottomWithNavbar(true /* immersive */);
    }