1 /* 2 * Copyright (C) 2022 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 android.platform.spectatio.constants; 18 19 public class JsonConfigConstants { 20 // Spectatio Config Constants 21 public static final String ACTIONS = "ACTIONS"; 22 public static final String COMMANDS = "COMMANDS"; 23 public static final String PACKAGES = "PACKAGES"; 24 public static final String UI_ELEMENTS = "UI_ELEMENTS"; 25 public static final String WORKFLOWS = "WORKFLOWS"; 26 27 // UI Element Constants 28 public static final String TYPE = "TYPE"; 29 public static final String VALUE = "VALUE"; 30 public static final String FLAG = "FLAG"; 31 public static final String PACKAGE = "PACKAGE"; 32 public static final String ANCESTOR = "ANCESTOR"; 33 public static final String DESCENDANT = "DESCENDANT"; 34 public static final String MAX_DEPTH = "MAX_DEPTH"; 35 public static final String SPECIFIERS = "SPECIFIERS"; 36 37 public static final String RESOURCE_ID = "RESOURCE_ID"; 38 public static final String SCROLLABLE = "SCROLLABLE"; 39 public static final String CLICKABLE = "CLICKABLE"; 40 public static final String TEXT = "TEXT"; 41 public static final String TEXT_CONTAINS = "TEXT_CONTAINS"; 42 public static final String DESCRIPTION = "DESCRIPTION"; 43 public static final String CLASS = "CLASS"; 44 public static final String HAS_ANCESTOR = "HAS_ANCESTOR"; 45 public static final String HAS_DESCENDANT = "HAS_DESCENDANT"; 46 public static final String MULTIPLE = "MULTIPLE"; 47 48 // Workflow Task Constants 49 // Supported Properties 50 public static final String NAME = "NAME"; 51 public static final String WORKFLOW_TYPE = "TYPE"; 52 public static final String CONFIG = "CONFIG"; 53 public static final String REPEAT_COUNT = "REPEAT_COUNT"; 54 public static final String SCROLL_CONFIG = "SCROLL_CONFIG"; 55 public static final String SWIPE_CONFIG = "SWIPE_CONFIG"; 56 57 // Supported Workflow Tasks 58 public static enum SupportedWorkFlowTasks { 59 // Execute the given Command 60 COMMAND, 61 // Press Key e.g. Home, Back, Power, etc. 62 PRESS, 63 // Long Press Key e.g. Power, Screen Center, etc. 64 LONG_PRESS, 65 // Click on given UI Element ( throws exception if UI Element does not exist ) 66 CLICK, 67 // Click on given UI Element if it exist otherwise ignore ( i.e. No Exception 68 // even if UI Element is missing ) 69 CLICK_IF_EXIST, 70 // Long Click on given UI Element ( throws exception if UI Element does not exist ) 71 LONG_CLICK, 72 // Validates if package is in foreground ( throws exception if it is not in foreground ) 73 HAS_PACKAGE_IN_FOREGROUND, 74 // Validates if Ui Element is in foreground ( throws exception if it is not in foreground ) 75 HAS_UI_ELEMENT_IN_FOREGROUND, 76 // Finds the given UI Element by Scrolling and Click on it ( Throws an exception if 77 // UI Element not found ) 78 SCROLL_TO_FIND_AND_CLICK, 79 // Finds the given UI Element by Scrolling and Click on it if found ( i.e. No Exception 80 // even if UI Element is missing ) 81 SCROLL_TO_FIND_AND_CLICK_IF_EXIST, 82 // Swipes once 83 SWIPE, 84 // Finds the given UI Element by Swiping and Click on it ( Throws an exception if 85 // UI Element not found ) 86 SWIPE_TO_FIND_AND_CLICK, 87 // Finds the given UI Element by Swiping and Click on it if found ( i.e. No Exception 88 // even if UI Element is missing ) 89 SWIPE_TO_FIND_AND_CLICK_IF_EXIST, 90 // Wait For Given Time in milliseconds 91 WAIT_MS; 92 } 93 94 // Workflow Task Config 95 public static final String CONFIG_TEXT = "TEXT"; 96 public static final String CONFIG_UI_ELEMENT = "UI_ELEMENT"; 97 98 // Scroll Config Constants 99 // Supported Properties 100 public static final String SCROLL_ACTION = "SCROLL_ACTION"; 101 public static final String SCROLL_DIRECTION = "SCROLL_DIRECTION"; 102 public static final String SCROLL_FORWARD = "SCROLL_FORWARD"; 103 public static final String SCROLL_BACKWARD = "SCROLL_BACKWARD"; 104 public static final String SCROLL_ELEMENT = "SCROLL_ELEMENT"; 105 public static final String SCROLL_MARGIN = "SCROLL_MARGIN"; 106 public static final String SCROLL_WAIT_TIME = "SCROLL_WAIT_TIME"; 107 108 public enum FindType { 109 NONE, 110 SCROLL, 111 SWIPE, 112 } 113 114 // Scroll Action 115 public enum ScrollActions { 116 USE_BUTTON, 117 USE_GESTURE; 118 } 119 120 // Scroll Direction 121 public enum ScrollDirection { 122 VERTICAL, 123 HORIZONTAL; 124 } 125 } 126