Sharing protocol constants between Launcher and TAPL

Bug: 110103162
Test: TaplTests
Change-Id: I5b2a2b8576a7a6ea4a156f00858711496d6b5bba
diff --git a/tests/Android.mk b/tests/Android.mk
index 1531c32..03cb154 100644
--- a/tests/Android.mk
+++ b/tests/Android.mk
@@ -46,7 +46,8 @@
 	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 d64f86c..c3bc61b 100644
--- a/tests/tapl/com/android/launcher3/tapl/AllApps.java
+++ b/tests/tapl/com/android/launcher3/tapl/AllApps.java
@@ -24,6 +24,8 @@
 
 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 @@
     }
 
     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 fa282c3..01e76f3 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.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 @@
 
     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 @@
     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);
     }