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

Commit 7d5db209 authored by Massimo Carli's avatar Massimo Carli Committed by Android (Google) Code Review
Browse files

Merge "Prevent NPE on AppCompatDisplayInsets" into main

parents 445da41d ada9afc4
Loading
Loading
Loading
Loading
+6 −7
Original line number Diff line number Diff line
@@ -8995,13 +8995,12 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A
                || orientationRespectedWithInsets)) {
            return;
        }
        final AppCompatDisplayInsets mAppCompatDisplayInsets = getAppCompatDisplayInsets();
        final AppCompatDisplayInsets appCompatDisplayInsets = getAppCompatDisplayInsets();
        final AppCompatSizeCompatModePolicy scmPolicy =
                mAppCompatController.getAppCompatSizeCompatModePolicy();

        if (scmPolicy.hasAppCompatDisplayInsetsWithoutInheritance()
                && mAppCompatDisplayInsets != null
                && !mAppCompatDisplayInsets.mIsInFixedOrientationOrAspectRatioLetterbox) {
        if (appCompatDisplayInsets != null
                && !appCompatDisplayInsets.mIsInFixedOrientationOrAspectRatioLetterbox) {
            // App prefers to keep its original size.
            // If the size compat is from previous fixed orientation letterboxing, we may want to
            // have fixed orientation letterbox again, otherwise it will show the size compat
@@ -9053,8 +9052,8 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A
                .applyDesiredAspectRatio(newParentConfig, parentBounds, resolvedBounds,
                        containingBoundsWithInsets, containingBounds);

        if (scmPolicy.hasAppCompatDisplayInsetsWithoutInheritance()) {
            mAppCompatDisplayInsets.getBoundsByRotation(mTmpBounds,
        if (appCompatDisplayInsets != null) {
            appCompatDisplayInsets.getBoundsByRotation(mTmpBounds,
                    newParentConfig.windowConfiguration.getRotation());
            if (resolvedBounds.width() != mTmpBounds.width()
                    || resolvedBounds.height() != mTmpBounds.height()) {
@@ -9077,7 +9076,7 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A

        // Calculate app bounds using fixed orientation bounds because they will be needed later
        // for comparison with size compat app bounds in {@link resolveSizeCompatModeConfiguration}.
        mResolveConfigHint.mTmpCompatInsets = mAppCompatDisplayInsets;
        mResolveConfigHint.mTmpCompatInsets = appCompatDisplayInsets;
        computeConfigByResolveHint(getResolvedOverrideConfiguration(), newParentConfig);
        mAppCompatController.getAppCompatAspectRatioPolicy()
                .setLetterboxBoundsForFixedOrientationAndAspectRatio(new Rect(resolvedBounds));