1/* 2 * Copyright (C) 2009 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 17package android.accessibilityservice; 18 19import android.os.Bundle; 20import android.accessibilityservice.AccessibilityServiceInfo; 21import android.view.accessibility.AccessibilityNodeInfo; 22import android.view.accessibility.IAccessibilityInteractionConnectionCallback; 23 24/** 25 * Interface given to an AccessibilitySerivce to talk to the AccessibilityManagerService. 26 * 27 * @hide 28 */ 29interface IAccessibilityServiceConnection { 30 31 void setServiceInfo(in AccessibilityServiceInfo info); 32 33 /** 34 * Finds an {@link android.view.accessibility.AccessibilityNodeInfo} by accessibility id. 35 * 36 * @param accessibilityWindowId A unique window id. Use 37 * {@link android.view.accessibility.AccessibilityNodeInfo#ACTIVE_WINDOW_ID} 38 * to query the currently active window. 39 * @param accessibilityNodeId A unique view id or virtual descendant id from 40 * where to start the search. Use 41 * {@link android.view.accessibility.AccessibilityNodeInfo#ROOT_NODE_ID} 42 * to start from the root. 43 * @param interactionId The id of the interaction for matching with the callback result. 44 * @param callback Callback which to receive the result. 45 * @param flags Additional flags. 46 * @param threadId The id of the calling thread. 47 * @return The current window scale, where zero means a failure. 48 */ 49 float findAccessibilityNodeInfoByAccessibilityId(int accessibilityWindowId, 50 long accessibilityNodeId, int interactionId, 51 IAccessibilityInteractionConnectionCallback callback, int flags, long threadId); 52 53 /** 54 * Finds {@link android.view.accessibility.AccessibilityNodeInfo}s by View text. 55 * The match is case insensitive containment. The search is performed in the window 56 * whose id is specified and starts from the node whose accessibility id is specified. 57 * 58 * @param accessibilityWindowId A unique window id. Use 59 * {@link android.view.accessibility.AccessibilityNodeInfo#ACTIVE_WINDOW_ID} 60 * to query the currently active window. 61 * @param accessibilityNodeId A unique view id or virtual descendant id from 62 * where to start the search. Use 63 * {@link android.view.accessibility.AccessibilityNodeInfo#ROOT_NODE_ID} 64 * to start from the root. 65 * @param text The searched text. 66 * @param interactionId The id of the interaction for matching with the callback result. 67 * @param callback Callback which to receive the result. 68 * @param threadId The id of the calling thread. 69 * @return The current window scale, where zero means a failure. 70 */ 71 float findAccessibilityNodeInfosByText(int accessibilityWindowId, long accessibilityNodeId, 72 String text, int interactionId, IAccessibilityInteractionConnectionCallback callback, 73 long threadId); 74 75 /** 76 * Finds an {@link android.view.accessibility.AccessibilityNodeInfo} by View id. The search 77 * is performed in the window whose id is specified and starts from the node whose 78 * accessibility id is specified. 79 * 80 * @param accessibilityWindowId A unique window id. Use 81 * {@link android.view.accessibility.AccessibilityNodeInfo#ACTIVE_WINDOW_ID} 82 * to query the currently active window. 83 * @param accessibilityNodeId A unique view id or virtual descendant id from 84 * where to start the search. Use 85 * {@link android.view.accessibility.AccessibilityNodeInfo#ROOT_NODE_ID} 86 * to start from the root. 87 * @param id The id of the node. 88 * @param interactionId The id of the interaction for matching with the callback result. 89 * @param callback Callback which to receive the result. 90 * @param threadId The id of the calling thread. 91 * @return The current window scale, where zero means a failure. 92 */ 93 float findAccessibilityNodeInfoByViewId(int accessibilityWindowId, long accessibilityNodeId, 94 int viewId, int interactionId, IAccessibilityInteractionConnectionCallback callback, 95 long threadId); 96 97 /** 98 * Finds the {@link android.view.accessibility.AccessibilityNodeInfo} that has the specified 99 * focus type. The search is performed in the window whose id is specified and starts from 100 * the node whose accessibility id is specified. 101 * 102 * @param accessibilityWindowId A unique window id. Use 103 * {@link android.view.accessibility.AccessibilityNodeInfo#ACTIVE_WINDOW_ID} 104 * to query the currently active window. 105 * @param accessibilityNodeId A unique view id or virtual descendant id from 106 * where to start the search. Use 107 * {@link android.view.accessibility.AccessibilityNodeInfo#ROOT_NODE_ID} 108 * to start from the root. 109 * @param focusType The type of focus to find. 110 * @param interactionId The id of the interaction for matching with the callback result. 111 * @param callback Callback which to receive the result. 112 * @param threadId The id of the calling thread. 113 * @return The current window scale, where zero means a failure. 114 */ 115 float findFocus(int accessibilityWindowId, long accessibilityNodeId, int focusType, 116 int interactionId, IAccessibilityInteractionConnectionCallback callback, long threadId); 117 118 /** 119 * Finds an {@link android.view.accessibility.AccessibilityNodeInfo} to take accessibility 120 * focus in the given direction. The search is performed in the window whose id is 121 * specified and starts from the node whose accessibility id is specified. 122 * 123 * @param accessibilityWindowId A unique window id. Use 124 * {@link android.view.accessibility.AccessibilityNodeInfo#ACTIVE_WINDOW_ID} 125 * to query the currently active window. 126 * @param accessibilityNodeId A unique view id or virtual descendant id from 127 * where to start the search. Use 128 * {@link android.view.accessibility.AccessibilityNodeInfo#ROOT_NODE_ID} 129 * to start from the root. 130 * @param direction The direction in which to search for focusable. 131 * @param interactionId The id of the interaction for matching with the callback result. 132 * @param callback Callback which to receive the result. 133 * @param threadId The id of the calling thread. 134 * @return The current window scale, where zero means a failure. 135 */ 136 float focusSearch(int accessibilityWindowId, long accessibilityNodeId, int direction, 137 int interactionId, IAccessibilityInteractionConnectionCallback callback, long threadId); 138 139 /** 140 * Performs an accessibility action on an 141 * {@link android.view.accessibility.AccessibilityNodeInfo}. 142 * 143 * @param accessibilityWindowId A unique window id. Use 144 * {@link android.view.accessibility.AccessibilityNodeInfo#ACTIVE_WINDOW_ID} 145 * to query the currently active window. 146 * @param accessibilityNodeId A unique view id or virtual descendant id from 147 * where to start the search. Use 148 * {@link android.view.accessibility.AccessibilityNodeInfo#ROOT_NODE_ID} 149 * to start from the root. 150 * @param action The action to perform. 151 * @param arguments Optional action arguments. 152 * @param interactionId The id of the interaction for matching with the callback result. 153 * @param callback Callback which to receive the result. 154 * @param threadId The id of the calling thread. 155 * @return Whether the action was performed. 156 */ 157 boolean performAccessibilityAction(int accessibilityWindowId, long accessibilityNodeId, 158 int action, in Bundle arguments, int interactionId, 159 IAccessibilityInteractionConnectionCallback callback, long threadId); 160 161 /** 162 * @return The associated accessibility service info. 163 */ 164 AccessibilityServiceInfo getServiceInfo(); 165 166 /** 167 * Performs a global action, such as going home, going back, etc. 168 * 169 * @param action The action to perform. 170 * @return Whether the action was performed. 171 */ 172 boolean performGlobalAction(int action); 173} 174