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