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

Commit 5d5f0987 authored by Winson Chung's avatar Winson Chung
Browse files

Always inset the IME by the extra nav bar frame height

- If the taskbar is collapsed and isn't providing full insets to the
  app, we still want the IME to be inset for the nav button that shows

Fixes: 197727397
Test: Collapse taskbar, open IME
Change-Id: I9f2367344385c9a23e2d6323637a0b2d1713b169
parent f9387616
Loading
Loading
Loading
Loading
+19 −0
Original line number Diff line number Diff line
@@ -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=");
+2 −0
Original line number Diff line number Diff line
@@ -55,6 +55,8 @@
    <dimen name="navigation_bar_height_landscape">48dp</dimen>
    <!-- Width of the navigation bar when it is placed vertically on the screen -->
    <dimen name="navigation_bar_width">48dp</dimen>
    <!-- Height of the bottom taskbar not including decorations like rounded corners. -->
    <dimen name="taskbar_frame_height">60dp</dimen>
    <!-- How much we expand the touchable region of the status bar below the notch to catch touches
         that just start below the notch. -->
    <dimen name="display_cutout_touchable_region_size">12dp</dimen>
+1 −0
Original line number Diff line number Diff line
@@ -1741,6 +1741,7 @@
  <java-symbol type="dimen" name="navigation_bar_height_car_mode" />
  <java-symbol type="dimen" name="navigation_bar_height_landscape_car_mode" />
  <java-symbol type="dimen" name="navigation_bar_width_car_mode" />
  <java-symbol type="dimen" name="taskbar_frame_height" />
  <java-symbol type="dimen" name="status_bar_height" />
  <java-symbol type="dimen" name="display_cutout_touchable_region_size" />
  <java-symbol type="dimen" name="quick_qs_offset_height" />
+3 −9
Original line number Diff line number Diff line
@@ -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());
+9 −2
Original line number Diff line number Diff line
@@ -1175,6 +1175,12 @@ public class DisplayPolicy {
            default:
                if (attrs.providesInsetsTypes != null) {
                    for (@InternalInsetsType int insetsType : attrs.providesInsetsTypes) {
                        final TriConsumer<DisplayFrames, WindowState, Rect> 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);
                        }
                    }
                }