• 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;
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_FREEZE_APP_LIST = "freeze-app-list";
70     public static final String REQUEST_UNFREEZE_APP_LIST = "unfreeze-app-list";
71     public static final String REQUEST_APP_LIST_FREEZE_FLAGS = "app-list-freeze-flags";
72 
73     public static boolean sDebugTracing = false;
74     public static final String REQUEST_ENABLE_DEBUG_TRACING = "enable-debug-tracing";
75     public static final String REQUEST_DISABLE_DEBUG_TRACING = "disable-debug-tracing";
76     public static final String NO_ALLAPPS_EVENT_TAG = "b/133867119";
77     public static final String NO_DRAG_TAG = "b/133009122";
78     public static final String NO_START_TAG = "b/132900132";
79     public static final String NO_START_TASK_TAG = "b/133765434";
80     public static final String NO_OVERVIEW_EVENT_TAG = "b/134532571";
81 }
82