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

Commit 42d12bad authored by Brian Isganitis's avatar Brian Isganitis Committed by Android (Google) Code Review
Browse files

Merge "Support tapping outside container from above IME if visible." into main

parents baf6e6dd 6066c44e
Loading
Loading
Loading
Loading
+9 −0
Original line number Diff line number Diff line
@@ -32,6 +32,7 @@ import android.os.Bundle;
import android.view.WindowInsets;

import androidx.annotation.Nullable;
import androidx.core.view.WindowInsetsCompat;

import com.android.launcher3.CellLayout;
import com.android.launcher3.DeviceProfile;
@@ -142,6 +143,14 @@ public class TestInformationHandler implements ResourceBasedOverride {
                }, this::getCurrentActivity);
            }

            case TestProtocol.REQUEST_IME_INSETS: {
                return getUIProperty(Bundle::putParcelable, activity -> {
                    WindowInsetsCompat insets = WindowInsetsCompat.toWindowInsetsCompat(
                            activity.getWindow().getDecorView().getRootWindowInsets());
                    return insets.getInsets(WindowInsetsCompat.Type.ime()).toPlatformInsets();
                }, this::getCurrentActivity);
            }

            case TestProtocol.REQUEST_ICON_HEIGHT: {
                response.putInt(TestProtocol.TEST_INFO_RESPONSE_FIELD,
                        mDeviceProfile.allAppsCellHeightPx);
+1 −0
Original line number Diff line number Diff line
@@ -102,6 +102,7 @@ public final class TestProtocol {
    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_IME_INSETS = "ime-insets";
    public static final String REQUEST_PID = "pid";
    public static final String REQUEST_FORCE_GC = "gc";
    public static final String REQUEST_RECENT_TASKS_LIST = "recent-tasks-list";
+10 −1
Original line number Diff line number Diff line
@@ -341,6 +341,11 @@ public final class LauncherInstrumentation {
                .getParcelable(TestProtocol.TEST_INFO_RESPONSE_FIELD);
    }

    Insets getImeInsets() {
        return getTestInfo(TestProtocol.REQUEST_IME_INSETS)
                .getParcelable(TestProtocol.TEST_INFO_RESPONSE_FIELD);
    }

    public boolean isTablet() {
        return getTestInfo(TestProtocol.REQUEST_IS_TABLET)
                .getBoolean(TestProtocol.TEST_INFO_RESPONSE_FIELD);
@@ -2111,7 +2116,11 @@ public final class LauncherInstrumentation {
                        ? containerBounds.right + 1
                        : containerBounds.left - 1;
            }
            int y = containerBounds.top + containerBounds.height() / 2;
            // If IME is visible and overlaps the container bounds, touch above it.
            int bottomBound = Math.min(
                    containerBounds.bottom,
                    getRealDisplaySize().y - getImeInsets().bottom);
            int y = (bottomBound - containerBounds.top) / 2;

            final long downTime = SystemClock.uptimeMillis();
            final Point tapTarget = new Point(x, y);