• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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.shared;
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 STATE_FIELD = "state";
24     public static final String SWITCHED_TO_STATE_MESSAGE = "TAPL_SWITCHED_TO_STATE";
25     public static final String SCROLL_FINISHED_MESSAGE = "TAPL_SCROLL_FINISHED";
26     public static final String PAUSE_DETECTED_MESSAGE = "TAPL_PAUSE_DETECTED";
27     public static final String DISMISS_ANIMATION_ENDS_MESSAGE = "TAPL_DISMISS_ANIMATION_ENDS";
28     public static final String FOLDER_OPENED_MESSAGE = "TAPL_FOLDER_OPENED";
29     public static final int NORMAL_STATE_ORDINAL = 0;
30     public static final int SPRING_LOADED_STATE_ORDINAL = 1;
31     public static final int OVERVIEW_STATE_ORDINAL = 2;
32     public static final int OVERVIEW_MODAL_TASK_STATE_ORDINAL = 3;
33     public static final int QUICK_SWITCH_STATE_ORDINAL = 4;
34     public static final int ALL_APPS_STATE_ORDINAL = 5;
35     public static final int BACKGROUND_APP_STATE_ORDINAL = 6;
36     public static final int HINT_STATE_ORDINAL = 7;
37     public static final int HINT_STATE_TWO_BUTTON_ORDINAL = 8;
38     public static final int OVERVIEW_SPLIT_SELECT_ORDINAL = 9;
39     public static final String TAPL_EVENTS_TAG = "TaplEvents";
40     public static final String SEQUENCE_MAIN = "Main";
41     public static final String SEQUENCE_TIS = "TIS";
42     public static final String SEQUENCE_PILFER = "Pilfer";
43 
stateOrdinalToString(int ordinal)44     public static String stateOrdinalToString(int ordinal) {
45         switch (ordinal) {
46             case NORMAL_STATE_ORDINAL:
47                 return "Normal";
48             case SPRING_LOADED_STATE_ORDINAL:
49                 return "SpringLoaded";
50             case OVERVIEW_STATE_ORDINAL:
51                 return "Overview";
52             case OVERVIEW_MODAL_TASK_STATE_ORDINAL:
53                 return "OverviewModal";
54             case QUICK_SWITCH_STATE_ORDINAL:
55                 return "QuickSwitch";
56             case ALL_APPS_STATE_ORDINAL:
57                 return "AllApps";
58             case BACKGROUND_APP_STATE_ORDINAL:
59                 return "Background";
60             case HINT_STATE_ORDINAL:
61                 return "Hint";
62             case HINT_STATE_TWO_BUTTON_ORDINAL:
63                 return "Hint2Button";
64             case OVERVIEW_SPLIT_SELECT_ORDINAL:
65                 return "OverviewSplitSelect";
66             default:
67                 return "Unknown";
68         }
69     }
70 
71     public static final String TEST_INFO_REQUEST_FIELD = "request";
72     public static final String TEST_INFO_RESPONSE_FIELD = "response";
73 
74     public static final String REQUEST_HOME_TO_OVERVIEW_SWIPE_HEIGHT =
75             "home-to-overview-swipe-height";
76     public static final String REQUEST_BACKGROUND_TO_OVERVIEW_SWIPE_HEIGHT =
77             "background-to-overview-swipe-height";
78     public static final String REQUEST_HOME_TO_ALL_APPS_SWIPE_HEIGHT =
79             "home-to-all-apps-swipe-height";
80     public static final String REQUEST_ICON_HEIGHT =
81             "icon-height";
82     public static final String REQUEST_IS_LAUNCHER_INITIALIZED = "is-launcher-initialized";
83     public static final String REQUEST_FREEZE_APP_LIST = "freeze-app-list";
84     public static final String REQUEST_UNFREEZE_APP_LIST = "unfreeze-app-list";
85     public static final String REQUEST_ENABLE_MANUAL_TASKBAR_STASHING = "enable-taskbar-stashing";
86     public static final String REQUEST_DISABLE_MANUAL_TASKBAR_STASHING = "disable-taskbar-stashing";
87     public static final String REQUEST_ENABLE_BLOCK_TIMEOUT = "enable-block-timeout";
88     public static final String REQUEST_DISABLE_BLOCK_TIMEOUT = "disable-block-timeout";
89     public static final String REQUEST_ENABLE_TRANSIENT_TASKBAR = "enable-transient-taskbar";
90     public static final String REQUEST_DISABLE_TRANSIENT_TASKBAR = "disable-transient-taskbar";
91     public static final String REQUEST_UNSTASH_TASKBAR_IF_STASHED = "unstash-taskbar-if-stashed";
92     public static final String REQUEST_STASHED_TASKBAR_HEIGHT = "stashed-taskbar-height";
93     public static final String REQUEST_RECREATE_TASKBAR = "recreate-taskbar";
94     public static final String REQUEST_APP_LIST_FREEZE_FLAGS = "app-list-freeze-flags";
95     public static final String REQUEST_APPS_LIST_SCROLL_Y = "apps-list-scroll-y";
96     public static final String REQUEST_WIDGETS_SCROLL_Y = "widgets-scroll-y";
97     public static final String REQUEST_TARGET_INSETS = "target-insets";
98     public static final String REQUEST_WINDOW_INSETS = "window-insets";
99     public static final String REQUEST_PID = "pid";
100     public static final String REQUEST_FORCE_GC = "gc";
101     public static final String REQUEST_VIEW_LEAK = "view-leak";
102     public static final String PRINT_VIEW_LEAK = "print-leak";
103     public static final String REQUEST_RECENT_TASKS_LIST = "recent-tasks-list";
104     public static final String REQUEST_START_EVENT_LOGGING = "start-event-logging";
105     public static final String REQUEST_GET_TEST_EVENTS = "get-test-events";
106     public static final String REQUEST_GET_HAD_NONTEST_EVENTS = "get-had-nontest-events";
107     public static final String REQUEST_STOP_EVENT_LOGGING = "stop-event-logging";
108     public static final String REQUEST_CLEAR_DATA = "clear-data";
109     public static final String REQUEST_USE_TEST_WORKSPACE_LAYOUT = "use-test-workspace-layout";
110     public static final String REQUEST_USE_TEST2_WORKSPACE_LAYOUT = "use-test2-workspace-layout";
111     public static final String REQUEST_USE_TAPL_WORKSPACE_LAYOUT = "use-tapl-workspace-layout";
112     public static final String REQUEST_USE_DEFAULT_WORKSPACE_LAYOUT =
113             "use-default-workspace-layout";
114     public static final String REQUEST_HOTSEAT_ICON_NAMES = "get-hotseat-icon-names";
115     public static final String REQUEST_IS_TABLET = "is-tablet";
116     public static final String REQUEST_IS_TWO_PANELS = "is-two-panel";
117     public static final String REQUEST_START_DRAG_THRESHOLD = "start-drag-threshold";
118     public static final String REQUEST_GET_ACTIVITIES_CREATED_COUNT =
119             "get-activities-created-count";
120     public static final String REQUEST_GET_ACTIVITIES = "get-activities";
121     public static final String REQUEST_HAS_TIS = "has-touch-interaction-service";
122     public static final String REQUEST_TASKBAR_ALL_APPS_TOP_PADDING =
123             "taskbar-all-apps-top-padding";
124     public static final String REQUEST_ALL_APPS_TOP_PADDING = "all-apps-top-padding";
125     public static final String REQUEST_ALL_APPS_BOTTOM_PADDING = "all-apps-bottom-padding";
126 
127     public static final String REQUEST_WORKSPACE_CELL_LAYOUT_SIZE = "workspace-cell-layout-size";
128     public static final String REQUEST_WORKSPACE_CELL_CENTER = "workspace-cell-center";
129     public static final String REQUEST_WORKSPACE_COLUMNS_ROWS = "workspace-columns-rows";
130 
131     public static final String REQUEST_WORKSPACE_CURRENT_PAGE_INDEX =
132             "workspace-current-page-index";
133 
134     public static final String REQUEST_HOTSEAT_CELL_CENTER = "hotseat-cell-center";
135 
136     public static final String REQUEST_GET_FOCUSED_TASK_HEIGHT_FOR_TABLET =
137             "get-focused-task-height-for-tablet";
138     public static final String REQUEST_GET_GRID_TASK_SIZE_RECT_FOR_TABLET =
139             "get-grid-task-size-rect-for-tablet";
140     public static final String REQUEST_GET_OVERVIEW_PAGE_SPACING = "get-overview-page-spacing";
141     public static final String REQUEST_ENABLE_ROTATION = "enable_rotation";
142     public static final String REQUEST_ENABLE_SUGGESTION = "enable-suggestion";
143     public static final String REQUEST_MODEL_QUEUE_CLEARED = "model-queue-cleared";
144 
145     public static boolean sDebugTracing = false;
146     public static final String REQUEST_ENABLE_DEBUG_TRACING = "enable-debug-tracing";
147     public static final String REQUEST_DISABLE_DEBUG_TRACING = "disable-debug-tracing";
148 
149 
150     public static boolean sDisableSensorRotation;
151     public static final String REQUEST_MOCK_SENSOR_ROTATION = "mock-sensor-rotation";
152 
153     public static final String PERMANENT_DIAG_TAG = "TaplTarget";
154     public static final String NO_DROP_TARGET = "b/195031154";
155     public static final String NULL_INT_SET = "b/200572078";
156     public static final String MISSING_PROMISE_ICON = "b/202985412";
157     public static final String TASKBAR_IN_APP_STATE = "b/227657604";
158     public static final String NPE_TRANSIENT_TASKBAR = "b/257549303";
159     public static final String FLAKY_BINDING = "b/270216650";
160     public static final String VIEW_AND_ACTIVITY_LEAKS = "b/260260325";
161     public static final String WORK_TAB_MISSING = "b/243688989";
162 
163     public static final String REQUEST_EMULATE_DISPLAY = "emulate-display";
164     public static final String REQUEST_STOP_EMULATE_DISPLAY = "stop-emulate-display";
165     public static final String REQUEST_IS_EMULATE_DISPLAY_RUNNING = "is-emulate-display-running";
166     public static final String REQUEST_EMULATE_PRINT_DEVICE = "emulate-print-device";
167 }
168