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

Commit 88f80b9a authored by Eghosa Ewansiha-Vlachavas's avatar Eghosa Ewansiha-Vlachavas
Browse files

Exclude insets from new parent config bounds when resolving SCM config

If insets overriden from the config are being used, exclude these insets
from the new parent config app bounds in
`resolveSizeCompatModeConfiguration`. This is because these bounds no
longer exclude these insets by default. This causes a missmatch between
the resolved app bounds and the parent config app bounds which can lead
to an app being wrongly placed in SCM.

Bug: 343197837
Fixes: 341051320
Fixes: 339994562
Fixes: 340831368
Test: atest CompatUIWindowManagerTest
Test: atest SizeCompatTests
Change-Id: I7c74ad2458aed1b22cd312f0d171cbdd25d532a3
parent ae648c05
Loading
Loading
Loading
Loading
+17 −1
Original line number Diff line number Diff line
@@ -9259,6 +9259,19 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A
            @NonNull CompatDisplayInsets compatDisplayInsets) {
        final Configuration resolvedConfig = getResolvedOverrideConfiguration();
        final Rect resolvedBounds = resolvedConfig.windowConfiguration.getBounds();
        final Insets insets;
        if (mResolveConfigHint.mUseOverrideInsetsForConfig) {
            // TODO(b/343197837): Add test to verify SCM behaviour with new bound configuration
            // Insets are decoupled from configuration by default from V+, use legacy
            // compatibility behaviour for apps targeting SDK earlier than 35
            // (see applySizeOverrideIfNeeded).
            insets = Insets.of(mDisplayContent.getDisplayPolicy()
                    .getDecorInsetsInfo(mDisplayContent.mDisplayFrames.mRotation,
                            mDisplayContent.mDisplayFrames.mWidth,
                            mDisplayContent.mDisplayFrames.mHeight).mOverrideNonDecorInsets);
        } else {
            insets = Insets.NONE;
        }
        // When an activity needs to be letterboxed because of fixed orientation, use fixed
        // orientation bounds (stored in resolved bounds) instead of parent bounds since the
@@ -9269,9 +9282,12 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A
        final Rect containerBounds = useResolvedBounds
                ? new Rect(resolvedBounds)
                : newParentConfiguration.windowConfiguration.getBounds();
        final Rect parentAppBounds =
                newParentConfiguration.windowConfiguration.getAppBounds();
        parentAppBounds.inset(insets);
        final Rect containerAppBounds = useResolvedBounds
                ? new Rect(resolvedConfig.windowConfiguration.getAppBounds())
                : newParentConfiguration.windowConfiguration.getAppBounds();
                : parentAppBounds;
        final int requestedOrientation = getRequestedConfigurationOrientation();
        final boolean orientationRequested = requestedOrientation != ORIENTATION_UNDEFINED;