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

Commit 64763fb1 authored by Tiger Huang's avatar Tiger Huang Committed by Android (Google) Code Review
Browse files

Merge "Add a WCT method to override system bar visibility" into main

parents 5d640a15 37ce8123
Loading
Loading
Loading
Loading
+67 −0
Original line number Diff line number Diff line
@@ -256,6 +256,32 @@ public final class WindowContainerTransaction implements Parcelable {
        return this;
    }

    /**
     * Sets the forcibly showing and hiding types of system bars of the display.
     * @hide
     */
    @NonNull
    public WindowContainerTransaction setSystemBarVisibilityOverride(
            @NonNull WindowContainerToken display,
            @InsetsType int forciblyShowingInsetsTypes,
            @InsetsType int forciblyHidingInsetsTypes) {
        final int forciblyShowingAndHidingTypes =
                forciblyShowingInsetsTypes & forciblyHidingInsetsTypes;
        if (forciblyShowingAndHidingTypes != 0) {
            throw new IllegalArgumentException(
                    WindowInsets.Type.toString(forciblyShowingAndHidingTypes)
                            + " cannot be forcibly shown and hidden at the same time.");
        }
        final HierarchyOp hierarchyOp = new HierarchyOp.Builder(
                HierarchyOp.HIERARCHY_OP_TYPE_SET_SYSTEM_BAR_VISIBILITY_OVERRIDE)
                .setContainer(display.asBinder())
                .setSystemBarVisibilityOverride(
                        forciblyShowingInsetsTypes, forciblyHidingInsetsTypes)
                .build();
        mHierarchyOps.add(hierarchyOp);
        return this;
    }

    /**
     * Sets whether a container or its children should be hidden. When {@code false}, the existing
     * visibility of the container applies, but when {@code true} the container will be forced
@@ -1676,6 +1702,7 @@ public final class WindowContainerTransaction implements Parcelable {
        public static final int HIERARCHY_OP_TYPE_REMOVE_ROOT_TASK = 24;
        public static final int HIERARCHY_OP_TYPE_APP_COMPAT_REACHABILITY = 25;
        public static final int HIERARCHY_OP_TYPE_SET_SAFE_REGION_BOUNDS = 26;
        public static final int HIERARCHY_OP_TYPE_SET_SYSTEM_BAR_VISIBILITY_OVERRIDE = 27;

        @IntDef(prefix = {"HIERARCHY_OP_TYPE_"}, value = {
                HIERARCHY_OP_TYPE_REPARENT,
@@ -1705,6 +1732,7 @@ public final class WindowContainerTransaction implements Parcelable {
                HIERARCHY_OP_TYPE_REMOVE_ROOT_TASK,
                HIERARCHY_OP_TYPE_APP_COMPAT_REACHABILITY,
                HIERARCHY_OP_TYPE_SET_SAFE_REGION_BOUNDS,
                HIERARCHY_OP_TYPE_SET_SYSTEM_BAR_VISIBILITY_OVERRIDE,
        })
        @Retention(RetentionPolicy.SOURCE)
        public @interface HierarchyOpType {
@@ -1788,6 +1816,9 @@ public final class WindowContainerTransaction implements Parcelable {

        private @InsetsType int mExcludeInsetsTypes;

        private @InsetsType int mForciblyShowingInsetsTypes;
        private @InsetsType int mForciblyHidingInsetsTypes;

        private boolean mLaunchAdjacentDisabled;

        @Nullable
@@ -1996,6 +2027,8 @@ public final class WindowContainerTransaction implements Parcelable {
            mReparentLeafTaskIfRelaunch = copy.mReparentLeafTaskIfRelaunch;
            mIsTrimmableFromRecents = copy.mIsTrimmableFromRecents;
            mExcludeInsetsTypes = copy.mExcludeInsetsTypes;
            mForciblyShowingInsetsTypes = copy.mForciblyShowingInsetsTypes;
            mForciblyHidingInsetsTypes = copy.mForciblyHidingInsetsTypes;
            mLaunchAdjacentDisabled = copy.mLaunchAdjacentDisabled;
            mSafeRegionBounds = copy.mSafeRegionBounds;
        }
@@ -2024,6 +2057,8 @@ public final class WindowContainerTransaction implements Parcelable {
            mReparentLeafTaskIfRelaunch = in.readBoolean();
            mIsTrimmableFromRecents = in.readBoolean();
            mExcludeInsetsTypes = in.readInt();
            mForciblyShowingInsetsTypes = in.readInt();
            mForciblyHidingInsetsTypes = in.readInt();
            mLaunchAdjacentDisabled = in.readBoolean();
            mSafeRegionBounds = in.readTypedObject(Rect.CREATOR);
        }
@@ -2142,6 +2177,14 @@ public final class WindowContainerTransaction implements Parcelable {
            return mExcludeInsetsTypes;
        }

        public @InsetsType int getForciblyShowingInsetsTypes() {
            return mForciblyShowingInsetsTypes;
        }

        public @InsetsType int getForciblyHidingInsetsTypes() {
            return mForciblyHidingInsetsTypes;
        }

        /** Denotes whether launch-adjacent flag is respected from this task or its children */
        public boolean isLaunchAdjacentDisabled() {
            return mLaunchAdjacentDisabled;
@@ -2187,6 +2230,8 @@ public final class WindowContainerTransaction implements Parcelable {
                case HIERARCHY_OP_TYPE_SET_EXCLUDE_INSETS_TYPES: return "setExcludeInsetsTypes";
                case HIERARCHY_OP_TYPE_SET_KEYGUARD_STATE: return "setKeyguardState";
                case HIERARCHY_OP_TYPE_SET_SAFE_REGION_BOUNDS: return "setSafeRegionBounds";
                case HIERARCHY_OP_TYPE_SET_SYSTEM_BAR_VISIBILITY_OVERRIDE:
                    return "setSystemBarVisibilityOverride";
                default: return "HOP(" + type + ")";
            }
        }
@@ -2293,6 +2338,13 @@ public final class WindowContainerTransaction implements Parcelable {
                            .append(" safeRegionBounds= ")
                            .append(mSafeRegionBounds);
                    break;
                case HIERARCHY_OP_TYPE_SET_SYSTEM_BAR_VISIBILITY_OVERRIDE:
                    sb.append(" container=").append(mContainer)
                            .append(" mForciblyShowingInsetsTypes=")
                            .append(WindowInsets.Type.toString(mForciblyShowingInsetsTypes))
                            .append(" mForciblyHidingInsetsTypes=")
                            .append(WindowInsets.Type.toString(mForciblyHidingInsetsTypes));
                    break;
                default:
                    sb.append("container=").append(mContainer)
                            .append(" reparent=").append(mReparent)
@@ -2328,6 +2380,8 @@ public final class WindowContainerTransaction implements Parcelable {
            dest.writeBoolean(mReparentLeafTaskIfRelaunch);
            dest.writeBoolean(mIsTrimmableFromRecents);
            dest.writeInt(mExcludeInsetsTypes);
            dest.writeInt(mForciblyShowingInsetsTypes);
            dest.writeInt(mForciblyHidingInsetsTypes);
            dest.writeBoolean(mLaunchAdjacentDisabled);
            dest.writeTypedObject(mSafeRegionBounds, flags);
        }
@@ -2413,6 +2467,9 @@ public final class WindowContainerTransaction implements Parcelable {

            private @InsetsType int mExcludeInsetsTypes;

            private @InsetsType int mForciblyShowingInsetsTypes;
            private @InsetsType int mForciblyHidingInsetsTypes;

            private boolean mLaunchAdjacentDisabled;

            @Nullable
@@ -2534,6 +2591,14 @@ public final class WindowContainerTransaction implements Parcelable {
                return this;
            }

            Builder setSystemBarVisibilityOverride(
                    @InsetsType int forciblyShowingInsetsTypes,
                    @InsetsType int forciblyHidingInsetsTypes) {
                mForciblyShowingInsetsTypes = forciblyShowingInsetsTypes;
                mForciblyHidingInsetsTypes = forciblyHidingInsetsTypes;
                return this;
            }

            Builder setLaunchAdjacentDisabled(boolean disabled) {
                mLaunchAdjacentDisabled = disabled;
                return this;
@@ -2573,6 +2638,8 @@ public final class WindowContainerTransaction implements Parcelable {
                hierarchyOp.mReparentLeafTaskIfRelaunch = mReparentLeafTaskIfRelaunch;
                hierarchyOp.mIsTrimmableFromRecents = mIsTrimmableFromRecents;
                hierarchyOp.mExcludeInsetsTypes = mExcludeInsetsTypes;
                hierarchyOp.mForciblyShowingInsetsTypes = mForciblyShowingInsetsTypes;
                hierarchyOp.mForciblyHidingInsetsTypes = mForciblyHidingInsetsTypes;
                hierarchyOp.mLaunchAdjacentDisabled = mLaunchAdjacentDisabled;
                hierarchyOp.mSafeRegionBounds = mSafeRegionBounds;
                return hierarchyOp;
+37 −7
Original line number Diff line number Diff line
@@ -269,7 +269,23 @@ public class DisplayPolicy {

    private boolean mIsFreeformWindowOverlappingWithNavBar;

    private @InsetsType int mForciblyShownTypes;
    /**
     * Insets types requested to be shown transiently which won't affect the insets visibility
     * received by clients windows, so they don't need to update their layout when this changes.
     */
    private @InsetsType int mShowingTransientInsetsTypes;

    /**
     * Insets types requested to be shown permanently which will affect the insets visibility
     * received by clients windows. They might need to update their layout when this changes.
     */
    private @InsetsType int mShowingPermanentInsetsTypes;

    /**
     * Insets types requested to be hidden permanently which will affect the insets visibility
     * received by clients windows. They might need to update their layout when this changes.
     */
    private @InsetsType int mHidingPermanentInsetsTypes;

    private boolean mImeInsetsConsumed;

@@ -1442,7 +1458,7 @@ public class DisplayPolicy {
        mAllowLockscreenWhenOn = false;
        mShowingDream = false;
        mIsFreeformWindowOverlappingWithNavBar = false;
        mForciblyShownTypes = 0;
        mShowingTransientInsetsTypes = 0;
        mImeInsetsConsumed = false;
    }

@@ -1501,7 +1517,7 @@ public class DisplayPolicy {
        }

        if (win.mSession.mCanForceShowingInsets) {
            mForciblyShownTypes |= win.mAttrs.forciblyShownTypes;
            mShowingTransientInsetsTypes |= win.mAttrs.forciblyShownTypes;
        }

        if (win.mImeInsetsConsumed != mImeInsetsConsumed) {
@@ -1706,8 +1722,8 @@ public class DisplayPolicy {
        mService.mPolicy.setAllowLockscreenWhenOn(getDisplayId(), mAllowLockscreenWhenOn);
    }

    boolean areTypesForciblyShownTransiently(@InsetsType int types) {
        return (mForciblyShownTypes & types) == types;
    boolean areInsetsTypesForciblyShownTransiently(@InsetsType int types) {
        return (mShowingTransientInsetsTypes & types) == types;
    }

    /**
@@ -1761,7 +1777,7 @@ public class DisplayPolicy {
     */
    boolean topAppHidesSystemBar(@InsetsType int type) {
        if (mTopFullscreenOpaqueWindowState == null
                || getInsetsPolicy().areTypesForciblyShowing(type)) {
                || getInsetsPolicy().areTypesForciblyShown(type)) {
            return false;
        }
        return !mTopFullscreenOpaqueWindowState.isRequestedVisible(type);
@@ -2444,6 +2460,16 @@ public class DisplayPolicy {
        }
    }

    void setSystemBarVisibilityOverride(
            @InsetsType int forciblyShowingInsetsTypes, @InsetsType int forciblyHidingInsetsTypes) {
        if (mShowingPermanentInsetsTypes != forciblyShowingInsetsTypes
                || mHidingPermanentInsetsTypes != forciblyHidingInsetsTypes) {
            mShowingPermanentInsetsTypes = forciblyShowingInsetsTypes;
            mHidingPermanentInsetsTypes = forciblyHidingInsetsTypes;
            updateSystemBarAttributes();
        }
    }

    void resetSystemBarAttributes() {
        mLastDisableFlags = 0;
        updateSystemBarAttributes();
@@ -2606,7 +2632,11 @@ public class DisplayPolicy {
        final boolean inNonFullscreenFreeformMode = freeformRootTaskVisible
                && !topFreeformTask.getBounds().equals(mDisplayContent.getBounds());

        getInsetsPolicy().updateSystemBars(win, adjacentTasksVisible,
        getInsetsPolicy().updateSystemBars(
                win,
                mShowingPermanentInsetsTypes,
                mHidingPermanentInsetsTypes,
                adjacentTasksVisible,
                DesktopModeFlags.ENABLE_FULLY_IMMERSIVE_IN_DESKTOP.isTrue()
                        ? inNonFullscreenFreeformMode : freeformRootTaskVisible);

+122 −38
Original line number Diff line number Diff line
@@ -72,10 +72,13 @@ class InsetsPolicy {
    private final DisplayPolicy mPolicy;

    /** Used to show system bars transiently. This won't affect the layout. */
    private final InsetsControlTarget mTransientControlTarget;
    private final InsetsControlTarget mShowingTransientControlTarget;

    /** Used to show system bars permanently. This will affect the layout. */
    private final InsetsControlTarget mPermanentControlTarget;
    /** Used to show system bars permanently. This can affect the layout. */
    private final InsetsControlTarget mShowingPermanentControlTarget;

    /** Used to hide system bars permanently. This can affect the layout. */
    private final InsetsControlTarget mHidingPermanentControlTarget;

    /**
     * Used to override the visibility of {@link Type#statusBars()} when dispatching insets to
@@ -92,8 +95,21 @@ class InsetsPolicy {
    private WindowState mFocusedWin;
    private final BarWindow mStatusBar = new BarWindow(StatusBarManager.WINDOW_STATUS_BAR);
    private final BarWindow mNavBar = new BarWindow(StatusBarManager.WINDOW_NAVIGATION_BAR);

    /**
     * Types shown transiently because of the user action.
     */
    private @InsetsType int mShowingTransientTypes;
    private @InsetsType int mForcedShowingTypes;

    /**
     * Types shown permanently by the upstream caller.
     */
    private @InsetsType int mForciblyShowingTypes;

    /**
     * Types hidden permanently by the upstream caller.
     */
    private @InsetsType int mForciblyHidingTypes;

    private final boolean mHideNavBarForKeyboard;

@@ -103,30 +119,44 @@ class InsetsPolicy {
        mPolicy = displayContent.getDisplayPolicy();
        final Resources r = mPolicy.getContext().getResources();
        mHideNavBarForKeyboard = r.getBoolean(R.bool.config_hideNavBarForKeyboard);
        mTransientControlTarget = new ControlTarget(displayContent, "TransientControlTarget");
        mPermanentControlTarget = new ControlTarget(displayContent, "PermanentControlTarget");
        mShowingTransientControlTarget = new ControlTarget(
                displayContent, true /* showing */, false /* permanent */);
        mShowingPermanentControlTarget = new ControlTarget(
                displayContent, true /* showing */, true /* permanent */);
        mHidingPermanentControlTarget = new ControlTarget(
                displayContent, false /* showing */, true /* permanent */);
    }

    /** Updates the target which can control system bars. */
    void updateBarControlTarget(@Nullable WindowState focusedWin) {
        if (mFocusedWin != focusedWin) {
        final @InsetsType int[] requestedVisibleTypes =
                {focusedWin != null ? focusedWin.getRequestedVisibleTypes() : 0};
        if ((mShowingTransientTypes & Type.statusBars()) != 0
                        && mFakeStatusControlTarget != null
                        && mFakeStatusControlTarget != getStatusControlTarget(
                                focusedWin, true, requestedVisibleTypes)
                || (mShowingTransientTypes & Type.navigationBars()) != 0
                        && mFakeNavControlTarget != null
                        && mFakeNavControlTarget != getNavControlTarget(
                                focusedWin, true, requestedVisibleTypes)) {
            // The fake control target is the target which was hiding the system bar before showing
            // the transient bar. Abort the transient bar if any of the fake control targets is
            // changed, so the request of the new target can be applied.
            abortTransient();
        }
        mFocusedWin = focusedWin;
        final @InsetsType int[] requestedVisibleTypes =
                {focusedWin != null ? focusedWin.getRequestedVisibleTypes() : 0};
        final WindowState notificationShade = mPolicy.getNotificationShade();
        final WindowState topApp = mPolicy.getTopFullscreenOpaqueWindow();
        final InsetsControlTarget statusControlTarget =
                getStatusControlTarget(focusedWin, false /* fake */, requestedVisibleTypes);
        mFakeStatusControlTarget = statusControlTarget == mTransientControlTarget
        mFakeStatusControlTarget = statusControlTarget == mShowingTransientControlTarget
                ? getStatusControlTarget(focusedWin, true /* fake */, requestedVisibleTypes)
                : statusControlTarget == notificationShade
                        ? getStatusControlTarget(topApp, true /* fake */, requestedVisibleTypes)
                        : null;
        final InsetsControlTarget navControlTarget =
                getNavControlTarget(focusedWin, false /* fake */, requestedVisibleTypes);
        mFakeNavControlTarget = navControlTarget == mTransientControlTarget
        mFakeNavControlTarget = navControlTarget == mShowingTransientControlTarget
                ? getNavControlTarget(focusedWin, true /* fake */, requestedVisibleTypes)
                : navControlTarget == notificationShade
                        ? getNavControlTarget(topApp, true /* fake */, requestedVisibleTypes)
@@ -189,13 +219,13 @@ class InsetsPolicy {
    }

    @VisibleForTesting
    InsetsControlTarget getTransientControlTarget() {
        return mTransientControlTarget;
    InsetsControlTarget getShowingTransientControlTarget() {
        return mShowingTransientControlTarget;
    }

    @VisibleForTesting
    InsetsControlTarget getPermanentControlTarget() {
        return mPermanentControlTarget;
    InsetsControlTarget getShowingPermanentControlTarget() {
        return mShowingPermanentControlTarget;
    }

    void hideTransient() {
@@ -519,23 +549,28 @@ class InsetsPolicy {
            @Nullable WindowState focusedWin,
            boolean fake) {
        if (!fake && isTransient(Type.statusBars())) {
            return mTransientControlTarget;
            return mShowingTransientControlTarget;
        }
        final WindowState notificationShade = mPolicy.getNotificationShade();
        if (focusedWin == notificationShade) {
            // Notification shade has control anyways, no reason to force anything.
            return focusedWin;
        }
        if (areTypesForciblyShowing(Type.statusBars())) {
        if (areTypesForciblyShown(Type.statusBars())) {
            // Status bar is forcibly shown. We don't want the client to control the status bar, and
            // we will dispatch the real visibility of status bar to the client.
            return mPermanentControlTarget;
            return mShowingPermanentControlTarget;
        }
        if (mPolicy.areTypesForciblyShownTransiently(Type.statusBars()) && !fake) {
        if (mPolicy.areInsetsTypesForciblyShownTransiently(Type.statusBars()) && !fake) {
            // Status bar is forcibly shown transiently, and its new visibility won't be
            // dispatched to the client so that we can keep the layout stable. We will dispatch the
            // fake control to the client, so that it can re-show the bar during this scenario.
            return mTransientControlTarget;
            return mShowingTransientControlTarget;
        }
        if (areTypesForciblyHidden(Type.statusBars())) {
            // Status bar is forcibly hidden. We don't want the client to control the status bar,
            // and we will dispatch the real visibility of status bar to the client.
            return mHidingPermanentControlTarget;
        }
        if (!canBeTopFullscreenOpaqueWindow(focusedWin)
                && mPolicy.topAppHidesSystemBar(Type.statusBars())
@@ -574,10 +609,10 @@ class InsetsPolicy {
        if (imeWin != null && imeWin.isVisible() && !mHideNavBarForKeyboard) {
            // Force showing navigation bar while IME is visible and if navigation bar is not
            // configured to be hidden by the IME.
            return mPermanentControlTarget;
            return mShowingPermanentControlTarget;
        }
        if (!fake && isTransient(Type.navigationBars())) {
            return mTransientControlTarget;
            return mShowingTransientControlTarget;
        }
        if (focusedWin == mPolicy.getNotificationShade()) {
            // Notification shade has control anyways, no reason to force anything.
@@ -590,16 +625,21 @@ class InsetsPolicy {
                return focusedWin;
            }
        }
        if (areTypesForciblyShowing(Type.navigationBars())) {
        if (areTypesForciblyShown(Type.navigationBars())) {
            // Navigation bar is forcibly shown. We don't want the client to control the navigation
            // bar, and we will dispatch the real visibility of navigation bar to the client.
            return mPermanentControlTarget;
            return mShowingPermanentControlTarget;
        }
        if (mPolicy.areTypesForciblyShownTransiently(Type.navigationBars()) && !fake) {
        if (mPolicy.areInsetsTypesForciblyShownTransiently(Type.navigationBars()) && !fake) {
            // Navigation bar is forcibly shown transiently, and its new visibility won't be
            // dispatched to the client so that we can keep the layout stable. We will dispatch the
            // fake control to the client, so that it can re-show the bar during this scenario.
            return mTransientControlTarget;
            return mShowingTransientControlTarget;
        }
        if (areTypesForciblyHidden(Type.navigationBars())) {
            // Navigation bar is forcibly hidden. We don't want the client to control the navigation
            // bar, and we will dispatch the real visibility of navigation bar to the client.
            return mHidingPermanentControlTarget;
        }
        final WindowState notificationShade = mPolicy.getNotificationShade();
        if (!canBeTopFullscreenOpaqueWindow(focusedWin)
@@ -624,22 +664,37 @@ class InsetsPolicy {
                component, requestVisibleTypes);
    }

    boolean areTypesForciblyShowing(@InsetsType int types) {
        return (mForcedShowingTypes & types) == types;
    boolean areTypesForciblyShown(@InsetsType int types) {
        return (mForciblyShowingTypes & types) == types;
    }

    void updateSystemBars(WindowState win, boolean inSplitScreenMode,
    boolean areTypesForciblyHidden(@InsetsType int types) {
        return (mForciblyHidingTypes & types) == types;
    }

    void updateSystemBars(WindowState win, @InsetsType int displayForciblyShowingTypes,
            @InsetsType int displayForciblyHidingTypes, boolean inSplitScreenMode,
            boolean inNonFullscreenFreeformMode) {
        mForcedShowingTypes = (inSplitScreenMode || inNonFullscreenFreeformMode)
                ? (Type.statusBars() | Type.navigationBars())
                : forceShowingNavigationBars(win)
        final boolean hasDisplayOverride = displayForciblyShowingTypes != 0
                || displayForciblyHidingTypes != 0;
        mForciblyShowingTypes =
                // Force showing navigation bar as long as forceShowingNavigationBars returns true.
                (forceShowingNavigationBars(win)
                        ? Type.navigationBars()
                        : 0;
                        : 0)
                | (hasDisplayOverride
                        // Add types forcibly shown by the display if there is any.
                        ? displayForciblyShowingTypes
                        // Otherwise, fallback to the legacy policy.
                        : (inSplitScreenMode || inNonFullscreenFreeformMode)
                                ? (Type.statusBars() | Type.navigationBars())
                                : 0);
        mForciblyHidingTypes = displayForciblyHidingTypes;

        // The client app won't be able to control these types of system bars. Here makes the client
        // forcibly consume these types to prevent the app content from getting obscured.
        mStateController.setForcedConsumingTypes(
                mForcedShowingTypes | (remoteInsetsControllerControlsSystemBars(win)
                mForciblyShowingTypes | (remoteInsetsControllerControlsSystemBars(win)
                        ? (Type.statusBars() | Type.navigationBars())
                        : 0));

@@ -713,9 +768,13 @@ class InsetsPolicy {
            pw.println(prefix + "mShowingTransientTypes="
                    + WindowInsets.Type.toString(mShowingTransientTypes));
        }
        if (mForcedShowingTypes != 0) {
            pw.println(prefix + "mForcedShowingTypes="
                    + WindowInsets.Type.toString(mForcedShowingTypes));
        if (mForciblyShowingTypes != 0) {
            pw.println(prefix + "mForciblyShowingTypes="
                    + WindowInsets.Type.toString(mForciblyShowingTypes));
        }
        if (mForciblyHidingTypes != 0) {
            pw.println(prefix + "mForciblyHidingTypes="
                    + WindowInsets.Type.toString(mForciblyHidingTypes));
        }
    }

@@ -750,18 +809,28 @@ class InsetsPolicy {

    private static class ControlTarget implements InsetsControlTarget, Runnable {

        private static final String FORMAT = "%s%sControlTarget";

        private final Handler mHandler;
        private final Object mGlobalLock;
        private final InsetsState mState = new InsetsState();
        private final InsetsStateController mStateController;
        private final InsetsController mInsetsController;
        private final @InsetsType int mRequestedVisibleTypes;
        private final String mName;

        ControlTarget(DisplayContent displayContent, String name) {
        ControlTarget(DisplayContent displayContent, boolean showing, boolean permanent) {
            final String name = String.format(FORMAT,
                    showing ? "Showing" : "Hiding",
                    permanent ? "Permanent" : "Transient");
            mHandler = displayContent.mWmService.mH;
            mGlobalLock = displayContent.mWmService.mGlobalLock;
            mStateController = displayContent.getInsetsStateController();
            mInsetsController = new InsetsController(new Host(mHandler, name));
            mRequestedVisibleTypes = Type.defaultVisible() & ~(showing ? 0 : Type.systemBars());
            if (!showing) {
                mInsetsController.hide(Type.systemBars());
            }
            mName = name;
        }

@@ -779,6 +848,21 @@ class InsetsPolicy {
            }
        }

        @Override
        public boolean canShowTransient() {
            return true;
        }

        @Override
        public boolean isRequestedVisible(@InsetsType int types) {
            return (mRequestedVisibleTypes & types) != 0;
        }

        @Override
        public @InsetsType int getRequestedVisibleTypes() {
            return mRequestedVisibleTypes;
        }

        @Override
        public String toString() {
            return mName;
+13 −0

File changed.

Preview size limit exceeded, changes collapsed.

+316 −0

File changed.

Preview size limit exceeded, changes collapsed.

Loading