Merge "Support tapping outside container from above IME if visible." into main
This commit is contained in:
committed by
Android (Google) Code Review
commit
42d12badd8
@@ -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);
|
||||
|
||||
@@ -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";
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user