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

Commit 1990afed authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Do not do anything special to system bars when dispatching insets"

parents dabdb954 a6e5b8c8
Loading
Loading
Loading
Loading
+16 −32
Original line number Original line Diff line number Diff line
@@ -26,7 +26,6 @@ import static android.view.InsetsController.ANIMATION_TYPE_HIDE;
import static android.view.InsetsController.ANIMATION_TYPE_SHOW;
import static android.view.InsetsController.ANIMATION_TYPE_SHOW;
import static android.view.InsetsController.LAYOUT_INSETS_DURING_ANIMATION_HIDDEN;
import static android.view.InsetsController.LAYOUT_INSETS_DURING_ANIMATION_HIDDEN;
import static android.view.InsetsController.LAYOUT_INSETS_DURING_ANIMATION_SHOWN;
import static android.view.InsetsController.LAYOUT_INSETS_DURING_ANIMATION_SHOWN;
import static android.view.InsetsState.ITYPE_CAPTION_BAR;
import static android.view.InsetsState.ITYPE_CLIMATE_BAR;
import static android.view.InsetsState.ITYPE_CLIMATE_BAR;
import static android.view.InsetsState.ITYPE_EXTRA_NAVIGATION_BAR;
import static android.view.InsetsState.ITYPE_EXTRA_NAVIGATION_BAR;
import static android.view.InsetsState.ITYPE_IME;
import static android.view.InsetsState.ITYPE_IME;
@@ -289,9 +288,8 @@ class InsetsPolicy {
        final boolean alwaysOnTop = token != null && token.isAlwaysOnTop();
        final boolean alwaysOnTop = token != null && token.isAlwaysOnTop();
        // Always use windowing mode fullscreen when get insets for window metrics to make sure it
        // Always use windowing mode fullscreen when get insets for window metrics to make sure it
        // contains all insets types.
        // contains all insets types.
        final InsetsState originalState = mDisplayContent.getInsetsPolicy()
        final InsetsState originalState = enforceInsetsPolicyForTarget(WINDOWING_MODE_FULLSCREEN,
                .enforceInsetsPolicyForTarget(type, WINDOWING_MODE_FULLSCREEN, alwaysOnTop,
                alwaysOnTop, attrs, mStateController.getRawInsetsState());
                        attrs.type, mStateController.getRawInsetsState());
        InsetsState state = adjustVisibilityForTransientTypes(originalState);
        InsetsState state = adjustVisibilityForTransientTypes(originalState);
        return adjustInsetsForRoundedCorners(token, state, state == originalState);
        return adjustInsetsForRoundedCorners(token, state, state == originalState);
    }
    }
@@ -343,56 +341,42 @@ class InsetsPolicy {




    /**
    /**
     * Modifies the given {@code state} according to the {@code type} (Inset type) provided by
     * Modifies the given {@code state} according to the target's window state.
     * the target.
     * When performing layout of the target or dispatching insets to the target, we need to adjust
     * When performing layout of the target or dispatching insets to the target, we need to exclude
     * sources based on the target. e.g., the floating window will not receive system bars other
     * sources which should not be visible to the target. e.g., the source which represents the
     * than caption, and some insets provider may request to override sizes for given window types.
     * target window itself, and the IME source when the target is above IME. We also need to
     * Since the window type and the insets types provided by the window shall not change at
     * exclude certain types of insets source for client within specific windowing modes.
     * runtime, rotation doesn't matter in the layout params.
     *
     *
     * @param type the inset type provided by the target
     * @param windowingMode the windowing mode of the target
     * @param windowingMode the windowing mode of the target
     * @param isAlwaysOnTop is the target always on top
     * @param isAlwaysOnTop is the target always on top
     * @param windowType the type of the target
     * @param attrs the layout params of the target
     * @param state the input inset state containing all the sources
     * @param state the input inset state containing all the sources
     * @return The state stripped of the necessary information.
     * @return The state stripped of the necessary information.
     */
     */
    InsetsState enforceInsetsPolicyForTarget(@InternalInsetsType int type,
    InsetsState enforceInsetsPolicyForTarget(@WindowConfiguration.WindowingMode int windowingMode,
            @WindowConfiguration.WindowingMode int windowingMode, boolean isAlwaysOnTop,
            boolean isAlwaysOnTop, WindowManager.LayoutParams attrs, InsetsState state) {
            int windowType, InsetsState state) {
        boolean stateCopied = false;
        boolean stateCopied = false;


        if (type != ITYPE_INVALID) {
        if (attrs.providedInsets != null && attrs.providedInsets.length > 0) {
            state = new InsetsState(state);
            state = new InsetsState(state);
            stateCopied = true;
            stateCopied = true;
            state.removeSource(type);
            for (int i = attrs.providedInsets.length - 1; i >= 0; i--) {

                state.removeSource(attrs.providedInsets[i].type);
            // Navigation bar doesn't get influenced by anything else
            if (type == ITYPE_NAVIGATION_BAR || type == ITYPE_EXTRA_NAVIGATION_BAR) {
                state.removeSource(ITYPE_STATUS_BAR);
                state.removeSource(ITYPE_CLIMATE_BAR);
                state.removeSource(ITYPE_CAPTION_BAR);
                state.removeSource(ITYPE_NAVIGATION_BAR);
                state.removeSource(ITYPE_EXTRA_NAVIGATION_BAR);
            }

            // Status bar doesn't get influenced by caption bar
            if (type == ITYPE_STATUS_BAR || type == ITYPE_CLIMATE_BAR) {
                state.removeSource(ITYPE_CAPTION_BAR);
            }
            }
        }
        }
        ArrayMap<Integer, WindowContainerInsetsSourceProvider> providers = mStateController
        ArrayMap<Integer, WindowContainerInsetsSourceProvider> providers = mStateController
                .getSourceProviders();
                .getSourceProviders();
        for (int i = providers.size() - 1; i >= 0; i--) {
        for (int i = providers.size() - 1; i >= 0; i--) {
            WindowContainerInsetsSourceProvider otherProvider = providers.valueAt(i);
            WindowContainerInsetsSourceProvider otherProvider = providers.valueAt(i);
            if (otherProvider.overridesFrame(windowType)) {
            if (otherProvider.overridesFrame(attrs.type)) {
                if (!stateCopied) {
                if (!stateCopied) {
                    state = new InsetsState(state);
                    state = new InsetsState(state);
                    stateCopied = true;
                    stateCopied = true;
                }
                }
                InsetsSource override =
                InsetsSource override =
                        new InsetsSource(state.getSource(otherProvider.getSource().getType()));
                        new InsetsSource(state.getSource(otherProvider.getSource().getType()));
                override.setFrame(otherProvider.getOverriddenFrame(windowType));
                override.setFrame(otherProvider.getOverriddenFrame(attrs.type));
                state.addSource(override);
                state.addSource(override);
            }
            }
        }
        }
+2 −6
Original line number Original line Diff line number Diff line
@@ -29,7 +29,6 @@ import static android.os.InputConstants.DEFAULT_DISPATCHING_TIMEOUT_MILLIS;
import static android.os.PowerManager.DRAW_WAKE_LOCK;
import static android.os.PowerManager.DRAW_WAKE_LOCK;
import static android.os.Trace.TRACE_TAG_WINDOW_MANAGER;
import static android.os.Trace.TRACE_TAG_WINDOW_MANAGER;
import static android.view.InsetsState.ITYPE_IME;
import static android.view.InsetsState.ITYPE_IME;
import static android.view.InsetsState.ITYPE_INVALID;
import static android.view.SurfaceControl.Transaction;
import static android.view.SurfaceControl.Transaction;
import static android.view.SurfaceControl.getGlobalTransaction;
import static android.view.SurfaceControl.getGlobalTransaction;
import static android.view.ViewRootImpl.LOCAL_LAYOUT;
import static android.view.ViewRootImpl.LOCAL_LAYOUT;
@@ -1673,14 +1672,11 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP
        if (rotatedState != null) {
        if (rotatedState != null) {
            return insetsPolicy.adjustInsetsForWindow(this, rotatedState);
            return insetsPolicy.adjustInsetsForWindow(this, rotatedState);
        }
        }
        final InsetsSourceProvider provider = getControllableInsetProvider();
        final @InternalInsetsType int insetTypeProvidedByWindow = provider != null
                ? provider.getSource().getType() : ITYPE_INVALID;
        final InsetsState rawInsetsState =
        final InsetsState rawInsetsState =
                mFrozenInsetsState != null ? mFrozenInsetsState : getMergedInsetsState();
                mFrozenInsetsState != null ? mFrozenInsetsState : getMergedInsetsState();
        final InsetsState insetsStateForWindow = insetsPolicy
        final InsetsState insetsStateForWindow = insetsPolicy
                .enforceInsetsPolicyForTarget(insetTypeProvidedByWindow,
                .enforceInsetsPolicyForTarget(
                        getWindowingMode(), isAlwaysOnTop(), mAttrs.type, rawInsetsState);
                        getWindowingMode(), isAlwaysOnTop(), mAttrs, rawInsetsState);
        return insetsPolicy.adjustInsetsForWindow(this, insetsStateForWindow,
        return insetsPolicy.adjustInsetsForWindow(this, insetsStateForWindow,
                includeTransient);
                includeTransient);
    }
    }