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

Commit 3fa36e3c authored by Yunfan Chen's avatar Yunfan Chen Committed by Android (Google) Code Review
Browse files

Merge "Resolve letterbox on some close-to-square devices" into main

parents 7354eb5e bf679721
Loading
Loading
Loading
Loading
+7 −0
Original line number Diff line number Diff line
@@ -832,6 +832,13 @@
         is set to true. -->
    <bool name="config_remoteInsetsControllerSystemBarsCanBeShownByUserAction">false</bool>

    <!-- To change the default behavior of how the insets get involved when calculating
         configuration. This will no longer consider status bar and display cutout, and only
         exclude navigation bars from the screen sizes. This is useful when the display is close to
         square and the system bars may cause the orientation with non-preferred value.
         -->
    <bool name="config_decoupleStatusBarAndDisplayCutoutFromScreenSize">false</bool>

    <!-- HDMI behavior -->

    <!-- The number of degrees to rotate the display when the device has HDMI connected
+1 −0
Original line number Diff line number Diff line
@@ -1733,6 +1733,7 @@
  <java-symbol type="bool" name="config_enableLockScreenRotation" />
  <java-symbol type="bool" name="config_remoteInsetsControllerControlsSystemBars" />
  <java-symbol type="bool" name="config_remoteInsetsControllerSystemBarsCanBeShownByUserAction" />
  <java-symbol type="bool" name="config_decoupleStatusBarAndDisplayCutoutFromScreenSize" />
  <java-symbol type="bool" name="config_lidControlsScreenLock" />
  <java-symbol type="bool" name="config_lidControlsSleep" />
  <java-symbol type="bool" name="config_lockDayNightMode" />
+2 −10
Original line number Diff line number Diff line
@@ -1876,7 +1876,8 @@ public class DisplayPolicy {
                dc.getDisplayPolicy().simulateLayoutDisplay(df);
                final InsetsState insetsState = df.mInsetsState;
                final Rect displayFrame = insetsState.getDisplayFrame();
                final Insets decor = insetsState.calculateInsets(displayFrame, DECOR_TYPES,
                final Insets decor = insetsState.calculateInsets(displayFrame,
                        dc.mWmService.mDecorTypes,
                        true /* ignoreVisibility */);
                final Insets statusBar = insetsState.calculateInsets(displayFrame,
                        Type.statusBars(), true /* ignoreVisibility */);
@@ -1912,15 +1913,6 @@ public class DisplayPolicy {
            }
        }


        static final int DECOR_TYPES = Type.displayCutout() | Type.navigationBars();

        /**
         * The types that may affect display configuration. This excludes cutout because it is
         * known from display info.
         */
        static final int CONFIG_TYPES = Type.statusBars() | Type.navigationBars();

        private final DisplayContent mDisplayContent;
        private final Info[] mInfoForRotation = new Info[4];
        final Info mTmpInfo = new Info();
+18 −0
Original line number Diff line number Diff line
@@ -336,6 +336,7 @@ import com.android.server.policy.WindowManagerPolicy;
import com.android.server.policy.WindowManagerPolicy.ScreenOffListener;
import com.android.server.power.ShutdownThread;
import com.android.server.utils.PriorityDump;
import com.android.window.flags.Flags;

import dalvik.annotation.optimization.NeverCompile;

@@ -542,6 +543,12 @@ public class WindowManagerService extends IWindowManager.Stub
    @VisibleForTesting
    boolean mSkipActivityRelaunchWhenDocking;

    /** Device default insets types provided non-decor insets. */
    final int mDecorTypes;

    /** Device default insets types shall be excluded from config app sizes. */
    final int mConfigTypes;

    final boolean mLimitedAlphaCompositing;
    final int mMaxUiWidth;

@@ -1185,6 +1192,16 @@ public class WindowManagerService extends IWindowManager.Stub
                com.android.internal.R.bool.config_assistantOnTopOfDream);
        mSkipActivityRelaunchWhenDocking = context.getResources()
                .getBoolean(R.bool.config_skipActivityRelaunchWhenDocking);
        final boolean isScreenSizeDecoupledFromStatusBarAndCutout = context.getResources()
                .getBoolean(R.bool.config_decoupleStatusBarAndDisplayCutoutFromScreenSize)
                && Flags.closeToSquareConfigIncludesStatusBar();
        if (!isScreenSizeDecoupledFromStatusBarAndCutout) {
            mDecorTypes = WindowInsets.Type.displayCutout() | WindowInsets.Type.navigationBars();
            mConfigTypes = WindowInsets.Type.statusBars() | WindowInsets.Type.navigationBars();
        } else {
            mDecorTypes = WindowInsets.Type.navigationBars();
            mConfigTypes = WindowInsets.Type.navigationBars();
        }

        mLetterboxConfiguration = new LetterboxConfiguration(
                // Using SysUI context to have access to Material colors extracted from Wallpaper.
@@ -7319,6 +7336,7 @@ public class WindowManagerService extends IWindowManager.Stub
        }
    }

    /** This is used when there's no app info available and shall return the system default.*/
    void getStableInsetsLocked(int displayId, Rect outInsets) {
        outInsets.setEmpty();
        final DisplayContent dc = mRoot.getDisplayContent(displayId);
+1 −1
Original line number Diff line number Diff line
@@ -1829,7 +1829,7 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP
        }
        for (int i = mInsetsSourceProviders.size() - 1; i >= 0; i--) {
            final InsetsSource source = mInsetsSourceProviders.valueAt(i).getSource();
            if ((source.getType() & DisplayPolicy.DecorInsets.CONFIG_TYPES) != 0) {
            if ((source.getType() & mWmService.mConfigTypes) != 0) {
                return true;
            }
        }
Loading