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