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

Commit e9dbb0d9 authored by Alex Chau's avatar Alex Chau
Browse files

Use windowInsets for bottomGestureSize instead of gestureInsets

- getTargetInsets will be reverted to its behavior before ag/15431427
- getBottomGestureSize will use the new getWindowInset call uses windowInsets instead of the max of windowInsets/gestureInsets, with the taskbar inset calibration

Bug: 195263971
Test: com.android.launcher3.ui.widget.AddWidgetTest#testDragCustomShortcut
Change-Id: I89368edee5252a404ef490db6540734ec4806f2b
parent 0a39f6da
Loading
Loading
Loading
Loading
+13 −5
Original line number Original line Diff line number Diff line
@@ -102,14 +102,22 @@ public class TestInformationHandler implements ResourceBasedOverride {
                        l -> WidgetsFullSheet.getWidgetsView(l).getCurrentScrollY());
                        l -> WidgetsFullSheet.getWidgetsView(l).getCurrentScrollY());
            }
            }


            case TestProtocol.REQUEST_TARGET_INSETS: {
                return getUIProperty(Bundle::putParcelable, activity -> {
                    WindowInsets insets = activity.getWindow()
                            .getDecorView().getRootWindowInsets();
                    return Insets.max(
                            insets.getSystemGestureInsets(),
                            insets.getSystemWindowInsets());
                }, this::getCurrentActivity);
            }

            case TestProtocol.REQUEST_WINDOW_INSETS: {
            case TestProtocol.REQUEST_WINDOW_INSETS: {
                return getUIProperty(Bundle::putParcelable, a -> {
                return getUIProperty(Bundle::putParcelable, activity -> {
                    WindowInsets insets = a.getWindow()
                    WindowInsets insets = activity.getWindow()
                            .getDecorView().getRootWindowInsets();
                            .getDecorView().getRootWindowInsets();
                    return Insets.subtract(
                    return Insets.subtract(
                            Insets.max(
                            insets.getSystemWindowInsets(),
                                    insets.getSystemGestureInsets(),
                                    insets.getSystemWindowInsets()),
                            Insets.of(0, 0, 0, mDeviceProfile.nonOverlappingTaskbarInset));
                            Insets.of(0, 0, 0, mDeviceProfile.nonOverlappingTaskbarInset));
                }, this::getCurrentActivity);
                }, this::getCurrentActivity);
            }
            }
+1 −0
Original line number Original line Diff line number Diff line
@@ -86,6 +86,7 @@ public final class TestProtocol {
    public static final String REQUEST_APP_LIST_FREEZE_FLAGS = "app-list-freeze-flags";
    public static final String REQUEST_APP_LIST_FREEZE_FLAGS = "app-list-freeze-flags";
    public static final String REQUEST_APPS_LIST_SCROLL_Y = "apps-list-scroll-y";
    public static final String REQUEST_APPS_LIST_SCROLL_Y = "apps-list-scroll-y";
    public static final String REQUEST_WIDGETS_SCROLL_Y = "widgets-scroll-y";
    public static final String REQUEST_WIDGETS_SCROLL_Y = "widgets-scroll-y";
    public static final String REQUEST_TARGET_INSETS = "target-insets";
    public static final String REQUEST_WINDOW_INSETS = "window-insets";
    public static final String REQUEST_WINDOW_INSETS = "window-insets";
    public static final String REQUEST_PID = "pid";
    public static final String REQUEST_PID = "pid";
    public static final String REQUEST_FORCE_GC = "gc";
    public static final String REQUEST_FORCE_GC = "gc";
+6 −1
Original line number Original line Diff line number Diff line
@@ -288,6 +288,11 @@ public final class LauncherInstrumentation {
    }
    }


    Insets getTargetInsets() {
    Insets getTargetInsets() {
        return getTestInfo(TestProtocol.REQUEST_TARGET_INSETS)
                .getParcelable(TestProtocol.TEST_INFO_RESPONSE_FIELD);
    }

    Insets getWindowInsets() {
        return getTestInfo(TestProtocol.REQUEST_WINDOW_INSETS)
        return getTestInfo(TestProtocol.REQUEST_WINDOW_INSETS)
                .getParcelable(TestProtocol.TEST_INFO_RESPONSE_FIELD);
                .getParcelable(TestProtocol.TEST_INFO_RESPONSE_FIELD);
    }
    }
@@ -1133,7 +1138,7 @@ public final class LauncherInstrumentation {
    }
    }


    int getBottomGestureSize() {
    int getBottomGestureSize() {
        return Math.max(getTargetInsets().bottom, ResourceUtils.getNavbarSize(
        return Math.max(getWindowInsets().bottom, ResourceUtils.getNavbarSize(
                ResourceUtils.NAVBAR_BOTTOM_GESTURE_SIZE, getResources())) + 1;
                ResourceUtils.NAVBAR_BOTTOM_GESTURE_SIZE, getResources())) + 1;
    }
    }