Loading services/core/java/com/android/server/wm/InsetsPolicy.java +16 −32 Original line number Diff line number Diff line Loading @@ -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.LAYOUT_INSETS_DURING_ANIMATION_HIDDEN; 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_EXTRA_NAVIGATION_BAR; import static android.view.InsetsState.ITYPE_IME; Loading Loading @@ -289,9 +288,8 @@ class InsetsPolicy { final boolean alwaysOnTop = token != null && token.isAlwaysOnTop(); // Always use windowing mode fullscreen when get insets for window metrics to make sure it // contains all insets types. final InsetsState originalState = mDisplayContent.getInsetsPolicy() .enforceInsetsPolicyForTarget(type, WINDOWING_MODE_FULLSCREEN, alwaysOnTop, attrs.type, mStateController.getRawInsetsState()); final InsetsState originalState = enforceInsetsPolicyForTarget(WINDOWING_MODE_FULLSCREEN, alwaysOnTop, attrs, mStateController.getRawInsetsState()); InsetsState state = adjustVisibilityForTransientTypes(originalState); return adjustInsetsForRoundedCorners(token, state, state == originalState); } Loading Loading @@ -343,56 +341,42 @@ class InsetsPolicy { /** * Modifies the given {@code state} according to the {@code type} (Inset type) provided by * the target. * When performing layout of the target or dispatching insets to the target, we need to exclude * sources which should not be visible to the target. e.g., the source which represents the * target window itself, and the IME source when the target is above IME. We also need to * exclude certain types of insets source for client within specific windowing modes. * Modifies the given {@code state} according to the target's window state. * When performing layout of the target or dispatching insets to the target, we need to adjust * sources based on the target. e.g., the floating window will not receive system bars other * than caption, and some insets provider may request to override sizes for given window types. * Since the window type and the insets types provided by the window shall not change at * 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 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 * @return The state stripped of the necessary information. */ InsetsState enforceInsetsPolicyForTarget(@InternalInsetsType int type, @WindowConfiguration.WindowingMode int windowingMode, boolean isAlwaysOnTop, int windowType, InsetsState state) { InsetsState enforceInsetsPolicyForTarget(@WindowConfiguration.WindowingMode int windowingMode, boolean isAlwaysOnTop, WindowManager.LayoutParams attrs, InsetsState state) { boolean stateCopied = false; if (type != ITYPE_INVALID) { if (attrs.providedInsets != null && attrs.providedInsets.length > 0) { state = new InsetsState(state); stateCopied = true; state.removeSource(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); for (int i = attrs.providedInsets.length - 1; i >= 0; i--) { state.removeSource(attrs.providedInsets[i].type); } } ArrayMap<Integer, WindowContainerInsetsSourceProvider> providers = mStateController .getSourceProviders(); for (int i = providers.size() - 1; i >= 0; i--) { WindowContainerInsetsSourceProvider otherProvider = providers.valueAt(i); if (otherProvider.overridesFrame(windowType)) { if (otherProvider.overridesFrame(attrs.type)) { if (!stateCopied) { state = new InsetsState(state); stateCopied = true; } InsetsSource override = new InsetsSource(state.getSource(otherProvider.getSource().getType())); override.setFrame(otherProvider.getOverriddenFrame(windowType)); override.setFrame(otherProvider.getOverriddenFrame(attrs.type)); state.addSource(override); } } Loading services/core/java/com/android/server/wm/WindowState.java +2 −6 Original line number Diff line number Diff line Loading @@ -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.Trace.TRACE_TAG_WINDOW_MANAGER; 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.getGlobalTransaction; import static android.view.ViewRootImpl.LOCAL_LAYOUT; Loading Loading @@ -1673,14 +1672,11 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP if (rotatedState != null) { return insetsPolicy.adjustInsetsForWindow(this, rotatedState); } final InsetsSourceProvider provider = getControllableInsetProvider(); final @InternalInsetsType int insetTypeProvidedByWindow = provider != null ? provider.getSource().getType() : ITYPE_INVALID; final InsetsState rawInsetsState = mFrozenInsetsState != null ? mFrozenInsetsState : getMergedInsetsState(); final InsetsState insetsStateForWindow = insetsPolicy .enforceInsetsPolicyForTarget(insetTypeProvidedByWindow, getWindowingMode(), isAlwaysOnTop(), mAttrs.type, rawInsetsState); .enforceInsetsPolicyForTarget( getWindowingMode(), isAlwaysOnTop(), mAttrs, rawInsetsState); return insetsPolicy.adjustInsetsForWindow(this, insetsStateForWindow, includeTransient); } Loading Loading
services/core/java/com/android/server/wm/InsetsPolicy.java +16 −32 Original line number Diff line number Diff line Loading @@ -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.LAYOUT_INSETS_DURING_ANIMATION_HIDDEN; 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_EXTRA_NAVIGATION_BAR; import static android.view.InsetsState.ITYPE_IME; Loading Loading @@ -289,9 +288,8 @@ class InsetsPolicy { final boolean alwaysOnTop = token != null && token.isAlwaysOnTop(); // Always use windowing mode fullscreen when get insets for window metrics to make sure it // contains all insets types. final InsetsState originalState = mDisplayContent.getInsetsPolicy() .enforceInsetsPolicyForTarget(type, WINDOWING_MODE_FULLSCREEN, alwaysOnTop, attrs.type, mStateController.getRawInsetsState()); final InsetsState originalState = enforceInsetsPolicyForTarget(WINDOWING_MODE_FULLSCREEN, alwaysOnTop, attrs, mStateController.getRawInsetsState()); InsetsState state = adjustVisibilityForTransientTypes(originalState); return adjustInsetsForRoundedCorners(token, state, state == originalState); } Loading Loading @@ -343,56 +341,42 @@ class InsetsPolicy { /** * Modifies the given {@code state} according to the {@code type} (Inset type) provided by * the target. * When performing layout of the target or dispatching insets to the target, we need to exclude * sources which should not be visible to the target. e.g., the source which represents the * target window itself, and the IME source when the target is above IME. We also need to * exclude certain types of insets source for client within specific windowing modes. * Modifies the given {@code state} according to the target's window state. * When performing layout of the target or dispatching insets to the target, we need to adjust * sources based on the target. e.g., the floating window will not receive system bars other * than caption, and some insets provider may request to override sizes for given window types. * Since the window type and the insets types provided by the window shall not change at * 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 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 * @return The state stripped of the necessary information. */ InsetsState enforceInsetsPolicyForTarget(@InternalInsetsType int type, @WindowConfiguration.WindowingMode int windowingMode, boolean isAlwaysOnTop, int windowType, InsetsState state) { InsetsState enforceInsetsPolicyForTarget(@WindowConfiguration.WindowingMode int windowingMode, boolean isAlwaysOnTop, WindowManager.LayoutParams attrs, InsetsState state) { boolean stateCopied = false; if (type != ITYPE_INVALID) { if (attrs.providedInsets != null && attrs.providedInsets.length > 0) { state = new InsetsState(state); stateCopied = true; state.removeSource(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); for (int i = attrs.providedInsets.length - 1; i >= 0; i--) { state.removeSource(attrs.providedInsets[i].type); } } ArrayMap<Integer, WindowContainerInsetsSourceProvider> providers = mStateController .getSourceProviders(); for (int i = providers.size() - 1; i >= 0; i--) { WindowContainerInsetsSourceProvider otherProvider = providers.valueAt(i); if (otherProvider.overridesFrame(windowType)) { if (otherProvider.overridesFrame(attrs.type)) { if (!stateCopied) { state = new InsetsState(state); stateCopied = true; } InsetsSource override = new InsetsSource(state.getSource(otherProvider.getSource().getType())); override.setFrame(otherProvider.getOverriddenFrame(windowType)); override.setFrame(otherProvider.getOverriddenFrame(attrs.type)); state.addSource(override); } } Loading
services/core/java/com/android/server/wm/WindowState.java +2 −6 Original line number Diff line number Diff line Loading @@ -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.Trace.TRACE_TAG_WINDOW_MANAGER; 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.getGlobalTransaction; import static android.view.ViewRootImpl.LOCAL_LAYOUT; Loading Loading @@ -1673,14 +1672,11 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP if (rotatedState != null) { return insetsPolicy.adjustInsetsForWindow(this, rotatedState); } final InsetsSourceProvider provider = getControllableInsetProvider(); final @InternalInsetsType int insetTypeProvidedByWindow = provider != null ? provider.getSource().getType() : ITYPE_INVALID; final InsetsState rawInsetsState = mFrozenInsetsState != null ? mFrozenInsetsState : getMergedInsetsState(); final InsetsState insetsStateForWindow = insetsPolicy .enforceInsetsPolicyForTarget(insetTypeProvidedByWindow, getWindowingMode(), isAlwaysOnTop(), mAttrs.type, rawInsetsState); .enforceInsetsPolicyForTarget( getWindowingMode(), isAlwaysOnTop(), mAttrs, rawInsetsState); return insetsPolicy.adjustInsetsForWindow(this, insetsStateForWindow, includeTransient); } Loading