diff options
-rw-r--r-- | quickstep/recents_ui_overrides/src/com/android/quickstep/QuickstepTestInformationHandler.java (renamed from quickstep/src/com/android/quickstep/QuickstepTestInformationHandler.java) | 31 | ||||
-rw-r--r-- | quickstep/recents_ui_overrides/src/com/android/quickstep/views/RecentsView.java | 11 | ||||
-rw-r--r-- | src/com/android/launcher3/testing/TestProtocol.java | 2 | ||||
-rw-r--r-- | tests/tapl/com/android/launcher3/tapl/BaseOverview.java | 15 |
4 files changed, 54 insertions, 5 deletions
diff --git a/quickstep/src/com/android/quickstep/QuickstepTestInformationHandler.java b/quickstep/recents_ui_overrides/src/com/android/quickstep/QuickstepTestInformationHandler.java index 57ed244d2..b507044e0 100644 --- a/quickstep/src/com/android/quickstep/QuickstepTestInformationHandler.java +++ b/quickstep/recents_ui_overrides/src/com/android/quickstep/QuickstepTestInformationHandler.java @@ -3,11 +3,15 @@ package com.android.quickstep; import android.content.Context; import android.os.Bundle; +import com.android.launcher3.MainThreadExecutor; import com.android.launcher3.testing.TestInformationHandler; import com.android.launcher3.testing.TestProtocol; import com.android.launcher3.uioverrides.states.OverviewState; import com.android.launcher3.uioverrides.touchcontrollers.PortraitStatesTouchController; import com.android.quickstep.util.LayoutUtils; +import com.android.quickstep.views.RecentsView; + +import java.util.concurrent.ExecutionException; public class QuickstepTestInformationHandler extends TestInformationHandler { @@ -45,6 +49,33 @@ public class QuickstepTestInformationHandler extends TestInformationHandler { PortraitStatesTouchController.getHotseatTop(mLauncher)); return response; } + + case TestProtocol.REQUEST_OVERVIEW_LEFT_GESTURE_MARGIN: { + try { + final int leftMargin = new MainThreadExecutor().submit(() -> + mLauncher.<RecentsView>getOverviewPanel().getLeftGestureMargin()).get(); + response.putInt(TestProtocol.TEST_INFO_RESPONSE_FIELD, leftMargin); + } catch (ExecutionException e) { + e.printStackTrace(); + } catch (InterruptedException e) { + e.printStackTrace(); + } + return response; + } + + case TestProtocol.REQUEST_OVERVIEW_RIGHT_GESTURE_MARGIN: { + try { + final int rightMargin = new MainThreadExecutor().submit(() -> + mLauncher.<RecentsView>getOverviewPanel().getRightGestureMargin()). + get(); + response.putInt(TestProtocol.TEST_INFO_RESPONSE_FIELD, rightMargin); + } catch (ExecutionException e) { + e.printStackTrace(); + } catch (InterruptedException e) { + e.printStackTrace(); + } + return response; + } } return super.call(method); diff --git a/quickstep/recents_ui_overrides/src/com/android/quickstep/views/RecentsView.java b/quickstep/recents_ui_overrides/src/com/android/quickstep/views/RecentsView.java index 66ddc727f..b566837da 100644 --- a/quickstep/recents_ui_overrides/src/com/android/quickstep/views/RecentsView.java +++ b/quickstep/recents_ui_overrides/src/com/android/quickstep/views/RecentsView.java @@ -73,6 +73,7 @@ import android.view.MotionEvent; import android.view.View; import android.view.ViewDebug; import android.view.ViewGroup; +import android.view.WindowInsets; import android.view.accessibility.AccessibilityEvent; import android.view.accessibility.AccessibilityNodeInfo; import android.widget.ListView; @@ -1742,4 +1743,14 @@ public abstract class RecentsView<T extends BaseActivity> extends PagedView impl updateEnabledOverlays(); } } + + public int getLeftGestureMargin() { + final WindowInsets insets = getRootWindowInsets(); + return Math.max(insets.getSystemGestureInsets().left, insets.getSystemWindowInsetLeft()); + } + + public int getRightGestureMargin() { + final WindowInsets insets = getRootWindowInsets(); + return Math.max(insets.getSystemGestureInsets().right, insets.getSystemWindowInsetRight()); + } } diff --git a/src/com/android/launcher3/testing/TestProtocol.java b/src/com/android/launcher3/testing/TestProtocol.java index f69b27896..079ab6d8f 100644 --- a/src/com/android/launcher3/testing/TestProtocol.java +++ b/src/com/android/launcher3/testing/TestProtocol.java @@ -71,6 +71,8 @@ public final class TestProtocol { public static final String REQUEST_FREEZE_APP_LIST = "freeze-app-list"; public static final String REQUEST_UNFREEZE_APP_LIST = "unfreeze-app-list"; public static final String REQUEST_APP_LIST_FREEZE_FLAGS = "app-list-freeze-flags"; + public static final String REQUEST_OVERVIEW_LEFT_GESTURE_MARGIN = "overview-left-margin"; + public static final String REQUEST_OVERVIEW_RIGHT_GESTURE_MARGIN = "overview-right-margin"; public static boolean sDebugTracing = false; public static final String REQUEST_ENABLE_DEBUG_TRACING = "enable-debug-tracing"; diff --git a/tests/tapl/com/android/launcher3/tapl/BaseOverview.java b/tests/tapl/com/android/launcher3/tapl/BaseOverview.java index ae9386719..04a0f1271 100644 --- a/tests/tapl/com/android/launcher3/tapl/BaseOverview.java +++ b/tests/tapl/com/android/launcher3/tapl/BaseOverview.java @@ -23,6 +23,8 @@ import androidx.test.uiautomator.BySelector; import androidx.test.uiautomator.Direction; import androidx.test.uiautomator.UiObject2; +import com.android.launcher3.testing.TestProtocol; + import java.util.Collections; import java.util.List; @@ -30,7 +32,6 @@ import java.util.List; * Common overview pane for both Launcher and fallback recents */ public class BaseOverview extends LauncherInstrumentation.VisibleContainer { - private static final int FLING_SPEED = LauncherInstrumentation.isAvd() ? 500 : 1500; private static final int FLINGS_FOR_DISMISS_LIMIT = 40; BaseOverview(LauncherInstrumentation launcher) { @@ -51,8 +52,10 @@ public class BaseOverview extends LauncherInstrumentation.VisibleContainer { mLauncher.addContextLayer("want to fling forward in overview")) { LauncherInstrumentation.log("Overview.flingForward before fling"); final UiObject2 overview = verifyActiveContainer(); - mLauncher.scroll(overview, Direction.LEFT, 1, - new Rect(mLauncher.getEdgeSensitivityWidth(), 0, 0, 0), 20); + final int leftMargin = mLauncher.getTestInfo( + TestProtocol.REQUEST_OVERVIEW_LEFT_GESTURE_MARGIN). + getInt(TestProtocol.TEST_INFO_RESPONSE_FIELD); + mLauncher.scroll(overview, Direction.LEFT, 1, new Rect(leftMargin, 0, 0, 0), 20); verifyActiveContainer(); } } @@ -87,8 +90,10 @@ public class BaseOverview extends LauncherInstrumentation.VisibleContainer { mLauncher.addContextLayer("want to fling backward in overview")) { LauncherInstrumentation.log("Overview.flingBackward before fling"); final UiObject2 overview = verifyActiveContainer(); - mLauncher.scroll(overview, Direction.RIGHT, 1, - new Rect(0, 0, mLauncher.getEdgeSensitivityWidth(), 0), 20); + final int rightMargin = mLauncher.getTestInfo( + TestProtocol.REQUEST_OVERVIEW_RIGHT_GESTURE_MARGIN). + getInt(TestProtocol.TEST_INFO_RESPONSE_FIELD); + mLauncher.scroll(overview, Direction.RIGHT, 1, new Rect(0, 0, rightMargin, 0), 20); verifyActiveContainer(); } } |