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 56 // Supported Workflow Tasks 57 public static enum SupportedWorkFlowTasks { 58 // Execute the given Command 59 COMMAND, 60 // Press Key e.g. Home, Back, Power, etc. 61 PRESS, 62 // Long Press Key e.g. Power, Screen Center, etc. 63 LONG_PRESS, 64 // Click on given UI Element ( throws exception if UI Element does not exist ) 65 CLICK, 66 // Click on given UI Element if it exist otherwise ignore ( i.e. No Exception 67 // even if UI Element is missing ) 68 CLICK_IF_EXIST, 69 // Long Click on given UI Element ( throws exception if UI Element does not exist ) 70 LONG_CLICK, 71 // Validates if package is in foreground ( throws exception if it is not in foreground ) 72 HAS_PACKAGE_IN_FOREGROUND, 73 // Validates if Ui Element is in foreground ( throws exception if it is not in foreground ) 74 HAS_UI_ELEMENT_IN_FOREGROUND, 75 // Finds the given UI Element by Scrolling and Click on it ( Throws an exception if 76 // UI Element not found ) 77 SCROLL_TO_FIND_AND_CLICK, 78 // Finds the given UI Element by Scrolling and Click on it if found ( i.e. No Exception 79 // even if UI Element is missing ) 80 SCROLL_TO_FIND_AND_CLICK_IF_EXIST, 81 // Wait For Given Time in milliseconds 82 WAIT_MS; 83 } 84 85 // Workflow Task Config 86 public static final String CONFIG_TEXT = "TEXT"; 87 public static final String CONFIG_UI_ELEMENT = "UI_ELEMENT"; 88 89 // Scroll Config Constants 90 // Supported Properties 91 public static final String SCROLL_ACTION = "SCROLL_ACTION"; 92 public static final String SCROLL_DIRECTION = "SCROLL_DIRECTION"; 93 public static final String SCROLL_FORWARD = "SCROLL_FORWARD"; 94 public static final String SCROLL_BACKWARD = "SCROLL_BACKWARD"; 95 public static final String SCROLL_ELEMENT = "SCROLL_ELEMENT"; 96 public static final String SCROLL_MARGIN = "SCROLL_MARGIN"; 97 public static final String SCROLL_WAIT_TIME = "SCROLL_WAIT_TIME"; 98 99 // Scroll Action 100 public static enum ScrollActions { 101 USE_BUTTON, 102 USE_GESTURE; 103 } 104 105 // Scroll Direction 106 public static enum ScrollDirection { 107 VERTICAL, 108 HORIZONTAL; 109 } 110 } 111