diff options
author | Vadim Tryshev <vadimt@google.com> | 2018-08-14 19:53:43 -0700 |
---|---|---|
committer | Vadim Tryshev <vadimt@google.com> | 2018-08-14 19:53:43 -0700 |
commit | b6398a1eb8b69651e0f901a93d7b46347e5d6a83 (patch) | |
tree | d53a77ff6d7e3e93dc4c70ddfb38d83604dc9e84 /src | |
parent | e1c4a90635f18548d3cadab5866dd1aba7bbfea4 (diff) | |
download | android_packages_apps_Trebuchet-b6398a1eb8b69651e0f901a93d7b46347e5d6a83.tar.gz android_packages_apps_Trebuchet-b6398a1eb8b69651e0f901a93d7b46347e5d6a83.tar.bz2 android_packages_apps_Trebuchet-b6398a1eb8b69651e0f901a93d7b46347e5d6a83.zip |
Sharing protocol constants between Launcher and TAPL
Bug: 110103162
Test: TaplTests
Change-Id: I5b2a2b8576a7a6ea4a156f00858711496d6b5bba
Diffstat (limited to 'src')
4 files changed, 36 insertions, 4 deletions
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); } } |