1 /*
2  * Copyright (C) 2018 The Android Open Source Project
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 package com.android.launcher3.testing;
18 
19 /**
20  * Protocol for custom accessibility events for communication with UI Automation tests.
21  */
22 public final class TestProtocol {
23     public static final String GET_SCROLL_MESSAGE = "TAPL_GET_SCROLL";
24     public static final String SCROLL_Y_FIELD = "scrollY";
25     public static final String STATE_FIELD = "state";
26     public static final String SWITCHED_TO_STATE_MESSAGE = "TAPL_SWITCHED_TO_STATE";
27     public static final String SCROLL_FINISHED_MESSAGE = "TAPL_SCROLL_FINISHED";
28     public static final String PAUSE_DETECTED_MESSAGE = "TAPL_PAUSE_DETECTED";
29     public static final String RESPONSE_MESSAGE_POSTFIX = "_RESPONSE";
30     public static final int NORMAL_STATE_ORDINAL = 0;
31     public static final int SPRING_LOADED_STATE_ORDINAL = 1;
32     public static final int OVERVIEW_STATE_ORDINAL = 2;
33     public static final int OVERVIEW_PEEK_STATE_ORDINAL = 3;
34     public static final int QUICK_SWITCH_STATE_ORDINAL = 4;
35     public static final int ALL_APPS_STATE_ORDINAL = 5;
36     public static final int BACKGROUND_APP_STATE_ORDINAL = 6;
37 
stateOrdinalToString(int ordinal)38     public static String stateOrdinalToString(int ordinal) {
39         switch (ordinal) {
40             case NORMAL_STATE_ORDINAL:
41                 return "Normal";
42             case SPRING_LOADED_STATE_ORDINAL:
43                 return "SpringLoaded";
44             case OVERVIEW_STATE_ORDINAL:
45                 return "Overview";
46             case OVERVIEW_PEEK_STATE_ORDINAL:
47                 return "OverviewPeek";
48             case QUICK_SWITCH_STATE_ORDINAL:
49                 return "QuickSwitch";
50             case ALL_APPS_STATE_ORDINAL:
51                 return "AllApps";
52             case BACKGROUND_APP_STATE_ORDINAL:
53                 return "Background";
54             default:
55                 return null;
56         }
57     }
58 
59     public static final String TEST_INFO_RESPONSE_FIELD = "response";
60 
61     public static final String REQUEST_HOME_TO_OVERVIEW_SWIPE_HEIGHT =
62             "home-to-overview-swipe-height";
63     public static final String REQUEST_BACKGROUND_TO_OVERVIEW_SWIPE_HEIGHT =
64             "background-to-overview-swipe-height";
65     public static final String REQUEST_ALL_APPS_TO_OVERVIEW_SWIPE_HEIGHT =
66             "all-apps-to-overview-swipe-height";
67     public static final String REQUEST_HOME_TO_ALL_APPS_SWIPE_HEIGHT =
68             "home-to-all-apps-swipe-height";
69     public static final String REQUEST_ICON_HEIGHT =
70             "icon-height";
71     public static final String REQUEST_HOTSEAT_TOP = "hotseat-top";
72     public static final String REQUEST_IS_LAUNCHER_INITIALIZED = "is-launcher-initialized";
73     public static final String REQUEST_FREEZE_APP_LIST = "freeze-app-list";
74     public static final String REQUEST_UNFREEZE_APP_LIST = "unfreeze-app-list";
75     public static final String REQUEST_APP_LIST_FREEZE_FLAGS = "app-list-freeze-flags";
76     public static final String REQUEST_OVERVIEW_LEFT_GESTURE_MARGIN = "overview-left-margin";
77     public static final String REQUEST_OVERVIEW_RIGHT_GESTURE_MARGIN = "overview-right-margin";
78     public static final String REQUEST_TOTAL_PSS_KB = "total_pss";
79     public static final String REQUEST_JAVA_LEAK = "java-leak";
80     public static final String REQUEST_NATIVE_LEAK = "native-leak";
81 
82     public static boolean sDebugTracing = false;
83     public static final String REQUEST_ENABLE_DEBUG_TRACING = "enable-debug-tracing";
84     public static final String REQUEST_DISABLE_DEBUG_TRACING = "disable-debug-tracing";
85 
86     public static final String NO_BACKGROUND_TO_OVERVIEW_TAG = "b/138251824";
87     public static final String NO_DRAG_TO_WORKSPACE = "b/138729456";
88     public static final String APP_NOT_DISABLED = "b/139891609";
89     public static final String NO_CONTEXT_MENU = "b/141770616";
90 }
91