summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorvadimt <vadimt@google.com>2019-07-17 16:27:12 -0700
committerandroid-build-merger <android-build-merger@google.com>2019-07-17 16:27:12 -0700
commit2254bcae3fda8bec18abced2d00e5ed0f539db9e (patch)
treeba37932e23e2f8bdb5d03faedad305fa5480bb28
parente5cb05f405a8f0469c64db1938688d0222c433b6 (diff)
parentaaf6c7ce56373aaf1b5a18054539abbf07c07459 (diff)
downloadandroid_packages_apps_Trebuchet-2254bcae3fda8bec18abced2d00e5ed0f539db9e.tar.gz
android_packages_apps_Trebuchet-2254bcae3fda8bec18abced2d00e5ed0f539db9e.tar.bz2
android_packages_apps_Trebuchet-2254bcae3fda8bec18abced2d00e5ed0f539db9e.zip
Merge "Using correct gesture margins in overview" into ub-launcher3-qt-r1-dev
am: aaf6c7ce56 Change-Id: I9e32e16101a837a61c9488f4b0d4484982778092
-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.java11
-rw-r--r--src/com/android/launcher3/testing/TestProtocol.java2
-rw-r--r--tests/tapl/com/android/launcher3/tapl/BaseOverview.java15
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();
}
}