175986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov/*
275986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov * Copyright (C) 2009 The Android Open Source Project
375986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov *
475986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov * Licensed under the Apache License, Version 2.0 (the "License");
575986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov * you may not use this file except in compliance with the License.
675986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov * You may obtain a copy of the License at
775986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov *
875986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov *      http://www.apache.org/licenses/LICENSE-2.0
975986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov *
1075986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov * Unless required by applicable law or agreed to in writing, software
1175986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov * distributed under the License is distributed on an "AS IS" BASIS,
1275986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1375986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov * See the License for the specific language governing permissions and
1475986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov * limitations under the License.
1575986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov */
1675986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov
1775986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganovpackage android.view.accessibility;
1875986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov
1975986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganovimport android.os.Parcel;
2075986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganovimport android.os.Parcelable;
2175986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganovimport android.text.TextUtils;
2275986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov
2375986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganovimport java.util.ArrayList;
24eeee4d2c01d3c4ed99e4891dbc75c7de69a803faSvetoslav Ganovimport java.util.List;
2575986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov
2675986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov/**
2738e8b4e5bc3c93affdffbc064fd9db5aeccc3e8eSvetoslav Ganov * <p>
2875986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov * This class represents accessibility events that are sent by the system when
2975986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov * something notable happens in the user interface. For example, when a
3075986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov * {@link android.widget.Button} is clicked, a {@link android.view.View} is focused, etc.
3138e8b4e5bc3c93affdffbc064fd9db5aeccc3e8eSvetoslav Ganov * </p>
3275986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov * <p>
33736c2756bf3c14ae9fef7255c119057f7a2be1edSvetoslav Ganov * An accessibility event is fired by an individual view which populates the event with
3438e8b4e5bc3c93affdffbc064fd9db5aeccc3e8eSvetoslav Ganov * data for its state and requests from its parent to send the event to interested
3538e8b4e5bc3c93affdffbc064fd9db5aeccc3e8eSvetoslav Ganov * parties. The parent can optionally add an {@link AccessibilityRecord} for itself before
3638e8b4e5bc3c93affdffbc064fd9db5aeccc3e8eSvetoslav Ganov * dispatching a similar request to its parent. A parent can also choose not to respect the
3738e8b4e5bc3c93affdffbc064fd9db5aeccc3e8eSvetoslav Ganov * request for sending an event. The accessibility event is sent by the topmost view in the
3838e8b4e5bc3c93affdffbc064fd9db5aeccc3e8eSvetoslav Ganov * view tree. Therefore, an {@link android.accessibilityservice.AccessibilityService} can
3938e8b4e5bc3c93affdffbc064fd9db5aeccc3e8eSvetoslav Ganov * explore all records in an accessibility event to obtain more information about the
4038e8b4e5bc3c93affdffbc064fd9db5aeccc3e8eSvetoslav Ganov * context in which the event was fired.
4138e8b4e5bc3c93affdffbc064fd9db5aeccc3e8eSvetoslav Ganov * </p>
42736c2756bf3c14ae9fef7255c119057f7a2be1edSvetoslav Ganov * <p>
4338e8b4e5bc3c93affdffbc064fd9db5aeccc3e8eSvetoslav Ganov * The main purpose of an accessibility event is to expose enough information for an
4438e8b4e5bc3c93affdffbc064fd9db5aeccc3e8eSvetoslav Ganov * {@link android.accessibilityservice.AccessibilityService} to provide meaningful feedback
4538e8b4e5bc3c93affdffbc064fd9db5aeccc3e8eSvetoslav Ganov * to the user. Sometimes however, an accessibility service may need more contextual
4638e8b4e5bc3c93affdffbc064fd9db5aeccc3e8eSvetoslav Ganov * information then the one in the event pay-load. In such cases the service can obtain
4738e8b4e5bc3c93affdffbc064fd9db5aeccc3e8eSvetoslav Ganov * the event source which is an {@link AccessibilityNodeInfo} (snapshot of a View state)
4838e8b4e5bc3c93affdffbc064fd9db5aeccc3e8eSvetoslav Ganov * which can be used for exploring the window content. Note that the privilege for accessing
4938e8b4e5bc3c93affdffbc064fd9db5aeccc3e8eSvetoslav Ganov * an event's source, thus the window content, has to be explicitly requested. For more
5038e8b4e5bc3c93affdffbc064fd9db5aeccc3e8eSvetoslav Ganov * details refer to {@link android.accessibilityservice.AccessibilityService}. If an
5138e8b4e5bc3c93affdffbc064fd9db5aeccc3e8eSvetoslav Ganov * accessibility service has not requested to retrieve the window content the event will
5238e8b4e5bc3c93affdffbc064fd9db5aeccc3e8eSvetoslav Ganov * not contain reference to its source. Also for events of type
5338e8b4e5bc3c93affdffbc064fd9db5aeccc3e8eSvetoslav Ganov * {@link #TYPE_NOTIFICATION_STATE_CHANGED} the source is never available.
5438e8b4e5bc3c93affdffbc064fd9db5aeccc3e8eSvetoslav Ganov * </p>
55736c2756bf3c14ae9fef7255c119057f7a2be1edSvetoslav Ganov * <p>
5675986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov * This class represents various semantically different accessibility event
5738e8b4e5bc3c93affdffbc064fd9db5aeccc3e8eSvetoslav Ganov * types. Each event type has an associated set of related properties. In other
5875986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov * words, each event type is characterized via a subset of the properties exposed
5975986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov * by this class. For each event type there is a corresponding constant defined
6038e8b4e5bc3c93affdffbc064fd9db5aeccc3e8eSvetoslav Ganov * in this class. Follows a specification of the event types and their associated properties:
6138e8b4e5bc3c93affdffbc064fd9db5aeccc3e8eSvetoslav Ganov * </p>
62e1302edd40c5cc264f842e17e3796e0a11d6f045Joe Fernandez * <div class="special reference">
63e1302edd40c5cc264f842e17e3796e0a11d6f045Joe Fernandez * <h3>Developer Guides</h3>
64e1302edd40c5cc264f842e17e3796e0a11d6f045Joe Fernandez * <p>For more information about creating and processing AccessibilityEvents, read the
65e1302edd40c5cc264f842e17e3796e0a11d6f045Joe Fernandez * <a href="{@docRoot}guide/topics/ui/accessibility/index.html">Accessibility</a>
66e1302edd40c5cc264f842e17e3796e0a11d6f045Joe Fernandez * developer guide.</p>
67e1302edd40c5cc264f842e17e3796e0a11d6f045Joe Fernandez * </div>
6875986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov * <p>
6938e8b4e5bc3c93affdffbc064fd9db5aeccc3e8eSvetoslav Ganov * <b>VIEW TYPES</b></br>
7038e8b4e5bc3c93affdffbc064fd9db5aeccc3e8eSvetoslav Ganov * </p>
7175986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov * <p>
7275986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov * <b>View clicked</b> - represents the event of clicking on a {@link android.view.View}
7338e8b4e5bc3c93affdffbc064fd9db5aeccc3e8eSvetoslav Ganov * like {@link android.widget.Button}, {@link android.widget.CompoundButton}, etc.</br>
7438e8b4e5bc3c93affdffbc064fd9db5aeccc3e8eSvetoslav Ganov * <em>Type:</em>{@link #TYPE_VIEW_CLICKED}</br>
7538e8b4e5bc3c93affdffbc064fd9db5aeccc3e8eSvetoslav Ganov * <em>Properties:</em></br>
76a0156177cdc809795dd8bc5a19943dd2b6f82b66Svetoslav Ganov * <ul>
7782e236d72ac197d6673d0b4d484fe5f0b9436731Svetoslav Ganov *   <li>{@link #getEventType()} - The type of the event.</li>
7838e8b4e5bc3c93affdffbc064fd9db5aeccc3e8eSvetoslav Ganov *   <li>{@link #getSource()} - The source info (for registered clients).</li>
79a0156177cdc809795dd8bc5a19943dd2b6f82b66Svetoslav Ganov *   <li>{@link #getClassName()} - The class name of the source.</li>
80a0156177cdc809795dd8bc5a19943dd2b6f82b66Svetoslav Ganov *   <li>{@link #getPackageName()} - The package name of the source.</li>
81a0156177cdc809795dd8bc5a19943dd2b6f82b66Svetoslav Ganov *   <li>{@link #getEventTime()}  - The event time.</li>
8282e236d72ac197d6673d0b4d484fe5f0b9436731Svetoslav Ganov *   <li>{@link #getText()} - The text of the source's sub-tree.</li>
83a0156177cdc809795dd8bc5a19943dd2b6f82b66Svetoslav Ganov *   <li>{@link #isEnabled()} - Whether the source is enabled.</li>
84a0156177cdc809795dd8bc5a19943dd2b6f82b66Svetoslav Ganov *   <li>{@link #isPassword()} - Whether the source is password.</li>
85a0156177cdc809795dd8bc5a19943dd2b6f82b66Svetoslav Ganov *   <li>{@link #isChecked()} - Whether the source is checked.</li>
8682e236d72ac197d6673d0b4d484fe5f0b9436731Svetoslav Ganov *   <li>{@link #getContentDescription()} - The content description of the source.</li>
87d9ee72fddb8be40e414a831fb80458dc48699613Svetoslav Ganov *   <li>{@link #getScrollX()} - The offset of the source left edge in pixels
88d9ee72fddb8be40e414a831fb80458dc48699613Svetoslav Ganov *       (without descendants of AdapterView).</li>
89d9ee72fddb8be40e414a831fb80458dc48699613Svetoslav Ganov *   <li>{@link #getScrollY()} - The offset of the source top edge in pixels
90d9ee72fddb8be40e414a831fb80458dc48699613Svetoslav Ganov *       (without descendants of AdapterView).</li>
91d9ee72fddb8be40e414a831fb80458dc48699613Svetoslav Ganov *   <li>{@link #getFromIndex()} - The zero based index of the first visible item of the source,
92d9ee72fddb8be40e414a831fb80458dc48699613Svetoslav Ganov *       inclusive (for descendants of AdapterView).</li>
93d9ee72fddb8be40e414a831fb80458dc48699613Svetoslav Ganov *   <li>{@link #getToIndex()} - The zero based index of the last visible item of the source,
94d9ee72fddb8be40e414a831fb80458dc48699613Svetoslav Ganov *       inclusive (for descendants of AdapterView).</li>
95d9ee72fddb8be40e414a831fb80458dc48699613Svetoslav Ganov *   <li>{@link #getItemCount()} - The total items of the source
96d9ee72fddb8be40e414a831fb80458dc48699613Svetoslav Ganov *       (for descendants of AdapterView).</li>
97a0156177cdc809795dd8bc5a19943dd2b6f82b66Svetoslav Ganov * </ul>
9838e8b4e5bc3c93affdffbc064fd9db5aeccc3e8eSvetoslav Ganov * </p>
9975986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov * <p>
10075986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov * <b>View long clicked</b> - represents the event of long clicking on a {@link android.view.View}
10138e8b4e5bc3c93affdffbc064fd9db5aeccc3e8eSvetoslav Ganov * like {@link android.widget.Button}, {@link android.widget.CompoundButton}, etc </br>
10238e8b4e5bc3c93affdffbc064fd9db5aeccc3e8eSvetoslav Ganov * <em>Type:</em>{@link #TYPE_VIEW_LONG_CLICKED}</br>
10338e8b4e5bc3c93affdffbc064fd9db5aeccc3e8eSvetoslav Ganov * <em>Properties:</em></br>
104a0156177cdc809795dd8bc5a19943dd2b6f82b66Svetoslav Ganov * <ul>
10582e236d72ac197d6673d0b4d484fe5f0b9436731Svetoslav Ganov *   <li>{@link #getEventType()} - The type of the event.</li>
10638e8b4e5bc3c93affdffbc064fd9db5aeccc3e8eSvetoslav Ganov *   <li>{@link #getSource()} - The source info (for registered clients).</li>
107a0156177cdc809795dd8bc5a19943dd2b6f82b66Svetoslav Ganov *   <li>{@link #getClassName()} - The class name of the source.</li>
108a0156177cdc809795dd8bc5a19943dd2b6f82b66Svetoslav Ganov *   <li>{@link #getPackageName()} - The package name of the source.</li>
109a0156177cdc809795dd8bc5a19943dd2b6f82b66Svetoslav Ganov *   <li>{@link #getEventTime()}  - The event time.</li>
11082e236d72ac197d6673d0b4d484fe5f0b9436731Svetoslav Ganov *   <li>{@link #getText()} - The text of the source's sub-tree.</li>
111a0156177cdc809795dd8bc5a19943dd2b6f82b66Svetoslav Ganov *   <li>{@link #isEnabled()} - Whether the source is enabled.</li>
112a0156177cdc809795dd8bc5a19943dd2b6f82b66Svetoslav Ganov *   <li>{@link #isPassword()} - Whether the source is password.</li>
113a0156177cdc809795dd8bc5a19943dd2b6f82b66Svetoslav Ganov *   <li>{@link #isChecked()} - Whether the source is checked.</li>
11482e236d72ac197d6673d0b4d484fe5f0b9436731Svetoslav Ganov *   <li>{@link #getContentDescription()} - The content description of the source.</li>
115d9ee72fddb8be40e414a831fb80458dc48699613Svetoslav Ganov *   <li>{@link #getScrollX()} - The offset of the source left edge in pixels
116d9ee72fddb8be40e414a831fb80458dc48699613Svetoslav Ganov *       (without descendants of AdapterView).</li>
117d9ee72fddb8be40e414a831fb80458dc48699613Svetoslav Ganov *   <li>{@link #getScrollY()} - The offset of the source top edge in pixels
118d9ee72fddb8be40e414a831fb80458dc48699613Svetoslav Ganov *       (without descendants of AdapterView).</li>
119d9ee72fddb8be40e414a831fb80458dc48699613Svetoslav Ganov *   <li>{@link #getFromIndex()} - The zero based index of the first visible item of the source,
120d9ee72fddb8be40e414a831fb80458dc48699613Svetoslav Ganov *       inclusive (for descendants of AdapterView).</li>
121d9ee72fddb8be40e414a831fb80458dc48699613Svetoslav Ganov *   <li>{@link #getToIndex()} - The zero based index of the last visible item of the source,
122d9ee72fddb8be40e414a831fb80458dc48699613Svetoslav Ganov *       inclusive (for descendants of AdapterView).</li>
123d9ee72fddb8be40e414a831fb80458dc48699613Svetoslav Ganov *   <li>{@link #getItemCount()} - The total items of the source
124d9ee72fddb8be40e414a831fb80458dc48699613Svetoslav Ganov *       (for descendants of AdapterView).</li>
125a0156177cdc809795dd8bc5a19943dd2b6f82b66Svetoslav Ganov * </ul>
12638e8b4e5bc3c93affdffbc064fd9db5aeccc3e8eSvetoslav Ganov * </p>
12775986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov * <p>
12875986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov * <b>View selected</b> - represents the event of selecting an item usually in
12938e8b4e5bc3c93affdffbc064fd9db5aeccc3e8eSvetoslav Ganov * the context of an {@link android.widget.AdapterView}.</br>
13038e8b4e5bc3c93affdffbc064fd9db5aeccc3e8eSvetoslav Ganov * <em>Type:</em> {@link #TYPE_VIEW_SELECTED}</br>
13138e8b4e5bc3c93affdffbc064fd9db5aeccc3e8eSvetoslav Ganov * <em>Properties:</em></br>
132a0156177cdc809795dd8bc5a19943dd2b6f82b66Svetoslav Ganov * <ul>
13382e236d72ac197d6673d0b4d484fe5f0b9436731Svetoslav Ganov *   <li>{@link #getEventType()} - The type of the event.</li>
13438e8b4e5bc3c93affdffbc064fd9db5aeccc3e8eSvetoslav Ganov *   <li>{@link #getSource()} - The source info (for registered clients).</li>
135a0156177cdc809795dd8bc5a19943dd2b6f82b66Svetoslav Ganov *   <li>{@link #getClassName()} - The class name of the source.</li>
136a0156177cdc809795dd8bc5a19943dd2b6f82b66Svetoslav Ganov *   <li>{@link #getPackageName()} - The package name of the source.</li>
137a0156177cdc809795dd8bc5a19943dd2b6f82b66Svetoslav Ganov *   <li>{@link #getEventTime()}  - The event time.</li>
13882e236d72ac197d6673d0b4d484fe5f0b9436731Svetoslav Ganov *   <li>{@link #getText()} - The text of the source's sub-tree.</li>
139a0156177cdc809795dd8bc5a19943dd2b6f82b66Svetoslav Ganov *   <li>{@link #isEnabled()} - Whether the source is enabled.</li>
140a0156177cdc809795dd8bc5a19943dd2b6f82b66Svetoslav Ganov *   <li>{@link #isPassword()} - Whether the source is password.</li>
141a0156177cdc809795dd8bc5a19943dd2b6f82b66Svetoslav Ganov *   <li>{@link #isChecked()} - Whether the source is checked.</li>
14238e8b4e5bc3c93affdffbc064fd9db5aeccc3e8eSvetoslav Ganov *   <li>{@link #getItemCount()} - The number of selectable items of the source.</li>
143a0156177cdc809795dd8bc5a19943dd2b6f82b66Svetoslav Ganov *   <li>{@link #getCurrentItemIndex()} - The currently selected item index.</li>
14482e236d72ac197d6673d0b4d484fe5f0b9436731Svetoslav Ganov *   <li>{@link #getContentDescription()} - The content description of the source.</li>
145d9ee72fddb8be40e414a831fb80458dc48699613Svetoslav Ganov *   <li>{@link #getScrollX()} - The offset of the source left edge in pixels
146d9ee72fddb8be40e414a831fb80458dc48699613Svetoslav Ganov *       (without descendants of AdapterView).</li>
147d9ee72fddb8be40e414a831fb80458dc48699613Svetoslav Ganov *   <li>{@link #getScrollY()} - The offset of the source top edge in pixels
148d9ee72fddb8be40e414a831fb80458dc48699613Svetoslav Ganov *       (without descendants of AdapterView).</li>
149d9ee72fddb8be40e414a831fb80458dc48699613Svetoslav Ganov *   <li>{@link #getFromIndex()} - The zero based index of the first visible item of the source,
150d9ee72fddb8be40e414a831fb80458dc48699613Svetoslav Ganov *       inclusive (for descendants of AdapterView).</li>
151d9ee72fddb8be40e414a831fb80458dc48699613Svetoslav Ganov *   <li>{@link #getToIndex()} - The zero based index of the last visible item of the source,
152d9ee72fddb8be40e414a831fb80458dc48699613Svetoslav Ganov *       inclusive (for descendants of AdapterView).</li>
153d9ee72fddb8be40e414a831fb80458dc48699613Svetoslav Ganov *   <li>{@link #getItemCount()} - The total items of the source
154d9ee72fddb8be40e414a831fb80458dc48699613Svetoslav Ganov *       (for descendants of AdapterView).</li>
155a0156177cdc809795dd8bc5a19943dd2b6f82b66Svetoslav Ganov * </ul>
15638e8b4e5bc3c93affdffbc064fd9db5aeccc3e8eSvetoslav Ganov * </p>
15775986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov * <p>
15875986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov * <b>View focused</b> - represents the event of focusing a
15938e8b4e5bc3c93affdffbc064fd9db5aeccc3e8eSvetoslav Ganov * {@link android.view.View}.</br>
16038e8b4e5bc3c93affdffbc064fd9db5aeccc3e8eSvetoslav Ganov * <em>Type:</em> {@link #TYPE_VIEW_FOCUSED}</br>
16138e8b4e5bc3c93affdffbc064fd9db5aeccc3e8eSvetoslav Ganov * <em>Properties:</em></br>
162a0156177cdc809795dd8bc5a19943dd2b6f82b66Svetoslav Ganov * <ul>
16382e236d72ac197d6673d0b4d484fe5f0b9436731Svetoslav Ganov *   <li>{@link #getEventType()} - The type of the event.</li>
16438e8b4e5bc3c93affdffbc064fd9db5aeccc3e8eSvetoslav Ganov *   <li>{@link #getSource()} - The source info (for registered clients).</li>
165a0156177cdc809795dd8bc5a19943dd2b6f82b66Svetoslav Ganov *   <li>{@link #getClassName()} - The class name of the source.</li>
166a0156177cdc809795dd8bc5a19943dd2b6f82b66Svetoslav Ganov *   <li>{@link #getPackageName()} - The package name of the source.</li>
167a0156177cdc809795dd8bc5a19943dd2b6f82b66Svetoslav Ganov *   <li>{@link #getEventTime()}  - The event time.</li>
16882e236d72ac197d6673d0b4d484fe5f0b9436731Svetoslav Ganov *   <li>{@link #getText()} - The text of the source's sub-tree.</li>
169a0156177cdc809795dd8bc5a19943dd2b6f82b66Svetoslav Ganov *   <li>{@link #isEnabled()} - Whether the source is enabled.</li>
170a0156177cdc809795dd8bc5a19943dd2b6f82b66Svetoslav Ganov *   <li>{@link #isPassword()} - Whether the source is password.</li>
171a0156177cdc809795dd8bc5a19943dd2b6f82b66Svetoslav Ganov *   <li>{@link #isChecked()} - Whether the source is checked.</li>
17238e8b4e5bc3c93affdffbc064fd9db5aeccc3e8eSvetoslav Ganov *   <li>{@link #getItemCount()} - The number of focusable items on the screen.</li>
173a0156177cdc809795dd8bc5a19943dd2b6f82b66Svetoslav Ganov *   <li>{@link #getCurrentItemIndex()} - The currently focused item index.</li>
17482e236d72ac197d6673d0b4d484fe5f0b9436731Svetoslav Ganov *   <li>{@link #getContentDescription()} - The content description of the source.</li>
175d9ee72fddb8be40e414a831fb80458dc48699613Svetoslav Ganov *   <li>{@link #getScrollX()} - The offset of the source left edge in pixels
176d9ee72fddb8be40e414a831fb80458dc48699613Svetoslav Ganov *       (without descendants of AdapterView).</li>
177d9ee72fddb8be40e414a831fb80458dc48699613Svetoslav Ganov *   <li>{@link #getScrollY()} - The offset of the source top edge in pixels
178d9ee72fddb8be40e414a831fb80458dc48699613Svetoslav Ganov *       (without descendants of AdapterView).</li>
179d9ee72fddb8be40e414a831fb80458dc48699613Svetoslav Ganov *   <li>{@link #getFromIndex()} - The zero based index of the first visible item of the source,
180d9ee72fddb8be40e414a831fb80458dc48699613Svetoslav Ganov *       inclusive (for descendants of AdapterView).</li>
181d9ee72fddb8be40e414a831fb80458dc48699613Svetoslav Ganov *   <li>{@link #getToIndex()} - The zero based index of the last visible item of the source,
182d9ee72fddb8be40e414a831fb80458dc48699613Svetoslav Ganov *       inclusive (for descendants of AdapterView).</li>
183d9ee72fddb8be40e414a831fb80458dc48699613Svetoslav Ganov *   <li>{@link #getItemCount()} - The total items of the source
184d9ee72fddb8be40e414a831fb80458dc48699613Svetoslav Ganov *       (for descendants of AdapterView).</li>
185a0156177cdc809795dd8bc5a19943dd2b6f82b66Svetoslav Ganov * </ul>
18638e8b4e5bc3c93affdffbc064fd9db5aeccc3e8eSvetoslav Ganov * </p>
18775986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov * <p>
18875986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov * <b>View text changed</b> - represents the event of changing the text of an
18938e8b4e5bc3c93affdffbc064fd9db5aeccc3e8eSvetoslav Ganov * {@link android.widget.EditText}.</br>
19038e8b4e5bc3c93affdffbc064fd9db5aeccc3e8eSvetoslav Ganov * <em>Type:</em> {@link #TYPE_VIEW_TEXT_CHANGED}</br>
19138e8b4e5bc3c93affdffbc064fd9db5aeccc3e8eSvetoslav Ganov * <em>Properties:</em></br>
192a0156177cdc809795dd8bc5a19943dd2b6f82b66Svetoslav Ganov * <ul>
19382e236d72ac197d6673d0b4d484fe5f0b9436731Svetoslav Ganov *   <li>{@link #getEventType()} - The type of the event.</li>
19438e8b4e5bc3c93affdffbc064fd9db5aeccc3e8eSvetoslav Ganov *   <li>{@link #getSource()} - The source info (for registered clients).</li>
195a0156177cdc809795dd8bc5a19943dd2b6f82b66Svetoslav Ganov *   <li>{@link #getClassName()} - The class name of the source.</li>
196a0156177cdc809795dd8bc5a19943dd2b6f82b66Svetoslav Ganov *   <li>{@link #getPackageName()} - The package name of the source.</li>
197a0156177cdc809795dd8bc5a19943dd2b6f82b66Svetoslav Ganov *   <li>{@link #getEventTime()}  - The event time.</li>
198a0156177cdc809795dd8bc5a19943dd2b6f82b66Svetoslav Ganov *   <li>{@link #getText()} - The text of the source.</li>
199a0156177cdc809795dd8bc5a19943dd2b6f82b66Svetoslav Ganov *   <li>{@link #isEnabled()} - Whether the source is enabled.</li>
200a0156177cdc809795dd8bc5a19943dd2b6f82b66Svetoslav Ganov *   <li>{@link #isPassword()} - Whether the source is password.</li>
201a0156177cdc809795dd8bc5a19943dd2b6f82b66Svetoslav Ganov *   <li>{@link #isChecked()} - Whether the source is checked.</li>
202a0156177cdc809795dd8bc5a19943dd2b6f82b66Svetoslav Ganov *   <li>{@link #getFromIndex()} - The text change start index.</li>
203a0156177cdc809795dd8bc5a19943dd2b6f82b66Svetoslav Ganov *   <li>{@link #getAddedCount()} - The number of added characters.</li>
204a0156177cdc809795dd8bc5a19943dd2b6f82b66Svetoslav Ganov *   <li>{@link #getRemovedCount()} - The number of removed characters.</li>
205a0156177cdc809795dd8bc5a19943dd2b6f82b66Svetoslav Ganov *   <li>{@link #getBeforeText()} - The text of the source before the change.</li>
20682e236d72ac197d6673d0b4d484fe5f0b9436731Svetoslav Ganov *   <li>{@link #getContentDescription()} - The content description of the source.</li>
207a0156177cdc809795dd8bc5a19943dd2b6f82b66Svetoslav Ganov * </ul>
20838e8b4e5bc3c93affdffbc064fd9db5aeccc3e8eSvetoslav Ganov * </p>
209a0156177cdc809795dd8bc5a19943dd2b6f82b66Svetoslav Ganov * <p>
210a0156177cdc809795dd8bc5a19943dd2b6f82b66Svetoslav Ganov * <b>View text selection changed</b> - represents the event of changing the text
21138e8b4e5bc3c93affdffbc064fd9db5aeccc3e8eSvetoslav Ganov * selection of an {@link android.widget.EditText}.</br>
21238e8b4e5bc3c93affdffbc064fd9db5aeccc3e8eSvetoslav Ganov * <em>Type:</em> {@link #TYPE_VIEW_TEXT_SELECTION_CHANGED} </br>
21338e8b4e5bc3c93affdffbc064fd9db5aeccc3e8eSvetoslav Ganov * <em>Properties:</em></br>
214a0156177cdc809795dd8bc5a19943dd2b6f82b66Svetoslav Ganov * <ul>
21582e236d72ac197d6673d0b4d484fe5f0b9436731Svetoslav Ganov *   <li>{@link #getEventType()} - The type of the event.</li>
21638e8b4e5bc3c93affdffbc064fd9db5aeccc3e8eSvetoslav Ganov *   <li>{@link #getSource()} - The source info (for registered clients).</li>
217a0156177cdc809795dd8bc5a19943dd2b6f82b66Svetoslav Ganov *   <li>{@link #getClassName()} - The class name of the source.</li>
218a0156177cdc809795dd8bc5a19943dd2b6f82b66Svetoslav Ganov *   <li>{@link #getPackageName()} - The package name of the source.</li>
219a0156177cdc809795dd8bc5a19943dd2b6f82b66Svetoslav Ganov *   <li>{@link #getEventTime()}  - The event time.</li>
220a0156177cdc809795dd8bc5a19943dd2b6f82b66Svetoslav Ganov *   <li>{@link #getText()} - The text of the source.</li>
221a0156177cdc809795dd8bc5a19943dd2b6f82b66Svetoslav Ganov *   <li>{@link #isPassword()} - Whether the source is password.</li>
222a0156177cdc809795dd8bc5a19943dd2b6f82b66Svetoslav Ganov *   <li>{@link #getFromIndex()} - The selection start index.</li>
223a0156177cdc809795dd8bc5a19943dd2b6f82b66Svetoslav Ganov *   <li>{@link #getToIndex()} - The selection end index.</li>
224a0156177cdc809795dd8bc5a19943dd2b6f82b66Svetoslav Ganov *   <li>{@link #getItemCount()} - The length of the source text.</li>
22582e236d72ac197d6673d0b4d484fe5f0b9436731Svetoslav Ganov *   <li>{@link #isEnabled()} - Whether the source is enabled.</li>
22682e236d72ac197d6673d0b4d484fe5f0b9436731Svetoslav Ganov *   <li>{@link #getContentDescription()} - The content description of the source.</li>
22738e8b4e5bc3c93affdffbc064fd9db5aeccc3e8eSvetoslav Ganov * </ul>
22838e8b4e5bc3c93affdffbc064fd9db5aeccc3e8eSvetoslav Ganov * </p>
2292b435aada3d274a9c08d334946fff1ab9ba15b48Svetoslav Ganov * <b>View text traversed at movement granularity</b> - represents the event of traversing the
230b7ff3255c6d4e12f9d2334e3bbec0a125b7b09dcSvetoslav Ganov * text of a view at a given granularity. For example, moving to the next word.</br>
2312b435aada3d274a9c08d334946fff1ab9ba15b48Svetoslav Ganov * <em>Type:</em> {@link #TYPE_VIEW_TEXT_TRAVERSED_AT_MOVEMENT_GRANULARITY} </br>
232b7ff3255c6d4e12f9d2334e3bbec0a125b7b09dcSvetoslav Ganov * <em>Properties:</em></br>
233b7ff3255c6d4e12f9d2334e3bbec0a125b7b09dcSvetoslav Ganov * <ul>
234b7ff3255c6d4e12f9d2334e3bbec0a125b7b09dcSvetoslav Ganov *   <li>{@link #getEventType()} - The type of the event.</li>
235b7ff3255c6d4e12f9d2334e3bbec0a125b7b09dcSvetoslav Ganov *   <li>{@link #getSource()} - The source info (for registered clients).</li>
236b7ff3255c6d4e12f9d2334e3bbec0a125b7b09dcSvetoslav Ganov *   <li>{@link #getClassName()} - The class name of the source.</li>
237b7ff3255c6d4e12f9d2334e3bbec0a125b7b09dcSvetoslav Ganov *   <li>{@link #getPackageName()} - The package name of the source.</li>
238b7ff3255c6d4e12f9d2334e3bbec0a125b7b09dcSvetoslav Ganov *   <li>{@link #getEventTime()}  - The event time.</li>
2396d17a936f73976971135aa1e6248662533343292Svetoslav Ganov *   <li>{@link #getMovementGranularity()} - Sets the granularity at which a view's text
2406d17a936f73976971135aa1e6248662533343292Svetoslav Ganov *       was traversed.</li>
2416d17a936f73976971135aa1e6248662533343292Svetoslav Ganov *   <li>{@link #getText()} -  The text of the source's sub-tree.</li>
2426d17a936f73976971135aa1e6248662533343292Svetoslav Ganov *   <li>{@link #getFromIndex()} - The start of the next/previous text at the specified granularity
2436d17a936f73976971135aa1e6248662533343292Svetoslav Ganov *           - inclusive.</li>
2446d17a936f73976971135aa1e6248662533343292Svetoslav Ganov *   <li>{@link #getToIndex()} - The end of the next/previous text at the specified granularity
2456d17a936f73976971135aa1e6248662533343292Svetoslav Ganov *           - exclusive.</li>
246b7ff3255c6d4e12f9d2334e3bbec0a125b7b09dcSvetoslav Ganov *   <li>{@link #isPassword()} - Whether the source is password.</li>
247b7ff3255c6d4e12f9d2334e3bbec0a125b7b09dcSvetoslav Ganov *   <li>{@link #isEnabled()} - Whether the source is enabled.</li>
248b7ff3255c6d4e12f9d2334e3bbec0a125b7b09dcSvetoslav Ganov *   <li>{@link #getContentDescription()} - The content description of the source.</li>
2492b435aada3d274a9c08d334946fff1ab9ba15b48Svetoslav Ganov *   <li>{@link #getMovementGranularity()} - Sets the granularity at which a view's text
2502b435aada3d274a9c08d334946fff1ab9ba15b48Svetoslav Ganov *       was traversed.</li>
2516d17a936f73976971135aa1e6248662533343292Svetoslav Ganov *   <li>{@link #getAction()} - Gets traversal action which specifies the direction.</li>
252b7ff3255c6d4e12f9d2334e3bbec0a125b7b09dcSvetoslav Ganov * </ul>
253b7ff3255c6d4e12f9d2334e3bbec0a125b7b09dcSvetoslav Ganov * </p>
254a0156177cdc809795dd8bc5a19943dd2b6f82b66Svetoslav Ganov * <p>
255a0156177cdc809795dd8bc5a19943dd2b6f82b66Svetoslav Ganov * <b>View scrolled</b> - represents the event of scrolling a view. If
256a0156177cdc809795dd8bc5a19943dd2b6f82b66Svetoslav Ganov * the source is a descendant of {@link android.widget.AdapterView} the
257a0156177cdc809795dd8bc5a19943dd2b6f82b66Svetoslav Ganov * scroll is reported in terms of visible items - the first visible item,
258a0156177cdc809795dd8bc5a19943dd2b6f82b66Svetoslav Ganov * the last visible item, and the total items - because the the source
25982e236d72ac197d6673d0b4d484fe5f0b9436731Svetoslav Ganov * is unaware of its pixel size since its adapter is responsible for
260a0156177cdc809795dd8bc5a19943dd2b6f82b66Svetoslav Ganov * creating views. In all other cases the scroll is reported as the current
261a0156177cdc809795dd8bc5a19943dd2b6f82b66Svetoslav Ganov * scroll on the X and Y axis respectively plus the height of the source in
26238e8b4e5bc3c93affdffbc064fd9db5aeccc3e8eSvetoslav Ganov * pixels.</br>
26338e8b4e5bc3c93affdffbc064fd9db5aeccc3e8eSvetoslav Ganov * <em>Type:</em> {@link #TYPE_VIEW_SCROLLED}</br>
26438e8b4e5bc3c93affdffbc064fd9db5aeccc3e8eSvetoslav Ganov * <em>Properties:</em></br>
265a0156177cdc809795dd8bc5a19943dd2b6f82b66Svetoslav Ganov * <ul>
26682e236d72ac197d6673d0b4d484fe5f0b9436731Svetoslav Ganov *   <li>{@link #getEventType()} - The type of the event.</li>
26738e8b4e5bc3c93affdffbc064fd9db5aeccc3e8eSvetoslav Ganov *   <li>{@link #getSource()} - The source info (for registered clients).</li>
268a0156177cdc809795dd8bc5a19943dd2b6f82b66Svetoslav Ganov *   <li>{@link #getClassName()} - The class name of the source.</li>
269a0156177cdc809795dd8bc5a19943dd2b6f82b66Svetoslav Ganov *   <li>{@link #getPackageName()} - The package name of the source.</li>
270a0156177cdc809795dd8bc5a19943dd2b6f82b66Svetoslav Ganov *   <li>{@link #getEventTime()}  - The event time.</li>
27182e236d72ac197d6673d0b4d484fe5f0b9436731Svetoslav Ganov *   <li>{@link #getText()} - The text of the source's sub-tree.</li>
272a0156177cdc809795dd8bc5a19943dd2b6f82b66Svetoslav Ganov *   <li>{@link #isEnabled()} - Whether the source is enabled.</li>
27382e236d72ac197d6673d0b4d484fe5f0b9436731Svetoslav Ganov *   <li>{@link #getContentDescription()} - The content description of the source.</li>
274d9ee72fddb8be40e414a831fb80458dc48699613Svetoslav Ganov *   <li>{@link #getScrollX()} - The offset of the source left edge in pixels
275d9ee72fddb8be40e414a831fb80458dc48699613Svetoslav Ganov *       (without descendants of AdapterView).</li>
276d9ee72fddb8be40e414a831fb80458dc48699613Svetoslav Ganov *   <li>{@link #getScrollY()} - The offset of the source top edge in pixels
277d9ee72fddb8be40e414a831fb80458dc48699613Svetoslav Ganov *       (without descendants of AdapterView).</li>
278d9ee72fddb8be40e414a831fb80458dc48699613Svetoslav Ganov *   <li>{@link #getFromIndex()} - The zero based index of the first visible item of the source,
279d9ee72fddb8be40e414a831fb80458dc48699613Svetoslav Ganov *       inclusive (for descendants of AdapterView).</li>
280d9ee72fddb8be40e414a831fb80458dc48699613Svetoslav Ganov *   <li>{@link #getToIndex()} - The zero based index of the last visible item of the source,
281d9ee72fddb8be40e414a831fb80458dc48699613Svetoslav Ganov *       inclusive (for descendants of AdapterView).</li>
282d9ee72fddb8be40e414a831fb80458dc48699613Svetoslav Ganov *   <li>{@link #getItemCount()} - The total items of the source
283d9ee72fddb8be40e414a831fb80458dc48699613Svetoslav Ganov *       (for descendants of AdapterView).</li>
28438e8b4e5bc3c93affdffbc064fd9db5aeccc3e8eSvetoslav Ganov * </ul>
28582e236d72ac197d6673d0b4d484fe5f0b9436731Svetoslav Ganov * <em>Note:</em> This event type is not dispatched to descendants though
28682e236d72ac197d6673d0b4d484fe5f0b9436731Svetoslav Ganov * {@link android.view.View#dispatchPopulateAccessibilityEvent(AccessibilityEvent)
28782e236d72ac197d6673d0b4d484fe5f0b9436731Svetoslav Ganov * View.dispatchPopulateAccessibilityEvent(AccessibilityEvent)}, hence the event
28882e236d72ac197d6673d0b4d484fe5f0b9436731Svetoslav Ganov * source {@link android.view.View} and the sub-tree rooted at it will not receive
28982e236d72ac197d6673d0b4d484fe5f0b9436731Svetoslav Ganov * calls to {@link android.view.View#onPopulateAccessibilityEvent(AccessibilityEvent)
29082e236d72ac197d6673d0b4d484fe5f0b9436731Svetoslav Ganov * View.onPopulateAccessibilityEvent(AccessibilityEvent)}. The preferred way to add
29182e236d72ac197d6673d0b4d484fe5f0b9436731Svetoslav Ganov * text content to such events is by setting the
29282e236d72ac197d6673d0b4d484fe5f0b9436731Svetoslav Ganov * {@link android.R.styleable#View_contentDescription contentDescription} of the source
29382e236d72ac197d6673d0b4d484fe5f0b9436731Svetoslav Ganov * view.</br>
29438e8b4e5bc3c93affdffbc064fd9db5aeccc3e8eSvetoslav Ganov * </p>
29575986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov * <p>
29638e8b4e5bc3c93affdffbc064fd9db5aeccc3e8eSvetoslav Ganov * <b>TRANSITION TYPES</b></br>
29738e8b4e5bc3c93affdffbc064fd9db5aeccc3e8eSvetoslav Ganov * </p>
29882e236d72ac197d6673d0b4d484fe5f0b9436731Svetoslav Ganov * <p>
299eeee4d2c01d3c4ed99e4891dbc75c7de69a803faSvetoslav Ganov * <b>Window state changed</b> - represents the event of opening a
30075986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov * {@link android.widget.PopupWindow}, {@link android.view.Menu},
30138e8b4e5bc3c93affdffbc064fd9db5aeccc3e8eSvetoslav Ganov * {@link android.app.Dialog}, etc.</br>
30238e8b4e5bc3c93affdffbc064fd9db5aeccc3e8eSvetoslav Ganov * <em>Type:</em> {@link #TYPE_WINDOW_STATE_CHANGED}</br>
30338e8b4e5bc3c93affdffbc064fd9db5aeccc3e8eSvetoslav Ganov * <em>Properties:</em></br>
304a0156177cdc809795dd8bc5a19943dd2b6f82b66Svetoslav Ganov * <ul>
30582e236d72ac197d6673d0b4d484fe5f0b9436731Svetoslav Ganov *   <li>{@link #getEventType()} - The type of the event.</li>
30638e8b4e5bc3c93affdffbc064fd9db5aeccc3e8eSvetoslav Ganov *   <li>{@link #getSource()} - The source info (for registered clients).</li>
307a0156177cdc809795dd8bc5a19943dd2b6f82b66Svetoslav Ganov *   <li>{@link #getClassName()} - The class name of the source.</li>
308a0156177cdc809795dd8bc5a19943dd2b6f82b66Svetoslav Ganov *   <li>{@link #getPackageName()} - The package name of the source.</li>
309a0156177cdc809795dd8bc5a19943dd2b6f82b66Svetoslav Ganov *   <li>{@link #getEventTime()}  - The event time.</li>
31082e236d72ac197d6673d0b4d484fe5f0b9436731Svetoslav Ganov *   <li>{@link #getText()} - The text of the source's sub-tree.</li>
31182e236d72ac197d6673d0b4d484fe5f0b9436731Svetoslav Ganov *   <li>{@link #isEnabled()} - Whether the source is enabled.</li>
312a0156177cdc809795dd8bc5a19943dd2b6f82b66Svetoslav Ganov * </ul>
31338e8b4e5bc3c93affdffbc064fd9db5aeccc3e8eSvetoslav Ganov * </p>
31475986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov * <p>
315eeee4d2c01d3c4ed99e4891dbc75c7de69a803faSvetoslav Ganov * <b>Window content changed</b> - represents the event of change in the
316eeee4d2c01d3c4ed99e4891dbc75c7de69a803faSvetoslav Ganov * content of a window. This change can be adding/removing view, changing
31738e8b4e5bc3c93affdffbc064fd9db5aeccc3e8eSvetoslav Ganov * a view size, etc.</br>
31882e236d72ac197d6673d0b4d484fe5f0b9436731Svetoslav Ganov * </p>
31938e8b4e5bc3c93affdffbc064fd9db5aeccc3e8eSvetoslav Ganov * <p>
32038e8b4e5bc3c93affdffbc064fd9db5aeccc3e8eSvetoslav Ganov * <strong>Note:</strong> This event is fired only for the window source of the
32182e236d72ac197d6673d0b4d484fe5f0b9436731Svetoslav Ganov * last accessibility event different from {@link #TYPE_NOTIFICATION_STATE_CHANGED}
32238e8b4e5bc3c93affdffbc064fd9db5aeccc3e8eSvetoslav Ganov * and its purpose is to notify clients that the content of the user interaction
32382e236d72ac197d6673d0b4d484fe5f0b9436731Svetoslav Ganov * window has changed.</br>
32438e8b4e5bc3c93affdffbc064fd9db5aeccc3e8eSvetoslav Ganov * <em>Type:</em> {@link #TYPE_WINDOW_CONTENT_CHANGED}</br>
32538e8b4e5bc3c93affdffbc064fd9db5aeccc3e8eSvetoslav Ganov * <em>Properties:</em></br>
326a0156177cdc809795dd8bc5a19943dd2b6f82b66Svetoslav Ganov * <ul>
32782e236d72ac197d6673d0b4d484fe5f0b9436731Svetoslav Ganov *   <li>{@link #getEventType()} - The type of the event.</li>
32838e8b4e5bc3c93affdffbc064fd9db5aeccc3e8eSvetoslav Ganov *   <li>{@link #getSource()} - The source info (for registered clients).</li>
329a0156177cdc809795dd8bc5a19943dd2b6f82b66Svetoslav Ganov *   <li>{@link #getClassName()} - The class name of the source.</li>
330a0156177cdc809795dd8bc5a19943dd2b6f82b66Svetoslav Ganov *   <li>{@link #getPackageName()} - The package name of the source.</li>
331a0156177cdc809795dd8bc5a19943dd2b6f82b66Svetoslav Ganov *   <li>{@link #getEventTime()}  - The event time.</li>
33238e8b4e5bc3c93affdffbc064fd9db5aeccc3e8eSvetoslav Ganov * </ul>
33382e236d72ac197d6673d0b4d484fe5f0b9436731Svetoslav Ganov * <em>Note:</em> This event type is not dispatched to descendants though
33482e236d72ac197d6673d0b4d484fe5f0b9436731Svetoslav Ganov * {@link android.view.View#dispatchPopulateAccessibilityEvent(AccessibilityEvent)
33582e236d72ac197d6673d0b4d484fe5f0b9436731Svetoslav Ganov * View.dispatchPopulateAccessibilityEvent(AccessibilityEvent)}, hence the event
33682e236d72ac197d6673d0b4d484fe5f0b9436731Svetoslav Ganov * source {@link android.view.View} and the sub-tree rooted at it will not receive
33782e236d72ac197d6673d0b4d484fe5f0b9436731Svetoslav Ganov * calls to {@link android.view.View#onPopulateAccessibilityEvent(AccessibilityEvent)
33882e236d72ac197d6673d0b4d484fe5f0b9436731Svetoslav Ganov * View.onPopulateAccessibilityEvent(AccessibilityEvent)}. The preferred way to add
33982e236d72ac197d6673d0b4d484fe5f0b9436731Svetoslav Ganov * text content to such events is by setting the
34082e236d72ac197d6673d0b4d484fe5f0b9436731Svetoslav Ganov * {@link android.R.styleable#View_contentDescription contentDescription} of the source
34182e236d72ac197d6673d0b4d484fe5f0b9436731Svetoslav Ganov * view.</br>
34282e236d72ac197d6673d0b4d484fe5f0b9436731Svetoslav Ganov * </p>
343eeee4d2c01d3c4ed99e4891dbc75c7de69a803faSvetoslav Ganov * <p>
34438e8b4e5bc3c93affdffbc064fd9db5aeccc3e8eSvetoslav Ganov * <b>NOTIFICATION TYPES</b></br>
34582e236d72ac197d6673d0b4d484fe5f0b9436731Svetoslav Ganov * </p>
34675986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov * <p>
34738e8b4e5bc3c93affdffbc064fd9db5aeccc3e8eSvetoslav Ganov * <b>Notification state changed</b> - represents the event showing
34882e236d72ac197d6673d0b4d484fe5f0b9436731Svetoslav Ganov * {@link android.app.Notification}.</br>
34938e8b4e5bc3c93affdffbc064fd9db5aeccc3e8eSvetoslav Ganov * <em>Type:</em> {@link #TYPE_NOTIFICATION_STATE_CHANGED}</br>
35038e8b4e5bc3c93affdffbc064fd9db5aeccc3e8eSvetoslav Ganov * <em>Properties:</em></br>
351a0156177cdc809795dd8bc5a19943dd2b6f82b66Svetoslav Ganov * <ul>
35282e236d72ac197d6673d0b4d484fe5f0b9436731Svetoslav Ganov *   <li>{@link #getEventType()} - The type of the event.</li>
353a0156177cdc809795dd8bc5a19943dd2b6f82b66Svetoslav Ganov *   <li>{@link #getClassName()} - The class name of the source.</li>
354a0156177cdc809795dd8bc5a19943dd2b6f82b66Svetoslav Ganov *   <li>{@link #getPackageName()} - The package name of the source.</li>
355a0156177cdc809795dd8bc5a19943dd2b6f82b66Svetoslav Ganov *   <li>{@link #getEventTime()}  - The event time.</li>
35682e236d72ac197d6673d0b4d484fe5f0b9436731Svetoslav Ganov *   <li>{@link #getText()} - The text of the source's sub-tree.</li>
357a0156177cdc809795dd8bc5a19943dd2b6f82b66Svetoslav Ganov *   <li>{@link #getParcelableData()} - The posted {@link android.app.Notification}.</li>
35882e236d72ac197d6673d0b4d484fe5f0b9436731Svetoslav Ganov *   <li>{@link #getText()} - Text for providing more context.</li>
359a0156177cdc809795dd8bc5a19943dd2b6f82b66Svetoslav Ganov * </ul>
36082e236d72ac197d6673d0b4d484fe5f0b9436731Svetoslav Ganov * <em>Note:</em> This event type is not dispatched to descendants though
36182e236d72ac197d6673d0b4d484fe5f0b9436731Svetoslav Ganov * {@link android.view.View#dispatchPopulateAccessibilityEvent(AccessibilityEvent)
36282e236d72ac197d6673d0b4d484fe5f0b9436731Svetoslav Ganov * View.dispatchPopulateAccessibilityEvent(AccessibilityEvent)}, hence the event
36382e236d72ac197d6673d0b4d484fe5f0b9436731Svetoslav Ganov * source {@link android.view.View} and the sub-tree rooted at it will not receive
36482e236d72ac197d6673d0b4d484fe5f0b9436731Svetoslav Ganov * calls to {@link android.view.View#onPopulateAccessibilityEvent(AccessibilityEvent)
36582e236d72ac197d6673d0b4d484fe5f0b9436731Svetoslav Ganov * View.onPopulateAccessibilityEvent(AccessibilityEvent)}. The preferred way to add
36682e236d72ac197d6673d0b4d484fe5f0b9436731Svetoslav Ganov * text content to such events is by setting the
36782e236d72ac197d6673d0b4d484fe5f0b9436731Svetoslav Ganov * {@link android.R.styleable#View_contentDescription contentDescription} of the source
36882e236d72ac197d6673d0b4d484fe5f0b9436731Svetoslav Ganov * view.</br>
36982e236d72ac197d6673d0b4d484fe5f0b9436731Svetoslav Ganov * </p>
37082e236d72ac197d6673d0b4d484fe5f0b9436731Svetoslav Ganov * <p>
37182e236d72ac197d6673d0b4d484fe5f0b9436731Svetoslav Ganov * <b>EXPLORATION TYPES</b></br>
37282e236d72ac197d6673d0b4d484fe5f0b9436731Svetoslav Ganov * </p>
37382e236d72ac197d6673d0b4d484fe5f0b9436731Svetoslav Ganov * <p>
37482e236d72ac197d6673d0b4d484fe5f0b9436731Svetoslav Ganov * <b>View hover enter</b> - represents the event of beginning to hover
37582e236d72ac197d6673d0b4d484fe5f0b9436731Svetoslav Ganov * over a {@link android.view.View}. The hover may be generated via
37682e236d72ac197d6673d0b4d484fe5f0b9436731Svetoslav Ganov * exploring the screen by touch or via a pointing device.</br>
37782e236d72ac197d6673d0b4d484fe5f0b9436731Svetoslav Ganov * <em>Type:</em> {@link #TYPE_VIEW_HOVER_ENTER}</br>
37882e236d72ac197d6673d0b4d484fe5f0b9436731Svetoslav Ganov * <em>Properties:</em></br>
37982e236d72ac197d6673d0b4d484fe5f0b9436731Svetoslav Ganov * <ul>
38082e236d72ac197d6673d0b4d484fe5f0b9436731Svetoslav Ganov *   <li>{@link #getEventType()} - The type of the event.</li>
38182e236d72ac197d6673d0b4d484fe5f0b9436731Svetoslav Ganov *   <li>{@link #getSource()} - The source info (for registered clients).</li>
38282e236d72ac197d6673d0b4d484fe5f0b9436731Svetoslav Ganov *   <li>{@link #getClassName()} - The class name of the source.</li>
38382e236d72ac197d6673d0b4d484fe5f0b9436731Svetoslav Ganov *   <li>{@link #getPackageName()} - The package name of the source.</li>
38482e236d72ac197d6673d0b4d484fe5f0b9436731Svetoslav Ganov *   <li>{@link #getEventTime()}  - The event time.</li>
38582e236d72ac197d6673d0b4d484fe5f0b9436731Svetoslav Ganov *   <li>{@link #getText()} - The text of the source's sub-tree.</li>
38682e236d72ac197d6673d0b4d484fe5f0b9436731Svetoslav Ganov *   <li>{@link #isEnabled()} - Whether the source is enabled.</li>
38782e236d72ac197d6673d0b4d484fe5f0b9436731Svetoslav Ganov *   <li>{@link #getContentDescription()} - The content description of the source.</li>
388d9ee72fddb8be40e414a831fb80458dc48699613Svetoslav Ganov *   <li>{@link #getScrollX()} - The offset of the source left edge in pixels
389d9ee72fddb8be40e414a831fb80458dc48699613Svetoslav Ganov *       (without descendants of AdapterView).</li>
390d9ee72fddb8be40e414a831fb80458dc48699613Svetoslav Ganov *   <li>{@link #getScrollY()} - The offset of the source top edge in pixels
391d9ee72fddb8be40e414a831fb80458dc48699613Svetoslav Ganov *       (without descendants of AdapterView).</li>
392d9ee72fddb8be40e414a831fb80458dc48699613Svetoslav Ganov *   <li>{@link #getFromIndex()} - The zero based index of the first visible item of the source,
393d9ee72fddb8be40e414a831fb80458dc48699613Svetoslav Ganov *       inclusive (for descendants of AdapterView).</li>
394d9ee72fddb8be40e414a831fb80458dc48699613Svetoslav Ganov *   <li>{@link #getToIndex()} - The zero based index of the last visible item of the source,
395d9ee72fddb8be40e414a831fb80458dc48699613Svetoslav Ganov *       inclusive (for descendants of AdapterView).</li>
396d9ee72fddb8be40e414a831fb80458dc48699613Svetoslav Ganov *   <li>{@link #getItemCount()} - The total items of the source
397d9ee72fddb8be40e414a831fb80458dc48699613Svetoslav Ganov *       (for descendants of AdapterView).</li>
39882e236d72ac197d6673d0b4d484fe5f0b9436731Svetoslav Ganov * </ul>
39982e236d72ac197d6673d0b4d484fe5f0b9436731Svetoslav Ganov * </p>
40082e236d72ac197d6673d0b4d484fe5f0b9436731Svetoslav Ganov * <b>View hover exit</b> - represents the event of stopping to hover
40182e236d72ac197d6673d0b4d484fe5f0b9436731Svetoslav Ganov * over a {@link android.view.View}. The hover may be generated via
40282e236d72ac197d6673d0b4d484fe5f0b9436731Svetoslav Ganov * exploring the screen by touch or via a pointing device.</br>
40382e236d72ac197d6673d0b4d484fe5f0b9436731Svetoslav Ganov * <em>Type:</em> {@link #TYPE_VIEW_HOVER_EXIT}</br>
40482e236d72ac197d6673d0b4d484fe5f0b9436731Svetoslav Ganov * <em>Properties:</em></br>
40582e236d72ac197d6673d0b4d484fe5f0b9436731Svetoslav Ganov * <ul>
40682e236d72ac197d6673d0b4d484fe5f0b9436731Svetoslav Ganov *   <li>{@link #getEventType()} - The type of the event.</li>
40782e236d72ac197d6673d0b4d484fe5f0b9436731Svetoslav Ganov *   <li>{@link #getSource()} - The source info (for registered clients).</li>
40882e236d72ac197d6673d0b4d484fe5f0b9436731Svetoslav Ganov *   <li>{@link #getClassName()} - The class name of the source.</li>
40982e236d72ac197d6673d0b4d484fe5f0b9436731Svetoslav Ganov *   <li>{@link #getPackageName()} - The package name of the source.</li>
41082e236d72ac197d6673d0b4d484fe5f0b9436731Svetoslav Ganov *   <li>{@link #getEventTime()}  - The event time.</li>
41182e236d72ac197d6673d0b4d484fe5f0b9436731Svetoslav Ganov *   <li>{@link #getText()} - The text of the source's sub-tree.</li>
41282e236d72ac197d6673d0b4d484fe5f0b9436731Svetoslav Ganov *   <li>{@link #isEnabled()} - Whether the source is enabled.</li>
41382e236d72ac197d6673d0b4d484fe5f0b9436731Svetoslav Ganov *   <li>{@link #getContentDescription()} - The content description of the source.</li>
414d9ee72fddb8be40e414a831fb80458dc48699613Svetoslav Ganov *   <li>{@link #getScrollX()} - The offset of the source left edge in pixels
415d9ee72fddb8be40e414a831fb80458dc48699613Svetoslav Ganov *       (without descendants of AdapterView).</li>
416d9ee72fddb8be40e414a831fb80458dc48699613Svetoslav Ganov *   <li>{@link #getScrollY()} - The offset of the source top edge in pixels
417d9ee72fddb8be40e414a831fb80458dc48699613Svetoslav Ganov *       (without descendants of AdapterView).</li>
418d9ee72fddb8be40e414a831fb80458dc48699613Svetoslav Ganov *   <li>{@link #getFromIndex()} - The zero based index of the first visible item of the source,
419d9ee72fddb8be40e414a831fb80458dc48699613Svetoslav Ganov *       inclusive (for descendants of AdapterView).</li>
420d9ee72fddb8be40e414a831fb80458dc48699613Svetoslav Ganov *   <li>{@link #getToIndex()} - The zero based index of the last visible item of the source,
421d9ee72fddb8be40e414a831fb80458dc48699613Svetoslav Ganov *       inclusive (for descendants of AdapterView).</li>
422d9ee72fddb8be40e414a831fb80458dc48699613Svetoslav Ganov *   <li>{@link #getItemCount()} - The total items of the source
423d9ee72fddb8be40e414a831fb80458dc48699613Svetoslav Ganov *       (for descendants of AdapterView).</li>
42482e236d72ac197d6673d0b4d484fe5f0b9436731Svetoslav Ganov * </ul>
42582e236d72ac197d6673d0b4d484fe5f0b9436731Svetoslav Ganov * </p>
42682e236d72ac197d6673d0b4d484fe5f0b9436731Svetoslav Ganov * <p>
42782e236d72ac197d6673d0b4d484fe5f0b9436731Svetoslav Ganov * <b>Touch exploration gesture start</b> - represents the event of starting a touch
42882e236d72ac197d6673d0b4d484fe5f0b9436731Svetoslav Ganov * exploring gesture.</br>
42982e236d72ac197d6673d0b4d484fe5f0b9436731Svetoslav Ganov * <em>Type:</em> {@link #TYPE_TOUCH_EXPLORATION_GESTURE_START}</br>
43082e236d72ac197d6673d0b4d484fe5f0b9436731Svetoslav Ganov * <em>Properties:</em></br>
43182e236d72ac197d6673d0b4d484fe5f0b9436731Svetoslav Ganov * <ul>
43282e236d72ac197d6673d0b4d484fe5f0b9436731Svetoslav Ganov *   <li>{@link #getEventType()} - The type of the event.</li>
43382e236d72ac197d6673d0b4d484fe5f0b9436731Svetoslav Ganov * </ul>
43482e236d72ac197d6673d0b4d484fe5f0b9436731Svetoslav Ganov * <em>Note:</em> This event type is not dispatched to descendants though
43582e236d72ac197d6673d0b4d484fe5f0b9436731Svetoslav Ganov * {@link android.view.View#dispatchPopulateAccessibilityEvent(AccessibilityEvent)
43682e236d72ac197d6673d0b4d484fe5f0b9436731Svetoslav Ganov * View.dispatchPopulateAccessibilityEvent(AccessibilityEvent)}, hence the event
43782e236d72ac197d6673d0b4d484fe5f0b9436731Svetoslav Ganov * source {@link android.view.View} and the sub-tree rooted at it will not receive
43882e236d72ac197d6673d0b4d484fe5f0b9436731Svetoslav Ganov * calls to {@link android.view.View#onPopulateAccessibilityEvent(AccessibilityEvent)
43982e236d72ac197d6673d0b4d484fe5f0b9436731Svetoslav Ganov * View.onPopulateAccessibilityEvent(AccessibilityEvent)}. The preferred way to add
44082e236d72ac197d6673d0b4d484fe5f0b9436731Svetoslav Ganov * text content to such events is by setting the
44182e236d72ac197d6673d0b4d484fe5f0b9436731Svetoslav Ganov * {@link android.R.styleable#View_contentDescription contentDescription} of the source
44282e236d72ac197d6673d0b4d484fe5f0b9436731Svetoslav Ganov * view.</br>
44382e236d72ac197d6673d0b4d484fe5f0b9436731Svetoslav Ganov * </p>
44482e236d72ac197d6673d0b4d484fe5f0b9436731Svetoslav Ganov * <p>
44582e236d72ac197d6673d0b4d484fe5f0b9436731Svetoslav Ganov * <b>Touch exploration gesture end</b> - represents the event of ending a touch
44682e236d72ac197d6673d0b4d484fe5f0b9436731Svetoslav Ganov * exploring gesture.</br>
44782e236d72ac197d6673d0b4d484fe5f0b9436731Svetoslav Ganov * <em>Type:</em> {@link #TYPE_TOUCH_EXPLORATION_GESTURE_END}</br>
44882e236d72ac197d6673d0b4d484fe5f0b9436731Svetoslav Ganov * <em>Properties:</em></br>
44982e236d72ac197d6673d0b4d484fe5f0b9436731Svetoslav Ganov * <ul>
45082e236d72ac197d6673d0b4d484fe5f0b9436731Svetoslav Ganov *   <li>{@link #getEventType()} - The type of the event.</li>
45182e236d72ac197d6673d0b4d484fe5f0b9436731Svetoslav Ganov * </ul>
45282e236d72ac197d6673d0b4d484fe5f0b9436731Svetoslav Ganov * <em>Note:</em> This event type is not dispatched to descendants though
45382e236d72ac197d6673d0b4d484fe5f0b9436731Svetoslav Ganov * {@link android.view.View#dispatchPopulateAccessibilityEvent(AccessibilityEvent)
45482e236d72ac197d6673d0b4d484fe5f0b9436731Svetoslav Ganov * View.dispatchPopulateAccessibilityEvent(AccessibilityEvent)}, hence the event
45582e236d72ac197d6673d0b4d484fe5f0b9436731Svetoslav Ganov * source {@link android.view.View} and the sub-tree rooted at it will not receive
45682e236d72ac197d6673d0b4d484fe5f0b9436731Svetoslav Ganov * calls to {@link android.view.View#onPopulateAccessibilityEvent(AccessibilityEvent)
45782e236d72ac197d6673d0b4d484fe5f0b9436731Svetoslav Ganov * View.onPopulateAccessibilityEvent(AccessibilityEvent)}. The preferred way to add
45882e236d72ac197d6673d0b4d484fe5f0b9436731Svetoslav Ganov * text content to such events is by setting the
45982e236d72ac197d6673d0b4d484fe5f0b9436731Svetoslav Ganov * {@link android.R.styleable#View_contentDescription contentDescription} of the source
46082e236d72ac197d6673d0b4d484fe5f0b9436731Svetoslav Ganov * view.</br>
46138e8b4e5bc3c93affdffbc064fd9db5aeccc3e8eSvetoslav Ganov * </p>
46275986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov * <p>
46351ab90cab1609cf0ddd2dfe5a660f020d823d4d5Svetoslav Ganov * <b>MISCELLANEOUS TYPES</b></br>
46451ab90cab1609cf0ddd2dfe5a660f020d823d4d5Svetoslav Ganov * </p>
46551ab90cab1609cf0ddd2dfe5a660f020d823d4d5Svetoslav Ganov * <p>
46651ab90cab1609cf0ddd2dfe5a660f020d823d4d5Svetoslav Ganov * <b>Announcement</b> - represents the event of an application making an
46751ab90cab1609cf0ddd2dfe5a660f020d823d4d5Svetoslav Ganov * announcement. Usually this announcement is related to some sort of a context
46851ab90cab1609cf0ddd2dfe5a660f020d823d4d5Svetoslav Ganov * change for which none of the events representing UI transitions is a good fit.
46951ab90cab1609cf0ddd2dfe5a660f020d823d4d5Svetoslav Ganov * For example, announcing a new page in a book.</br>
47051ab90cab1609cf0ddd2dfe5a660f020d823d4d5Svetoslav Ganov * <em>Type:</em> {@link #TYPE_ANNOUNCEMENT}</br>
47151ab90cab1609cf0ddd2dfe5a660f020d823d4d5Svetoslav Ganov * <em>Properties:</em></br>
47251ab90cab1609cf0ddd2dfe5a660f020d823d4d5Svetoslav Ganov * <ul>
47351ab90cab1609cf0ddd2dfe5a660f020d823d4d5Svetoslav Ganov *   <li>{@link #getEventType()} - The type of the event.</li>
47451ab90cab1609cf0ddd2dfe5a660f020d823d4d5Svetoslav Ganov *   <li>{@link #getSource()} - The source info (for registered clients).</li>
47551ab90cab1609cf0ddd2dfe5a660f020d823d4d5Svetoslav Ganov *   <li>{@link #getClassName()} - The class name of the source.</li>
47651ab90cab1609cf0ddd2dfe5a660f020d823d4d5Svetoslav Ganov *   <li>{@link #getPackageName()} - The package name of the source.</li>
47751ab90cab1609cf0ddd2dfe5a660f020d823d4d5Svetoslav Ganov *   <li>{@link #getEventTime()}  - The event time.</li>
47851ab90cab1609cf0ddd2dfe5a660f020d823d4d5Svetoslav Ganov *   <li>{@link #getText()} - The text of the announcement.</li>
47951ab90cab1609cf0ddd2dfe5a660f020d823d4d5Svetoslav Ganov *   <li>{@link #isEnabled()} - Whether the source is enabled.</li>
48051ab90cab1609cf0ddd2dfe5a660f020d823d4d5Svetoslav Ganov * </ul>
48151ab90cab1609cf0ddd2dfe5a660f020d823d4d5Svetoslav Ganov * </p>
48251ab90cab1609cf0ddd2dfe5a660f020d823d4d5Svetoslav Ganov * <p>
48375986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov * <b>Security note</b>
48475986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov * <p>
48538e8b4e5bc3c93affdffbc064fd9db5aeccc3e8eSvetoslav Ganov * Since an event contains the text of its source privacy can be compromised by leaking
48675986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov * sensitive information such as passwords. To address this issue any event fired in response
48775986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov * to manipulation of a PASSWORD field does NOT CONTAIN the text of the password.
48882e236d72ac197d6673d0b4d484fe5f0b9436731Svetoslav Ganov * </p>
48975986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov *
49075986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov * @see android.view.accessibility.AccessibilityManager
49175986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov * @see android.accessibilityservice.AccessibilityService
49238e8b4e5bc3c93affdffbc064fd9db5aeccc3e8eSvetoslav Ganov * @see AccessibilityNodeInfo
49375986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov */
494736c2756bf3c14ae9fef7255c119057f7a2be1edSvetoslav Ganovpublic final class AccessibilityEvent extends AccessibilityRecord implements Parcelable {
4958643aa0179e598e78d938c59035389054535a229Svetoslav Ganov    private static final boolean DEBUG = false;
49675986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov
49775986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov    /**
49875986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov     * Invalid selection/focus position.
49975986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov     *
50075986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov     * @see #getCurrentItemIndex()
50175986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov     */
50275986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov    public static final int INVALID_POSITION = -1;
50375986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov
50475986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov    /**
50575986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov     * Maximum length of the text fields.
50675986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov     *
50775986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov     * @see #getBeforeText()
50875986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov     * @see #getText()
509c0a8cd10a5829bf4e94ee073ba6f553128e9d8e9Svetoslav Ganov     * </br>
510c0a8cd10a5829bf4e94ee073ba6f553128e9d8e9Svetoslav Ganov     * Note: This constant is no longer needed since there
511c0a8cd10a5829bf4e94ee073ba6f553128e9d8e9Svetoslav Ganov     *       is no limit on the length of text that is contained
512c0a8cd10a5829bf4e94ee073ba6f553128e9d8e9Svetoslav Ganov     *       in an accessibility event anymore.
51375986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov     */
514c0a8cd10a5829bf4e94ee073ba6f553128e9d8e9Svetoslav Ganov    @Deprecated
51575986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov    public static final int MAX_TEXT_LENGTH = 500;
51675986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov
51775986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov    /**
51875986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov     * Represents the event of clicking on a {@link android.view.View} like
51975986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov     * {@link android.widget.Button}, {@link android.widget.CompoundButton}, etc.
52075986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov     */
52175986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov    public static final int TYPE_VIEW_CLICKED = 0x00000001;
52275986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov
52375986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov    /**
52475986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov     * Represents the event of long clicking on a {@link android.view.View} like
52575986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov     * {@link android.widget.Button}, {@link android.widget.CompoundButton}, etc.
52675986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov     */
52775986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov    public static final int TYPE_VIEW_LONG_CLICKED = 0x00000002;
52875986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov
52975986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov    /**
53075986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov     * Represents the event of selecting an item usually in the context of an
53175986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov     * {@link android.widget.AdapterView}.
53275986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov     */
53375986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov    public static final int TYPE_VIEW_SELECTED = 0x00000004;
53475986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov
53575986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov    /**
5364213804541a8b05cd0587b138a2fd9a3b7fd9350Svetoslav Ganov     * Represents the event of setting input focus of a {@link android.view.View}.
53775986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov     */
53875986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov    public static final int TYPE_VIEW_FOCUSED = 0x00000008;
53975986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov
54075986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov    /**
54175986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov     * Represents the event of changing the text of an {@link android.widget.EditText}.
54275986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov     */
54375986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov    public static final int TYPE_VIEW_TEXT_CHANGED = 0x00000010;
54475986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov
54575986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov    /**
54638e8b4e5bc3c93affdffbc064fd9db5aeccc3e8eSvetoslav Ganov     * Represents the event of opening a {@link android.widget.PopupWindow},
54775986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov     * {@link android.view.Menu}, {@link android.app.Dialog}, etc.
54875986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov     */
54975986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov    public static final int TYPE_WINDOW_STATE_CHANGED = 0x00000020;
55075986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov
55175986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov    /**
55238e8b4e5bc3c93affdffbc064fd9db5aeccc3e8eSvetoslav Ganov     * Represents the event showing a {@link android.app.Notification}.
55375986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov     */
55475986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov    public static final int TYPE_NOTIFICATION_STATE_CHANGED = 0x00000040;
55575986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov
55675986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov    /**
557736c2756bf3c14ae9fef7255c119057f7a2be1edSvetoslav Ganov     * Represents the event of a hover enter over a {@link android.view.View}.
558736c2756bf3c14ae9fef7255c119057f7a2be1edSvetoslav Ganov     */
559736c2756bf3c14ae9fef7255c119057f7a2be1edSvetoslav Ganov    public static final int TYPE_VIEW_HOVER_ENTER = 0x00000080;
560736c2756bf3c14ae9fef7255c119057f7a2be1edSvetoslav Ganov
561736c2756bf3c14ae9fef7255c119057f7a2be1edSvetoslav Ganov    /**
562736c2756bf3c14ae9fef7255c119057f7a2be1edSvetoslav Ganov     * Represents the event of a hover exit over a {@link android.view.View}.
563736c2756bf3c14ae9fef7255c119057f7a2be1edSvetoslav Ganov     */
564736c2756bf3c14ae9fef7255c119057f7a2be1edSvetoslav Ganov    public static final int TYPE_VIEW_HOVER_EXIT = 0x00000100;
565736c2756bf3c14ae9fef7255c119057f7a2be1edSvetoslav Ganov
566736c2756bf3c14ae9fef7255c119057f7a2be1edSvetoslav Ganov    /**
567736c2756bf3c14ae9fef7255c119057f7a2be1edSvetoslav Ganov     * Represents the event of starting a touch exploration gesture.
568736c2756bf3c14ae9fef7255c119057f7a2be1edSvetoslav Ganov     */
569736c2756bf3c14ae9fef7255c119057f7a2be1edSvetoslav Ganov    public static final int TYPE_TOUCH_EXPLORATION_GESTURE_START = 0x00000200;
570736c2756bf3c14ae9fef7255c119057f7a2be1edSvetoslav Ganov
571736c2756bf3c14ae9fef7255c119057f7a2be1edSvetoslav Ganov    /**
572736c2756bf3c14ae9fef7255c119057f7a2be1edSvetoslav Ganov     * Represents the event of ending a touch exploration gesture.
573736c2756bf3c14ae9fef7255c119057f7a2be1edSvetoslav Ganov     */
574736c2756bf3c14ae9fef7255c119057f7a2be1edSvetoslav Ganov    public static final int TYPE_TOUCH_EXPLORATION_GESTURE_END = 0x00000400;
575736c2756bf3c14ae9fef7255c119057f7a2be1edSvetoslav Ganov
576736c2756bf3c14ae9fef7255c119057f7a2be1edSvetoslav Ganov    /**
5774213804541a8b05cd0587b138a2fd9a3b7fd9350Svetoslav Ganov     * Represents the event of changing the content of a window and more
5784213804541a8b05cd0587b138a2fd9a3b7fd9350Svetoslav Ganov     * specifically the sub-tree rooted at the event's source.
579eeee4d2c01d3c4ed99e4891dbc75c7de69a803faSvetoslav Ganov     */
580eeee4d2c01d3c4ed99e4891dbc75c7de69a803faSvetoslav Ganov    public static final int TYPE_WINDOW_CONTENT_CHANGED = 0x00000800;
581eeee4d2c01d3c4ed99e4891dbc75c7de69a803faSvetoslav Ganov
582eeee4d2c01d3c4ed99e4891dbc75c7de69a803faSvetoslav Ganov    /**
583a0156177cdc809795dd8bc5a19943dd2b6f82b66Svetoslav Ganov     * Represents the event of scrolling a view.
584a0156177cdc809795dd8bc5a19943dd2b6f82b66Svetoslav Ganov     */
585a0156177cdc809795dd8bc5a19943dd2b6f82b66Svetoslav Ganov    public static final int TYPE_VIEW_SCROLLED = 0x00001000;
586a0156177cdc809795dd8bc5a19943dd2b6f82b66Svetoslav Ganov
587a0156177cdc809795dd8bc5a19943dd2b6f82b66Svetoslav Ganov    /**
588a0156177cdc809795dd8bc5a19943dd2b6f82b66Svetoslav Ganov     * Represents the event of changing the selection in an {@link android.widget.EditText}.
589a0156177cdc809795dd8bc5a19943dd2b6f82b66Svetoslav Ganov     */
590a0156177cdc809795dd8bc5a19943dd2b6f82b66Svetoslav Ganov    public static final int TYPE_VIEW_TEXT_SELECTION_CHANGED = 0x00002000;
591a0156177cdc809795dd8bc5a19943dd2b6f82b66Svetoslav Ganov
592a0156177cdc809795dd8bc5a19943dd2b6f82b66Svetoslav Ganov    /**
59351ab90cab1609cf0ddd2dfe5a660f020d823d4d5Svetoslav Ganov     * Represents the event of an application making an announcement.
59451ab90cab1609cf0ddd2dfe5a660f020d823d4d5Svetoslav Ganov     */
59551ab90cab1609cf0ddd2dfe5a660f020d823d4d5Svetoslav Ganov    public static final int TYPE_ANNOUNCEMENT = 0x00004000;
59651ab90cab1609cf0ddd2dfe5a660f020d823d4d5Svetoslav Ganov
59751ab90cab1609cf0ddd2dfe5a660f020d823d4d5Svetoslav Ganov    /**
5984213804541a8b05cd0587b138a2fd9a3b7fd9350Svetoslav Ganov     * Represents the event of gaining accessibility focus.
5994213804541a8b05cd0587b138a2fd9a3b7fd9350Svetoslav Ganov     */
6004213804541a8b05cd0587b138a2fd9a3b7fd9350Svetoslav Ganov    public static final int TYPE_VIEW_ACCESSIBILITY_FOCUSED = 0x00008000;
6014213804541a8b05cd0587b138a2fd9a3b7fd9350Svetoslav Ganov
6024213804541a8b05cd0587b138a2fd9a3b7fd9350Svetoslav Ganov    /**
6034213804541a8b05cd0587b138a2fd9a3b7fd9350Svetoslav Ganov     * Represents the event of clearing accessibility focus.
6044213804541a8b05cd0587b138a2fd9a3b7fd9350Svetoslav Ganov     */
6054213804541a8b05cd0587b138a2fd9a3b7fd9350Svetoslav Ganov    public static final int TYPE_VIEW_ACCESSIBILITY_FOCUS_CLEARED = 0x00010000;
6064213804541a8b05cd0587b138a2fd9a3b7fd9350Svetoslav Ganov
6074213804541a8b05cd0587b138a2fd9a3b7fd9350Svetoslav Ganov    /**
6082b435aada3d274a9c08d334946fff1ab9ba15b48Svetoslav Ganov     * Represents the event of traversing the text of a view at a given movement granularity.
609b7ff3255c6d4e12f9d2334e3bbec0a125b7b09dcSvetoslav Ganov     */
6102b435aada3d274a9c08d334946fff1ab9ba15b48Svetoslav Ganov    public static final int TYPE_VIEW_TEXT_TRAVERSED_AT_MOVEMENT_GRANULARITY = 0x00020000;
611b7ff3255c6d4e12f9d2334e3bbec0a125b7b09dcSvetoslav Ganov
612b7ff3255c6d4e12f9d2334e3bbec0a125b7b09dcSvetoslav Ganov    /**
61375986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov     * Mask for {@link AccessibilityEvent} all types.
61475986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov     *
61575986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov     * @see #TYPE_VIEW_CLICKED
61675986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov     * @see #TYPE_VIEW_LONG_CLICKED
61775986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov     * @see #TYPE_VIEW_SELECTED
61875986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov     * @see #TYPE_VIEW_FOCUSED
61975986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov     * @see #TYPE_VIEW_TEXT_CHANGED
62075986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov     * @see #TYPE_WINDOW_STATE_CHANGED
62175986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov     * @see #TYPE_NOTIFICATION_STATE_CHANGED
62238e8b4e5bc3c93affdffbc064fd9db5aeccc3e8eSvetoslav Ganov     * @see #TYPE_VIEW_HOVER_ENTER
62338e8b4e5bc3c93affdffbc064fd9db5aeccc3e8eSvetoslav Ganov     * @see #TYPE_VIEW_HOVER_EXIT
62438e8b4e5bc3c93affdffbc064fd9db5aeccc3e8eSvetoslav Ganov     * @see #TYPE_TOUCH_EXPLORATION_GESTURE_START
62538e8b4e5bc3c93affdffbc064fd9db5aeccc3e8eSvetoslav Ganov     * @see #TYPE_TOUCH_EXPLORATION_GESTURE_END
62638e8b4e5bc3c93affdffbc064fd9db5aeccc3e8eSvetoslav Ganov     * @see #TYPE_WINDOW_CONTENT_CHANGED
62738e8b4e5bc3c93affdffbc064fd9db5aeccc3e8eSvetoslav Ganov     * @see #TYPE_VIEW_SCROLLED
62838e8b4e5bc3c93affdffbc064fd9db5aeccc3e8eSvetoslav Ganov     * @see #TYPE_VIEW_TEXT_SELECTION_CHANGED
62951ab90cab1609cf0ddd2dfe5a660f020d823d4d5Svetoslav Ganov     * @see #TYPE_ANNOUNCEMENT
6302b435aada3d274a9c08d334946fff1ab9ba15b48Svetoslav Ganov     * @see #TYPE_VIEW_TEXT_TRAVERSED_AT_MOVEMENT_GRANULARITY
63175986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov     */
63275986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov    public static final int TYPES_ALL_MASK = 0xFFFFFFFF;
63375986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov
634736c2756bf3c14ae9fef7255c119057f7a2be1edSvetoslav Ganov    private static final int MAX_POOL_SIZE = 10;
635887e1a17eb9b12448f5929791b564565b2665aabSvetoslav Ganov    private static final Object sPoolLock = new Object();
63675986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov    private static AccessibilityEvent sPool;
63775986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov    private static int sPoolSize;
63875986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov    private AccessibilityEvent mNext;
639736c2756bf3c14ae9fef7255c119057f7a2be1edSvetoslav Ganov    private boolean mIsInPool;
64075986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov
64175986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov    private int mEventType;
6423fb3d7c4e756bd32d5abde0abca9ab52d559bc84Adam Powell    private CharSequence mPackageName;
643736c2756bf3c14ae9fef7255c119057f7a2be1edSvetoslav Ganov    private long mEventTime;
6442b435aada3d274a9c08d334946fff1ab9ba15b48Svetoslav Ganov    int mMovementGranularity;
6456d17a936f73976971135aa1e6248662533343292Svetoslav Ganov    int mAction;
6463fb3d7c4e756bd32d5abde0abca9ab52d559bc84Adam Powell
647736c2756bf3c14ae9fef7255c119057f7a2be1edSvetoslav Ganov    private final ArrayList<AccessibilityRecord> mRecords = new ArrayList<AccessibilityRecord>();
64875986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov
64975986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov    /*
65075986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov     * Hide constructor from clients.
65175986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov     */
65275986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov    private AccessibilityEvent() {
6538643aa0179e598e78d938c59035389054535a229Svetoslav Ganov    }
65475986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov
6558643aa0179e598e78d938c59035389054535a229Svetoslav Ganov    /**
6568643aa0179e598e78d938c59035389054535a229Svetoslav Ganov     * Initialize an event from another one.
6578643aa0179e598e78d938c59035389054535a229Svetoslav Ganov     *
6588643aa0179e598e78d938c59035389054535a229Svetoslav Ganov     * @param event The event to initialize from.
6598643aa0179e598e78d938c59035389054535a229Svetoslav Ganov     */
6608643aa0179e598e78d938c59035389054535a229Svetoslav Ganov    void init(AccessibilityEvent event) {
6618643aa0179e598e78d938c59035389054535a229Svetoslav Ganov        super.init(event);
6628643aa0179e598e78d938c59035389054535a229Svetoslav Ganov        mEventType = event.mEventType;
6632b435aada3d274a9c08d334946fff1ab9ba15b48Svetoslav Ganov        mMovementGranularity = event.mMovementGranularity;
6646d17a936f73976971135aa1e6248662533343292Svetoslav Ganov        mAction = event.mAction;
6658643aa0179e598e78d938c59035389054535a229Svetoslav Ganov        mEventTime = event.mEventTime;
6668643aa0179e598e78d938c59035389054535a229Svetoslav Ganov        mPackageName = event.mPackageName;
667eeee4d2c01d3c4ed99e4891dbc75c7de69a803faSvetoslav Ganov    }
668eeee4d2c01d3c4ed99e4891dbc75c7de69a803faSvetoslav Ganov
669eeee4d2c01d3c4ed99e4891dbc75c7de69a803faSvetoslav Ganov    /**
670eeee4d2c01d3c4ed99e4891dbc75c7de69a803faSvetoslav Ganov     * Sets if this instance is sealed.
671eeee4d2c01d3c4ed99e4891dbc75c7de69a803faSvetoslav Ganov     *
672eeee4d2c01d3c4ed99e4891dbc75c7de69a803faSvetoslav Ganov     * @param sealed Whether is sealed.
673eeee4d2c01d3c4ed99e4891dbc75c7de69a803faSvetoslav Ganov     *
674eeee4d2c01d3c4ed99e4891dbc75c7de69a803faSvetoslav Ganov     * @hide
675eeee4d2c01d3c4ed99e4891dbc75c7de69a803faSvetoslav Ganov     */
676eeee4d2c01d3c4ed99e4891dbc75c7de69a803faSvetoslav Ganov    @Override
677eeee4d2c01d3c4ed99e4891dbc75c7de69a803faSvetoslav Ganov    public void setSealed(boolean sealed) {
678eeee4d2c01d3c4ed99e4891dbc75c7de69a803faSvetoslav Ganov        super.setSealed(sealed);
679eeee4d2c01d3c4ed99e4891dbc75c7de69a803faSvetoslav Ganov        List<AccessibilityRecord> records = mRecords;
680eeee4d2c01d3c4ed99e4891dbc75c7de69a803faSvetoslav Ganov        final int recordCount = records.size();
681eeee4d2c01d3c4ed99e4891dbc75c7de69a803faSvetoslav Ganov        for (int i = 0; i < recordCount; i++) {
682eeee4d2c01d3c4ed99e4891dbc75c7de69a803faSvetoslav Ganov            AccessibilityRecord record = records.get(i);
683eeee4d2c01d3c4ed99e4891dbc75c7de69a803faSvetoslav Ganov            record.setSealed(sealed);
684eeee4d2c01d3c4ed99e4891dbc75c7de69a803faSvetoslav Ganov        }
68575986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov    }
68675986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov
68775986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov    /**
688736c2756bf3c14ae9fef7255c119057f7a2be1edSvetoslav Ganov     * Gets the number of records contained in the event.
68975986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov     *
690736c2756bf3c14ae9fef7255c119057f7a2be1edSvetoslav Ganov     * @return The number of records.
69175986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov     */
692736c2756bf3c14ae9fef7255c119057f7a2be1edSvetoslav Ganov    public int getRecordCount() {
693736c2756bf3c14ae9fef7255c119057f7a2be1edSvetoslav Ganov        return mRecords.size();
69475986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov    }
69575986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov
69675986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov    /**
697736c2756bf3c14ae9fef7255c119057f7a2be1edSvetoslav Ganov     * Appends an {@link AccessibilityRecord} to the end of event records.
69875986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov     *
699736c2756bf3c14ae9fef7255c119057f7a2be1edSvetoslav Ganov     * @param record The record to append.
7008643aa0179e598e78d938c59035389054535a229Svetoslav Ganov     *
7018643aa0179e598e78d938c59035389054535a229Svetoslav Ganov     * @throws IllegalStateException If called from an AccessibilityService.
70275986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov     */
703736c2756bf3c14ae9fef7255c119057f7a2be1edSvetoslav Ganov    public void appendRecord(AccessibilityRecord record) {
7048643aa0179e598e78d938c59035389054535a229Svetoslav Ganov        enforceNotSealed();
705736c2756bf3c14ae9fef7255c119057f7a2be1edSvetoslav Ganov        mRecords.add(record);
70675986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov    }
70775986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov
70875986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov    /**
70938e8b4e5bc3c93affdffbc064fd9db5aeccc3e8eSvetoslav Ganov     * Gets the record at a given index.
71075986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov     *
711736c2756bf3c14ae9fef7255c119057f7a2be1edSvetoslav Ganov     * @param index The index.
71238e8b4e5bc3c93affdffbc064fd9db5aeccc3e8eSvetoslav Ganov     * @return The record at the specified index.
71375986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov     */
714736c2756bf3c14ae9fef7255c119057f7a2be1edSvetoslav Ganov    public AccessibilityRecord getRecord(int index) {
715736c2756bf3c14ae9fef7255c119057f7a2be1edSvetoslav Ganov        return mRecords.get(index);
71675986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov    }
71775986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov
71875986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov    /**
71975986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov     * Gets the event type.
72075986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov     *
72175986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov     * @return The event type.
72275986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov     */
72375986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov    public int getEventType() {
72475986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov        return mEventType;
72575986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov    }
72675986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov
72775986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov    /**
72875986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov     * Sets the event type.
72975986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov     *
73075986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov     * @param eventType The event type.
7318643aa0179e598e78d938c59035389054535a229Svetoslav Ganov     *
7328643aa0179e598e78d938c59035389054535a229Svetoslav Ganov     * @throws IllegalStateException If called from an AccessibilityService.
73375986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov     */
73475986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov    public void setEventType(int eventType) {
7358643aa0179e598e78d938c59035389054535a229Svetoslav Ganov        enforceNotSealed();
73675986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov        mEventType = eventType;
73775986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov    }
73875986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov
73975986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov    /**
74075986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov     * Gets the time in which this event was sent.
74175986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov     *
74275986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov     * @return The event time.
74375986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov     */
74475986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov    public long getEventTime() {
74575986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov        return mEventTime;
74675986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov    }
74775986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov
74875986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov    /**
74975986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov     * Sets the time in which this event was sent.
75075986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov     *
75175986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov     * @param eventTime The event time.
7528643aa0179e598e78d938c59035389054535a229Svetoslav Ganov     *
7538643aa0179e598e78d938c59035389054535a229Svetoslav Ganov     * @throws IllegalStateException If called from an AccessibilityService.
75475986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov     */
75575986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov    public void setEventTime(long eventTime) {
7568643aa0179e598e78d938c59035389054535a229Svetoslav Ganov        enforceNotSealed();
75775986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov        mEventTime = eventTime;
75875986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov    }
75975986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov
76075986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov    /**
76175986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov     * Gets the package name of the source.
76275986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov     *
76375986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov     * @return The package name.
76475986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov     */
76575986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov    public CharSequence getPackageName() {
76675986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov        return mPackageName;
76775986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov    }
76875986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov
76975986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov    /**
77075986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov     * Sets the package name of the source.
77175986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov     *
77275986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov     * @param packageName The package name.
7738643aa0179e598e78d938c59035389054535a229Svetoslav Ganov     *
7748643aa0179e598e78d938c59035389054535a229Svetoslav Ganov     * @throws IllegalStateException If called from an AccessibilityService.
77575986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov     */
77675986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov    public void setPackageName(CharSequence packageName) {
7778643aa0179e598e78d938c59035389054535a229Svetoslav Ganov        enforceNotSealed();
77875986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov        mPackageName = packageName;
77975986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov    }
78075986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov
78175986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov    /**
7822b435aada3d274a9c08d334946fff1ab9ba15b48Svetoslav Ganov     * Sets the movement granularity that was traversed.
783b7ff3255c6d4e12f9d2334e3bbec0a125b7b09dcSvetoslav Ganov     *
784b7ff3255c6d4e12f9d2334e3bbec0a125b7b09dcSvetoslav Ganov     * @param granularity The granularity.
785b7ff3255c6d4e12f9d2334e3bbec0a125b7b09dcSvetoslav Ganov     *
786b7ff3255c6d4e12f9d2334e3bbec0a125b7b09dcSvetoslav Ganov     * @throws IllegalStateException If called from an AccessibilityService.
787b7ff3255c6d4e12f9d2334e3bbec0a125b7b09dcSvetoslav Ganov     */
7882b435aada3d274a9c08d334946fff1ab9ba15b48Svetoslav Ganov    public void setMovementGranularity(int granularity) {
789b7ff3255c6d4e12f9d2334e3bbec0a125b7b09dcSvetoslav Ganov        enforceNotSealed();
7902b435aada3d274a9c08d334946fff1ab9ba15b48Svetoslav Ganov        mMovementGranularity = granularity;
791b7ff3255c6d4e12f9d2334e3bbec0a125b7b09dcSvetoslav Ganov    }
792b7ff3255c6d4e12f9d2334e3bbec0a125b7b09dcSvetoslav Ganov
793b7ff3255c6d4e12f9d2334e3bbec0a125b7b09dcSvetoslav Ganov    /**
7942b435aada3d274a9c08d334946fff1ab9ba15b48Svetoslav Ganov     * Gets the movement granularity that was traversed.
795b7ff3255c6d4e12f9d2334e3bbec0a125b7b09dcSvetoslav Ganov     *
796b7ff3255c6d4e12f9d2334e3bbec0a125b7b09dcSvetoslav Ganov     * @return The granularity.
797b7ff3255c6d4e12f9d2334e3bbec0a125b7b09dcSvetoslav Ganov     */
7982b435aada3d274a9c08d334946fff1ab9ba15b48Svetoslav Ganov    public int getMovementGranularity() {
7992b435aada3d274a9c08d334946fff1ab9ba15b48Svetoslav Ganov        return mMovementGranularity;
800b7ff3255c6d4e12f9d2334e3bbec0a125b7b09dcSvetoslav Ganov    }
801b7ff3255c6d4e12f9d2334e3bbec0a125b7b09dcSvetoslav Ganov
802b7ff3255c6d4e12f9d2334e3bbec0a125b7b09dcSvetoslav Ganov    /**
8036d17a936f73976971135aa1e6248662533343292Svetoslav Ganov     * Sets the performed action that triggered this event.
8046d17a936f73976971135aa1e6248662533343292Svetoslav Ganov     *
8056d17a936f73976971135aa1e6248662533343292Svetoslav Ganov     * @param action The action.
8066d17a936f73976971135aa1e6248662533343292Svetoslav Ganov     *
8076d17a936f73976971135aa1e6248662533343292Svetoslav Ganov     * @throws IllegalStateException If called from an AccessibilityService.
8086d17a936f73976971135aa1e6248662533343292Svetoslav Ganov     */
8096d17a936f73976971135aa1e6248662533343292Svetoslav Ganov    public void setAction(int action) {
8106d17a936f73976971135aa1e6248662533343292Svetoslav Ganov        enforceNotSealed();
8116d17a936f73976971135aa1e6248662533343292Svetoslav Ganov        mAction = action;
8126d17a936f73976971135aa1e6248662533343292Svetoslav Ganov    }
8136d17a936f73976971135aa1e6248662533343292Svetoslav Ganov
8146d17a936f73976971135aa1e6248662533343292Svetoslav Ganov    /**
8156d17a936f73976971135aa1e6248662533343292Svetoslav Ganov     * Gets the performed action that triggered this event.
8166d17a936f73976971135aa1e6248662533343292Svetoslav Ganov     *
8176d17a936f73976971135aa1e6248662533343292Svetoslav Ganov     * @return The action.
8186d17a936f73976971135aa1e6248662533343292Svetoslav Ganov     */
8196d17a936f73976971135aa1e6248662533343292Svetoslav Ganov    public int getAction() {
8206d17a936f73976971135aa1e6248662533343292Svetoslav Ganov        return mAction;
8216d17a936f73976971135aa1e6248662533343292Svetoslav Ganov    }
8226d17a936f73976971135aa1e6248662533343292Svetoslav Ganov
8236d17a936f73976971135aa1e6248662533343292Svetoslav Ganov    /**
82475986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov     * Returns a cached instance if such is available or a new one is
82538e8b4e5bc3c93affdffbc064fd9db5aeccc3e8eSvetoslav Ganov     * instantiated with its type property set.
82675986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov     *
82775986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov     * @param eventType The event type.
82875986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov     * @return An instance.
82975986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov     */
83075986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov    public static AccessibilityEvent obtain(int eventType) {
83175986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov        AccessibilityEvent event = AccessibilityEvent.obtain();
83275986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov        event.setEventType(eventType);
83375986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov        return event;
83475986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov    }
83575986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov
83675986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov    /**
83775986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov     * Returns a cached instance if such is available or a new one is
83835bfedeaba724aeadc6f6c890269cb6bf7ef42f5Svetoslav Ganov     * created. The returned instance is initialized from the given
83935bfedeaba724aeadc6f6c890269cb6bf7ef42f5Svetoslav Ganov     * <code>event</code>.
8408643aa0179e598e78d938c59035389054535a229Svetoslav Ganov     *
8418643aa0179e598e78d938c59035389054535a229Svetoslav Ganov     * @param event The other event.
8428643aa0179e598e78d938c59035389054535a229Svetoslav Ganov     * @return An instance.
8438643aa0179e598e78d938c59035389054535a229Svetoslav Ganov     */
8448643aa0179e598e78d938c59035389054535a229Svetoslav Ganov    public static AccessibilityEvent obtain(AccessibilityEvent event) {
8458643aa0179e598e78d938c59035389054535a229Svetoslav Ganov        AccessibilityEvent eventClone = AccessibilityEvent.obtain();
8468643aa0179e598e78d938c59035389054535a229Svetoslav Ganov        eventClone.init(event);
8478643aa0179e598e78d938c59035389054535a229Svetoslav Ganov
8488643aa0179e598e78d938c59035389054535a229Svetoslav Ganov        final int recordCount = event.mRecords.size();
8498643aa0179e598e78d938c59035389054535a229Svetoslav Ganov        for (int i = 0; i < recordCount; i++) {
8508643aa0179e598e78d938c59035389054535a229Svetoslav Ganov            AccessibilityRecord record = event.mRecords.get(i);
8518643aa0179e598e78d938c59035389054535a229Svetoslav Ganov            AccessibilityRecord recordClone = AccessibilityRecord.obtain(record);
8528643aa0179e598e78d938c59035389054535a229Svetoslav Ganov            eventClone.mRecords.add(recordClone);
8538643aa0179e598e78d938c59035389054535a229Svetoslav Ganov        }
8548643aa0179e598e78d938c59035389054535a229Svetoslav Ganov
8558643aa0179e598e78d938c59035389054535a229Svetoslav Ganov        return eventClone;
8568643aa0179e598e78d938c59035389054535a229Svetoslav Ganov    }
8578643aa0179e598e78d938c59035389054535a229Svetoslav Ganov
8588643aa0179e598e78d938c59035389054535a229Svetoslav Ganov    /**
8598643aa0179e598e78d938c59035389054535a229Svetoslav Ganov     * Returns a cached instance if such is available or a new one is
86075986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov     * instantiated.
86175986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov     *
86275986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov     * @return An instance.
86375986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov     */
86475986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov    public static AccessibilityEvent obtain() {
865887e1a17eb9b12448f5929791b564565b2665aabSvetoslav Ganov        synchronized (sPoolLock) {
86675986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov            if (sPool != null) {
86775986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov                AccessibilityEvent event = sPool;
86875986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov                sPool = sPool.mNext;
86975986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov                sPoolSize--;
87075986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov                event.mNext = null;
87175986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov                event.mIsInPool = false;
87275986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov                return event;
87375986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov            }
87475986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov            return new AccessibilityEvent();
87575986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov        }
87675986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov    }
87775986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov
87875986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov    /**
87938e8b4e5bc3c93affdffbc064fd9db5aeccc3e8eSvetoslav Ganov     * Recycles an instance back to be reused.
88075986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov     * <p>
88138e8b4e5bc3c93affdffbc064fd9db5aeccc3e8eSvetoslav Ganov     *   <b>Note: You must not touch the object after calling this function.</b>
88238e8b4e5bc3c93affdffbc064fd9db5aeccc3e8eSvetoslav Ganov     * </p>
883887e1a17eb9b12448f5929791b564565b2665aabSvetoslav Ganov     *
884887e1a17eb9b12448f5929791b564565b2665aabSvetoslav Ganov     * @throws IllegalStateException If the event is already recycled.
88575986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov     */
886736c2756bf3c14ae9fef7255c119057f7a2be1edSvetoslav Ganov    @Override
88775986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov    public void recycle() {
88875986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov        if (mIsInPool) {
889887e1a17eb9b12448f5929791b564565b2665aabSvetoslav Ganov            throw new IllegalStateException("Event already recycled!");
89075986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov        }
89175986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov        clear();
892887e1a17eb9b12448f5929791b564565b2665aabSvetoslav Ganov        synchronized (sPoolLock) {
89375986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov            if (sPoolSize <= MAX_POOL_SIZE) {
89475986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov                mNext = sPool;
89575986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov                sPool = this;
89675986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov                mIsInPool = true;
89775986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov                sPoolSize++;
89875986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov            }
89975986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov        }
90075986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov    }
90175986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov
90275986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov    /**
90375986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov     * Clears the state of this instance.
9048643aa0179e598e78d938c59035389054535a229Svetoslav Ganov     *
9058643aa0179e598e78d938c59035389054535a229Svetoslav Ganov     * @hide
90675986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov     */
907736c2756bf3c14ae9fef7255c119057f7a2be1edSvetoslav Ganov    @Override
908736c2756bf3c14ae9fef7255c119057f7a2be1edSvetoslav Ganov    protected void clear() {
909736c2756bf3c14ae9fef7255c119057f7a2be1edSvetoslav Ganov        super.clear();
91075986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov        mEventType = 0;
9112b435aada3d274a9c08d334946fff1ab9ba15b48Svetoslav Ganov        mMovementGranularity = 0;
9126d17a936f73976971135aa1e6248662533343292Svetoslav Ganov        mAction = 0;
9133fb3d7c4e756bd32d5abde0abca9ab52d559bc84Adam Powell        mPackageName = null;
914736c2756bf3c14ae9fef7255c119057f7a2be1edSvetoslav Ganov        mEventTime = 0;
915736c2756bf3c14ae9fef7255c119057f7a2be1edSvetoslav Ganov        while (!mRecords.isEmpty()) {
916736c2756bf3c14ae9fef7255c119057f7a2be1edSvetoslav Ganov            AccessibilityRecord record = mRecords.remove(0);
917736c2756bf3c14ae9fef7255c119057f7a2be1edSvetoslav Ganov            record.recycle();
9183fb3d7c4e756bd32d5abde0abca9ab52d559bc84Adam Powell        }
919ac84d3ba81f08036308b17e1ab919e43987a3df5Svetoslav Ganov    }
920ac84d3ba81f08036308b17e1ab919e43987a3df5Svetoslav Ganov
921ac84d3ba81f08036308b17e1ab919e43987a3df5Svetoslav Ganov    /**
9223fb3d7c4e756bd32d5abde0abca9ab52d559bc84Adam Powell     * Creates a new instance from a {@link Parcel}.
9233fb3d7c4e756bd32d5abde0abca9ab52d559bc84Adam Powell     *
9243fb3d7c4e756bd32d5abde0abca9ab52d559bc84Adam Powell     * @param parcel A parcel containing the state of a {@link AccessibilityEvent}.
925ac84d3ba81f08036308b17e1ab919e43987a3df5Svetoslav Ganov     */
9263fb3d7c4e756bd32d5abde0abca9ab52d559bc84Adam Powell    public void initFromParcel(Parcel parcel) {
927d116d7c78a9c53f30a73bf273bd7618312cf3847Svetoslav Ganov        mSealed = (parcel.readInt() == 1);
9283fb3d7c4e756bd32d5abde0abca9ab52d559bc84Adam Powell        mEventType = parcel.readInt();
9292b435aada3d274a9c08d334946fff1ab9ba15b48Svetoslav Ganov        mMovementGranularity = parcel.readInt();
9306d17a936f73976971135aa1e6248662533343292Svetoslav Ganov        mAction = parcel.readInt();
9313fb3d7c4e756bd32d5abde0abca9ab52d559bc84Adam Powell        mPackageName = TextUtils.CHAR_SEQUENCE_CREATOR.createFromParcel(parcel);
932736c2756bf3c14ae9fef7255c119057f7a2be1edSvetoslav Ganov        mEventTime = parcel.readLong();
933d116d7c78a9c53f30a73bf273bd7618312cf3847Svetoslav Ganov        mConnectionId = parcel.readInt();
934736c2756bf3c14ae9fef7255c119057f7a2be1edSvetoslav Ganov        readAccessibilityRecordFromParcel(this, parcel);
935736c2756bf3c14ae9fef7255c119057f7a2be1edSvetoslav Ganov
936736c2756bf3c14ae9fef7255c119057f7a2be1edSvetoslav Ganov        // Read the records.
937736c2756bf3c14ae9fef7255c119057f7a2be1edSvetoslav Ganov        final int recordCount = parcel.readInt();
938736c2756bf3c14ae9fef7255c119057f7a2be1edSvetoslav Ganov        for (int i = 0; i < recordCount; i++) {
939736c2756bf3c14ae9fef7255c119057f7a2be1edSvetoslav Ganov            AccessibilityRecord record = AccessibilityRecord.obtain();
94034e350daf89aed09ac748c2185f4506772a63b3fSvetoslav Ganov            readAccessibilityRecordFromParcel(record, parcel);
941d116d7c78a9c53f30a73bf273bd7618312cf3847Svetoslav Ganov            record.mConnectionId = mConnectionId;
942736c2756bf3c14ae9fef7255c119057f7a2be1edSvetoslav Ganov            mRecords.add(record);
943736c2756bf3c14ae9fef7255c119057f7a2be1edSvetoslav Ganov        }
9443fb3d7c4e756bd32d5abde0abca9ab52d559bc84Adam Powell    }
9453fb3d7c4e756bd32d5abde0abca9ab52d559bc84Adam Powell
946736c2756bf3c14ae9fef7255c119057f7a2be1edSvetoslav Ganov    /**
947736c2756bf3c14ae9fef7255c119057f7a2be1edSvetoslav Ganov     * Reads an {@link AccessibilityRecord} from a parcel.
948736c2756bf3c14ae9fef7255c119057f7a2be1edSvetoslav Ganov     *
949736c2756bf3c14ae9fef7255c119057f7a2be1edSvetoslav Ganov     * @param record The record to initialize.
950736c2756bf3c14ae9fef7255c119057f7a2be1edSvetoslav Ganov     * @param parcel The parcel to read from.
951736c2756bf3c14ae9fef7255c119057f7a2be1edSvetoslav Ganov     */
952736c2756bf3c14ae9fef7255c119057f7a2be1edSvetoslav Ganov    private void readAccessibilityRecordFromParcel(AccessibilityRecord record,
953736c2756bf3c14ae9fef7255c119057f7a2be1edSvetoslav Ganov            Parcel parcel) {
954736c2756bf3c14ae9fef7255c119057f7a2be1edSvetoslav Ganov        record.mBooleanProperties = parcel.readInt();
955736c2756bf3c14ae9fef7255c119057f7a2be1edSvetoslav Ganov        record.mCurrentItemIndex = parcel.readInt();
956736c2756bf3c14ae9fef7255c119057f7a2be1edSvetoslav Ganov        record.mItemCount = parcel.readInt();
957736c2756bf3c14ae9fef7255c119057f7a2be1edSvetoslav Ganov        record.mFromIndex = parcel.readInt();
958a0156177cdc809795dd8bc5a19943dd2b6f82b66Svetoslav Ganov        record.mToIndex = parcel.readInt();
959a0156177cdc809795dd8bc5a19943dd2b6f82b66Svetoslav Ganov        record.mScrollX = parcel.readInt();
960a0156177cdc809795dd8bc5a19943dd2b6f82b66Svetoslav Ganov        record.mScrollY =  parcel.readInt();
961d9ee72fddb8be40e414a831fb80458dc48699613Svetoslav Ganov        record.mMaxScrollX = parcel.readInt();
962d9ee72fddb8be40e414a831fb80458dc48699613Svetoslav Ganov        record.mMaxScrollY =  parcel.readInt();
963736c2756bf3c14ae9fef7255c119057f7a2be1edSvetoslav Ganov        record.mAddedCount = parcel.readInt();
964736c2756bf3c14ae9fef7255c119057f7a2be1edSvetoslav Ganov        record.mRemovedCount = parcel.readInt();
965736c2756bf3c14ae9fef7255c119057f7a2be1edSvetoslav Ganov        record.mClassName = TextUtils.CHAR_SEQUENCE_CREATOR.createFromParcel(parcel);
966736c2756bf3c14ae9fef7255c119057f7a2be1edSvetoslav Ganov        record.mContentDescription = TextUtils.CHAR_SEQUENCE_CREATOR.createFromParcel(parcel);
967736c2756bf3c14ae9fef7255c119057f7a2be1edSvetoslav Ganov        record.mBeforeText = TextUtils.CHAR_SEQUENCE_CREATOR.createFromParcel(parcel);
968736c2756bf3c14ae9fef7255c119057f7a2be1edSvetoslav Ganov        record.mParcelableData = parcel.readParcelable(null);
969736c2756bf3c14ae9fef7255c119057f7a2be1edSvetoslav Ganov        parcel.readList(record.mText, null);
970eeee4d2c01d3c4ed99e4891dbc75c7de69a803faSvetoslav Ganov        record.mSourceWindowId = parcel.readInt();
971021078554b902179442a345a9d080a165c3b5139Svetoslav Ganov        record.mSourceNodeId = parcel.readLong();
972eeee4d2c01d3c4ed99e4891dbc75c7de69a803faSvetoslav Ganov        record.mSealed = (parcel.readInt() == 1);
973736c2756bf3c14ae9fef7255c119057f7a2be1edSvetoslav Ganov    }
974736c2756bf3c14ae9fef7255c119057f7a2be1edSvetoslav Ganov
975736c2756bf3c14ae9fef7255c119057f7a2be1edSvetoslav Ganov    /**
976736c2756bf3c14ae9fef7255c119057f7a2be1edSvetoslav Ganov     * {@inheritDoc}
977736c2756bf3c14ae9fef7255c119057f7a2be1edSvetoslav Ganov     */
97875986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov    public void writeToParcel(Parcel parcel, int flags) {
9798643aa0179e598e78d938c59035389054535a229Svetoslav Ganov        parcel.writeInt(isSealed() ? 1 : 0);
98075986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov        parcel.writeInt(mEventType);
9812b435aada3d274a9c08d334946fff1ab9ba15b48Svetoslav Ganov        parcel.writeInt(mMovementGranularity);
9826d17a936f73976971135aa1e6248662533343292Svetoslav Ganov        parcel.writeInt(mAction);
9833fb3d7c4e756bd32d5abde0abca9ab52d559bc84Adam Powell        TextUtils.writeToParcel(mPackageName, parcel, 0);
984736c2756bf3c14ae9fef7255c119057f7a2be1edSvetoslav Ganov        parcel.writeLong(mEventTime);
985d116d7c78a9c53f30a73bf273bd7618312cf3847Svetoslav Ganov        parcel.writeInt(mConnectionId);
986736c2756bf3c14ae9fef7255c119057f7a2be1edSvetoslav Ganov        writeAccessibilityRecordToParcel(this, parcel, flags);
987736c2756bf3c14ae9fef7255c119057f7a2be1edSvetoslav Ganov
988736c2756bf3c14ae9fef7255c119057f7a2be1edSvetoslav Ganov        // Write the records.
989736c2756bf3c14ae9fef7255c119057f7a2be1edSvetoslav Ganov        final int recordCount = getRecordCount();
990736c2756bf3c14ae9fef7255c119057f7a2be1edSvetoslav Ganov        parcel.writeInt(recordCount);
991736c2756bf3c14ae9fef7255c119057f7a2be1edSvetoslav Ganov        for (int i = 0; i < recordCount; i++) {
992736c2756bf3c14ae9fef7255c119057f7a2be1edSvetoslav Ganov            AccessibilityRecord record = mRecords.get(i);
993736c2756bf3c14ae9fef7255c119057f7a2be1edSvetoslav Ganov            writeAccessibilityRecordToParcel(record, parcel, flags);
994736c2756bf3c14ae9fef7255c119057f7a2be1edSvetoslav Ganov        }
995736c2756bf3c14ae9fef7255c119057f7a2be1edSvetoslav Ganov    }
996736c2756bf3c14ae9fef7255c119057f7a2be1edSvetoslav Ganov
997736c2756bf3c14ae9fef7255c119057f7a2be1edSvetoslav Ganov    /**
998736c2756bf3c14ae9fef7255c119057f7a2be1edSvetoslav Ganov     * Writes an {@link AccessibilityRecord} to a parcel.
999736c2756bf3c14ae9fef7255c119057f7a2be1edSvetoslav Ganov     *
1000736c2756bf3c14ae9fef7255c119057f7a2be1edSvetoslav Ganov     * @param record The record to write.
1001736c2756bf3c14ae9fef7255c119057f7a2be1edSvetoslav Ganov     * @param parcel The parcel to which to write.
1002736c2756bf3c14ae9fef7255c119057f7a2be1edSvetoslav Ganov     */
1003736c2756bf3c14ae9fef7255c119057f7a2be1edSvetoslav Ganov    private void writeAccessibilityRecordToParcel(AccessibilityRecord record, Parcel parcel,
1004736c2756bf3c14ae9fef7255c119057f7a2be1edSvetoslav Ganov            int flags) {
1005736c2756bf3c14ae9fef7255c119057f7a2be1edSvetoslav Ganov        parcel.writeInt(record.mBooleanProperties);
1006736c2756bf3c14ae9fef7255c119057f7a2be1edSvetoslav Ganov        parcel.writeInt(record.mCurrentItemIndex);
1007736c2756bf3c14ae9fef7255c119057f7a2be1edSvetoslav Ganov        parcel.writeInt(record.mItemCount);
1008736c2756bf3c14ae9fef7255c119057f7a2be1edSvetoslav Ganov        parcel.writeInt(record.mFromIndex);
1009a0156177cdc809795dd8bc5a19943dd2b6f82b66Svetoslav Ganov        parcel.writeInt(record.mToIndex);
1010a0156177cdc809795dd8bc5a19943dd2b6f82b66Svetoslav Ganov        parcel.writeInt(record.mScrollX);
1011a0156177cdc809795dd8bc5a19943dd2b6f82b66Svetoslav Ganov        parcel.writeInt(record.mScrollY);
1012d9ee72fddb8be40e414a831fb80458dc48699613Svetoslav Ganov        parcel.writeInt(record.mMaxScrollX);
1013d9ee72fddb8be40e414a831fb80458dc48699613Svetoslav Ganov        parcel.writeInt(record.mMaxScrollY);
1014736c2756bf3c14ae9fef7255c119057f7a2be1edSvetoslav Ganov        parcel.writeInt(record.mAddedCount);
1015736c2756bf3c14ae9fef7255c119057f7a2be1edSvetoslav Ganov        parcel.writeInt(record.mRemovedCount);
1016736c2756bf3c14ae9fef7255c119057f7a2be1edSvetoslav Ganov        TextUtils.writeToParcel(record.mClassName, parcel, flags);
1017736c2756bf3c14ae9fef7255c119057f7a2be1edSvetoslav Ganov        TextUtils.writeToParcel(record.mContentDescription, parcel, flags);
1018736c2756bf3c14ae9fef7255c119057f7a2be1edSvetoslav Ganov        TextUtils.writeToParcel(record.mBeforeText, parcel, flags);
1019736c2756bf3c14ae9fef7255c119057f7a2be1edSvetoslav Ganov        parcel.writeParcelable(record.mParcelableData, flags);
1020736c2756bf3c14ae9fef7255c119057f7a2be1edSvetoslav Ganov        parcel.writeList(record.mText);
1021eeee4d2c01d3c4ed99e4891dbc75c7de69a803faSvetoslav Ganov        parcel.writeInt(record.mSourceWindowId);
1022021078554b902179442a345a9d080a165c3b5139Svetoslav Ganov        parcel.writeLong(record.mSourceNodeId);
1023eeee4d2c01d3c4ed99e4891dbc75c7de69a803faSvetoslav Ganov        parcel.writeInt(record.mSealed ? 1 : 0);
102475986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov    }
102575986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov
1026736c2756bf3c14ae9fef7255c119057f7a2be1edSvetoslav Ganov    /**
1027736c2756bf3c14ae9fef7255c119057f7a2be1edSvetoslav Ganov     * {@inheritDoc}
1028736c2756bf3c14ae9fef7255c119057f7a2be1edSvetoslav Ganov     */
102975986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov    public int describeContents() {
103075986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov        return 0;
103175986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov    }
103275986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov
103375986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov    @Override
103475986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov    public String toString() {
103575986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov        StringBuilder builder = new StringBuilder();
103638e8b4e5bc3c93affdffbc064fd9db5aeccc3e8eSvetoslav Ganov        builder.append("EventType: ").append(eventTypeToString(mEventType));
1037cc4053e031371456fe54d51bbad1db721db4ae38Svetoslav Ganov        builder.append("; EventTime: ").append(mEventTime);
1038cc4053e031371456fe54d51bbad1db721db4ae38Svetoslav Ganov        builder.append("; PackageName: ").append(mPackageName);
10392b435aada3d274a9c08d334946fff1ab9ba15b48Svetoslav Ganov        builder.append("; MovementGranularity: ").append(mMovementGranularity);
10406d17a936f73976971135aa1e6248662533343292Svetoslav Ganov        builder.append("; Action: ").append(mAction);
1041736c2756bf3c14ae9fef7255c119057f7a2be1edSvetoslav Ganov        builder.append(super.toString());
10428643aa0179e598e78d938c59035389054535a229Svetoslav Ganov        if (DEBUG) {
1043736c2756bf3c14ae9fef7255c119057f7a2be1edSvetoslav Ganov            builder.append("\n");
1044eeee4d2c01d3c4ed99e4891dbc75c7de69a803faSvetoslav Ganov            builder.append("; sourceWindowId: ").append(mSourceWindowId);
1045021078554b902179442a345a9d080a165c3b5139Svetoslav Ganov            builder.append("; mSourceNodeId: ").append(mSourceNodeId);
10468643aa0179e598e78d938c59035389054535a229Svetoslav Ganov            for (int i = 0; i < mRecords.size(); i++) {
10478643aa0179e598e78d938c59035389054535a229Svetoslav Ganov                AccessibilityRecord record = mRecords.get(i);
10488643aa0179e598e78d938c59035389054535a229Svetoslav Ganov                builder.append("  Record ");
10498643aa0179e598e78d938c59035389054535a229Svetoslav Ganov                builder.append(i);
10508643aa0179e598e78d938c59035389054535a229Svetoslav Ganov                builder.append(":");
10518643aa0179e598e78d938c59035389054535a229Svetoslav Ganov                builder.append(" [ ClassName: " + record.mClassName);
10528643aa0179e598e78d938c59035389054535a229Svetoslav Ganov                builder.append("; Text: " + record.mText);
10538643aa0179e598e78d938c59035389054535a229Svetoslav Ganov                builder.append("; ContentDescription: " + record.mContentDescription);
10548643aa0179e598e78d938c59035389054535a229Svetoslav Ganov                builder.append("; ItemCount: " + record.mItemCount);
10558643aa0179e598e78d938c59035389054535a229Svetoslav Ganov                builder.append("; CurrentItemIndex: " + record.mCurrentItemIndex);
10568643aa0179e598e78d938c59035389054535a229Svetoslav Ganov                builder.append("; IsEnabled: " + record.isEnabled());
10578643aa0179e598e78d938c59035389054535a229Svetoslav Ganov                builder.append("; IsPassword: " + record.isPassword());
10588643aa0179e598e78d938c59035389054535a229Svetoslav Ganov                builder.append("; IsChecked: " + record.isChecked());
10598643aa0179e598e78d938c59035389054535a229Svetoslav Ganov                builder.append("; IsFullScreen: " + record.isFullScreen());
1060a0156177cdc809795dd8bc5a19943dd2b6f82b66Svetoslav Ganov                builder.append("; Scrollable: " + record.isScrollable());
10618643aa0179e598e78d938c59035389054535a229Svetoslav Ganov                builder.append("; BeforeText: " + record.mBeforeText);
10628643aa0179e598e78d938c59035389054535a229Svetoslav Ganov                builder.append("; FromIndex: " + record.mFromIndex);
1063a0156177cdc809795dd8bc5a19943dd2b6f82b66Svetoslav Ganov                builder.append("; ToIndex: " + record.mToIndex);
1064a0156177cdc809795dd8bc5a19943dd2b6f82b66Svetoslav Ganov                builder.append("; ScrollX: " + record.mScrollX);
1065a0156177cdc809795dd8bc5a19943dd2b6f82b66Svetoslav Ganov                builder.append("; ScrollY: " + record.mScrollY);
10668643aa0179e598e78d938c59035389054535a229Svetoslav Ganov                builder.append("; AddedCount: " + record.mAddedCount);
10678643aa0179e598e78d938c59035389054535a229Svetoslav Ganov                builder.append("; RemovedCount: " + record.mRemovedCount);
10688643aa0179e598e78d938c59035389054535a229Svetoslav Ganov                builder.append("; ParcelableData: " + record.mParcelableData);
10698643aa0179e598e78d938c59035389054535a229Svetoslav Ganov                builder.append(" ]");
10708643aa0179e598e78d938c59035389054535a229Svetoslav Ganov                builder.append("\n");
10718643aa0179e598e78d938c59035389054535a229Svetoslav Ganov            }
10728643aa0179e598e78d938c59035389054535a229Svetoslav Ganov        } else {
1073e4aa13b20166219a62916a92294055e7cc5c9f10Svetoslav Ganov            builder.append("; recordCount: ").append(getRecordCount());
1074736c2756bf3c14ae9fef7255c119057f7a2be1edSvetoslav Ganov        }
107575986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov        return builder.toString();
107675986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov    }
107775986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov
107875986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov    /**
1079cc4053e031371456fe54d51bbad1db721db4ae38Svetoslav Ganov     * Returns the string representation of an event type. For example,
1080cc4053e031371456fe54d51bbad1db721db4ae38Svetoslav Ganov     * {@link #TYPE_VIEW_CLICKED} is represented by the string TYPE_VIEW_CLICKED.
1081cc4053e031371456fe54d51bbad1db721db4ae38Svetoslav Ganov     *
108238e8b4e5bc3c93affdffbc064fd9db5aeccc3e8eSvetoslav Ganov     * @param eventType The event type
1083cc4053e031371456fe54d51bbad1db721db4ae38Svetoslav Ganov     * @return The string representation.
1084cc4053e031371456fe54d51bbad1db721db4ae38Svetoslav Ganov     */
108538e8b4e5bc3c93affdffbc064fd9db5aeccc3e8eSvetoslav Ganov    public static String eventTypeToString(int eventType) {
108638e8b4e5bc3c93affdffbc064fd9db5aeccc3e8eSvetoslav Ganov        switch (eventType) {
1087cc4053e031371456fe54d51bbad1db721db4ae38Svetoslav Ganov            case TYPE_VIEW_CLICKED:
1088cc4053e031371456fe54d51bbad1db721db4ae38Svetoslav Ganov                return "TYPE_VIEW_CLICKED";
1089cc4053e031371456fe54d51bbad1db721db4ae38Svetoslav Ganov            case TYPE_VIEW_LONG_CLICKED:
1090cc4053e031371456fe54d51bbad1db721db4ae38Svetoslav Ganov                return "TYPE_VIEW_LONG_CLICKED";
1091cc4053e031371456fe54d51bbad1db721db4ae38Svetoslav Ganov            case TYPE_VIEW_SELECTED:
1092cc4053e031371456fe54d51bbad1db721db4ae38Svetoslav Ganov                return "TYPE_VIEW_SELECTED";
1093cc4053e031371456fe54d51bbad1db721db4ae38Svetoslav Ganov            case TYPE_VIEW_FOCUSED:
1094cc4053e031371456fe54d51bbad1db721db4ae38Svetoslav Ganov                return "TYPE_VIEW_FOCUSED";
1095cc4053e031371456fe54d51bbad1db721db4ae38Svetoslav Ganov            case TYPE_VIEW_TEXT_CHANGED:
1096cc4053e031371456fe54d51bbad1db721db4ae38Svetoslav Ganov                return "TYPE_VIEW_TEXT_CHANGED";
1097cc4053e031371456fe54d51bbad1db721db4ae38Svetoslav Ganov            case TYPE_WINDOW_STATE_CHANGED:
1098cc4053e031371456fe54d51bbad1db721db4ae38Svetoslav Ganov                return "TYPE_WINDOW_STATE_CHANGED";
1099cc4053e031371456fe54d51bbad1db721db4ae38Svetoslav Ganov            case TYPE_VIEW_HOVER_ENTER:
1100cc4053e031371456fe54d51bbad1db721db4ae38Svetoslav Ganov                return "TYPE_VIEW_HOVER_ENTER";
1101cc4053e031371456fe54d51bbad1db721db4ae38Svetoslav Ganov            case TYPE_VIEW_HOVER_EXIT:
1102cc4053e031371456fe54d51bbad1db721db4ae38Svetoslav Ganov                return "TYPE_VIEW_HOVER_EXIT";
1103cc4053e031371456fe54d51bbad1db721db4ae38Svetoslav Ganov            case TYPE_NOTIFICATION_STATE_CHANGED:
1104cc4053e031371456fe54d51bbad1db721db4ae38Svetoslav Ganov                return "TYPE_NOTIFICATION_STATE_CHANGED";
1105cc4053e031371456fe54d51bbad1db721db4ae38Svetoslav Ganov            case TYPE_TOUCH_EXPLORATION_GESTURE_START:
1106cc4053e031371456fe54d51bbad1db721db4ae38Svetoslav Ganov                return "TYPE_TOUCH_EXPLORATION_GESTURE_START";
1107cc4053e031371456fe54d51bbad1db721db4ae38Svetoslav Ganov            case TYPE_TOUCH_EXPLORATION_GESTURE_END:
1108cc4053e031371456fe54d51bbad1db721db4ae38Svetoslav Ganov                return "TYPE_TOUCH_EXPLORATION_GESTURE_END";
1109eeee4d2c01d3c4ed99e4891dbc75c7de69a803faSvetoslav Ganov            case TYPE_WINDOW_CONTENT_CHANGED:
1110eeee4d2c01d3c4ed99e4891dbc75c7de69a803faSvetoslav Ganov                return "TYPE_WINDOW_CONTENT_CHANGED";
1111a0156177cdc809795dd8bc5a19943dd2b6f82b66Svetoslav Ganov            case TYPE_VIEW_TEXT_SELECTION_CHANGED:
1112a0156177cdc809795dd8bc5a19943dd2b6f82b66Svetoslav Ganov                return "TYPE_VIEW_TEXT_SELECTION_CHANGED";
1113a0156177cdc809795dd8bc5a19943dd2b6f82b66Svetoslav Ganov            case TYPE_VIEW_SCROLLED:
1114a0156177cdc809795dd8bc5a19943dd2b6f82b66Svetoslav Ganov                return "TYPE_VIEW_SCROLLED";
111551ab90cab1609cf0ddd2dfe5a660f020d823d4d5Svetoslav Ganov            case TYPE_ANNOUNCEMENT:
111651ab90cab1609cf0ddd2dfe5a660f020d823d4d5Svetoslav Ganov                return "TYPE_ANNOUNCEMENT";
11174213804541a8b05cd0587b138a2fd9a3b7fd9350Svetoslav Ganov            case TYPE_VIEW_ACCESSIBILITY_FOCUSED:
11184213804541a8b05cd0587b138a2fd9a3b7fd9350Svetoslav Ganov                return "TYPE_VIEW_ACCESSIBILITY_FOCUSED";
11194213804541a8b05cd0587b138a2fd9a3b7fd9350Svetoslav Ganov            case TYPE_VIEW_ACCESSIBILITY_FOCUS_CLEARED:
11204213804541a8b05cd0587b138a2fd9a3b7fd9350Svetoslav Ganov                return "TYPE_VIEW_ACCESSIBILITY_FOCUS_CLEARED";
11212b435aada3d274a9c08d334946fff1ab9ba15b48Svetoslav Ganov            case TYPE_VIEW_TEXT_TRAVERSED_AT_MOVEMENT_GRANULARITY:
11222b435aada3d274a9c08d334946fff1ab9ba15b48Svetoslav Ganov                return "TYPE_CURRENT_AT_GRANULARITY_MOVEMENT_CHANGED";
1123cc4053e031371456fe54d51bbad1db721db4ae38Svetoslav Ganov            default:
1124cc4053e031371456fe54d51bbad1db721db4ae38Svetoslav Ganov                return null;
1125cc4053e031371456fe54d51bbad1db721db4ae38Svetoslav Ganov        }
1126cc4053e031371456fe54d51bbad1db721db4ae38Svetoslav Ganov    }
1127cc4053e031371456fe54d51bbad1db721db4ae38Svetoslav Ganov
1128cc4053e031371456fe54d51bbad1db721db4ae38Svetoslav Ganov    /**
112975986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov     * @see Parcelable.Creator
113075986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov     */
113175986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov    public static final Parcelable.Creator<AccessibilityEvent> CREATOR =
113275986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov            new Parcelable.Creator<AccessibilityEvent>() {
113375986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov        public AccessibilityEvent createFromParcel(Parcel parcel) {
113475986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov            AccessibilityEvent event = AccessibilityEvent.obtain();
113575986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov            event.initFromParcel(parcel);
113675986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov            return event;
113775986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov        }
113875986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov
113975986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov        public AccessibilityEvent[] newArray(int size) {
114075986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov            return new AccessibilityEvent[size];
114175986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov        }
114275986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov    };
114375986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov}
1144