summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--quickstep/src/com/android/quickstep/ActivityControlHelper.java4
-rw-r--r--src/com/android/launcher3/TestProtocol.java27
-rw-r--r--src/com/android/launcher3/allapps/AllAppsContainerView.java6
-rw-r--r--src/com/android/launcher3/compat/AccessibilityManagerCompat.java3
-rw-r--r--src/com/android/launcher3/touch/AbstractStateChangeTouchController.java4
-rw-r--r--tests/Android.mk3
-rw-r--r--tests/tapl/com/android/launcher3/tapl/AllApps.java6
-rw-r--r--tests/tapl/com/android/launcher3/tapl/LauncherInstrumentation.java5
8 files changed, 48 insertions, 10 deletions
diff --git a/quickstep/src/com/android/quickstep/ActivityControlHelper.java b/quickstep/src/com/android/quickstep/ActivityControlHelper.java
index 185080eef..322e270e2 100644
--- a/quickstep/src/com/android/quickstep/ActivityControlHelper.java
+++ b/quickstep/src/com/android/quickstep/ActivityControlHelper.java
@@ -51,6 +51,7 @@ import com.android.launcher3.LauncherAppState;
import com.android.launcher3.LauncherInitListener;
import com.android.launcher3.LauncherState;
import com.android.launcher3.R;
+import com.android.launcher3.TestProtocol;
import com.android.launcher3.allapps.AllAppsTransitionController;
import com.android.launcher3.allapps.DiscoveryBounce;
import com.android.launcher3.anim.AnimationSuccessListener;
@@ -233,7 +234,8 @@ public interface ActivityControlHelper<T extends BaseDraggingActivity> {
// Optimization, hide the all apps view to prevent layout while initializing
activity.getAppsView().getContentView().setVisibility(View.GONE);
- AccessibilityManagerCompat.sendEventToTest(activity, "TAPL_WENT_TO_STATE");
+ AccessibilityManagerCompat.sendEventToTest(
+ activity, TestProtocol.SWITCHED_TO_STATE_MESSAGE);
}
return new AnimationFactory() {
diff --git a/src/com/android/launcher3/TestProtocol.java b/src/com/android/launcher3/TestProtocol.java
new file mode 100644
index 000000000..0a3b86d63
--- /dev/null
+++ b/src/com/android/launcher3/TestProtocol.java
@@ -0,0 +1,27 @@
+/*
+ * Copyright (C) 2018 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.launcher3;
+
+/**
+ * Protocol for custom accessibility events for communication with UI Automation tests.
+ */
+public final class TestProtocol {
+ public static final String GET_SCROLL_MESSAGE = "TAPL_GET_SCROLL";
+ public static final String SCROLL_Y_FIELD = "scrollY";
+ public static final String SWITCHED_TO_STATE_MESSAGE = "TAPL_SWITCHED_TO_STATE";
+ public static final String RESPONSE_MESSAGE_POSTFIX = "_RESPONSE";
+}
diff --git a/src/com/android/launcher3/allapps/AllAppsContainerView.java b/src/com/android/launcher3/allapps/AllAppsContainerView.java
index e5cda21f1..6908ab48a 100644
--- a/src/com/android/launcher3/allapps/AllAppsContainerView.java
+++ b/src/com/android/launcher3/allapps/AllAppsContainerView.java
@@ -42,6 +42,7 @@ import com.android.launcher3.InsettableFrameLayout;
import com.android.launcher3.ItemInfo;
import com.android.launcher3.Launcher;
import com.android.launcher3.R;
+import com.android.launcher3.TestProtocol;
import com.android.launcher3.Utilities;
import com.android.launcher3.compat.AccessibilityManagerCompat;
import com.android.launcher3.config.FeatureFlags;
@@ -576,9 +577,10 @@ public class AllAppsContainerView extends SpringRelativeLayout implements DragSo
@Override
public boolean performAccessibilityAction(int action, Bundle arguments) {
if (AccessibilityManagerCompat.processTestRequest(
- mLauncher, "TAPL_GET_SCROLL", action, arguments,
+ mLauncher, TestProtocol.GET_SCROLL_MESSAGE, action, arguments,
response ->
- response.putInt("scrollY", getActiveRecyclerView().getCurrentScrollY()))) {
+ response.putInt(TestProtocol.SCROLL_Y_FIELD,
+ getActiveRecyclerView().getCurrentScrollY()))) {
return true;
}
diff --git a/src/com/android/launcher3/compat/AccessibilityManagerCompat.java b/src/com/android/launcher3/compat/AccessibilityManagerCompat.java
index 3b0226e1c..02da86186 100644
--- a/src/com/android/launcher3/compat/AccessibilityManagerCompat.java
+++ b/src/com/android/launcher3/compat/AccessibilityManagerCompat.java
@@ -23,6 +23,7 @@ import android.view.accessibility.AccessibilityEvent;
import android.view.accessibility.AccessibilityManager;
import android.view.accessibility.AccessibilityNodeInfo;
+import com.android.launcher3.TestProtocol;
import com.android.launcher3.Utilities;
public class AccessibilityManagerCompat {
@@ -95,7 +96,7 @@ public class AccessibilityManagerCompat {
final Bundle response = new Bundle();
responseFiller.accept(response);
AccessibilityManagerCompat.sendEventToTest(
- accessibilityManager, eventTag + "_RESPONSE", response);
+ accessibilityManager, eventTag + TestProtocol.RESPONSE_MESSAGE_POSTFIX, response);
return true;
}
return false;
diff --git a/src/com/android/launcher3/touch/AbstractStateChangeTouchController.java b/src/com/android/launcher3/touch/AbstractStateChangeTouchController.java
index 0e277eabc..fd9157e21 100644
--- a/src/com/android/launcher3/touch/AbstractStateChangeTouchController.java
+++ b/src/com/android/launcher3/touch/AbstractStateChangeTouchController.java
@@ -39,6 +39,7 @@ import com.android.launcher3.LauncherState;
import com.android.launcher3.LauncherStateManager.AnimationComponents;
import com.android.launcher3.LauncherStateManager.AnimationConfig;
import com.android.launcher3.LauncherStateManager.StateHandler;
+import com.android.launcher3.TestProtocol;
import com.android.launcher3.Utilities;
import com.android.launcher3.anim.AnimationSuccessListener;
import com.android.launcher3.anim.AnimatorPlaybackController;
@@ -517,7 +518,8 @@ public abstract class AbstractStateChangeTouchController
}
mLauncher.getStateManager().goToState(targetState, false /* animated */);
- AccessibilityManagerCompat.sendEventToTest(mLauncher, "TAPL_WENT_TO_STATE");
+ AccessibilityManagerCompat.sendEventToTest(
+ mLauncher, TestProtocol.SWITCHED_TO_STATE_MESSAGE);
}
}
diff --git a/tests/Android.mk b/tests/Android.mk
index 1531c32df..03cb154a4 100644
--- a/tests/Android.mk
+++ b/tests/Android.mk
@@ -46,7 +46,8 @@ LOCAL_STATIC_JAVA_LIBRARIES := \
libSharedSystemUI
LOCAL_SRC_FILES := $(call all-java-files-under, tapl) \
- ../quickstep/src/com/android/quickstep/SwipeUpSetting.java
+ ../quickstep/src/com/android/quickstep/SwipeUpSetting.java \
+ ../src/com/android/launcher3/TestProtocol.java
LOCAL_SDK_VERSION := current
LOCAL_MODULE := ub-launcher-aosp-tapl
diff --git a/tests/tapl/com/android/launcher3/tapl/AllApps.java b/tests/tapl/com/android/launcher3/tapl/AllApps.java
index d64f86cbc..c3bc61bab 100644
--- a/tests/tapl/com/android/launcher3/tapl/AllApps.java
+++ b/tests/tapl/com/android/launcher3/tapl/AllApps.java
@@ -24,6 +24,8 @@ import android.support.test.uiautomator.UiObject2;
import androidx.annotation.NonNull;
+import com.android.launcher3.TestProtocol;
+
/**
* Operations on AllApps opened from Home. Also a parent for All Apps opened from Overview.
*/
@@ -96,8 +98,8 @@ public class AllApps extends LauncherInstrumentation.VisibleContainer {
}
private int getScroll(UiObject2 allAppsContainer) {
- return mLauncher.getAnswerFromLauncher(allAppsContainer, "TAPL_GET_SCROLL").
- getInt("scrollY", -1);
+ return mLauncher.getAnswerFromLauncher(allAppsContainer, TestProtocol.GET_SCROLL_MESSAGE).
+ getInt(TestProtocol.SCROLL_Y_FIELD, -1);
}
private void ensureIconVisible(UiObject2 appIcon, UiObject2 allAppsContainer) {
diff --git a/tests/tapl/com/android/launcher3/tapl/LauncherInstrumentation.java b/tests/tapl/com/android/launcher3/tapl/LauncherInstrumentation.java
index fa282c333..01e76f3f3 100644
--- a/tests/tapl/com/android/launcher3/tapl/LauncherInstrumentation.java
+++ b/tests/tapl/com/android/launcher3/tapl/LauncherInstrumentation.java
@@ -34,6 +34,7 @@ import android.support.test.uiautomator.UiObject2;
import android.support.test.uiautomator.Until;
import android.view.accessibility.AccessibilityEvent;
+import com.android.launcher3.TestProtocol;
import com.android.quickstep.SwipeUpSetting;
import java.lang.ref.WeakReference;
@@ -174,7 +175,7 @@ public final class LauncherInstrumentation {
Bundle getAnswerFromLauncher(UiObject2 view, String requestTag) {
// Send a fake set-text request to Launcher to initiate a response with requested data.
- final String responseTag = requestTag + "_RESPONSE";
+ final String responseTag = requestTag + TestProtocol.RESPONSE_MESSAGE_POSTFIX;
return executeAndWaitForEvent(
() -> view.setText(requestTag),
event -> responseTag.equals(event.getClassName()),
@@ -338,7 +339,7 @@ public final class LauncherInstrumentation {
void swipe(int startX, int startY, int endX, int endY) {
executeAndWaitForEvent(
() -> mDevice.swipe(startX, startY, endX, endY, 60),
- event -> "TAPL_WENT_TO_STATE".equals(event.getClassName()),
+ event -> TestProtocol.SWITCHED_TO_STATE_MESSAGE.equals(event.getClassName()),
"Swipe failed to receive an event for the swipe end: " + startX + ", " + startY
+ ", " + endX + ", " + endY);
}