diff --git a/core/java/android/view/WindowManager.java b/core/java/android/view/WindowManager.java index f57e5209f5a43..3ce3fabbd6fea 100644 --- a/core/java/android/view/WindowManager.java +++ b/core/java/android/view/WindowManager.java @@ -3530,6 +3530,14 @@ public interface WindowManager extends ViewManager { */ public Insets providedInternalInsets = Insets.NONE; + /** + * If specified, the insets provided by this window for the IME will be our window frame + * minus the insets specified by providedInternalImeInsets. + * + * @hide + */ + public Insets providedInternalImeInsets = Insets.NONE; + /** * {@link LayoutParams} to be applied to the window when layout with a assigned rotation. * This will make layout during rotation change smoothly. @@ -3904,6 +3912,7 @@ public interface WindowManager extends ViewManager { out.writeInt(0); } providedInternalInsets.writeToParcel(out, 0 /* parcelableFlags */); + providedInternalImeInsets.writeToParcel(out, 0 /* parcelableFlags */); if (paramsForRotation != null) { checkNonRecursiveParams(); out.writeInt(paramsForRotation.length); @@ -3983,6 +3992,7 @@ public interface WindowManager extends ViewManager { in.readIntArray(providesInsetsTypes); } providedInternalInsets = Insets.CREATOR.createFromParcel(in); + providedInternalImeInsets = Insets.CREATOR.createFromParcel(in); int paramsForRotationLength = in.readInt(); if (paramsForRotationLength > 0) { paramsForRotation = new LayoutParams[paramsForRotationLength]; @@ -4289,6 +4299,11 @@ public interface WindowManager extends ViewManager { changes |= LAYOUT_CHANGED; } + if (!providedInternalImeInsets.equals(o.providedInternalImeInsets)) { + providedInternalImeInsets = o.providedInternalImeInsets; + changes |= LAYOUT_CHANGED; + } + if (!Arrays.equals(paramsForRotation, o.paramsForRotation)) { paramsForRotation = o.paramsForRotation; checkNonRecursiveParams(); @@ -4494,6 +4509,10 @@ public interface WindowManager extends ViewManager { sb.append(" providedInternalInsets="); sb.append(providedInternalInsets); } + if (!providedInternalImeInsets.equals(Insets.NONE)) { + sb.append(" providedInternalImeInsets="); + sb.append(providedInternalImeInsets); + } if (paramsForRotation != null && paramsForRotation.length != 0) { sb.append(System.lineSeparator()); sb.append(prefix).append(" paramsForRotation="); diff --git a/core/res/res/values/dimens.xml b/core/res/res/values/dimens.xml index e8bb6067932ec..ec5110728071c 100644 --- a/core/res/res/values/dimens.xml +++ b/core/res/res/values/dimens.xml @@ -55,6 +55,8 @@ 48dp 48dp + + 60dp 12dp diff --git a/core/res/res/values/symbols.xml b/core/res/res/values/symbols.xml index 77a45f9caf7f6..d7a477be9549c 100644 --- a/core/res/res/values/symbols.xml +++ b/core/res/res/values/symbols.xml @@ -1741,6 +1741,7 @@ + diff --git a/libs/WindowManager/Shell/src/com/android/wm/shell/common/split/DividerView.java b/libs/WindowManager/Shell/src/com/android/wm/shell/common/split/DividerView.java index 826e2f5c2f74a..f35c8e1c59291 100644 --- a/libs/WindowManager/Shell/src/com/android/wm/shell/common/split/DividerView.java +++ b/libs/WindowManager/Shell/src/com/android/wm/shell/common/split/DividerView.java @@ -58,16 +58,8 @@ public class DividerView extends FrameLayout implements View.OnTouchListener { // TODO(b/191269755): use the value defined in InsetsController. private static final int ANIMATION_DURATION_RESIZE = 300; - /** - * The task bar height defined in launcher. Used to determine whether to insets divider bounds - * or not. - */ - private static final int EXPANDED_TASK_BAR_HEIGHT_IN_DP = 60; - /** The task bar expanded height. Used to determine whether to insets divider bounds or not. */ - private final float mExpandedTaskBarHeight = TypedValue.applyDimension( - TypedValue.COMPLEX_UNIT_DIP, EXPANDED_TASK_BAR_HEIGHT_IN_DP, - getResources().getDisplayMetrics()); + private float mExpandedTaskBarHeight; private final int mTouchSlop = ViewConfiguration.get(getContext()).getScaledTouchSlop(); @@ -167,6 +159,8 @@ public class DividerView extends FrameLayout implements View.OnTouchListener { mDividerBar = findViewById(R.id.divider_bar); mHandle = findViewById(R.id.docked_divider_handle); mBackground = findViewById(R.id.docked_divider_background); + mExpandedTaskBarHeight = getResources().getDimensionPixelSize( + com.android.internal.R.dimen.taskbar_frame_height); mTouchElevation = getResources().getDimensionPixelSize( R.dimen.docked_stack_divider_lift_elevation); mDoubleTapDetector = new GestureDetector(getContext(), new DoubleTapListener()); diff --git a/services/core/java/com/android/server/wm/DisplayPolicy.java b/services/core/java/com/android/server/wm/DisplayPolicy.java index c1d6c1765a7a6..d58679883eaab 100644 --- a/services/core/java/com/android/server/wm/DisplayPolicy.java +++ b/services/core/java/com/android/server/wm/DisplayPolicy.java @@ -1175,6 +1175,12 @@ public class DisplayPolicy { default: if (attrs.providesInsetsTypes != null) { for (@InternalInsetsType int insetsType : attrs.providesInsetsTypes) { + final TriConsumer imeFrameProvider = + !attrs.providedInternalImeInsets.equals(Insets.NONE) + ? (displayFrames, windowState, inOutFrame) -> + inOutFrame.inset(windowState.getLayoutingAttrs( + displayFrames.mRotation).providedInternalImeInsets) + : null; switch (insetsType) { case ITYPE_STATUS_BAR: mStatusBarAlt = win; @@ -1194,12 +1200,13 @@ public class DisplayPolicy { break; } if (!INSETS_LAYOUT_GENERALIZATION) { - mDisplayContent.setInsetProvider(insetsType, win, null); + mDisplayContent.setInsetProvider(insetsType, win, null, + imeFrameProvider); } else { mDisplayContent.setInsetProvider(insetsType, win, (displayFrames, windowState, inOutFrame) -> inOutFrame.inset( windowState.getLayoutingAttrs(displayFrames.mRotation) - .providedInternalInsets)); + .providedInternalInsets), imeFrameProvider); } } }