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

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

Merge "[7/n] AppCompatController definition" into main

parents da8df84a deed9aae
Loading
Loading
Loading
Loading
+26 −21
Original line number Diff line number Diff line
@@ -806,9 +806,10 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A
    final LetterboxUiController mLetterboxUiController;
    /**
     * The policy for transparent activities
     * App Compat Facade
     */
    final TransparentPolicy mTransparentPolicy;
    @NonNull
    final AppCompatController mAppCompatController;
    /**
     * The scale to fit at least one side of the activity to its parent. If the activity uses
@@ -1705,7 +1706,7 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A
            if (isState(RESUMED)) {
                newParent.setResumedActivity(this, "onParentChanged");
            }
            mTransparentPolicy.start();
            mAppCompatController.getTransparentPolicy().start();
        }
        if (rootTask != null && rootTask.topRunningActivity() == this) {
@@ -2143,8 +2144,8 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A
        // Don't move below setOrientation(info.screenOrientation) since it triggers
        // getOverrideOrientation that requires having mLetterboxUiController
        // initialised.
        mTransparentPolicy = new TransparentPolicy(this, mWmService.mLetterboxConfiguration);
        mLetterboxUiController = new LetterboxUiController(mWmService, this);
        mAppCompatController = new AppCompatController(mWmService, this);
        mCameraCompatControlEnabled = mWmService.mContext.getResources()
                .getBoolean(R.bool.config_isCameraCompatControlForStretchedIssuesEnabled);
        mResolveConfigHint = new TaskFragment.ConfigOverrideHint();
@@ -4504,6 +4505,7 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A
        mTaskSupervisor.getActivityMetricsLogger().notifyActivityRemoved(this);
        mTaskSupervisor.mStoppingActivities.remove(this);
        mLetterboxUiController.destroy();
        mAppCompatController.getTransparentPolicy().stop();
        // Defer removal of this activity when either a child is animating, or app transition is on
        // going. App transition animation might be applied on the parent task not on the activity,
@@ -8107,13 +8109,13 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A
    @Configuration.Orientation
    int getRequestedConfigurationOrientation(boolean forDisplay,
            @ActivityInfo.ScreenOrientation int requestedOrientation) {
        if (mTransparentPolicy.hasInheritedOrientation()) {
        if (mAppCompatController.getTransparentPolicy().hasInheritedOrientation()) {
            final RootDisplayArea root = getRootDisplayArea();
            if (forDisplay && root != null && root.isOrientationDifferentFromDisplay()) {
                return reverseConfigurationOrientation(
                        mTransparentPolicy.getInheritedOrientation());
                        mAppCompatController.getTransparentPolicy().getInheritedOrientation());
            } else {
                return mTransparentPolicy.getInheritedOrientation();
                return mAppCompatController.getTransparentPolicy().getInheritedOrientation();
            }
        }
        if (task != null && requestedOrientation == SCREEN_ORIENTATION_BEHIND) {
@@ -8186,7 +8188,9 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A
    }
    void setRequestedOrientation(@ActivityInfo.ScreenOrientation int requestedOrientation) {
        if (mLetterboxUiController.shouldIgnoreRequestedOrientation(requestedOrientation)) {
        if (mAppCompatController.getAppCompatCapability()
                .getAppCompatOrientationCapability()
                .shouldIgnoreRequestedOrientation(requestedOrientation)) {
            return;
        }
        final int originalRelaunchingCount = mPendingRelaunchCount;
@@ -8329,8 +8333,8 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A
    @Nullable
    CompatDisplayInsets getCompatDisplayInsets() {
        if (mTransparentPolicy.isRunning()) {
            return mTransparentPolicy.getInheritedCompatDisplayInsets();
        if (mAppCompatController.getTransparentPolicy().isRunning()) {
            return mAppCompatController.getTransparentPolicy().getInheritedCompatDisplayInsets();
        }
        return mCompatDisplayInsets;
    }
@@ -8493,7 +8497,7 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A
        }
        mSizeCompatBounds = null;
        mCompatDisplayInsets = null;
        mTransparentPolicy.clearInheritedCompatDisplayInsets();
        mAppCompatController.getTransparentPolicy().clearInheritedCompatDisplayInsets();
    }
    @VisibleForTesting
@@ -8826,8 +8830,8 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A
            return APP_COMPAT_STATE_CHANGED__STATE__NOT_VISIBLE;
        }
        // TODO(b/256564921): Investigate if we need new metrics for translucent activities
        if (mTransparentPolicy.isRunning()) {
            return mTransparentPolicy.getInheritedAppCompatState();
        if (mAppCompatController.getTransparentPolicy().isRunning()) {
            return mAppCompatController.getTransparentPolicy().getInheritedAppCompatState();
        }
        if (mInSizeCompatModeForBounds) {
            return APP_COMPAT_STATE_CHANGED__STATE__LETTERBOXED_FOR_SIZE_COMPAT_MODE;
@@ -8980,7 +8984,7 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A
        // We check if the current activity is transparent. In that case we need to
        // recomputeConfiguration of the first opaque activity beneath, to allow a
        // proper computation of the new bounds.
        if (!mTransparentPolicy.applyOnOpaqueActivityBelow(
        if (!mAppCompatController.getTransparentPolicy().applyOnOpaqueActivityBelow(
                ActivityRecord::recomputeConfiguration)) {
            onRequestedOverrideConfigurationChanged(getRequestedOverrideConfiguration());
        }
@@ -9440,7 +9444,8 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A
    void updateSizeCompatScale(Rect resolvedAppBounds, Rect containerAppBounds) {
        // Only allow to scale down.
        mSizeCompatScale = mTransparentPolicy.findOpaqueNotFinishingActivityBelow()
        mSizeCompatScale = mAppCompatController.getTransparentPolicy()
                .findOpaqueNotFinishingActivityBelow()
                .map(activityRecord -> activityRecord.mSizeCompatScale)
                .orElseGet(() -> {
                    final int contentW = resolvedAppBounds.width();
@@ -9453,7 +9458,7 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A
    }
    private boolean isInSizeCompatModeForBounds(final Rect appBounds, final Rect containerBounds) {
        if (mTransparentPolicy.isRunning()) {
        if (mAppCompatController.getTransparentPolicy().isRunning()) {
            // To avoid wrong app behaviour, we decided to disable SCM when a translucent activity
            // is letterboxed.
            return false;
@@ -9516,7 +9521,7 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A
    public Rect getBounds() {
        // TODO(b/268458693): Refactor configuration inheritance in case of translucent activities
        final Rect superBounds = super.getBounds();
        return mTransparentPolicy.findOpaqueNotFinishingActivityBelow()
        return mAppCompatController.getTransparentPolicy().findOpaqueNotFinishingActivityBelow()
                .map(ActivityRecord::getBounds)
                .orElseGet(() -> {
                    if (mSizeCompatBounds != null) {
@@ -9880,8 +9885,8 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A
     * Returns the min aspect ratio of this activity.
     */
    float getMinAspectRatio() {
        if (mTransparentPolicy.isRunning()) {
            return mTransparentPolicy.getInheritedMinAspectRatio();
        if (mAppCompatController.getTransparentPolicy().isRunning()) {
            return mAppCompatController.getTransparentPolicy().getInheritedMinAspectRatio();
        }
        if (info.applicationInfo == null) {
            return info.getMinAspectRatio();
@@ -9931,8 +9936,8 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A
    }
    float getMaxAspectRatio() {
        if (mTransparentPolicy.isRunning()) {
            return mTransparentPolicy.getInheritedMaxAspectRatio();
        if (mAppCompatController.getTransparentPolicy().isRunning()) {
            return mAppCompatController.getTransparentPolicy().getInheritedMaxAspectRatio();
        }
        return info.getMaxAspectRatio();
    }
+0 −33
Original line number Diff line number Diff line
@@ -47,7 +47,6 @@ import static com.android.server.wm.ActivityTaskManagerDebugConfig.TAG_ATM;
import static com.android.server.wm.ActivityTaskManagerDebugConfig.TAG_WITH_CLASS_NAME;

import android.annotation.NonNull;
import android.content.pm.ActivityInfo;
import android.content.pm.PackageManager;

import com.android.server.wm.utils.OptPropFactory;
@@ -159,38 +158,6 @@ public class AppCompatCapability {
                isCompatChangeEnabled(OVERRIDE_ORIENTATION_ONLY_FOR_CAMERA);
    }

    /**
     * Whether should ignore app requested orientation in response to an app
     * calling {@link android.app.Activity#setRequestedOrientation}.
     *
     * <p>This is needed to avoid getting into {@link android.app.Activity#setRequestedOrientation}
     * loop when {@link DisplayContent#getIgnoreOrientationRequest} is enabled or device has
     * landscape natural orientation which app developers don't expect. For example, the loop can
     * look like this:
     * <ol>
     *     <li>App sets default orientation to "unspecified" at runtime
     *     <li>App requests to "portrait" after checking some condition (e.g. display rotation).
     *     <li>(2) leads to fullscreen -> letterboxed bounds change and activity relaunch because
     *     app can't handle the corresponding config changes.
     *     <li>Loop goes back to (1)
     * </ol>
     *
     * <p>This treatment is enabled when the following conditions are met:
     * <ul>
     *     <li>Flag gating the treatment is enabled
     *     <li>Opt-out component property isn't enabled
     *     <li>Opt-in component property or per-app override are enabled
     *     <li>Activity is relaunched after {@link android.app.Activity#setRequestedOrientation}
     *     call from an app or camera compat force rotation treatment is active for the activity.
     *     <li>Orientation request loop detected and is not letterboxed for fixed orientation
     * </ul>
     */
    boolean shouldIgnoreRequestedOrientation(
            @ActivityInfo.ScreenOrientation int requestedOrientation) {
        return mAppCompatOrientationCapability
                .shouldIgnoreRequestedOrientation(requestedOrientation);
    }

    /**
     * @return {@code true} if the App Compat Camera Policy is active for the current activity.
     */
+60 −0
Original line number Diff line number Diff line
/*
 * Copyright (C) 2024 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package com.android.server.wm;

import android.annotation.NonNull;

/**
 * Allows the interaction with all the app compat policies and configurations
 */
class AppCompatController {

    @NonNull
    private final TransparentPolicy mTransparentPolicy;
    @NonNull
    private final AppCompatOrientationPolicy mOrientationPolicy;
    @NonNull
    private final AppCompatCapability mAppCompatCapability;

    AppCompatController(@NonNull WindowManagerService wmService,
                        @NonNull ActivityRecord activityRecord) {
        mTransparentPolicy = new TransparentPolicy(activityRecord,
                wmService.mLetterboxConfiguration);
        mAppCompatCapability = new AppCompatCapability(wmService, activityRecord,
                wmService.mLetterboxConfiguration);
        // TODO(b/341903757) Remove BooleanSuppliers after fixing dependency with aspectRatio.
        final LetterboxUiController tmpController = activityRecord.mLetterboxUiController;
        mOrientationPolicy = new AppCompatOrientationPolicy(activityRecord,
                mAppCompatCapability, tmpController::shouldApplyUserFullscreenOverride,
                tmpController::shouldApplyUserMinAspectRatioOverride,
                tmpController::isSystemOverrideToFullscreenEnabled);
    }

    @NonNull
    TransparentPolicy getTransparentPolicy() {
        return mTransparentPolicy;
    }

    @NonNull
    AppCompatOrientationPolicy getOrientationPolicy() {
        return mOrientationPolicy;
    }

    @NonNull
    AppCompatCapability getAppCompatCapability() {
        return mAppCompatCapability;
    }
}
+37 −72
Original line number Diff line number Diff line
@@ -122,12 +122,6 @@ final class LetterboxUiController {
    // DisplayRotationCompatPolicy.
    private boolean mIsRefreshRequested;

    @NonNull
    private final AppCompatCapability mAppCompatCapability;

    @NonNull
    private final AppCompatOrientationPolicy mAppCompatOrientationPolicy;

    private boolean mLastShouldShowLetterboxUi;

    private boolean mDoubleTapEvent;
@@ -141,13 +135,6 @@ final class LetterboxUiController {
        // is created in its constructor. It shouldn't be used in this constructor but it's safe
        // to use it after since controller is only used in ActivityRecord.
        mActivityRecord = activityRecord;

        mAppCompatCapability = new AppCompatCapability(wmService, mActivityRecord,
                mLetterboxConfiguration);
        mAppCompatOrientationPolicy = new AppCompatOrientationPolicy(mActivityRecord,
                mAppCompatCapability, () -> shouldApplyUserFullscreenOverride(),
                () -> shouldApplyUserMinAspectRatioOverride(),
                () -> isSystemOverrideToFullscreenEnabled());
    }

    /** Cleans up {@link Letterbox} if it exists.*/
@@ -156,7 +143,6 @@ final class LetterboxUiController {
            mLetterbox.destroy();
            mLetterbox = null;
        }
        mActivityRecord.mTransparentPolicy.stop();
    }

    void onMovedToDisplay(int displayId) {
@@ -165,36 +151,6 @@ final class LetterboxUiController {
        }
    }

    /**
     * Whether should ignore app requested orientation in response to an app
     * calling {@link android.app.Activity#setRequestedOrientation}.
     *
     * <p>This is needed to avoid getting into {@link android.app.Activity#setRequestedOrientation}
     * loop when {@link DisplayContent#getIgnoreOrientationRequest} is enabled or device has
     * landscape natural orientation which app developers don't expect. For example, the loop can
     * look like this:
     * <ol>
     *     <li>App sets default orientation to "unspecified" at runtime
     *     <li>App requests to "portrait" after checking some condition (e.g. display rotation).
     *     <li>(2) leads to fullscreen -> letterboxed bounds change and activity relaunch because
     *     app can't handle the corresponding config changes.
     *     <li>Loop goes back to (1)
     * </ol>
     *
     * <p>This treatment is enabled when the following conditions are met:
     * <ul>
     *     <li>Flag gating the treatment is enabled
     *     <li>Opt-out component property isn't enabled
     *     <li>Opt-in component property or per-app override are enabled
     *     <li>Activity is relaunched after {@link android.app.Activity#setRequestedOrientation}
     *     call from an app or camera compat force rotation treatment is active for the activity.
     *     <li>Orientation request loop detected and is not letterboxed for fixed orientation
     * </ul>
     */
    boolean shouldIgnoreRequestedOrientation(@ScreenOrientation int requestedOrientation) {
        return mAppCompatCapability.shouldIgnoreRequestedOrientation(requestedOrientation);
    }

    /**
     * Whether an app is calling {@link android.app.Activity#setRequestedOrientation}
     * in a loop and orientation request should be ignored.
@@ -213,13 +169,13 @@ final class LetterboxUiController {
     * </ul>
     */
    boolean shouldIgnoreOrientationRequestLoop() {
        return mAppCompatCapability.getAppCompatOrientationCapability()
        return getAppCompatCapability().getAppCompatOrientationCapability()
                .shouldIgnoreOrientationRequestLoop();
    }

    @VisibleForTesting
    int getSetOrientationRequestCounter() {
        return mAppCompatCapability.getAppCompatOrientationCapability()
        return getAppCompatCapability().getAppCompatOrientationCapability()
                .getSetOrientationRequestCounter();
    }

@@ -236,7 +192,7 @@ final class LetterboxUiController {
     * </ul>
     */
    boolean shouldSendFakeFocus() {
        return mAppCompatCapability.shouldSendFakeFocus();
        return getAppCompatCapability().shouldSendFakeFocus();
    }

    /**
@@ -252,7 +208,7 @@ final class LetterboxUiController {
     * </ul>
     */
    boolean shouldOverrideMinAspectRatio() {
        return mAppCompatCapability.shouldOverrideMinAspectRatio();
        return getAppCompatCapability().shouldOverrideMinAspectRatio();
    }

    /**
@@ -269,7 +225,7 @@ final class LetterboxUiController {
     * </ul>
     */
    boolean shouldOverrideMinAspectRatioForCamera() {
        return mAppCompatCapability.shouldOverrideMinAspectRatioForCamera();
        return getAppCompatCapability().shouldOverrideMinAspectRatioForCamera();
    }

    /**
@@ -285,7 +241,7 @@ final class LetterboxUiController {
     * </ul>
     */
    boolean shouldOverrideForceResizeApp() {
        return mAppCompatCapability.shouldOverrideForceResizeApp();
        return getAppCompatCapability().shouldOverrideForceResizeApp();
    }

    /**
@@ -299,7 +255,7 @@ final class LetterboxUiController {
     * </ul>
     */
    boolean shouldOverrideForceNonResizeApp() {
        return mAppCompatCapability.shouldOverrideForceNonResizeApp();
        return getAppCompatCapability().shouldOverrideForceNonResizeApp();
    }

    /**
@@ -307,7 +263,7 @@ final class LetterboxUiController {
     * android.app.Activity#setRequestedOrientation}.
     */
    void setRelaunchingAfterRequestedOrientationChanged(boolean isRelaunching) {
        mAppCompatCapability.getAppCompatOrientationCapability()
        getAppCompatCapability().getAppCompatOrientationCapability()
                .setRelaunchingAfterRequestedOrientationChanged(isRelaunching);
    }

@@ -323,7 +279,7 @@ final class LetterboxUiController {
    }

    boolean isOverrideRespectRequestedOrientationEnabled() {
        return mAppCompatCapability.isOverrideRespectRequestedOrientationEnabled();
        return getAppCompatCapability().isOverrideRespectRequestedOrientationEnabled();
    }

    /**
@@ -340,16 +296,17 @@ final class LetterboxUiController {
     * </ul>
     */
    boolean shouldUseDisplayLandscapeNaturalOrientation() {
        return mAppCompatCapability.shouldUseDisplayLandscapeNaturalOrientation();
        return getAppCompatCapability().shouldUseDisplayLandscapeNaturalOrientation();
    }

    @ScreenOrientation
    int overrideOrientationIfNeeded(@ScreenOrientation int candidate) {
        return mAppCompatOrientationPolicy.overrideOrientationIfNeeded(candidate);
        return mActivityRecord.mAppCompatController.getOrientationPolicy()
                .overrideOrientationIfNeeded(candidate);
    }

    boolean isOverrideOrientationOnlyForCameraEnabled() {
        return mAppCompatCapability.isOverrideOrientationOnlyForCameraEnabled();
        return getAppCompatCapability().isOverrideOrientationOnlyForCameraEnabled();
    }

    /**
@@ -364,7 +321,7 @@ final class LetterboxUiController {
     * </ul>
     */
    boolean shouldRefreshActivityForCameraCompat() {
        return mAppCompatCapability.shouldRefreshActivityForCameraCompat();
        return getAppCompatCapability().shouldRefreshActivityForCameraCompat();
    }

    /**
@@ -382,7 +339,7 @@ final class LetterboxUiController {
     * </ul>
     */
    boolean shouldRefreshActivityViaPauseForCameraCompat() {
        return mAppCompatCapability.shouldRefreshActivityViaPauseForCameraCompat();
        return getAppCompatCapability().shouldRefreshActivityViaPauseForCameraCompat();
    }

    /**
@@ -397,7 +354,7 @@ final class LetterboxUiController {
     * </ul>
     */
    boolean shouldForceRotateForCameraCompat() {
        return mAppCompatCapability.shouldForceRotateForCameraCompat();
        return getAppCompatCapability().shouldForceRotateForCameraCompat();
    }

    /**
@@ -415,7 +372,7 @@ final class LetterboxUiController {
     * </ul>
     */
    boolean shouldApplyFreeformTreatmentForCameraCompat() {
        return mAppCompatCapability.shouldApplyFreeformTreatmentForCameraCompat();
        return getAppCompatCapability().shouldApplyFreeformTreatmentForCameraCompat();
    }

    @FreeformCameraCompatMode
@@ -542,7 +499,8 @@ final class LetterboxUiController {
            // For this reason we use ActivityRecord#getBounds() that the translucent activity
            // inherits from the first opaque activity beneath and also takes care of the scaling
            // in case of activities in size compat mode.
            final Rect innerFrame = mActivityRecord.mTransparentPolicy.isRunning()
            final Rect innerFrame = mActivityRecord.mAppCompatController
                    .getTransparentPolicy().isRunning()
                    ? mActivityRecord.getBounds() : w.getFrame();
            mLetterbox.layout(spaceToFill, innerFrame, mTmpPoint);
            if (mDoubleTapEvent) {
@@ -679,7 +637,7 @@ final class LetterboxUiController {
        // Don't resize to split screen size when in book mode if letterbox position is centered
        return (isBookMode && isNotCenteredHorizontally || isTabletopMode && isLandscape)
                    || isCameraCompatSplitScreenAspectRatioAllowed()
                        && mAppCompatCapability.isCameraCompatTreatmentActive();
                        && getAppCompatCapability().isCameraCompatTreatmentActive();
    }

    private float getDefaultMinAspectRatioForUnresizableApps() {
@@ -781,7 +739,7 @@ final class LetterboxUiController {
     * Whether we should enable users to resize the current app.
     */
    boolean shouldEnableUserAspectRatioSettings() {
        return mAppCompatCapability.shouldEnableUserAspectRatioSettings();
        return getAppCompatCapability().shouldEnableUserAspectRatioSettings();
    }

    /**
@@ -811,11 +769,11 @@ final class LetterboxUiController {
    }

    boolean isUserFullscreenOverrideEnabled() {
        return mAppCompatCapability.isUserFullscreenOverrideEnabled();
        return getAppCompatCapability().isUserFullscreenOverrideEnabled();
    }

    boolean isSystemOverrideToFullscreenEnabled() {
        return mAppCompatCapability.isSystemOverrideToFullscreenEnabled(mUserAspectRatio);
        return getAppCompatCapability().isSystemOverrideToFullscreenEnabled(mUserAspectRatio);
    }

    boolean hasFullscreenOverride() {
@@ -989,8 +947,9 @@ final class LetterboxUiController {
                ? parentAppBoundsOverride : parentConfiguration.windowConfiguration.getAppBounds();
        // Use screen resolved bounds which uses resolved bounds or size compat bounds
        // as activity bounds can sometimes be empty
        final Rect opaqueActivityBounds = mActivityRecord.mTransparentPolicy
                .getFirstOpaqueActivity().map(ActivityRecord::getScreenResolvedBounds)
        final Rect opaqueActivityBounds = mActivityRecord.mAppCompatController
                .getTransparentPolicy().getFirstOpaqueActivity()
                .map(ActivityRecord::getScreenResolvedBounds)
                .orElse(mActivityRecord.getScreenResolvedBounds());
        return mLetterboxConfiguration.getIsHorizontalReachabilityEnabled()
                && parentConfiguration.windowConfiguration.getWindowingMode()
@@ -1009,6 +968,11 @@ final class LetterboxUiController {
        return isHorizontalReachabilityEnabled() || isVerticalReachabilityEnabled();
    }

    // TODO(b/346264992): Remove after AppCompatController refactoring
    private AppCompatCapability getAppCompatCapability() {
        return mActivityRecord.mAppCompatController.getAppCompatCapability();
    }

    /**
     * Whether vertical reachability is enabled for an activity in the current configuration.
     *
@@ -1028,8 +992,9 @@ final class LetterboxUiController {
                ? parentAppBoundsOverride : parentConfiguration.windowConfiguration.getAppBounds();
        // Use screen resolved bounds which uses resolved bounds or size compat bounds
        // as activity bounds can sometimes be empty.
        final Rect opaqueActivityBounds = mActivityRecord.mTransparentPolicy
                .getFirstOpaqueActivity().map(ActivityRecord::getScreenResolvedBounds)
        final Rect opaqueActivityBounds = mActivityRecord.mAppCompatController
                .getTransparentPolicy().getFirstOpaqueActivity()
                .map(ActivityRecord::getScreenResolvedBounds)
                .orElse(mActivityRecord.getScreenResolvedBounds());
        return mLetterboxConfiguration.getIsVerticalReachabilityEnabled()
                && parentConfiguration.windowConfiguration.getWindowingMode()
@@ -1046,7 +1011,7 @@ final class LetterboxUiController {

    @VisibleForTesting
    boolean shouldShowLetterboxUi(WindowState mainWindow) {
        if (mAppCompatCapability.getAppCompatOrientationCapability()
        if (getAppCompatCapability().getAppCompatOrientationCapability()
                .getIsRelaunchingAfterRequestedOrientationChanged()) {
            return mLastShouldShowLetterboxUi;
        }
@@ -1136,7 +1101,7 @@ final class LetterboxUiController {
        // corners because we assume the specific layout would. This is the case when the layout
        // of the translucent activity uses only a part of all the bounds because of the use of
        // LayoutParams.WRAP_CONTENT.
        if (mActivityRecord.mTransparentPolicy.isRunning()
        if (mActivityRecord.mAppCompatController.getTransparentPolicy().isRunning()
                && (cropBounds.width() != mainWindow.mRequestedWidth
                || cropBounds.height() != mainWindow.mRequestedHeight)) {
            return null;
@@ -1207,7 +1172,7 @@ final class LetterboxUiController {
    }

    boolean getIsRelaunchingAfterRequestedOrientationChanged() {
        return mAppCompatCapability.getAppCompatOrientationCapability()
        return getAppCompatCapability().getAppCompatOrientationCapability()
                .getIsRelaunchingAfterRequestedOrientationChanged();
    }

+6 −4

File changed.

Preview size limit exceeded, changes collapsed.

Loading