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

Commit 45e2c3e2 authored by Treehugger Robot's avatar Treehugger Robot Committed by Automerger Merge Worker
Browse files

Merge "Change the default behavior with status bar decouple flag" into 24D1-dev am: 0d383316

parents 67c985fa 0d383316
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -8645,7 +8645,7 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A

        // Override starts here.
        final Rect stableInsets = mDisplayContent.getDisplayPolicy().getDecorInsetsInfo(
                rotation, fullBounds.width(), fullBounds.height()).mLegacyConfigInsets;
                rotation, fullBounds.width(), fullBounds.height()).mOverrideConfigInsets;
        // This should be the only place override the configuration for ActivityRecord. Override
        // the value if not calculated yet.
        Rect outAppBounds = inOutConfig.windowConfiguration.getAppBounds();
@@ -8681,7 +8681,7 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A
            mDisplayContent.getDisplay().getDisplayInfo(info);
            mDisplayContent.computeSizeRanges(info, rotated, info.logicalWidth,
                    info.logicalHeight, mDisplayContent.getDisplayMetrics().density,
                    inOutConfig, true /* legacyConfig */);
                    inOutConfig, true /* overrideConfig */);
        }

        // It's possible that screen size will be considered in different orientation with or
+14 −13
Original line number Diff line number Diff line
@@ -2277,7 +2277,7 @@ class DisplayContent extends RootDisplayArea implements WindowManagerPolicy.Disp
        }

        computeSizeRanges(mDisplayInfo, rotated, dw, dh, mDisplayMetrics.density, outConfig,
                false /* legacyConfig */);
                false /* overrideConfig */);

        setDisplayInfoOverride();

@@ -2414,7 +2414,7 @@ class DisplayContent extends RootDisplayArea implements WindowManagerPolicy.Disp
        final DisplayCutout displayCutout = calculateDisplayCutoutForRotation(rotation);
        displayInfo.displayCutout = displayCutout.isEmpty() ? null : displayCutout;
        computeSizeRanges(displayInfo, rotated, dw, dh, mDisplayMetrics.density, outConfig,
                false /* legacyConfig */);
                false /* overrideConfig */);
        return displayInfo;
    }

@@ -2588,11 +2588,10 @@ class DisplayContent extends RootDisplayArea implements WindowManagerPolicy.Disp
     * @param dh Display Height in current rotation.
     * @param density Display density.
     * @param outConfig The output configuration to
     * @param legacyConfig Whether we need to report the legacy result, which is excluding system
     *                     decorations.
     * @param overrideConfig Whether we need to report the override config result
     */
    void computeSizeRanges(DisplayInfo displayInfo, boolean rotated,
            int dw, int dh, float density, Configuration outConfig, boolean legacyConfig) {
            int dw, int dh, float density, Configuration outConfig, boolean overrideConfig) {

        // We need to determine the smallest width that will occur under normal
        // operation.  To this, start with the base screen size and compute the
@@ -2610,10 +2609,12 @@ class DisplayContent extends RootDisplayArea implements WindowManagerPolicy.Disp
        displayInfo.smallestNominalAppHeight = 1<<30;
        displayInfo.largestNominalAppWidth = 0;
        displayInfo.largestNominalAppHeight = 0;
        adjustDisplaySizeRanges(displayInfo, Surface.ROTATION_0, unrotDw, unrotDh, legacyConfig);
        adjustDisplaySizeRanges(displayInfo, Surface.ROTATION_90, unrotDh, unrotDw, legacyConfig);
        adjustDisplaySizeRanges(displayInfo, Surface.ROTATION_180, unrotDw, unrotDh, legacyConfig);
        adjustDisplaySizeRanges(displayInfo, Surface.ROTATION_270, unrotDh, unrotDw, legacyConfig);
        adjustDisplaySizeRanges(displayInfo, Surface.ROTATION_0, unrotDw, unrotDh, overrideConfig);
        adjustDisplaySizeRanges(displayInfo, Surface.ROTATION_90, unrotDh, unrotDw, overrideConfig);
        adjustDisplaySizeRanges(displayInfo, Surface.ROTATION_180, unrotDw, unrotDh,
                overrideConfig);
        adjustDisplaySizeRanges(displayInfo, Surface.ROTATION_270, unrotDh, unrotDw,
                overrideConfig);

        if (outConfig == null) {
            return;
@@ -2623,17 +2624,17 @@ class DisplayContent extends RootDisplayArea implements WindowManagerPolicy.Disp
    }

    private void adjustDisplaySizeRanges(DisplayInfo displayInfo, int rotation, int dw, int dh,
            boolean legacyConfig) {
            boolean overrideConfig) {
        final DisplayPolicy.DecorInsets.Info info = mDisplayPolicy.getDecorInsetsInfo(
                rotation, dw, dh);
        final int w;
        final int h;
        if (!legacyConfig) {
        if (!overrideConfig) {
            w = info.mConfigFrame.width();
            h = info.mConfigFrame.height();
        } else {
            w = info.mLegacyConfigFrame.width();
            h = info.mLegacyConfigFrame.height();
            w = info.mOverrideConfigFrame.width();
            h = info.mOverrideConfigFrame.height();
        }
        if (w < displayInfo.smallestNominalAppWidth) {
            displayInfo.smallestNominalAppWidth = w;
+14 −14
Original line number Diff line number Diff line
@@ -1935,9 +1935,9 @@ public class DisplayPolicy {
            final Rect mConfigInsets = new Rect();

            /**
             * Legacy value of mConfigInsets for app compatibility purpose.
             * Override value of mConfigInsets for app compatibility purpose.
             */
            final Rect mLegacyConfigInsets = new Rect();
            final Rect mOverrideConfigInsets = new Rect();

            /** The display frame available after excluding {@link #mNonDecorInsets}. */
            final Rect mNonDecorFrame = new Rect();
@@ -1950,9 +1950,9 @@ public class DisplayPolicy {
            final Rect mConfigFrame = new Rect();

            /**
             * Legacy value of mConfigFrame for app compatibility purpose.
             * Override value of mConfigFrame for app compatibility purpose.
             */
            final Rect mLegacyConfigFrame = new Rect();
            final Rect mOverrideConfigFrame = new Rect();

            private boolean mNeedUpdate = true;

@@ -1968,22 +1968,22 @@ public class DisplayPolicy {
                        ? decor
                        : insetsState.calculateInsets(displayFrame, dc.mWmService.mConfigTypes,
                                true /* ignoreVisibility */);
                final Insets legacyConfigInsets = dc.mWmService.mConfigTypes
                        == dc.mWmService.mLegacyConfigTypes
                final Insets overrideConfigInsets = dc.mWmService.mConfigTypes
                        == dc.mWmService.mOverrideConfigTypes
                        ? configInsets
                        : insetsState.calculateInsets(displayFrame,
                                dc.mWmService.mLegacyConfigTypes, true /* ignoreVisibility */);
                                dc.mWmService.mOverrideConfigTypes, true /* ignoreVisibility */);
                mNonDecorInsets.set(decor.left, decor.top, decor.right, decor.bottom);
                mConfigInsets.set(configInsets.left, configInsets.top, configInsets.right,
                        configInsets.bottom);
                mLegacyConfigInsets.set(legacyConfigInsets.left, legacyConfigInsets.top,
                        legacyConfigInsets.right, legacyConfigInsets.bottom);
                mOverrideConfigInsets.set(overrideConfigInsets.left, overrideConfigInsets.top,
                        overrideConfigInsets.right, overrideConfigInsets.bottom);
                mNonDecorFrame.set(displayFrame);
                mNonDecorFrame.inset(mNonDecorInsets);
                mConfigFrame.set(displayFrame);
                mConfigFrame.inset(mConfigInsets);
                mLegacyConfigFrame.set(displayFrame);
                mLegacyConfigFrame.inset(mLegacyConfigInsets);
                mOverrideConfigFrame.set(displayFrame);
                mOverrideConfigFrame.inset(mOverrideConfigInsets);
                mNeedUpdate = false;
                return insetsState;
            }
@@ -1991,10 +1991,10 @@ public class DisplayPolicy {
            void set(Info other) {
                mNonDecorInsets.set(other.mNonDecorInsets);
                mConfigInsets.set(other.mConfigInsets);
                mLegacyConfigInsets.set(other.mLegacyConfigInsets);
                mOverrideConfigInsets.set(other.mOverrideConfigInsets);
                mNonDecorFrame.set(other.mNonDecorFrame);
                mConfigFrame.set(other.mConfigFrame);
                mLegacyConfigFrame.set(other.mLegacyConfigFrame);
                mOverrideConfigFrame.set(other.mOverrideConfigFrame);
                mNeedUpdate = false;
            }

@@ -2107,7 +2107,7 @@ public class DisplayPolicy {
        final InsetsState newInsetsState = newInfo.update(mDisplayContent, rotation, dw, dh);
        final DecorInsets.Info currentInfo = getDecorInsetsInfo(rotation, dw, dh);
        if (newInfo.mConfigFrame.equals(currentInfo.mConfigFrame)
                && newInfo.mLegacyConfigFrame.equals(currentInfo.mLegacyConfigFrame)) {
                && newInfo.mOverrideConfigFrame.equals(currentInfo.mOverrideConfigFrame)) {
            // Even if the config frame is not changed in current rotation, it may change the
            // insets in other rotations if the frame of insets source is changed.
            final InsetsState currentInsetsState = mDisplayContent.mDisplayFrames.mInsetsState;
+1 −1
Original line number Diff line number Diff line
@@ -2427,7 +2427,7 @@ class TaskFragment extends WindowContainer<WindowContainer> {
        if (!useLegacyInsetsForStableBounds) {
            intersectWithInsetsIfFits(outStableBounds, mTmpBounds, info.mConfigInsets);
        } else {
            intersectWithInsetsIfFits(outStableBounds, mTmpBounds, info.mLegacyConfigInsets);
            intersectWithInsetsIfFits(outStableBounds, mTmpBounds, info.mOverrideConfigInsets);
        }
    }

+7 −9
Original line number Diff line number Diff line
@@ -567,7 +567,7 @@ public class WindowManagerService extends IWindowManager.Stub
    /** Device default insets types shall be excluded from config app sizes. */
    final int mConfigTypes;

    final int mLegacyConfigTypes;
    final int mOverrideConfigTypes;

    final boolean mLimitedAlphaCompositing;
    final int mMaxUiWidth;
@@ -1238,19 +1238,17 @@ public class WindowManagerService extends IWindowManager.Stub
        if (mFlags.mInsetsDecoupledConfiguration) {
            mDecorTypes = 0;
            mConfigTypes = 0;
        } else if (isScreenSizeDecoupledFromStatusBarAndCutout) {
            mDecorTypes = WindowInsets.Type.navigationBars();
            mConfigTypes = WindowInsets.Type.navigationBars();
        } else {
            mDecorTypes = WindowInsets.Type.displayCutout() | WindowInsets.Type.navigationBars();
            mConfigTypes = WindowInsets.Type.displayCutout() | WindowInsets.Type.statusBars()
                    | WindowInsets.Type.navigationBars();
        }
        if (isScreenSizeDecoupledFromStatusBarAndCutout) {
            // Do not fallback to legacy value for enabled devices.
            mLegacyConfigTypes = WindowInsets.Type.navigationBars();
        if (isScreenSizeDecoupledFromStatusBarAndCutout && !mFlags.mInsetsDecoupledConfiguration) {
            // If the global new behavior is not there, but the partial decouple flag is on.
            mOverrideConfigTypes = 0;
        } else {
            mLegacyConfigTypes = WindowInsets.Type.displayCutout() | WindowInsets.Type.statusBars()
            mOverrideConfigTypes =
                    WindowInsets.Type.displayCutout() | WindowInsets.Type.statusBars()
                            | WindowInsets.Type.navigationBars();
        }