AccessibilityEvent.java revision abad55d860be793b8b9b3e288a74214da89fb368
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;
22f4782ec9c57a40224ac0974fce6b6fe280c829ceSvetoslav Ganovimport android.util.Pools.SynchronizedPool;
2375986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov
2475986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganovimport java.util.ArrayList;
25eeee4d2c01d3c4ed99e4891dbc75c7de69a803faSvetoslav Ganovimport java.util.List;
2675986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov
2775986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov/**
2838e8b4e5bc3c93affdffbc064fd9db5aeccc3e8eSvetoslav Ganov * <p>
2975986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov * This class represents accessibility events that are sent by the system when
3075986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov * something notable happens in the user interface. For example, when a
3175986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov * {@link android.widget.Button} is clicked, a {@link android.view.View} is focused, etc.
3238e8b4e5bc3c93affdffbc064fd9db5aeccc3e8eSvetoslav Ganov * </p>
3375986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov * <p>
34736c2756bf3c14ae9fef7255c119057f7a2be1edSvetoslav Ganov * An accessibility event is fired by an individual view which populates the event with
3538e8b4e5bc3c93affdffbc064fd9db5aeccc3e8eSvetoslav Ganov * data for its state and requests from its parent to send the event to interested
3638e8b4e5bc3c93affdffbc064fd9db5aeccc3e8eSvetoslav Ganov * parties. The parent can optionally add an {@link AccessibilityRecord} for itself before
3738e8b4e5bc3c93affdffbc064fd9db5aeccc3e8eSvetoslav Ganov * dispatching a similar request to its parent. A parent can also choose not to respect the
3838e8b4e5bc3c93affdffbc064fd9db5aeccc3e8eSvetoslav Ganov * request for sending an event. The accessibility event is sent by the topmost view in the
3938e8b4e5bc3c93affdffbc064fd9db5aeccc3e8eSvetoslav Ganov * view tree. Therefore, an {@link android.accessibilityservice.AccessibilityService} can
4038e8b4e5bc3c93affdffbc064fd9db5aeccc3e8eSvetoslav Ganov * explore all records in an accessibility event to obtain more information about the
4138e8b4e5bc3c93affdffbc064fd9db5aeccc3e8eSvetoslav Ganov * context in which the event was fired.
4238e8b4e5bc3c93affdffbc064fd9db5aeccc3e8eSvetoslav Ganov * </p>
43736c2756bf3c14ae9fef7255c119057f7a2be1edSvetoslav Ganov * <p>
4438e8b4e5bc3c93affdffbc064fd9db5aeccc3e8eSvetoslav Ganov * The main purpose of an accessibility event is to expose enough information for an
4538e8b4e5bc3c93affdffbc064fd9db5aeccc3e8eSvetoslav Ganov * {@link android.accessibilityservice.AccessibilityService} to provide meaningful feedback
4638e8b4e5bc3c93affdffbc064fd9db5aeccc3e8eSvetoslav Ganov * to the user. Sometimes however, an accessibility service may need more contextual
4738e8b4e5bc3c93affdffbc064fd9db5aeccc3e8eSvetoslav Ganov * information then the one in the event pay-load. In such cases the service can obtain
4838e8b4e5bc3c93affdffbc064fd9db5aeccc3e8eSvetoslav Ganov * the event source which is an {@link AccessibilityNodeInfo} (snapshot of a View state)
4938e8b4e5bc3c93affdffbc064fd9db5aeccc3e8eSvetoslav Ganov * which can be used for exploring the window content. Note that the privilege for accessing
5038e8b4e5bc3c93affdffbc064fd9db5aeccc3e8eSvetoslav Ganov * an event's source, thus the window content, has to be explicitly requested. For more
5138e8b4e5bc3c93affdffbc064fd9db5aeccc3e8eSvetoslav Ganov * details refer to {@link android.accessibilityservice.AccessibilityService}. If an
5238e8b4e5bc3c93affdffbc064fd9db5aeccc3e8eSvetoslav Ganov * accessibility service has not requested to retrieve the window content the event will
5338e8b4e5bc3c93affdffbc064fd9db5aeccc3e8eSvetoslav Ganov * not contain reference to its source. Also for events of type
5438e8b4e5bc3c93affdffbc064fd9db5aeccc3e8eSvetoslav Ganov * {@link #TYPE_NOTIFICATION_STATE_CHANGED} the source is never available.
5538e8b4e5bc3c93affdffbc064fd9db5aeccc3e8eSvetoslav Ganov * </p>
56736c2756bf3c14ae9fef7255c119057f7a2be1edSvetoslav Ganov * <p>
5775986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov * This class represents various semantically different accessibility event
5838e8b4e5bc3c93affdffbc064fd9db5aeccc3e8eSvetoslav Ganov * types. Each event type has an associated set of related properties. In other
5975986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov * words, each event type is characterized via a subset of the properties exposed
6075986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov * by this class. For each event type there is a corresponding constant defined
6138e8b4e5bc3c93affdffbc064fd9db5aeccc3e8eSvetoslav Ganov * in this class. Follows a specification of the event types and their associated properties:
6238e8b4e5bc3c93affdffbc064fd9db5aeccc3e8eSvetoslav Ganov * </p>
63e1302edd40c5cc264f842e17e3796e0a11d6f045Joe Fernandez * <div class="special reference">
64e1302edd40c5cc264f842e17e3796e0a11d6f045Joe Fernandez * <h3>Developer Guides</h3>
65e1302edd40c5cc264f842e17e3796e0a11d6f045Joe Fernandez * <p>For more information about creating and processing AccessibilityEvents, read the
66e1302edd40c5cc264f842e17e3796e0a11d6f045Joe Fernandez * <a href="{@docRoot}guide/topics/ui/accessibility/index.html">Accessibility</a>
67e1302edd40c5cc264f842e17e3796e0a11d6f045Joe Fernandez * developer guide.</p>
68e1302edd40c5cc264f842e17e3796e0a11d6f045Joe Fernandez * </div>
6975986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov * <p>
7038e8b4e5bc3c93affdffbc064fd9db5aeccc3e8eSvetoslav Ganov * <b>VIEW TYPES</b></br>
7138e8b4e5bc3c93affdffbc064fd9db5aeccc3e8eSvetoslav Ganov * </p>
7275986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov * <p>
7375986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov * <b>View clicked</b> - represents the event of clicking on a {@link android.view.View}
7438e8b4e5bc3c93affdffbc064fd9db5aeccc3e8eSvetoslav Ganov * like {@link android.widget.Button}, {@link android.widget.CompoundButton}, etc.</br>
7538e8b4e5bc3c93affdffbc064fd9db5aeccc3e8eSvetoslav Ganov * <em>Type:</em>{@link #TYPE_VIEW_CLICKED}</br>
7638e8b4e5bc3c93affdffbc064fd9db5aeccc3e8eSvetoslav Ganov * <em>Properties:</em></br>
77a0156177cdc809795dd8bc5a19943dd2b6f82b66Svetoslav Ganov * <ul>
7882e236d72ac197d6673d0b4d484fe5f0b9436731Svetoslav Ganov *   <li>{@link #getEventType()} - The type of the event.</li>
7938e8b4e5bc3c93affdffbc064fd9db5aeccc3e8eSvetoslav Ganov *   <li>{@link #getSource()} - The source info (for registered clients).</li>
80a0156177cdc809795dd8bc5a19943dd2b6f82b66Svetoslav Ganov *   <li>{@link #getClassName()} - The class name of the source.</li>
81a0156177cdc809795dd8bc5a19943dd2b6f82b66Svetoslav Ganov *   <li>{@link #getPackageName()} - The package name of the source.</li>
82a0156177cdc809795dd8bc5a19943dd2b6f82b66Svetoslav Ganov *   <li>{@link #getEventTime()}  - The event time.</li>
8382e236d72ac197d6673d0b4d484fe5f0b9436731Svetoslav Ganov *   <li>{@link #getText()} - The text of the source's sub-tree.</li>
84a0156177cdc809795dd8bc5a19943dd2b6f82b66Svetoslav Ganov *   <li>{@link #isEnabled()} - Whether the source is enabled.</li>
85a0156177cdc809795dd8bc5a19943dd2b6f82b66Svetoslav Ganov *   <li>{@link #isPassword()} - Whether the source is password.</li>
86a0156177cdc809795dd8bc5a19943dd2b6f82b66Svetoslav Ganov *   <li>{@link #isChecked()} - Whether the source is checked.</li>
8782e236d72ac197d6673d0b4d484fe5f0b9436731Svetoslav Ganov *   <li>{@link #getContentDescription()} - The content description of the source.</li>
88d9ee72fddb8be40e414a831fb80458dc48699613Svetoslav Ganov *   <li>{@link #getScrollX()} - The offset of the source left edge in pixels
89d9ee72fddb8be40e414a831fb80458dc48699613Svetoslav Ganov *       (without descendants of AdapterView).</li>
90d9ee72fddb8be40e414a831fb80458dc48699613Svetoslav Ganov *   <li>{@link #getScrollY()} - The offset of the source top edge in pixels
91d9ee72fddb8be40e414a831fb80458dc48699613Svetoslav Ganov *       (without descendants of AdapterView).</li>
92d9ee72fddb8be40e414a831fb80458dc48699613Svetoslav Ganov *   <li>{@link #getFromIndex()} - The zero based index of the first visible item of the source,
93d9ee72fddb8be40e414a831fb80458dc48699613Svetoslav Ganov *       inclusive (for descendants of AdapterView).</li>
94d9ee72fddb8be40e414a831fb80458dc48699613Svetoslav Ganov *   <li>{@link #getToIndex()} - The zero based index of the last visible item of the source,
95d9ee72fddb8be40e414a831fb80458dc48699613Svetoslav Ganov *       inclusive (for descendants of AdapterView).</li>
96d9ee72fddb8be40e414a831fb80458dc48699613Svetoslav Ganov *   <li>{@link #getItemCount()} - The total items of the source
97d9ee72fddb8be40e414a831fb80458dc48699613Svetoslav Ganov *       (for descendants of AdapterView).</li>
98a0156177cdc809795dd8bc5a19943dd2b6f82b66Svetoslav Ganov * </ul>
9938e8b4e5bc3c93affdffbc064fd9db5aeccc3e8eSvetoslav Ganov * </p>
10075986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov * <p>
10175986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov * <b>View long clicked</b> - represents the event of long clicking on a {@link android.view.View}
10238e8b4e5bc3c93affdffbc064fd9db5aeccc3e8eSvetoslav Ganov * like {@link android.widget.Button}, {@link android.widget.CompoundButton}, etc </br>
10338e8b4e5bc3c93affdffbc064fd9db5aeccc3e8eSvetoslav Ganov * <em>Type:</em>{@link #TYPE_VIEW_LONG_CLICKED}</br>
10438e8b4e5bc3c93affdffbc064fd9db5aeccc3e8eSvetoslav Ganov * <em>Properties:</em></br>
105a0156177cdc809795dd8bc5a19943dd2b6f82b66Svetoslav Ganov * <ul>
10682e236d72ac197d6673d0b4d484fe5f0b9436731Svetoslav Ganov *   <li>{@link #getEventType()} - The type of the event.</li>
10738e8b4e5bc3c93affdffbc064fd9db5aeccc3e8eSvetoslav Ganov *   <li>{@link #getSource()} - The source info (for registered clients).</li>
108a0156177cdc809795dd8bc5a19943dd2b6f82b66Svetoslav Ganov *   <li>{@link #getClassName()} - The class name of the source.</li>
109a0156177cdc809795dd8bc5a19943dd2b6f82b66Svetoslav Ganov *   <li>{@link #getPackageName()} - The package name of the source.</li>
110a0156177cdc809795dd8bc5a19943dd2b6f82b66Svetoslav Ganov *   <li>{@link #getEventTime()}  - The event time.</li>
11182e236d72ac197d6673d0b4d484fe5f0b9436731Svetoslav Ganov *   <li>{@link #getText()} - The text of the source's sub-tree.</li>
112a0156177cdc809795dd8bc5a19943dd2b6f82b66Svetoslav Ganov *   <li>{@link #isEnabled()} - Whether the source is enabled.</li>
113a0156177cdc809795dd8bc5a19943dd2b6f82b66Svetoslav Ganov *   <li>{@link #isPassword()} - Whether the source is password.</li>
114a0156177cdc809795dd8bc5a19943dd2b6f82b66Svetoslav Ganov *   <li>{@link #isChecked()} - Whether the source is checked.</li>
11582e236d72ac197d6673d0b4d484fe5f0b9436731Svetoslav Ganov *   <li>{@link #getContentDescription()} - The content description of the source.</li>
116d9ee72fddb8be40e414a831fb80458dc48699613Svetoslav Ganov *   <li>{@link #getScrollX()} - The offset of the source left edge in pixels
117d9ee72fddb8be40e414a831fb80458dc48699613Svetoslav Ganov *       (without descendants of AdapterView).</li>
118d9ee72fddb8be40e414a831fb80458dc48699613Svetoslav Ganov *   <li>{@link #getScrollY()} - The offset of the source top edge in pixels
119d9ee72fddb8be40e414a831fb80458dc48699613Svetoslav Ganov *       (without descendants of AdapterView).</li>
120d9ee72fddb8be40e414a831fb80458dc48699613Svetoslav Ganov *   <li>{@link #getFromIndex()} - The zero based index of the first visible item of the source,
121d9ee72fddb8be40e414a831fb80458dc48699613Svetoslav Ganov *       inclusive (for descendants of AdapterView).</li>
122d9ee72fddb8be40e414a831fb80458dc48699613Svetoslav Ganov *   <li>{@link #getToIndex()} - The zero based index of the last visible item of the source,
123d9ee72fddb8be40e414a831fb80458dc48699613Svetoslav Ganov *       inclusive (for descendants of AdapterView).</li>
124d9ee72fddb8be40e414a831fb80458dc48699613Svetoslav Ganov *   <li>{@link #getItemCount()} - The total items of the source
125d9ee72fddb8be40e414a831fb80458dc48699613Svetoslav Ganov *       (for descendants of AdapterView).</li>
126a0156177cdc809795dd8bc5a19943dd2b6f82b66Svetoslav Ganov * </ul>
12738e8b4e5bc3c93affdffbc064fd9db5aeccc3e8eSvetoslav Ganov * </p>
12875986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov * <p>
12975986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov * <b>View selected</b> - represents the event of selecting an item usually in
13038e8b4e5bc3c93affdffbc064fd9db5aeccc3e8eSvetoslav Ganov * the context of an {@link android.widget.AdapterView}.</br>
13138e8b4e5bc3c93affdffbc064fd9db5aeccc3e8eSvetoslav Ganov * <em>Type:</em> {@link #TYPE_VIEW_SELECTED}</br>
13238e8b4e5bc3c93affdffbc064fd9db5aeccc3e8eSvetoslav Ganov * <em>Properties:</em></br>
133a0156177cdc809795dd8bc5a19943dd2b6f82b66Svetoslav Ganov * <ul>
13482e236d72ac197d6673d0b4d484fe5f0b9436731Svetoslav Ganov *   <li>{@link #getEventType()} - The type of the event.</li>
13538e8b4e5bc3c93affdffbc064fd9db5aeccc3e8eSvetoslav Ganov *   <li>{@link #getSource()} - The source info (for registered clients).</li>
136a0156177cdc809795dd8bc5a19943dd2b6f82b66Svetoslav Ganov *   <li>{@link #getClassName()} - The class name of the source.</li>
137a0156177cdc809795dd8bc5a19943dd2b6f82b66Svetoslav Ganov *   <li>{@link #getPackageName()} - The package name of the source.</li>
138a0156177cdc809795dd8bc5a19943dd2b6f82b66Svetoslav Ganov *   <li>{@link #getEventTime()}  - The event time.</li>
13982e236d72ac197d6673d0b4d484fe5f0b9436731Svetoslav Ganov *   <li>{@link #getText()} - The text of the source's sub-tree.</li>
140a0156177cdc809795dd8bc5a19943dd2b6f82b66Svetoslav Ganov *   <li>{@link #isEnabled()} - Whether the source is enabled.</li>
141a0156177cdc809795dd8bc5a19943dd2b6f82b66Svetoslav Ganov *   <li>{@link #isPassword()} - Whether the source is password.</li>
142a0156177cdc809795dd8bc5a19943dd2b6f82b66Svetoslav Ganov *   <li>{@link #isChecked()} - Whether the source is checked.</li>
14338e8b4e5bc3c93affdffbc064fd9db5aeccc3e8eSvetoslav Ganov *   <li>{@link #getItemCount()} - The number of selectable items of the source.</li>
144a0156177cdc809795dd8bc5a19943dd2b6f82b66Svetoslav Ganov *   <li>{@link #getCurrentItemIndex()} - The currently selected item index.</li>
14582e236d72ac197d6673d0b4d484fe5f0b9436731Svetoslav Ganov *   <li>{@link #getContentDescription()} - The content description of the source.</li>
146d9ee72fddb8be40e414a831fb80458dc48699613Svetoslav Ganov *   <li>{@link #getScrollX()} - The offset of the source left edge in pixels
147d9ee72fddb8be40e414a831fb80458dc48699613Svetoslav Ganov *       (without descendants of AdapterView).</li>
148d9ee72fddb8be40e414a831fb80458dc48699613Svetoslav Ganov *   <li>{@link #getScrollY()} - The offset of the source top edge in pixels
149d9ee72fddb8be40e414a831fb80458dc48699613Svetoslav Ganov *       (without descendants of AdapterView).</li>
150d9ee72fddb8be40e414a831fb80458dc48699613Svetoslav Ganov *   <li>{@link #getFromIndex()} - The zero based index of the first visible item of the source,
151d9ee72fddb8be40e414a831fb80458dc48699613Svetoslav Ganov *       inclusive (for descendants of AdapterView).</li>
152d9ee72fddb8be40e414a831fb80458dc48699613Svetoslav Ganov *   <li>{@link #getToIndex()} - The zero based index of the last visible item of the source,
153d9ee72fddb8be40e414a831fb80458dc48699613Svetoslav Ganov *       inclusive (for descendants of AdapterView).</li>
154d9ee72fddb8be40e414a831fb80458dc48699613Svetoslav Ganov *   <li>{@link #getItemCount()} - The total items of the source
155d9ee72fddb8be40e414a831fb80458dc48699613Svetoslav Ganov *       (for descendants of AdapterView).</li>
156a0156177cdc809795dd8bc5a19943dd2b6f82b66Svetoslav Ganov * </ul>
15738e8b4e5bc3c93affdffbc064fd9db5aeccc3e8eSvetoslav Ganov * </p>
15875986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov * <p>
15975986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov * <b>View focused</b> - represents the event of focusing a
16038e8b4e5bc3c93affdffbc064fd9db5aeccc3e8eSvetoslav Ganov * {@link android.view.View}.</br>
16138e8b4e5bc3c93affdffbc064fd9db5aeccc3e8eSvetoslav Ganov * <em>Type:</em> {@link #TYPE_VIEW_FOCUSED}</br>
16238e8b4e5bc3c93affdffbc064fd9db5aeccc3e8eSvetoslav Ganov * <em>Properties:</em></br>
163a0156177cdc809795dd8bc5a19943dd2b6f82b66Svetoslav Ganov * <ul>
16482e236d72ac197d6673d0b4d484fe5f0b9436731Svetoslav Ganov *   <li>{@link #getEventType()} - The type of the event.</li>
16538e8b4e5bc3c93affdffbc064fd9db5aeccc3e8eSvetoslav Ganov *   <li>{@link #getSource()} - The source info (for registered clients).</li>
166a0156177cdc809795dd8bc5a19943dd2b6f82b66Svetoslav Ganov *   <li>{@link #getClassName()} - The class name of the source.</li>
167a0156177cdc809795dd8bc5a19943dd2b6f82b66Svetoslav Ganov *   <li>{@link #getPackageName()} - The package name of the source.</li>
168a0156177cdc809795dd8bc5a19943dd2b6f82b66Svetoslav Ganov *   <li>{@link #getEventTime()}  - The event time.</li>
16982e236d72ac197d6673d0b4d484fe5f0b9436731Svetoslav Ganov *   <li>{@link #getText()} - The text of the source's sub-tree.</li>
170a0156177cdc809795dd8bc5a19943dd2b6f82b66Svetoslav Ganov *   <li>{@link #isEnabled()} - Whether the source is enabled.</li>
171a0156177cdc809795dd8bc5a19943dd2b6f82b66Svetoslav Ganov *   <li>{@link #isPassword()} - Whether the source is password.</li>
172a0156177cdc809795dd8bc5a19943dd2b6f82b66Svetoslav Ganov *   <li>{@link #isChecked()} - Whether the source is checked.</li>
17338e8b4e5bc3c93affdffbc064fd9db5aeccc3e8eSvetoslav Ganov *   <li>{@link #getItemCount()} - The number of focusable items on the screen.</li>
174a0156177cdc809795dd8bc5a19943dd2b6f82b66Svetoslav Ganov *   <li>{@link #getCurrentItemIndex()} - The currently focused item index.</li>
17582e236d72ac197d6673d0b4d484fe5f0b9436731Svetoslav Ganov *   <li>{@link #getContentDescription()} - The content description of the source.</li>
176d9ee72fddb8be40e414a831fb80458dc48699613Svetoslav Ganov *   <li>{@link #getScrollX()} - The offset of the source left edge in pixels
177d9ee72fddb8be40e414a831fb80458dc48699613Svetoslav Ganov *       (without descendants of AdapterView).</li>
178d9ee72fddb8be40e414a831fb80458dc48699613Svetoslav Ganov *   <li>{@link #getScrollY()} - The offset of the source top edge in pixels
179d9ee72fddb8be40e414a831fb80458dc48699613Svetoslav Ganov *       (without descendants of AdapterView).</li>
180d9ee72fddb8be40e414a831fb80458dc48699613Svetoslav Ganov *   <li>{@link #getFromIndex()} - The zero based index of the first visible item of the source,
181d9ee72fddb8be40e414a831fb80458dc48699613Svetoslav Ganov *       inclusive (for descendants of AdapterView).</li>
182d9ee72fddb8be40e414a831fb80458dc48699613Svetoslav Ganov *   <li>{@link #getToIndex()} - The zero based index of the last visible item of the source,
183d9ee72fddb8be40e414a831fb80458dc48699613Svetoslav Ganov *       inclusive (for descendants of AdapterView).</li>
184d9ee72fddb8be40e414a831fb80458dc48699613Svetoslav Ganov *   <li>{@link #getItemCount()} - The total items of the source
185d9ee72fddb8be40e414a831fb80458dc48699613Svetoslav Ganov *       (for descendants of AdapterView).</li>
186a0156177cdc809795dd8bc5a19943dd2b6f82b66Svetoslav Ganov * </ul>
18738e8b4e5bc3c93affdffbc064fd9db5aeccc3e8eSvetoslav Ganov * </p>
18875986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov * <p>
18975986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov * <b>View text changed</b> - represents the event of changing the text of an
19038e8b4e5bc3c93affdffbc064fd9db5aeccc3e8eSvetoslav Ganov * {@link android.widget.EditText}.</br>
19138e8b4e5bc3c93affdffbc064fd9db5aeccc3e8eSvetoslav Ganov * <em>Type:</em> {@link #TYPE_VIEW_TEXT_CHANGED}</br>
19238e8b4e5bc3c93affdffbc064fd9db5aeccc3e8eSvetoslav Ganov * <em>Properties:</em></br>
193a0156177cdc809795dd8bc5a19943dd2b6f82b66Svetoslav Ganov * <ul>
19482e236d72ac197d6673d0b4d484fe5f0b9436731Svetoslav Ganov *   <li>{@link #getEventType()} - The type of the event.</li>
19538e8b4e5bc3c93affdffbc064fd9db5aeccc3e8eSvetoslav Ganov *   <li>{@link #getSource()} - The source info (for registered clients).</li>
196a0156177cdc809795dd8bc5a19943dd2b6f82b66Svetoslav Ganov *   <li>{@link #getClassName()} - The class name of the source.</li>
197a0156177cdc809795dd8bc5a19943dd2b6f82b66Svetoslav Ganov *   <li>{@link #getPackageName()} - The package name of the source.</li>
198a0156177cdc809795dd8bc5a19943dd2b6f82b66Svetoslav Ganov *   <li>{@link #getEventTime()}  - The event time.</li>
199a0156177cdc809795dd8bc5a19943dd2b6f82b66Svetoslav Ganov *   <li>{@link #getText()} - The text of the source.</li>
200a0156177cdc809795dd8bc5a19943dd2b6f82b66Svetoslav Ganov *   <li>{@link #isEnabled()} - Whether the source is enabled.</li>
201a0156177cdc809795dd8bc5a19943dd2b6f82b66Svetoslav Ganov *   <li>{@link #isPassword()} - Whether the source is password.</li>
202a0156177cdc809795dd8bc5a19943dd2b6f82b66Svetoslav Ganov *   <li>{@link #isChecked()} - Whether the source is checked.</li>
203a0156177cdc809795dd8bc5a19943dd2b6f82b66Svetoslav Ganov *   <li>{@link #getFromIndex()} - The text change start index.</li>
204a0156177cdc809795dd8bc5a19943dd2b6f82b66Svetoslav Ganov *   <li>{@link #getAddedCount()} - The number of added characters.</li>
205a0156177cdc809795dd8bc5a19943dd2b6f82b66Svetoslav Ganov *   <li>{@link #getRemovedCount()} - The number of removed characters.</li>
206a0156177cdc809795dd8bc5a19943dd2b6f82b66Svetoslav Ganov *   <li>{@link #getBeforeText()} - The text of the source before the change.</li>
20782e236d72ac197d6673d0b4d484fe5f0b9436731Svetoslav Ganov *   <li>{@link #getContentDescription()} - The content description of the source.</li>
208a0156177cdc809795dd8bc5a19943dd2b6f82b66Svetoslav Ganov * </ul>
20938e8b4e5bc3c93affdffbc064fd9db5aeccc3e8eSvetoslav Ganov * </p>
210a0156177cdc809795dd8bc5a19943dd2b6f82b66Svetoslav Ganov * <p>
211a0156177cdc809795dd8bc5a19943dd2b6f82b66Svetoslav Ganov * <b>View text selection changed</b> - represents the event of changing the text
21238e8b4e5bc3c93affdffbc064fd9db5aeccc3e8eSvetoslav Ganov * selection of an {@link android.widget.EditText}.</br>
21338e8b4e5bc3c93affdffbc064fd9db5aeccc3e8eSvetoslav Ganov * <em>Type:</em> {@link #TYPE_VIEW_TEXT_SELECTION_CHANGED} </br>
21438e8b4e5bc3c93affdffbc064fd9db5aeccc3e8eSvetoslav Ganov * <em>Properties:</em></br>
215a0156177cdc809795dd8bc5a19943dd2b6f82b66Svetoslav Ganov * <ul>
21682e236d72ac197d6673d0b4d484fe5f0b9436731Svetoslav Ganov *   <li>{@link #getEventType()} - The type of the event.</li>
21738e8b4e5bc3c93affdffbc064fd9db5aeccc3e8eSvetoslav Ganov *   <li>{@link #getSource()} - The source info (for registered clients).</li>
218a0156177cdc809795dd8bc5a19943dd2b6f82b66Svetoslav Ganov *   <li>{@link #getClassName()} - The class name of the source.</li>
219a0156177cdc809795dd8bc5a19943dd2b6f82b66Svetoslav Ganov *   <li>{@link #getPackageName()} - The package name of the source.</li>
220a0156177cdc809795dd8bc5a19943dd2b6f82b66Svetoslav Ganov *   <li>{@link #getEventTime()}  - The event time.</li>
221a0156177cdc809795dd8bc5a19943dd2b6f82b66Svetoslav Ganov *   <li>{@link #getText()} - The text of the source.</li>
222a0156177cdc809795dd8bc5a19943dd2b6f82b66Svetoslav Ganov *   <li>{@link #isPassword()} - Whether the source is password.</li>
223a0156177cdc809795dd8bc5a19943dd2b6f82b66Svetoslav Ganov *   <li>{@link #getFromIndex()} - The selection start index.</li>
224a0156177cdc809795dd8bc5a19943dd2b6f82b66Svetoslav Ganov *   <li>{@link #getToIndex()} - The selection end index.</li>
225a0156177cdc809795dd8bc5a19943dd2b6f82b66Svetoslav Ganov *   <li>{@link #getItemCount()} - The length of the source text.</li>
22682e236d72ac197d6673d0b4d484fe5f0b9436731Svetoslav Ganov *   <li>{@link #isEnabled()} - Whether the source is enabled.</li>
22782e236d72ac197d6673d0b4d484fe5f0b9436731Svetoslav Ganov *   <li>{@link #getContentDescription()} - The content description of the source.</li>
22838e8b4e5bc3c93affdffbc064fd9db5aeccc3e8eSvetoslav Ganov * </ul>
22938e8b4e5bc3c93affdffbc064fd9db5aeccc3e8eSvetoslav Ganov * </p>
2302b435aada3d274a9c08d334946fff1ab9ba15b48Svetoslav Ganov * <b>View text traversed at movement granularity</b> - represents the event of traversing the
231b7ff3255c6d4e12f9d2334e3bbec0a125b7b09dcSvetoslav Ganov * text of a view at a given granularity. For example, moving to the next word.</br>
2322b435aada3d274a9c08d334946fff1ab9ba15b48Svetoslav Ganov * <em>Type:</em> {@link #TYPE_VIEW_TEXT_TRAVERSED_AT_MOVEMENT_GRANULARITY} </br>
233b7ff3255c6d4e12f9d2334e3bbec0a125b7b09dcSvetoslav Ganov * <em>Properties:</em></br>
234b7ff3255c6d4e12f9d2334e3bbec0a125b7b09dcSvetoslav Ganov * <ul>
235b7ff3255c6d4e12f9d2334e3bbec0a125b7b09dcSvetoslav Ganov *   <li>{@link #getEventType()} - The type of the event.</li>
236b7ff3255c6d4e12f9d2334e3bbec0a125b7b09dcSvetoslav Ganov *   <li>{@link #getSource()} - The source info (for registered clients).</li>
237b7ff3255c6d4e12f9d2334e3bbec0a125b7b09dcSvetoslav Ganov *   <li>{@link #getClassName()} - The class name of the source.</li>
238b7ff3255c6d4e12f9d2334e3bbec0a125b7b09dcSvetoslav Ganov *   <li>{@link #getPackageName()} - The package name of the source.</li>
239b7ff3255c6d4e12f9d2334e3bbec0a125b7b09dcSvetoslav Ganov *   <li>{@link #getEventTime()}  - The event time.</li>
2406d17a936f73976971135aa1e6248662533343292Svetoslav Ganov *   <li>{@link #getMovementGranularity()} - Sets the granularity at which a view's text
2416d17a936f73976971135aa1e6248662533343292Svetoslav Ganov *       was traversed.</li>
2426d17a936f73976971135aa1e6248662533343292Svetoslav Ganov *   <li>{@link #getText()} -  The text of the source's sub-tree.</li>
2436d17a936f73976971135aa1e6248662533343292Svetoslav Ganov *   <li>{@link #getFromIndex()} - The start of the next/previous text at the specified granularity
2446d17a936f73976971135aa1e6248662533343292Svetoslav Ganov *           - inclusive.</li>
2456d17a936f73976971135aa1e6248662533343292Svetoslav Ganov *   <li>{@link #getToIndex()} - The end of the next/previous text at the specified granularity
2466d17a936f73976971135aa1e6248662533343292Svetoslav Ganov *           - exclusive.</li>
247b7ff3255c6d4e12f9d2334e3bbec0a125b7b09dcSvetoslav Ganov *   <li>{@link #isPassword()} - Whether the source is password.</li>
248b7ff3255c6d4e12f9d2334e3bbec0a125b7b09dcSvetoslav Ganov *   <li>{@link #isEnabled()} - Whether the source is enabled.</li>
249b7ff3255c6d4e12f9d2334e3bbec0a125b7b09dcSvetoslav Ganov *   <li>{@link #getContentDescription()} - The content description of the source.</li>
2502b435aada3d274a9c08d334946fff1ab9ba15b48Svetoslav Ganov *   <li>{@link #getMovementGranularity()} - Sets the granularity at which a view's text
2512b435aada3d274a9c08d334946fff1ab9ba15b48Svetoslav Ganov *       was traversed.</li>
2526d17a936f73976971135aa1e6248662533343292Svetoslav Ganov *   <li>{@link #getAction()} - Gets traversal action which specifies the direction.</li>
253b7ff3255c6d4e12f9d2334e3bbec0a125b7b09dcSvetoslav Ganov * </ul>
254b7ff3255c6d4e12f9d2334e3bbec0a125b7b09dcSvetoslav Ganov * </p>
255a0156177cdc809795dd8bc5a19943dd2b6f82b66Svetoslav Ganov * <p>
256a0156177cdc809795dd8bc5a19943dd2b6f82b66Svetoslav Ganov * <b>View scrolled</b> - represents the event of scrolling a view. If
257a0156177cdc809795dd8bc5a19943dd2b6f82b66Svetoslav Ganov * the source is a descendant of {@link android.widget.AdapterView} the
258a0156177cdc809795dd8bc5a19943dd2b6f82b66Svetoslav Ganov * scroll is reported in terms of visible items - the first visible item,
259a0156177cdc809795dd8bc5a19943dd2b6f82b66Svetoslav Ganov * the last visible item, and the total items - because the the source
26082e236d72ac197d6673d0b4d484fe5f0b9436731Svetoslav Ganov * is unaware of its pixel size since its adapter is responsible for
261a0156177cdc809795dd8bc5a19943dd2b6f82b66Svetoslav Ganov * creating views. In all other cases the scroll is reported as the current
262a0156177cdc809795dd8bc5a19943dd2b6f82b66Svetoslav Ganov * scroll on the X and Y axis respectively plus the height of the source in
26338e8b4e5bc3c93affdffbc064fd9db5aeccc3e8eSvetoslav Ganov * pixels.</br>
26438e8b4e5bc3c93affdffbc064fd9db5aeccc3e8eSvetoslav Ganov * <em>Type:</em> {@link #TYPE_VIEW_SCROLLED}</br>
26538e8b4e5bc3c93affdffbc064fd9db5aeccc3e8eSvetoslav Ganov * <em>Properties:</em></br>
266a0156177cdc809795dd8bc5a19943dd2b6f82b66Svetoslav Ganov * <ul>
26782e236d72ac197d6673d0b4d484fe5f0b9436731Svetoslav Ganov *   <li>{@link #getEventType()} - The type of the event.</li>
26838e8b4e5bc3c93affdffbc064fd9db5aeccc3e8eSvetoslav Ganov *   <li>{@link #getSource()} - The source info (for registered clients).</li>
269a0156177cdc809795dd8bc5a19943dd2b6f82b66Svetoslav Ganov *   <li>{@link #getClassName()} - The class name of the source.</li>
270a0156177cdc809795dd8bc5a19943dd2b6f82b66Svetoslav Ganov *   <li>{@link #getPackageName()} - The package name of the source.</li>
271a0156177cdc809795dd8bc5a19943dd2b6f82b66Svetoslav Ganov *   <li>{@link #getEventTime()}  - The event time.</li>
27282e236d72ac197d6673d0b4d484fe5f0b9436731Svetoslav Ganov *   <li>{@link #getText()} - The text of the source's sub-tree.</li>
273a0156177cdc809795dd8bc5a19943dd2b6f82b66Svetoslav Ganov *   <li>{@link #isEnabled()} - Whether the source is enabled.</li>
27482e236d72ac197d6673d0b4d484fe5f0b9436731Svetoslav Ganov *   <li>{@link #getContentDescription()} - The content description of the source.</li>
275d9ee72fddb8be40e414a831fb80458dc48699613Svetoslav Ganov *   <li>{@link #getScrollX()} - The offset of the source left edge in pixels
276d9ee72fddb8be40e414a831fb80458dc48699613Svetoslav Ganov *       (without descendants of AdapterView).</li>
277d9ee72fddb8be40e414a831fb80458dc48699613Svetoslav Ganov *   <li>{@link #getScrollY()} - The offset of the source top edge in pixels
278d9ee72fddb8be40e414a831fb80458dc48699613Svetoslav Ganov *       (without descendants of AdapterView).</li>
279d9ee72fddb8be40e414a831fb80458dc48699613Svetoslav Ganov *   <li>{@link #getFromIndex()} - The zero based index of the first visible item of the source,
280d9ee72fddb8be40e414a831fb80458dc48699613Svetoslav Ganov *       inclusive (for descendants of AdapterView).</li>
281d9ee72fddb8be40e414a831fb80458dc48699613Svetoslav Ganov *   <li>{@link #getToIndex()} - The zero based index of the last visible item of the source,
282d9ee72fddb8be40e414a831fb80458dc48699613Svetoslav Ganov *       inclusive (for descendants of AdapterView).</li>
283d9ee72fddb8be40e414a831fb80458dc48699613Svetoslav Ganov *   <li>{@link #getItemCount()} - The total items of the source
284d9ee72fddb8be40e414a831fb80458dc48699613Svetoslav Ganov *       (for descendants of AdapterView).</li>
28538e8b4e5bc3c93affdffbc064fd9db5aeccc3e8eSvetoslav Ganov * </ul>
28682e236d72ac197d6673d0b4d484fe5f0b9436731Svetoslav Ganov * <em>Note:</em> This event type is not dispatched to descendants though
28782e236d72ac197d6673d0b4d484fe5f0b9436731Svetoslav Ganov * {@link android.view.View#dispatchPopulateAccessibilityEvent(AccessibilityEvent)
28882e236d72ac197d6673d0b4d484fe5f0b9436731Svetoslav Ganov * View.dispatchPopulateAccessibilityEvent(AccessibilityEvent)}, hence the event
28982e236d72ac197d6673d0b4d484fe5f0b9436731Svetoslav Ganov * source {@link android.view.View} and the sub-tree rooted at it will not receive
29082e236d72ac197d6673d0b4d484fe5f0b9436731Svetoslav Ganov * calls to {@link android.view.View#onPopulateAccessibilityEvent(AccessibilityEvent)
29182e236d72ac197d6673d0b4d484fe5f0b9436731Svetoslav Ganov * View.onPopulateAccessibilityEvent(AccessibilityEvent)}. The preferred way to add
29282e236d72ac197d6673d0b4d484fe5f0b9436731Svetoslav Ganov * text content to such events is by setting the
29382e236d72ac197d6673d0b4d484fe5f0b9436731Svetoslav Ganov * {@link android.R.styleable#View_contentDescription contentDescription} of the source
29482e236d72ac197d6673d0b4d484fe5f0b9436731Svetoslav Ganov * view.</br>
29538e8b4e5bc3c93affdffbc064fd9db5aeccc3e8eSvetoslav Ganov * </p>
29675986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov * <p>
29738e8b4e5bc3c93affdffbc064fd9db5aeccc3e8eSvetoslav Ganov * <b>TRANSITION TYPES</b></br>
29838e8b4e5bc3c93affdffbc064fd9db5aeccc3e8eSvetoslav Ganov * </p>
29982e236d72ac197d6673d0b4d484fe5f0b9436731Svetoslav Ganov * <p>
300eeee4d2c01d3c4ed99e4891dbc75c7de69a803faSvetoslav Ganov * <b>Window state changed</b> - represents the event of opening a
30175986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov * {@link android.widget.PopupWindow}, {@link android.view.Menu},
30238e8b4e5bc3c93affdffbc064fd9db5aeccc3e8eSvetoslav Ganov * {@link android.app.Dialog}, etc.</br>
30338e8b4e5bc3c93affdffbc064fd9db5aeccc3e8eSvetoslav Ganov * <em>Type:</em> {@link #TYPE_WINDOW_STATE_CHANGED}</br>
30438e8b4e5bc3c93affdffbc064fd9db5aeccc3e8eSvetoslav Ganov * <em>Properties:</em></br>
305a0156177cdc809795dd8bc5a19943dd2b6f82b66Svetoslav Ganov * <ul>
30682e236d72ac197d6673d0b4d484fe5f0b9436731Svetoslav Ganov *   <li>{@link #getEventType()} - The type of the event.</li>
30738e8b4e5bc3c93affdffbc064fd9db5aeccc3e8eSvetoslav Ganov *   <li>{@link #getSource()} - The source info (for registered clients).</li>
308a0156177cdc809795dd8bc5a19943dd2b6f82b66Svetoslav Ganov *   <li>{@link #getClassName()} - The class name of the source.</li>
309a0156177cdc809795dd8bc5a19943dd2b6f82b66Svetoslav Ganov *   <li>{@link #getPackageName()} - The package name of the source.</li>
310a0156177cdc809795dd8bc5a19943dd2b6f82b66Svetoslav Ganov *   <li>{@link #getEventTime()}  - The event time.</li>
31182e236d72ac197d6673d0b4d484fe5f0b9436731Svetoslav Ganov *   <li>{@link #getText()} - The text of the source's sub-tree.</li>
31282e236d72ac197d6673d0b4d484fe5f0b9436731Svetoslav Ganov *   <li>{@link #isEnabled()} - Whether the source is enabled.</li>
313a0156177cdc809795dd8bc5a19943dd2b6f82b66Svetoslav Ganov * </ul>
31438e8b4e5bc3c93affdffbc064fd9db5aeccc3e8eSvetoslav Ganov * </p>
31575986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov * <p>
316eeee4d2c01d3c4ed99e4891dbc75c7de69a803faSvetoslav Ganov * <b>Window content changed</b> - represents the event of change in the
317eeee4d2c01d3c4ed99e4891dbc75c7de69a803faSvetoslav Ganov * content of a window. This change can be adding/removing view, changing
31838e8b4e5bc3c93affdffbc064fd9db5aeccc3e8eSvetoslav Ganov * a view size, etc.</br>
31982e236d72ac197d6673d0b4d484fe5f0b9436731Svetoslav Ganov * </p>
32038e8b4e5bc3c93affdffbc064fd9db5aeccc3e8eSvetoslav Ganov * <p>
32138e8b4e5bc3c93affdffbc064fd9db5aeccc3e8eSvetoslav Ganov * <strong>Note:</strong> This event is fired only for the window source of the
32282e236d72ac197d6673d0b4d484fe5f0b9436731Svetoslav Ganov * last accessibility event different from {@link #TYPE_NOTIFICATION_STATE_CHANGED}
32338e8b4e5bc3c93affdffbc064fd9db5aeccc3e8eSvetoslav Ganov * and its purpose is to notify clients that the content of the user interaction
32482e236d72ac197d6673d0b4d484fe5f0b9436731Svetoslav Ganov * window has changed.</br>
32538e8b4e5bc3c93affdffbc064fd9db5aeccc3e8eSvetoslav Ganov * <em>Type:</em> {@link #TYPE_WINDOW_CONTENT_CHANGED}</br>
32638e8b4e5bc3c93affdffbc064fd9db5aeccc3e8eSvetoslav Ganov * <em>Properties:</em></br>
327a0156177cdc809795dd8bc5a19943dd2b6f82b66Svetoslav Ganov * <ul>
32882e236d72ac197d6673d0b4d484fe5f0b9436731Svetoslav Ganov *   <li>{@link #getEventType()} - The type of the event.</li>
32938e8b4e5bc3c93affdffbc064fd9db5aeccc3e8eSvetoslav Ganov *   <li>{@link #getSource()} - The source info (for registered clients).</li>
330a0156177cdc809795dd8bc5a19943dd2b6f82b66Svetoslav Ganov *   <li>{@link #getClassName()} - The class name of the source.</li>
331a0156177cdc809795dd8bc5a19943dd2b6f82b66Svetoslav Ganov *   <li>{@link #getPackageName()} - The package name of the source.</li>
332a0156177cdc809795dd8bc5a19943dd2b6f82b66Svetoslav Ganov *   <li>{@link #getEventTime()}  - The event time.</li>
33338e8b4e5bc3c93affdffbc064fd9db5aeccc3e8eSvetoslav Ganov * </ul>
33482e236d72ac197d6673d0b4d484fe5f0b9436731Svetoslav Ganov * <em>Note:</em> This event type is not dispatched to descendants though
33582e236d72ac197d6673d0b4d484fe5f0b9436731Svetoslav Ganov * {@link android.view.View#dispatchPopulateAccessibilityEvent(AccessibilityEvent)
33682e236d72ac197d6673d0b4d484fe5f0b9436731Svetoslav Ganov * View.dispatchPopulateAccessibilityEvent(AccessibilityEvent)}, hence the event
33782e236d72ac197d6673d0b4d484fe5f0b9436731Svetoslav Ganov * source {@link android.view.View} and the sub-tree rooted at it will not receive
33882e236d72ac197d6673d0b4d484fe5f0b9436731Svetoslav Ganov * calls to {@link android.view.View#onPopulateAccessibilityEvent(AccessibilityEvent)
33982e236d72ac197d6673d0b4d484fe5f0b9436731Svetoslav Ganov * View.onPopulateAccessibilityEvent(AccessibilityEvent)}. The preferred way to add
34082e236d72ac197d6673d0b4d484fe5f0b9436731Svetoslav Ganov * text content to such events is by setting the
34182e236d72ac197d6673d0b4d484fe5f0b9436731Svetoslav Ganov * {@link android.R.styleable#View_contentDescription contentDescription} of the source
34282e236d72ac197d6673d0b4d484fe5f0b9436731Svetoslav Ganov * view.</br>
34382e236d72ac197d6673d0b4d484fe5f0b9436731Svetoslav Ganov * </p>
344eeee4d2c01d3c4ed99e4891dbc75c7de69a803faSvetoslav Ganov * <p>
34538e8b4e5bc3c93affdffbc064fd9db5aeccc3e8eSvetoslav Ganov * <b>NOTIFICATION TYPES</b></br>
34682e236d72ac197d6673d0b4d484fe5f0b9436731Svetoslav Ganov * </p>
34775986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov * <p>
34838e8b4e5bc3c93affdffbc064fd9db5aeccc3e8eSvetoslav Ganov * <b>Notification state changed</b> - represents the event showing
34982e236d72ac197d6673d0b4d484fe5f0b9436731Svetoslav Ganov * {@link android.app.Notification}.</br>
35038e8b4e5bc3c93affdffbc064fd9db5aeccc3e8eSvetoslav Ganov * <em>Type:</em> {@link #TYPE_NOTIFICATION_STATE_CHANGED}</br>
35138e8b4e5bc3c93affdffbc064fd9db5aeccc3e8eSvetoslav Ganov * <em>Properties:</em></br>
352a0156177cdc809795dd8bc5a19943dd2b6f82b66Svetoslav Ganov * <ul>
35382e236d72ac197d6673d0b4d484fe5f0b9436731Svetoslav Ganov *   <li>{@link #getEventType()} - The type of the event.</li>
354a0156177cdc809795dd8bc5a19943dd2b6f82b66Svetoslav Ganov *   <li>{@link #getClassName()} - The class name of the source.</li>
355a0156177cdc809795dd8bc5a19943dd2b6f82b66Svetoslav Ganov *   <li>{@link #getPackageName()} - The package name of the source.</li>
356a0156177cdc809795dd8bc5a19943dd2b6f82b66Svetoslav Ganov *   <li>{@link #getEventTime()}  - The event time.</li>
35782e236d72ac197d6673d0b4d484fe5f0b9436731Svetoslav Ganov *   <li>{@link #getText()} - The text of the source's sub-tree.</li>
358a0156177cdc809795dd8bc5a19943dd2b6f82b66Svetoslav Ganov *   <li>{@link #getParcelableData()} - The posted {@link android.app.Notification}.</li>
35982e236d72ac197d6673d0b4d484fe5f0b9436731Svetoslav Ganov *   <li>{@link #getText()} - Text for providing more context.</li>
360a0156177cdc809795dd8bc5a19943dd2b6f82b66Svetoslav Ganov * </ul>
36182e236d72ac197d6673d0b4d484fe5f0b9436731Svetoslav Ganov * <em>Note:</em> This event type is not dispatched to descendants though
36282e236d72ac197d6673d0b4d484fe5f0b9436731Svetoslav Ganov * {@link android.view.View#dispatchPopulateAccessibilityEvent(AccessibilityEvent)
36382e236d72ac197d6673d0b4d484fe5f0b9436731Svetoslav Ganov * View.dispatchPopulateAccessibilityEvent(AccessibilityEvent)}, hence the event
36482e236d72ac197d6673d0b4d484fe5f0b9436731Svetoslav Ganov * source {@link android.view.View} and the sub-tree rooted at it will not receive
36582e236d72ac197d6673d0b4d484fe5f0b9436731Svetoslav Ganov * calls to {@link android.view.View#onPopulateAccessibilityEvent(AccessibilityEvent)
36682e236d72ac197d6673d0b4d484fe5f0b9436731Svetoslav Ganov * View.onPopulateAccessibilityEvent(AccessibilityEvent)}. The preferred way to add
36782e236d72ac197d6673d0b4d484fe5f0b9436731Svetoslav Ganov * text content to such events is by setting the
36882e236d72ac197d6673d0b4d484fe5f0b9436731Svetoslav Ganov * {@link android.R.styleable#View_contentDescription contentDescription} of the source
36982e236d72ac197d6673d0b4d484fe5f0b9436731Svetoslav Ganov * view.</br>
37082e236d72ac197d6673d0b4d484fe5f0b9436731Svetoslav Ganov * </p>
37182e236d72ac197d6673d0b4d484fe5f0b9436731Svetoslav Ganov * <p>
37282e236d72ac197d6673d0b4d484fe5f0b9436731Svetoslav Ganov * <b>EXPLORATION TYPES</b></br>
37382e236d72ac197d6673d0b4d484fe5f0b9436731Svetoslav Ganov * </p>
37482e236d72ac197d6673d0b4d484fe5f0b9436731Svetoslav Ganov * <p>
37582e236d72ac197d6673d0b4d484fe5f0b9436731Svetoslav Ganov * <b>View hover enter</b> - represents the event of beginning to hover
37682e236d72ac197d6673d0b4d484fe5f0b9436731Svetoslav Ganov * over a {@link android.view.View}. The hover may be generated via
37782e236d72ac197d6673d0b4d484fe5f0b9436731Svetoslav Ganov * exploring the screen by touch or via a pointing device.</br>
37882e236d72ac197d6673d0b4d484fe5f0b9436731Svetoslav Ganov * <em>Type:</em> {@link #TYPE_VIEW_HOVER_ENTER}</br>
37982e236d72ac197d6673d0b4d484fe5f0b9436731Svetoslav Ganov * <em>Properties:</em></br>
38082e236d72ac197d6673d0b4d484fe5f0b9436731Svetoslav Ganov * <ul>
38182e236d72ac197d6673d0b4d484fe5f0b9436731Svetoslav Ganov *   <li>{@link #getEventType()} - The type of the event.</li>
38282e236d72ac197d6673d0b4d484fe5f0b9436731Svetoslav Ganov *   <li>{@link #getSource()} - The source info (for registered clients).</li>
38382e236d72ac197d6673d0b4d484fe5f0b9436731Svetoslav Ganov *   <li>{@link #getClassName()} - The class name of the source.</li>
38482e236d72ac197d6673d0b4d484fe5f0b9436731Svetoslav Ganov *   <li>{@link #getPackageName()} - The package name of the source.</li>
38582e236d72ac197d6673d0b4d484fe5f0b9436731Svetoslav Ganov *   <li>{@link #getEventTime()}  - The event time.</li>
38682e236d72ac197d6673d0b4d484fe5f0b9436731Svetoslav Ganov *   <li>{@link #getText()} - The text of the source's sub-tree.</li>
38782e236d72ac197d6673d0b4d484fe5f0b9436731Svetoslav Ganov *   <li>{@link #isEnabled()} - Whether the source is enabled.</li>
38882e236d72ac197d6673d0b4d484fe5f0b9436731Svetoslav Ganov *   <li>{@link #getContentDescription()} - The content description of the source.</li>
389d9ee72fddb8be40e414a831fb80458dc48699613Svetoslav Ganov *   <li>{@link #getScrollX()} - The offset of the source left edge in pixels
390d9ee72fddb8be40e414a831fb80458dc48699613Svetoslav Ganov *       (without descendants of AdapterView).</li>
391d9ee72fddb8be40e414a831fb80458dc48699613Svetoslav Ganov *   <li>{@link #getScrollY()} - The offset of the source top edge in pixels
392d9ee72fddb8be40e414a831fb80458dc48699613Svetoslav Ganov *       (without descendants of AdapterView).</li>
393d9ee72fddb8be40e414a831fb80458dc48699613Svetoslav Ganov *   <li>{@link #getFromIndex()} - The zero based index of the first visible item of the source,
394d9ee72fddb8be40e414a831fb80458dc48699613Svetoslav Ganov *       inclusive (for descendants of AdapterView).</li>
395d9ee72fddb8be40e414a831fb80458dc48699613Svetoslav Ganov *   <li>{@link #getToIndex()} - The zero based index of the last visible item of the source,
396d9ee72fddb8be40e414a831fb80458dc48699613Svetoslav Ganov *       inclusive (for descendants of AdapterView).</li>
397d9ee72fddb8be40e414a831fb80458dc48699613Svetoslav Ganov *   <li>{@link #getItemCount()} - The total items of the source
398d9ee72fddb8be40e414a831fb80458dc48699613Svetoslav Ganov *       (for descendants of AdapterView).</li>
39982e236d72ac197d6673d0b4d484fe5f0b9436731Svetoslav Ganov * </ul>
40082e236d72ac197d6673d0b4d484fe5f0b9436731Svetoslav Ganov * </p>
40182e236d72ac197d6673d0b4d484fe5f0b9436731Svetoslav Ganov * <b>View hover exit</b> - represents the event of stopping to hover
40282e236d72ac197d6673d0b4d484fe5f0b9436731Svetoslav Ganov * over a {@link android.view.View}. The hover may be generated via
40382e236d72ac197d6673d0b4d484fe5f0b9436731Svetoslav Ganov * exploring the screen by touch or via a pointing device.</br>
40482e236d72ac197d6673d0b4d484fe5f0b9436731Svetoslav Ganov * <em>Type:</em> {@link #TYPE_VIEW_HOVER_EXIT}</br>
40582e236d72ac197d6673d0b4d484fe5f0b9436731Svetoslav Ganov * <em>Properties:</em></br>
40682e236d72ac197d6673d0b4d484fe5f0b9436731Svetoslav Ganov * <ul>
40782e236d72ac197d6673d0b4d484fe5f0b9436731Svetoslav Ganov *   <li>{@link #getEventType()} - The type of the event.</li>
40882e236d72ac197d6673d0b4d484fe5f0b9436731Svetoslav Ganov *   <li>{@link #getSource()} - The source info (for registered clients).</li>
40982e236d72ac197d6673d0b4d484fe5f0b9436731Svetoslav Ganov *   <li>{@link #getClassName()} - The class name of the source.</li>
41082e236d72ac197d6673d0b4d484fe5f0b9436731Svetoslav Ganov *   <li>{@link #getPackageName()} - The package name of the source.</li>
41182e236d72ac197d6673d0b4d484fe5f0b9436731Svetoslav Ganov *   <li>{@link #getEventTime()}  - The event time.</li>
41282e236d72ac197d6673d0b4d484fe5f0b9436731Svetoslav Ganov *   <li>{@link #getText()} - The text of the source's sub-tree.</li>
41382e236d72ac197d6673d0b4d484fe5f0b9436731Svetoslav Ganov *   <li>{@link #isEnabled()} - Whether the source is enabled.</li>
41482e236d72ac197d6673d0b4d484fe5f0b9436731Svetoslav Ganov *   <li>{@link #getContentDescription()} - The content description of the source.</li>
415d9ee72fddb8be40e414a831fb80458dc48699613Svetoslav Ganov *   <li>{@link #getScrollX()} - The offset of the source left edge in pixels
416d9ee72fddb8be40e414a831fb80458dc48699613Svetoslav Ganov *       (without descendants of AdapterView).</li>
417d9ee72fddb8be40e414a831fb80458dc48699613Svetoslav Ganov *   <li>{@link #getScrollY()} - The offset of the source top edge in pixels
418d9ee72fddb8be40e414a831fb80458dc48699613Svetoslav Ganov *       (without descendants of AdapterView).</li>
419d9ee72fddb8be40e414a831fb80458dc48699613Svetoslav Ganov *   <li>{@link #getFromIndex()} - The zero based index of the first visible item of the source,
420d9ee72fddb8be40e414a831fb80458dc48699613Svetoslav Ganov *       inclusive (for descendants of AdapterView).</li>
421d9ee72fddb8be40e414a831fb80458dc48699613Svetoslav Ganov *   <li>{@link #getToIndex()} - The zero based index of the last visible item of the source,
422d9ee72fddb8be40e414a831fb80458dc48699613Svetoslav Ganov *       inclusive (for descendants of AdapterView).</li>
423d9ee72fddb8be40e414a831fb80458dc48699613Svetoslav Ganov *   <li>{@link #getItemCount()} - The total items of the source
424d9ee72fddb8be40e414a831fb80458dc48699613Svetoslav Ganov *       (for descendants of AdapterView).</li>
42582e236d72ac197d6673d0b4d484fe5f0b9436731Svetoslav Ganov * </ul>
42682e236d72ac197d6673d0b4d484fe5f0b9436731Svetoslav Ganov * </p>
42782e236d72ac197d6673d0b4d484fe5f0b9436731Svetoslav Ganov * <p>
42877276b60851a158ad3e142cb3b091d57ae5ceffbSvetoslav Ganov * <b>Touch interaction start</b> - represents the event of starting a touch
42977276b60851a158ad3e142cb3b091d57ae5ceffbSvetoslav Ganov * interaction, which is the user starts touching the screen.</br>
43077276b60851a158ad3e142cb3b091d57ae5ceffbSvetoslav Ganov * <em>Type:</em> {@link #TYPE_TOUCH_INTERACTION_START}</br>
43177276b60851a158ad3e142cb3b091d57ae5ceffbSvetoslav Ganov * <em>Properties:</em></br>
43277276b60851a158ad3e142cb3b091d57ae5ceffbSvetoslav Ganov * <ul>
43377276b60851a158ad3e142cb3b091d57ae5ceffbSvetoslav Ganov *   <li>{@link #getEventType()} - The type of the event.</li>
43477276b60851a158ad3e142cb3b091d57ae5ceffbSvetoslav Ganov * </ul>
43577276b60851a158ad3e142cb3b091d57ae5ceffbSvetoslav Ganov * <em>Note:</em> This event is fired only by the system and is not passed to the
43677276b60851a158ad3e142cb3b091d57ae5ceffbSvetoslav Ganov * view tree to be populated.</br>
43777276b60851a158ad3e142cb3b091d57ae5ceffbSvetoslav Ganov * </p>
43877276b60851a158ad3e142cb3b091d57ae5ceffbSvetoslav Ganov * <p>
43977276b60851a158ad3e142cb3b091d57ae5ceffbSvetoslav Ganov * <b>Touch interaction end</b> - represents the event of ending a touch
44077276b60851a158ad3e142cb3b091d57ae5ceffbSvetoslav Ganov * interaction, which is the user stops touching the screen.</br>
44177276b60851a158ad3e142cb3b091d57ae5ceffbSvetoslav Ganov * <em>Type:</em> {@link #TYPE_TOUCH_INTERACTION_END}</br>
44277276b60851a158ad3e142cb3b091d57ae5ceffbSvetoslav Ganov * <em>Properties:</em></br>
44377276b60851a158ad3e142cb3b091d57ae5ceffbSvetoslav Ganov * <ul>
44477276b60851a158ad3e142cb3b091d57ae5ceffbSvetoslav Ganov *   <li>{@link #getEventType()} - The type of the event.</li>
44577276b60851a158ad3e142cb3b091d57ae5ceffbSvetoslav Ganov * </ul>
44677276b60851a158ad3e142cb3b091d57ae5ceffbSvetoslav Ganov * <em>Note:</em> This event is fired only by the system and is not passed to the
44777276b60851a158ad3e142cb3b091d57ae5ceffbSvetoslav Ganov * view tree to be populated.</br>
44877276b60851a158ad3e142cb3b091d57ae5ceffbSvetoslav Ganov * </p>
44977276b60851a158ad3e142cb3b091d57ae5ceffbSvetoslav Ganov * <p>
45082e236d72ac197d6673d0b4d484fe5f0b9436731Svetoslav Ganov * <b>Touch exploration gesture start</b> - represents the event of starting a touch
45182e236d72ac197d6673d0b4d484fe5f0b9436731Svetoslav Ganov * exploring gesture.</br>
45282e236d72ac197d6673d0b4d484fe5f0b9436731Svetoslav Ganov * <em>Type:</em> {@link #TYPE_TOUCH_EXPLORATION_GESTURE_START}</br>
45382e236d72ac197d6673d0b4d484fe5f0b9436731Svetoslav Ganov * <em>Properties:</em></br>
45482e236d72ac197d6673d0b4d484fe5f0b9436731Svetoslav Ganov * <ul>
45582e236d72ac197d6673d0b4d484fe5f0b9436731Svetoslav Ganov *   <li>{@link #getEventType()} - The type of the event.</li>
45682e236d72ac197d6673d0b4d484fe5f0b9436731Svetoslav Ganov * </ul>
45777276b60851a158ad3e142cb3b091d57ae5ceffbSvetoslav Ganov * <em>Note:</em> This event is fired only by the system and is not passed to the
45877276b60851a158ad3e142cb3b091d57ae5ceffbSvetoslav Ganov * view tree to be populated.</br>
45982e236d72ac197d6673d0b4d484fe5f0b9436731Svetoslav Ganov * </p>
46082e236d72ac197d6673d0b4d484fe5f0b9436731Svetoslav Ganov * <p>
46182e236d72ac197d6673d0b4d484fe5f0b9436731Svetoslav Ganov * <b>Touch exploration gesture end</b> - represents the event of ending a touch
46282e236d72ac197d6673d0b4d484fe5f0b9436731Svetoslav Ganov * exploring gesture.</br>
46382e236d72ac197d6673d0b4d484fe5f0b9436731Svetoslav Ganov * <em>Type:</em> {@link #TYPE_TOUCH_EXPLORATION_GESTURE_END}</br>
46482e236d72ac197d6673d0b4d484fe5f0b9436731Svetoslav Ganov * <em>Properties:</em></br>
46582e236d72ac197d6673d0b4d484fe5f0b9436731Svetoslav Ganov * <ul>
46682e236d72ac197d6673d0b4d484fe5f0b9436731Svetoslav Ganov *   <li>{@link #getEventType()} - The type of the event.</li>
46782e236d72ac197d6673d0b4d484fe5f0b9436731Svetoslav Ganov * </ul>
46877276b60851a158ad3e142cb3b091d57ae5ceffbSvetoslav Ganov * <em>Note:</em> This event is fired only by the system and is not passed to the
46977276b60851a158ad3e142cb3b091d57ae5ceffbSvetoslav Ganov * view tree to be populated.</br>
47077276b60851a158ad3e142cb3b091d57ae5ceffbSvetoslav Ganov * </p>
47177276b60851a158ad3e142cb3b091d57ae5ceffbSvetoslav Ganov * <p>
47277276b60851a158ad3e142cb3b091d57ae5ceffbSvetoslav Ganov * <b>Touch gesture detection start</b> - represents the event of starting a user
47377276b60851a158ad3e142cb3b091d57ae5ceffbSvetoslav Ganov * gesture detection.</br>
47477276b60851a158ad3e142cb3b091d57ae5ceffbSvetoslav Ganov * <em>Type:</em> {@link #TYPE_GESTURE_DETECTION_START}</br>
47577276b60851a158ad3e142cb3b091d57ae5ceffbSvetoslav Ganov * <em>Properties:</em></br>
47677276b60851a158ad3e142cb3b091d57ae5ceffbSvetoslav Ganov * <ul>
47777276b60851a158ad3e142cb3b091d57ae5ceffbSvetoslav Ganov *   <li>{@link #getEventType()} - The type of the event.</li>
47877276b60851a158ad3e142cb3b091d57ae5ceffbSvetoslav Ganov * </ul>
47977276b60851a158ad3e142cb3b091d57ae5ceffbSvetoslav Ganov * <em>Note:</em> This event is fired only by the system and is not passed to the
48077276b60851a158ad3e142cb3b091d57ae5ceffbSvetoslav Ganov * view tree to be populated.</br>
48177276b60851a158ad3e142cb3b091d57ae5ceffbSvetoslav Ganov * </p>
48277276b60851a158ad3e142cb3b091d57ae5ceffbSvetoslav Ganov * <p>
48377276b60851a158ad3e142cb3b091d57ae5ceffbSvetoslav Ganov * <b>Touch gesture detection end</b> - represents the event of ending a user
48477276b60851a158ad3e142cb3b091d57ae5ceffbSvetoslav Ganov * gesture detection.</br>
48577276b60851a158ad3e142cb3b091d57ae5ceffbSvetoslav Ganov * <em>Type:</em> {@link #TYPE_GESTURE_DETECTION_END}</br>
48677276b60851a158ad3e142cb3b091d57ae5ceffbSvetoslav Ganov * <em>Properties:</em></br>
48777276b60851a158ad3e142cb3b091d57ae5ceffbSvetoslav Ganov * <ul>
48877276b60851a158ad3e142cb3b091d57ae5ceffbSvetoslav Ganov *   <li>{@link #getEventType()} - The type of the event.</li>
48977276b60851a158ad3e142cb3b091d57ae5ceffbSvetoslav Ganov * </ul>
49077276b60851a158ad3e142cb3b091d57ae5ceffbSvetoslav Ganov * <em>Note:</em> This event is fired only by the system and is not passed to the
49177276b60851a158ad3e142cb3b091d57ae5ceffbSvetoslav Ganov * view tree to be populated.</br>
49238e8b4e5bc3c93affdffbc064fd9db5aeccc3e8eSvetoslav Ganov * </p>
49375986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov * <p>
49451ab90cab1609cf0ddd2dfe5a660f020d823d4d5Svetoslav Ganov * <b>MISCELLANEOUS TYPES</b></br>
49551ab90cab1609cf0ddd2dfe5a660f020d823d4d5Svetoslav Ganov * </p>
49651ab90cab1609cf0ddd2dfe5a660f020d823d4d5Svetoslav Ganov * <p>
49751ab90cab1609cf0ddd2dfe5a660f020d823d4d5Svetoslav Ganov * <b>Announcement</b> - represents the event of an application making an
49851ab90cab1609cf0ddd2dfe5a660f020d823d4d5Svetoslav Ganov * announcement. Usually this announcement is related to some sort of a context
49951ab90cab1609cf0ddd2dfe5a660f020d823d4d5Svetoslav Ganov * change for which none of the events representing UI transitions is a good fit.
50051ab90cab1609cf0ddd2dfe5a660f020d823d4d5Svetoslav Ganov * For example, announcing a new page in a book.</br>
50151ab90cab1609cf0ddd2dfe5a660f020d823d4d5Svetoslav Ganov * <em>Type:</em> {@link #TYPE_ANNOUNCEMENT}</br>
50251ab90cab1609cf0ddd2dfe5a660f020d823d4d5Svetoslav Ganov * <em>Properties:</em></br>
50351ab90cab1609cf0ddd2dfe5a660f020d823d4d5Svetoslav Ganov * <ul>
50451ab90cab1609cf0ddd2dfe5a660f020d823d4d5Svetoslav Ganov *   <li>{@link #getEventType()} - The type of the event.</li>
50551ab90cab1609cf0ddd2dfe5a660f020d823d4d5Svetoslav Ganov *   <li>{@link #getSource()} - The source info (for registered clients).</li>
50651ab90cab1609cf0ddd2dfe5a660f020d823d4d5Svetoslav Ganov *   <li>{@link #getClassName()} - The class name of the source.</li>
50751ab90cab1609cf0ddd2dfe5a660f020d823d4d5Svetoslav Ganov *   <li>{@link #getPackageName()} - The package name of the source.</li>
50851ab90cab1609cf0ddd2dfe5a660f020d823d4d5Svetoslav Ganov *   <li>{@link #getEventTime()}  - The event time.</li>
50951ab90cab1609cf0ddd2dfe5a660f020d823d4d5Svetoslav Ganov *   <li>{@link #getText()} - The text of the announcement.</li>
51051ab90cab1609cf0ddd2dfe5a660f020d823d4d5Svetoslav Ganov *   <li>{@link #isEnabled()} - Whether the source is enabled.</li>
51151ab90cab1609cf0ddd2dfe5a660f020d823d4d5Svetoslav Ganov * </ul>
51251ab90cab1609cf0ddd2dfe5a660f020d823d4d5Svetoslav Ganov * </p>
51351ab90cab1609cf0ddd2dfe5a660f020d823d4d5Svetoslav Ganov * <p>
51475986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov * <b>Security note</b>
51575986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov * <p>
51638e8b4e5bc3c93affdffbc064fd9db5aeccc3e8eSvetoslav Ganov * Since an event contains the text of its source privacy can be compromised by leaking
51775986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov * sensitive information such as passwords. To address this issue any event fired in response
51875986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov * to manipulation of a PASSWORD field does NOT CONTAIN the text of the password.
51982e236d72ac197d6673d0b4d484fe5f0b9436731Svetoslav Ganov * </p>
52075986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov *
52175986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov * @see android.view.accessibility.AccessibilityManager
52275986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov * @see android.accessibilityservice.AccessibilityService
52338e8b4e5bc3c93affdffbc064fd9db5aeccc3e8eSvetoslav Ganov * @see AccessibilityNodeInfo
52475986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov */
525736c2756bf3c14ae9fef7255c119057f7a2be1edSvetoslav Ganovpublic final class AccessibilityEvent extends AccessibilityRecord implements Parcelable {
5268643aa0179e598e78d938c59035389054535a229Svetoslav Ganov    private static final boolean DEBUG = false;
52775986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov
52875986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov    /**
52975986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov     * Invalid selection/focus position.
53075986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov     *
53175986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov     * @see #getCurrentItemIndex()
53275986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov     */
53375986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov    public static final int INVALID_POSITION = -1;
53475986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov
53575986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov    /**
53675986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov     * Maximum length of the text fields.
53775986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov     *
53875986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov     * @see #getBeforeText()
53975986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov     * @see #getText()
540c0a8cd10a5829bf4e94ee073ba6f553128e9d8e9Svetoslav Ganov     * </br>
541c0a8cd10a5829bf4e94ee073ba6f553128e9d8e9Svetoslav Ganov     * Note: This constant is no longer needed since there
542c0a8cd10a5829bf4e94ee073ba6f553128e9d8e9Svetoslav Ganov     *       is no limit on the length of text that is contained
543c0a8cd10a5829bf4e94ee073ba6f553128e9d8e9Svetoslav Ganov     *       in an accessibility event anymore.
54475986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov     */
545c0a8cd10a5829bf4e94ee073ba6f553128e9d8e9Svetoslav Ganov    @Deprecated
54675986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov    public static final int MAX_TEXT_LENGTH = 500;
54775986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov
54875986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov    /**
54975986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov     * Represents the event of clicking on a {@link android.view.View} like
55075986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov     * {@link android.widget.Button}, {@link android.widget.CompoundButton}, etc.
55175986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov     */
55275986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov    public static final int TYPE_VIEW_CLICKED = 0x00000001;
55375986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov
55475986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov    /**
55575986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov     * Represents the event of long clicking on a {@link android.view.View} like
55675986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov     * {@link android.widget.Button}, {@link android.widget.CompoundButton}, etc.
55775986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov     */
55875986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov    public static final int TYPE_VIEW_LONG_CLICKED = 0x00000002;
55975986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov
56075986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov    /**
56175986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov     * Represents the event of selecting an item usually in the context of an
56275986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov     * {@link android.widget.AdapterView}.
56375986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov     */
56475986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov    public static final int TYPE_VIEW_SELECTED = 0x00000004;
56575986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov
56675986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov    /**
5674213804541a8b05cd0587b138a2fd9a3b7fd9350Svetoslav Ganov     * Represents the event of setting input focus of a {@link android.view.View}.
56875986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov     */
56975986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov    public static final int TYPE_VIEW_FOCUSED = 0x00000008;
57075986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov
57175986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov    /**
57275986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov     * Represents the event of changing the text of an {@link android.widget.EditText}.
57375986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov     */
57475986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov    public static final int TYPE_VIEW_TEXT_CHANGED = 0x00000010;
57575986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov
57675986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov    /**
57738e8b4e5bc3c93affdffbc064fd9db5aeccc3e8eSvetoslav Ganov     * Represents the event of opening a {@link android.widget.PopupWindow},
57875986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov     * {@link android.view.Menu}, {@link android.app.Dialog}, etc.
57975986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov     */
58075986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov    public static final int TYPE_WINDOW_STATE_CHANGED = 0x00000020;
58175986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov
58275986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov    /**
58338e8b4e5bc3c93affdffbc064fd9db5aeccc3e8eSvetoslav Ganov     * Represents the event showing a {@link android.app.Notification}.
58475986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov     */
58575986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov    public static final int TYPE_NOTIFICATION_STATE_CHANGED = 0x00000040;
58675986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov
58775986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov    /**
588736c2756bf3c14ae9fef7255c119057f7a2be1edSvetoslav Ganov     * Represents the event of a hover enter over a {@link android.view.View}.
589736c2756bf3c14ae9fef7255c119057f7a2be1edSvetoslav Ganov     */
590736c2756bf3c14ae9fef7255c119057f7a2be1edSvetoslav Ganov    public static final int TYPE_VIEW_HOVER_ENTER = 0x00000080;
591736c2756bf3c14ae9fef7255c119057f7a2be1edSvetoslav Ganov
592736c2756bf3c14ae9fef7255c119057f7a2be1edSvetoslav Ganov    /**
593736c2756bf3c14ae9fef7255c119057f7a2be1edSvetoslav Ganov     * Represents the event of a hover exit over a {@link android.view.View}.
594736c2756bf3c14ae9fef7255c119057f7a2be1edSvetoslav Ganov     */
595736c2756bf3c14ae9fef7255c119057f7a2be1edSvetoslav Ganov    public static final int TYPE_VIEW_HOVER_EXIT = 0x00000100;
596736c2756bf3c14ae9fef7255c119057f7a2be1edSvetoslav Ganov
597736c2756bf3c14ae9fef7255c119057f7a2be1edSvetoslav Ganov    /**
598736c2756bf3c14ae9fef7255c119057f7a2be1edSvetoslav Ganov     * Represents the event of starting a touch exploration gesture.
599736c2756bf3c14ae9fef7255c119057f7a2be1edSvetoslav Ganov     */
600736c2756bf3c14ae9fef7255c119057f7a2be1edSvetoslav Ganov    public static final int TYPE_TOUCH_EXPLORATION_GESTURE_START = 0x00000200;
601736c2756bf3c14ae9fef7255c119057f7a2be1edSvetoslav Ganov
602736c2756bf3c14ae9fef7255c119057f7a2be1edSvetoslav Ganov    /**
603736c2756bf3c14ae9fef7255c119057f7a2be1edSvetoslav Ganov     * Represents the event of ending a touch exploration gesture.
604736c2756bf3c14ae9fef7255c119057f7a2be1edSvetoslav Ganov     */
605736c2756bf3c14ae9fef7255c119057f7a2be1edSvetoslav Ganov    public static final int TYPE_TOUCH_EXPLORATION_GESTURE_END = 0x00000400;
606736c2756bf3c14ae9fef7255c119057f7a2be1edSvetoslav Ganov
607736c2756bf3c14ae9fef7255c119057f7a2be1edSvetoslav Ganov    /**
6084213804541a8b05cd0587b138a2fd9a3b7fd9350Svetoslav Ganov     * Represents the event of changing the content of a window and more
6094213804541a8b05cd0587b138a2fd9a3b7fd9350Svetoslav Ganov     * specifically the sub-tree rooted at the event's source.
610eeee4d2c01d3c4ed99e4891dbc75c7de69a803faSvetoslav Ganov     */
611eeee4d2c01d3c4ed99e4891dbc75c7de69a803faSvetoslav Ganov    public static final int TYPE_WINDOW_CONTENT_CHANGED = 0x00000800;
612eeee4d2c01d3c4ed99e4891dbc75c7de69a803faSvetoslav Ganov
613eeee4d2c01d3c4ed99e4891dbc75c7de69a803faSvetoslav Ganov    /**
614a0156177cdc809795dd8bc5a19943dd2b6f82b66Svetoslav Ganov     * Represents the event of scrolling a view.
615a0156177cdc809795dd8bc5a19943dd2b6f82b66Svetoslav Ganov     */
616a0156177cdc809795dd8bc5a19943dd2b6f82b66Svetoslav Ganov    public static final int TYPE_VIEW_SCROLLED = 0x00001000;
617a0156177cdc809795dd8bc5a19943dd2b6f82b66Svetoslav Ganov
618a0156177cdc809795dd8bc5a19943dd2b6f82b66Svetoslav Ganov    /**
619a0156177cdc809795dd8bc5a19943dd2b6f82b66Svetoslav Ganov     * Represents the event of changing the selection in an {@link android.widget.EditText}.
620a0156177cdc809795dd8bc5a19943dd2b6f82b66Svetoslav Ganov     */
621a0156177cdc809795dd8bc5a19943dd2b6f82b66Svetoslav Ganov    public static final int TYPE_VIEW_TEXT_SELECTION_CHANGED = 0x00002000;
622a0156177cdc809795dd8bc5a19943dd2b6f82b66Svetoslav Ganov
623a0156177cdc809795dd8bc5a19943dd2b6f82b66Svetoslav Ganov    /**
62451ab90cab1609cf0ddd2dfe5a660f020d823d4d5Svetoslav Ganov     * Represents the event of an application making an announcement.
62551ab90cab1609cf0ddd2dfe5a660f020d823d4d5Svetoslav Ganov     */
62651ab90cab1609cf0ddd2dfe5a660f020d823d4d5Svetoslav Ganov    public static final int TYPE_ANNOUNCEMENT = 0x00004000;
62751ab90cab1609cf0ddd2dfe5a660f020d823d4d5Svetoslav Ganov
62851ab90cab1609cf0ddd2dfe5a660f020d823d4d5Svetoslav Ganov    /**
6294213804541a8b05cd0587b138a2fd9a3b7fd9350Svetoslav Ganov     * Represents the event of gaining accessibility focus.
6304213804541a8b05cd0587b138a2fd9a3b7fd9350Svetoslav Ganov     */
6314213804541a8b05cd0587b138a2fd9a3b7fd9350Svetoslav Ganov    public static final int TYPE_VIEW_ACCESSIBILITY_FOCUSED = 0x00008000;
6324213804541a8b05cd0587b138a2fd9a3b7fd9350Svetoslav Ganov
6334213804541a8b05cd0587b138a2fd9a3b7fd9350Svetoslav Ganov    /**
6344213804541a8b05cd0587b138a2fd9a3b7fd9350Svetoslav Ganov     * Represents the event of clearing accessibility focus.
6354213804541a8b05cd0587b138a2fd9a3b7fd9350Svetoslav Ganov     */
6364213804541a8b05cd0587b138a2fd9a3b7fd9350Svetoslav Ganov    public static final int TYPE_VIEW_ACCESSIBILITY_FOCUS_CLEARED = 0x00010000;
6374213804541a8b05cd0587b138a2fd9a3b7fd9350Svetoslav Ganov
6384213804541a8b05cd0587b138a2fd9a3b7fd9350Svetoslav Ganov    /**
6392b435aada3d274a9c08d334946fff1ab9ba15b48Svetoslav Ganov     * Represents the event of traversing the text of a view at a given movement granularity.
640b7ff3255c6d4e12f9d2334e3bbec0a125b7b09dcSvetoslav Ganov     */
6412b435aada3d274a9c08d334946fff1ab9ba15b48Svetoslav Ganov    public static final int TYPE_VIEW_TEXT_TRAVERSED_AT_MOVEMENT_GRANULARITY = 0x00020000;
642b7ff3255c6d4e12f9d2334e3bbec0a125b7b09dcSvetoslav Ganov
643b7ff3255c6d4e12f9d2334e3bbec0a125b7b09dcSvetoslav Ganov    /**
64477276b60851a158ad3e142cb3b091d57ae5ceffbSvetoslav Ganov     * Represents the event of beginning gesture detection.
64577276b60851a158ad3e142cb3b091d57ae5ceffbSvetoslav Ganov     */
64677276b60851a158ad3e142cb3b091d57ae5ceffbSvetoslav Ganov    public static final int TYPE_GESTURE_DETECTION_START = 0x00040000;
64777276b60851a158ad3e142cb3b091d57ae5ceffbSvetoslav Ganov
64877276b60851a158ad3e142cb3b091d57ae5ceffbSvetoslav Ganov    /**
64977276b60851a158ad3e142cb3b091d57ae5ceffbSvetoslav Ganov     * Represents the event of ending gesture detection.
65077276b60851a158ad3e142cb3b091d57ae5ceffbSvetoslav Ganov     */
65177276b60851a158ad3e142cb3b091d57ae5ceffbSvetoslav Ganov    public static final int TYPE_GESTURE_DETECTION_END = 0x00080000;
65277276b60851a158ad3e142cb3b091d57ae5ceffbSvetoslav Ganov
65377276b60851a158ad3e142cb3b091d57ae5ceffbSvetoslav Ganov    /**
65477276b60851a158ad3e142cb3b091d57ae5ceffbSvetoslav Ganov     * Represents the event of the user starting to touch the screen.
65577276b60851a158ad3e142cb3b091d57ae5ceffbSvetoslav Ganov     */
65677276b60851a158ad3e142cb3b091d57ae5ceffbSvetoslav Ganov    public static final int TYPE_TOUCH_INTERACTION_START = 0x00100000;
65777276b60851a158ad3e142cb3b091d57ae5ceffbSvetoslav Ganov
65877276b60851a158ad3e142cb3b091d57ae5ceffbSvetoslav Ganov    /**
65977276b60851a158ad3e142cb3b091d57ae5ceffbSvetoslav Ganov     * Represents the event of the user ending to touch the screen.
66077276b60851a158ad3e142cb3b091d57ae5ceffbSvetoslav Ganov     */
66177276b60851a158ad3e142cb3b091d57ae5ceffbSvetoslav Ganov    public static final int TYPE_TOUCH_INTERACTION_END = 0x00200000;
66277276b60851a158ad3e142cb3b091d57ae5ceffbSvetoslav Ganov
66377276b60851a158ad3e142cb3b091d57ae5ceffbSvetoslav Ganov    /**
66475986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov     * Mask for {@link AccessibilityEvent} all types.
66575986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov     *
66675986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov     * @see #TYPE_VIEW_CLICKED
66775986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov     * @see #TYPE_VIEW_LONG_CLICKED
66875986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov     * @see #TYPE_VIEW_SELECTED
66975986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov     * @see #TYPE_VIEW_FOCUSED
67075986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov     * @see #TYPE_VIEW_TEXT_CHANGED
67175986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov     * @see #TYPE_WINDOW_STATE_CHANGED
67275986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov     * @see #TYPE_NOTIFICATION_STATE_CHANGED
67338e8b4e5bc3c93affdffbc064fd9db5aeccc3e8eSvetoslav Ganov     * @see #TYPE_VIEW_HOVER_ENTER
67438e8b4e5bc3c93affdffbc064fd9db5aeccc3e8eSvetoslav Ganov     * @see #TYPE_VIEW_HOVER_EXIT
67538e8b4e5bc3c93affdffbc064fd9db5aeccc3e8eSvetoslav Ganov     * @see #TYPE_TOUCH_EXPLORATION_GESTURE_START
67638e8b4e5bc3c93affdffbc064fd9db5aeccc3e8eSvetoslav Ganov     * @see #TYPE_TOUCH_EXPLORATION_GESTURE_END
67738e8b4e5bc3c93affdffbc064fd9db5aeccc3e8eSvetoslav Ganov     * @see #TYPE_WINDOW_CONTENT_CHANGED
67838e8b4e5bc3c93affdffbc064fd9db5aeccc3e8eSvetoslav Ganov     * @see #TYPE_VIEW_SCROLLED
67938e8b4e5bc3c93affdffbc064fd9db5aeccc3e8eSvetoslav Ganov     * @see #TYPE_VIEW_TEXT_SELECTION_CHANGED
68051ab90cab1609cf0ddd2dfe5a660f020d823d4d5Svetoslav Ganov     * @see #TYPE_ANNOUNCEMENT
6812b435aada3d274a9c08d334946fff1ab9ba15b48Svetoslav Ganov     * @see #TYPE_VIEW_TEXT_TRAVERSED_AT_MOVEMENT_GRANULARITY
68277276b60851a158ad3e142cb3b091d57ae5ceffbSvetoslav Ganov     * @see #TYPE_GESTURE_DETECTION_START
68377276b60851a158ad3e142cb3b091d57ae5ceffbSvetoslav Ganov     * @see #TYPE_GESTURE_DETECTION_END
68477276b60851a158ad3e142cb3b091d57ae5ceffbSvetoslav Ganov     * @see #TYPE_TOUCH_INTERACTION_START
68577276b60851a158ad3e142cb3b091d57ae5ceffbSvetoslav Ganov     * @see #TYPE_TOUCH_INTERACTION_END
68675986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov     */
68775986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov    public static final int TYPES_ALL_MASK = 0xFFFFFFFF;
68875986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov
689736c2756bf3c14ae9fef7255c119057f7a2be1edSvetoslav Ganov    private static final int MAX_POOL_SIZE = 10;
690f4782ec9c57a40224ac0974fce6b6fe280c829ceSvetoslav Ganov    private static final SynchronizedPool<AccessibilityEvent> sPool =
691f4782ec9c57a40224ac0974fce6b6fe280c829ceSvetoslav Ganov            new SynchronizedPool<AccessibilityEvent>(MAX_POOL_SIZE);
69275986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov
69375986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov    private int mEventType;
6943fb3d7c4e756bd32d5abde0abca9ab52d559bc84Adam Powell    private CharSequence mPackageName;
695736c2756bf3c14ae9fef7255c119057f7a2be1edSvetoslav Ganov    private long mEventTime;
6962b435aada3d274a9c08d334946fff1ab9ba15b48Svetoslav Ganov    int mMovementGranularity;
6976d17a936f73976971135aa1e6248662533343292Svetoslav Ganov    int mAction;
6983fb3d7c4e756bd32d5abde0abca9ab52d559bc84Adam Powell
699736c2756bf3c14ae9fef7255c119057f7a2be1edSvetoslav Ganov    private final ArrayList<AccessibilityRecord> mRecords = new ArrayList<AccessibilityRecord>();
70075986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov
70175986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov    /*
70275986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov     * Hide constructor from clients.
70375986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov     */
70475986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov    private AccessibilityEvent() {
7058643aa0179e598e78d938c59035389054535a229Svetoslav Ganov    }
70675986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov
7078643aa0179e598e78d938c59035389054535a229Svetoslav Ganov    /**
7088643aa0179e598e78d938c59035389054535a229Svetoslav Ganov     * Initialize an event from another one.
7098643aa0179e598e78d938c59035389054535a229Svetoslav Ganov     *
7108643aa0179e598e78d938c59035389054535a229Svetoslav Ganov     * @param event The event to initialize from.
7118643aa0179e598e78d938c59035389054535a229Svetoslav Ganov     */
7128643aa0179e598e78d938c59035389054535a229Svetoslav Ganov    void init(AccessibilityEvent event) {
7138643aa0179e598e78d938c59035389054535a229Svetoslav Ganov        super.init(event);
7148643aa0179e598e78d938c59035389054535a229Svetoslav Ganov        mEventType = event.mEventType;
7152b435aada3d274a9c08d334946fff1ab9ba15b48Svetoslav Ganov        mMovementGranularity = event.mMovementGranularity;
7166d17a936f73976971135aa1e6248662533343292Svetoslav Ganov        mAction = event.mAction;
7178643aa0179e598e78d938c59035389054535a229Svetoslav Ganov        mEventTime = event.mEventTime;
7188643aa0179e598e78d938c59035389054535a229Svetoslav Ganov        mPackageName = event.mPackageName;
719eeee4d2c01d3c4ed99e4891dbc75c7de69a803faSvetoslav Ganov    }
720eeee4d2c01d3c4ed99e4891dbc75c7de69a803faSvetoslav Ganov
721eeee4d2c01d3c4ed99e4891dbc75c7de69a803faSvetoslav Ganov    /**
722eeee4d2c01d3c4ed99e4891dbc75c7de69a803faSvetoslav Ganov     * Sets if this instance is sealed.
723eeee4d2c01d3c4ed99e4891dbc75c7de69a803faSvetoslav Ganov     *
724eeee4d2c01d3c4ed99e4891dbc75c7de69a803faSvetoslav Ganov     * @param sealed Whether is sealed.
725eeee4d2c01d3c4ed99e4891dbc75c7de69a803faSvetoslav Ganov     *
726eeee4d2c01d3c4ed99e4891dbc75c7de69a803faSvetoslav Ganov     * @hide
727eeee4d2c01d3c4ed99e4891dbc75c7de69a803faSvetoslav Ganov     */
728eeee4d2c01d3c4ed99e4891dbc75c7de69a803faSvetoslav Ganov    @Override
729eeee4d2c01d3c4ed99e4891dbc75c7de69a803faSvetoslav Ganov    public void setSealed(boolean sealed) {
730eeee4d2c01d3c4ed99e4891dbc75c7de69a803faSvetoslav Ganov        super.setSealed(sealed);
731eeee4d2c01d3c4ed99e4891dbc75c7de69a803faSvetoslav Ganov        List<AccessibilityRecord> records = mRecords;
732eeee4d2c01d3c4ed99e4891dbc75c7de69a803faSvetoslav Ganov        final int recordCount = records.size();
733eeee4d2c01d3c4ed99e4891dbc75c7de69a803faSvetoslav Ganov        for (int i = 0; i < recordCount; i++) {
734eeee4d2c01d3c4ed99e4891dbc75c7de69a803faSvetoslav Ganov            AccessibilityRecord record = records.get(i);
735eeee4d2c01d3c4ed99e4891dbc75c7de69a803faSvetoslav Ganov            record.setSealed(sealed);
736eeee4d2c01d3c4ed99e4891dbc75c7de69a803faSvetoslav Ganov        }
73775986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov    }
73875986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov
73975986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov    /**
740736c2756bf3c14ae9fef7255c119057f7a2be1edSvetoslav Ganov     * Gets the number of records contained in the event.
74175986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov     *
742736c2756bf3c14ae9fef7255c119057f7a2be1edSvetoslav Ganov     * @return The number of records.
74375986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov     */
744736c2756bf3c14ae9fef7255c119057f7a2be1edSvetoslav Ganov    public int getRecordCount() {
745736c2756bf3c14ae9fef7255c119057f7a2be1edSvetoslav Ganov        return mRecords.size();
74675986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov    }
74775986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov
74875986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov    /**
749736c2756bf3c14ae9fef7255c119057f7a2be1edSvetoslav Ganov     * Appends an {@link AccessibilityRecord} to the end of event records.
75075986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov     *
751736c2756bf3c14ae9fef7255c119057f7a2be1edSvetoslav Ganov     * @param record The record to append.
7528643aa0179e598e78d938c59035389054535a229Svetoslav Ganov     *
7538643aa0179e598e78d938c59035389054535a229Svetoslav Ganov     * @throws IllegalStateException If called from an AccessibilityService.
75475986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov     */
755736c2756bf3c14ae9fef7255c119057f7a2be1edSvetoslav Ganov    public void appendRecord(AccessibilityRecord record) {
7568643aa0179e598e78d938c59035389054535a229Svetoslav Ganov        enforceNotSealed();
757736c2756bf3c14ae9fef7255c119057f7a2be1edSvetoslav Ganov        mRecords.add(record);
75875986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov    }
75975986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov
76075986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov    /**
76138e8b4e5bc3c93affdffbc064fd9db5aeccc3e8eSvetoslav Ganov     * Gets the record at a given index.
76275986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov     *
763736c2756bf3c14ae9fef7255c119057f7a2be1edSvetoslav Ganov     * @param index The index.
76438e8b4e5bc3c93affdffbc064fd9db5aeccc3e8eSvetoslav Ganov     * @return The record at the specified index.
76575986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov     */
766736c2756bf3c14ae9fef7255c119057f7a2be1edSvetoslav Ganov    public AccessibilityRecord getRecord(int index) {
767736c2756bf3c14ae9fef7255c119057f7a2be1edSvetoslav Ganov        return mRecords.get(index);
76875986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov    }
76975986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov
77075986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov    /**
77175986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov     * Gets the event type.
77275986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov     *
77375986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov     * @return The event type.
77475986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov     */
77575986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov    public int getEventType() {
77675986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov        return mEventType;
77775986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov    }
77875986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov
77975986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov    /**
78075986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov     * Sets the event type.
78175986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov     *
78275986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov     * @param eventType The event type.
7838643aa0179e598e78d938c59035389054535a229Svetoslav Ganov     *
7848643aa0179e598e78d938c59035389054535a229Svetoslav Ganov     * @throws IllegalStateException If called from an AccessibilityService.
78575986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov     */
78675986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov    public void setEventType(int eventType) {
7878643aa0179e598e78d938c59035389054535a229Svetoslav Ganov        enforceNotSealed();
78875986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov        mEventType = eventType;
78975986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov    }
79075986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov
79175986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov    /**
79275986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov     * Gets the time in which this event was sent.
79375986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov     *
79475986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov     * @return The event time.
79575986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov     */
79675986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov    public long getEventTime() {
79775986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov        return mEventTime;
79875986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov    }
79975986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov
80075986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov    /**
80175986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov     * Sets the time in which this event was sent.
80275986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov     *
80375986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov     * @param eventTime The event time.
8048643aa0179e598e78d938c59035389054535a229Svetoslav Ganov     *
8058643aa0179e598e78d938c59035389054535a229Svetoslav Ganov     * @throws IllegalStateException If called from an AccessibilityService.
80675986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov     */
80775986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov    public void setEventTime(long eventTime) {
8088643aa0179e598e78d938c59035389054535a229Svetoslav Ganov        enforceNotSealed();
80975986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov        mEventTime = eventTime;
81075986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov    }
81175986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov
81275986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov    /**
81375986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov     * Gets the package name of the source.
81475986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov     *
81575986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov     * @return The package name.
81675986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov     */
81775986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov    public CharSequence getPackageName() {
81875986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov        return mPackageName;
81975986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov    }
82075986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov
82175986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov    /**
82275986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov     * Sets the package name of the source.
82375986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov     *
82475986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov     * @param packageName The package name.
8258643aa0179e598e78d938c59035389054535a229Svetoslav Ganov     *
8268643aa0179e598e78d938c59035389054535a229Svetoslav Ganov     * @throws IllegalStateException If called from an AccessibilityService.
82775986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov     */
82875986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov    public void setPackageName(CharSequence packageName) {
8298643aa0179e598e78d938c59035389054535a229Svetoslav Ganov        enforceNotSealed();
83075986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov        mPackageName = packageName;
83175986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov    }
83275986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov
83375986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov    /**
8342b435aada3d274a9c08d334946fff1ab9ba15b48Svetoslav Ganov     * Sets the movement granularity that was traversed.
835b7ff3255c6d4e12f9d2334e3bbec0a125b7b09dcSvetoslav Ganov     *
836b7ff3255c6d4e12f9d2334e3bbec0a125b7b09dcSvetoslav Ganov     * @param granularity The granularity.
837b7ff3255c6d4e12f9d2334e3bbec0a125b7b09dcSvetoslav Ganov     *
838b7ff3255c6d4e12f9d2334e3bbec0a125b7b09dcSvetoslav Ganov     * @throws IllegalStateException If called from an AccessibilityService.
839b7ff3255c6d4e12f9d2334e3bbec0a125b7b09dcSvetoslav Ganov     */
8402b435aada3d274a9c08d334946fff1ab9ba15b48Svetoslav Ganov    public void setMovementGranularity(int granularity) {
841b7ff3255c6d4e12f9d2334e3bbec0a125b7b09dcSvetoslav Ganov        enforceNotSealed();
8422b435aada3d274a9c08d334946fff1ab9ba15b48Svetoslav Ganov        mMovementGranularity = granularity;
843b7ff3255c6d4e12f9d2334e3bbec0a125b7b09dcSvetoslav Ganov    }
844b7ff3255c6d4e12f9d2334e3bbec0a125b7b09dcSvetoslav Ganov
845b7ff3255c6d4e12f9d2334e3bbec0a125b7b09dcSvetoslav Ganov    /**
8462b435aada3d274a9c08d334946fff1ab9ba15b48Svetoslav Ganov     * Gets the movement granularity that was traversed.
847b7ff3255c6d4e12f9d2334e3bbec0a125b7b09dcSvetoslav Ganov     *
848b7ff3255c6d4e12f9d2334e3bbec0a125b7b09dcSvetoslav Ganov     * @return The granularity.
849b7ff3255c6d4e12f9d2334e3bbec0a125b7b09dcSvetoslav Ganov     */
8502b435aada3d274a9c08d334946fff1ab9ba15b48Svetoslav Ganov    public int getMovementGranularity() {
8512b435aada3d274a9c08d334946fff1ab9ba15b48Svetoslav Ganov        return mMovementGranularity;
852b7ff3255c6d4e12f9d2334e3bbec0a125b7b09dcSvetoslav Ganov    }
853b7ff3255c6d4e12f9d2334e3bbec0a125b7b09dcSvetoslav Ganov
854b7ff3255c6d4e12f9d2334e3bbec0a125b7b09dcSvetoslav Ganov    /**
8556d17a936f73976971135aa1e6248662533343292Svetoslav Ganov     * Sets the performed action that triggered this event.
8566d17a936f73976971135aa1e6248662533343292Svetoslav Ganov     *
8576d17a936f73976971135aa1e6248662533343292Svetoslav Ganov     * @param action The action.
8586d17a936f73976971135aa1e6248662533343292Svetoslav Ganov     *
8596d17a936f73976971135aa1e6248662533343292Svetoslav Ganov     * @throws IllegalStateException If called from an AccessibilityService.
8606d17a936f73976971135aa1e6248662533343292Svetoslav Ganov     */
8616d17a936f73976971135aa1e6248662533343292Svetoslav Ganov    public void setAction(int action) {
8626d17a936f73976971135aa1e6248662533343292Svetoslav Ganov        enforceNotSealed();
8636d17a936f73976971135aa1e6248662533343292Svetoslav Ganov        mAction = action;
8646d17a936f73976971135aa1e6248662533343292Svetoslav Ganov    }
8656d17a936f73976971135aa1e6248662533343292Svetoslav Ganov
8666d17a936f73976971135aa1e6248662533343292Svetoslav Ganov    /**
8676d17a936f73976971135aa1e6248662533343292Svetoslav Ganov     * Gets the performed action that triggered this event.
8686d17a936f73976971135aa1e6248662533343292Svetoslav Ganov     *
8696d17a936f73976971135aa1e6248662533343292Svetoslav Ganov     * @return The action.
8706d17a936f73976971135aa1e6248662533343292Svetoslav Ganov     */
8716d17a936f73976971135aa1e6248662533343292Svetoslav Ganov    public int getAction() {
8726d17a936f73976971135aa1e6248662533343292Svetoslav Ganov        return mAction;
8736d17a936f73976971135aa1e6248662533343292Svetoslav Ganov    }
8746d17a936f73976971135aa1e6248662533343292Svetoslav Ganov
8756d17a936f73976971135aa1e6248662533343292Svetoslav Ganov    /**
87675986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov     * Returns a cached instance if such is available or a new one is
87738e8b4e5bc3c93affdffbc064fd9db5aeccc3e8eSvetoslav Ganov     * instantiated with its type property set.
87875986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov     *
87975986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov     * @param eventType The event type.
88075986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov     * @return An instance.
88175986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov     */
88275986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov    public static AccessibilityEvent obtain(int eventType) {
88375986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov        AccessibilityEvent event = AccessibilityEvent.obtain();
88475986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov        event.setEventType(eventType);
88575986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov        return event;
88675986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov    }
88775986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov
88875986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov    /**
88975986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov     * Returns a cached instance if such is available or a new one is
89035bfedeaba724aeadc6f6c890269cb6bf7ef42f5Svetoslav Ganov     * created. The returned instance is initialized from the given
89135bfedeaba724aeadc6f6c890269cb6bf7ef42f5Svetoslav Ganov     * <code>event</code>.
8928643aa0179e598e78d938c59035389054535a229Svetoslav Ganov     *
8938643aa0179e598e78d938c59035389054535a229Svetoslav Ganov     * @param event The other event.
8948643aa0179e598e78d938c59035389054535a229Svetoslav Ganov     * @return An instance.
8958643aa0179e598e78d938c59035389054535a229Svetoslav Ganov     */
8968643aa0179e598e78d938c59035389054535a229Svetoslav Ganov    public static AccessibilityEvent obtain(AccessibilityEvent event) {
8978643aa0179e598e78d938c59035389054535a229Svetoslav Ganov        AccessibilityEvent eventClone = AccessibilityEvent.obtain();
8988643aa0179e598e78d938c59035389054535a229Svetoslav Ganov        eventClone.init(event);
8998643aa0179e598e78d938c59035389054535a229Svetoslav Ganov
9008643aa0179e598e78d938c59035389054535a229Svetoslav Ganov        final int recordCount = event.mRecords.size();
9018643aa0179e598e78d938c59035389054535a229Svetoslav Ganov        for (int i = 0; i < recordCount; i++) {
9028643aa0179e598e78d938c59035389054535a229Svetoslav Ganov            AccessibilityRecord record = event.mRecords.get(i);
9038643aa0179e598e78d938c59035389054535a229Svetoslav Ganov            AccessibilityRecord recordClone = AccessibilityRecord.obtain(record);
9048643aa0179e598e78d938c59035389054535a229Svetoslav Ganov            eventClone.mRecords.add(recordClone);
9058643aa0179e598e78d938c59035389054535a229Svetoslav Ganov        }
9068643aa0179e598e78d938c59035389054535a229Svetoslav Ganov
9078643aa0179e598e78d938c59035389054535a229Svetoslav Ganov        return eventClone;
9088643aa0179e598e78d938c59035389054535a229Svetoslav Ganov    }
9098643aa0179e598e78d938c59035389054535a229Svetoslav Ganov
9108643aa0179e598e78d938c59035389054535a229Svetoslav Ganov    /**
9118643aa0179e598e78d938c59035389054535a229Svetoslav Ganov     * Returns a cached instance if such is available or a new one is
91275986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov     * instantiated.
91375986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov     *
91475986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov     * @return An instance.
91575986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov     */
91675986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov    public static AccessibilityEvent obtain() {
917f4782ec9c57a40224ac0974fce6b6fe280c829ceSvetoslav Ganov        AccessibilityEvent event = sPool.acquire();
918f4782ec9c57a40224ac0974fce6b6fe280c829ceSvetoslav Ganov        return (event != null) ? event : new AccessibilityEvent();
91975986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov    }
92075986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov
92175986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov    /**
92238e8b4e5bc3c93affdffbc064fd9db5aeccc3e8eSvetoslav Ganov     * Recycles an instance back to be reused.
92375986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov     * <p>
92438e8b4e5bc3c93affdffbc064fd9db5aeccc3e8eSvetoslav Ganov     *   <b>Note: You must not touch the object after calling this function.</b>
92538e8b4e5bc3c93affdffbc064fd9db5aeccc3e8eSvetoslav Ganov     * </p>
926887e1a17eb9b12448f5929791b564565b2665aabSvetoslav Ganov     *
927887e1a17eb9b12448f5929791b564565b2665aabSvetoslav Ganov     * @throws IllegalStateException If the event is already recycled.
92875986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov     */
929736c2756bf3c14ae9fef7255c119057f7a2be1edSvetoslav Ganov    @Override
93075986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov    public void recycle() {
93175986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov        clear();
932f4782ec9c57a40224ac0974fce6b6fe280c829ceSvetoslav Ganov        sPool.release(this);
93375986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov    }
93475986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov
93575986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov    /**
93675986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov     * Clears the state of this instance.
9378643aa0179e598e78d938c59035389054535a229Svetoslav Ganov     *
9388643aa0179e598e78d938c59035389054535a229Svetoslav Ganov     * @hide
93975986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov     */
940736c2756bf3c14ae9fef7255c119057f7a2be1edSvetoslav Ganov    @Override
941736c2756bf3c14ae9fef7255c119057f7a2be1edSvetoslav Ganov    protected void clear() {
942736c2756bf3c14ae9fef7255c119057f7a2be1edSvetoslav Ganov        super.clear();
94375986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov        mEventType = 0;
9442b435aada3d274a9c08d334946fff1ab9ba15b48Svetoslav Ganov        mMovementGranularity = 0;
9456d17a936f73976971135aa1e6248662533343292Svetoslav Ganov        mAction = 0;
9463fb3d7c4e756bd32d5abde0abca9ab52d559bc84Adam Powell        mPackageName = null;
947736c2756bf3c14ae9fef7255c119057f7a2be1edSvetoslav Ganov        mEventTime = 0;
948736c2756bf3c14ae9fef7255c119057f7a2be1edSvetoslav Ganov        while (!mRecords.isEmpty()) {
949736c2756bf3c14ae9fef7255c119057f7a2be1edSvetoslav Ganov            AccessibilityRecord record = mRecords.remove(0);
950736c2756bf3c14ae9fef7255c119057f7a2be1edSvetoslav Ganov            record.recycle();
9513fb3d7c4e756bd32d5abde0abca9ab52d559bc84Adam Powell        }
952ac84d3ba81f08036308b17e1ab919e43987a3df5Svetoslav Ganov    }
953ac84d3ba81f08036308b17e1ab919e43987a3df5Svetoslav Ganov
954ac84d3ba81f08036308b17e1ab919e43987a3df5Svetoslav Ganov    /**
9553fb3d7c4e756bd32d5abde0abca9ab52d559bc84Adam Powell     * Creates a new instance from a {@link Parcel}.
9563fb3d7c4e756bd32d5abde0abca9ab52d559bc84Adam Powell     *
9573fb3d7c4e756bd32d5abde0abca9ab52d559bc84Adam Powell     * @param parcel A parcel containing the state of a {@link AccessibilityEvent}.
958ac84d3ba81f08036308b17e1ab919e43987a3df5Svetoslav Ganov     */
9593fb3d7c4e756bd32d5abde0abca9ab52d559bc84Adam Powell    public void initFromParcel(Parcel parcel) {
960d116d7c78a9c53f30a73bf273bd7618312cf3847Svetoslav Ganov        mSealed = (parcel.readInt() == 1);
9613fb3d7c4e756bd32d5abde0abca9ab52d559bc84Adam Powell        mEventType = parcel.readInt();
9622b435aada3d274a9c08d334946fff1ab9ba15b48Svetoslav Ganov        mMovementGranularity = parcel.readInt();
9636d17a936f73976971135aa1e6248662533343292Svetoslav Ganov        mAction = parcel.readInt();
9643fb3d7c4e756bd32d5abde0abca9ab52d559bc84Adam Powell        mPackageName = TextUtils.CHAR_SEQUENCE_CREATOR.createFromParcel(parcel);
965736c2756bf3c14ae9fef7255c119057f7a2be1edSvetoslav Ganov        mEventTime = parcel.readLong();
966d116d7c78a9c53f30a73bf273bd7618312cf3847Svetoslav Ganov        mConnectionId = parcel.readInt();
967736c2756bf3c14ae9fef7255c119057f7a2be1edSvetoslav Ganov        readAccessibilityRecordFromParcel(this, parcel);
968736c2756bf3c14ae9fef7255c119057f7a2be1edSvetoslav Ganov
969736c2756bf3c14ae9fef7255c119057f7a2be1edSvetoslav Ganov        // Read the records.
970736c2756bf3c14ae9fef7255c119057f7a2be1edSvetoslav Ganov        final int recordCount = parcel.readInt();
971736c2756bf3c14ae9fef7255c119057f7a2be1edSvetoslav Ganov        for (int i = 0; i < recordCount; i++) {
972736c2756bf3c14ae9fef7255c119057f7a2be1edSvetoslav Ganov            AccessibilityRecord record = AccessibilityRecord.obtain();
97334e350daf89aed09ac748c2185f4506772a63b3fSvetoslav Ganov            readAccessibilityRecordFromParcel(record, parcel);
974d116d7c78a9c53f30a73bf273bd7618312cf3847Svetoslav Ganov            record.mConnectionId = mConnectionId;
975736c2756bf3c14ae9fef7255c119057f7a2be1edSvetoslav Ganov            mRecords.add(record);
976736c2756bf3c14ae9fef7255c119057f7a2be1edSvetoslav Ganov        }
9773fb3d7c4e756bd32d5abde0abca9ab52d559bc84Adam Powell    }
9783fb3d7c4e756bd32d5abde0abca9ab52d559bc84Adam Powell
979736c2756bf3c14ae9fef7255c119057f7a2be1edSvetoslav Ganov    /**
980736c2756bf3c14ae9fef7255c119057f7a2be1edSvetoslav Ganov     * Reads an {@link AccessibilityRecord} from a parcel.
981736c2756bf3c14ae9fef7255c119057f7a2be1edSvetoslav Ganov     *
982736c2756bf3c14ae9fef7255c119057f7a2be1edSvetoslav Ganov     * @param record The record to initialize.
983736c2756bf3c14ae9fef7255c119057f7a2be1edSvetoslav Ganov     * @param parcel The parcel to read from.
984736c2756bf3c14ae9fef7255c119057f7a2be1edSvetoslav Ganov     */
985736c2756bf3c14ae9fef7255c119057f7a2be1edSvetoslav Ganov    private void readAccessibilityRecordFromParcel(AccessibilityRecord record,
986736c2756bf3c14ae9fef7255c119057f7a2be1edSvetoslav Ganov            Parcel parcel) {
987736c2756bf3c14ae9fef7255c119057f7a2be1edSvetoslav Ganov        record.mBooleanProperties = parcel.readInt();
988736c2756bf3c14ae9fef7255c119057f7a2be1edSvetoslav Ganov        record.mCurrentItemIndex = parcel.readInt();
989736c2756bf3c14ae9fef7255c119057f7a2be1edSvetoslav Ganov        record.mItemCount = parcel.readInt();
990736c2756bf3c14ae9fef7255c119057f7a2be1edSvetoslav Ganov        record.mFromIndex = parcel.readInt();
991a0156177cdc809795dd8bc5a19943dd2b6f82b66Svetoslav Ganov        record.mToIndex = parcel.readInt();
992a0156177cdc809795dd8bc5a19943dd2b6f82b66Svetoslav Ganov        record.mScrollX = parcel.readInt();
993a0156177cdc809795dd8bc5a19943dd2b6f82b66Svetoslav Ganov        record.mScrollY =  parcel.readInt();
994d9ee72fddb8be40e414a831fb80458dc48699613Svetoslav Ganov        record.mMaxScrollX = parcel.readInt();
995d9ee72fddb8be40e414a831fb80458dc48699613Svetoslav Ganov        record.mMaxScrollY =  parcel.readInt();
996736c2756bf3c14ae9fef7255c119057f7a2be1edSvetoslav Ganov        record.mAddedCount = parcel.readInt();
997736c2756bf3c14ae9fef7255c119057f7a2be1edSvetoslav Ganov        record.mRemovedCount = parcel.readInt();
998736c2756bf3c14ae9fef7255c119057f7a2be1edSvetoslav Ganov        record.mClassName = TextUtils.CHAR_SEQUENCE_CREATOR.createFromParcel(parcel);
999736c2756bf3c14ae9fef7255c119057f7a2be1edSvetoslav Ganov        record.mContentDescription = TextUtils.CHAR_SEQUENCE_CREATOR.createFromParcel(parcel);
1000736c2756bf3c14ae9fef7255c119057f7a2be1edSvetoslav Ganov        record.mBeforeText = TextUtils.CHAR_SEQUENCE_CREATOR.createFromParcel(parcel);
1001736c2756bf3c14ae9fef7255c119057f7a2be1edSvetoslav Ganov        record.mParcelableData = parcel.readParcelable(null);
1002736c2756bf3c14ae9fef7255c119057f7a2be1edSvetoslav Ganov        parcel.readList(record.mText, null);
1003eeee4d2c01d3c4ed99e4891dbc75c7de69a803faSvetoslav Ganov        record.mSourceWindowId = parcel.readInt();
1004021078554b902179442a345a9d080a165c3b5139Svetoslav Ganov        record.mSourceNodeId = parcel.readLong();
1005eeee4d2c01d3c4ed99e4891dbc75c7de69a803faSvetoslav Ganov        record.mSealed = (parcel.readInt() == 1);
1006736c2756bf3c14ae9fef7255c119057f7a2be1edSvetoslav Ganov    }
1007736c2756bf3c14ae9fef7255c119057f7a2be1edSvetoslav Ganov
1008736c2756bf3c14ae9fef7255c119057f7a2be1edSvetoslav Ganov    /**
1009736c2756bf3c14ae9fef7255c119057f7a2be1edSvetoslav Ganov     * {@inheritDoc}
1010736c2756bf3c14ae9fef7255c119057f7a2be1edSvetoslav Ganov     */
101175986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov    public void writeToParcel(Parcel parcel, int flags) {
10128643aa0179e598e78d938c59035389054535a229Svetoslav Ganov        parcel.writeInt(isSealed() ? 1 : 0);
101375986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov        parcel.writeInt(mEventType);
10142b435aada3d274a9c08d334946fff1ab9ba15b48Svetoslav Ganov        parcel.writeInt(mMovementGranularity);
10156d17a936f73976971135aa1e6248662533343292Svetoslav Ganov        parcel.writeInt(mAction);
10163fb3d7c4e756bd32d5abde0abca9ab52d559bc84Adam Powell        TextUtils.writeToParcel(mPackageName, parcel, 0);
1017736c2756bf3c14ae9fef7255c119057f7a2be1edSvetoslav Ganov        parcel.writeLong(mEventTime);
1018d116d7c78a9c53f30a73bf273bd7618312cf3847Svetoslav Ganov        parcel.writeInt(mConnectionId);
1019736c2756bf3c14ae9fef7255c119057f7a2be1edSvetoslav Ganov        writeAccessibilityRecordToParcel(this, parcel, flags);
1020736c2756bf3c14ae9fef7255c119057f7a2be1edSvetoslav Ganov
1021736c2756bf3c14ae9fef7255c119057f7a2be1edSvetoslav Ganov        // Write the records.
1022736c2756bf3c14ae9fef7255c119057f7a2be1edSvetoslav Ganov        final int recordCount = getRecordCount();
1023736c2756bf3c14ae9fef7255c119057f7a2be1edSvetoslav Ganov        parcel.writeInt(recordCount);
1024736c2756bf3c14ae9fef7255c119057f7a2be1edSvetoslav Ganov        for (int i = 0; i < recordCount; i++) {
1025736c2756bf3c14ae9fef7255c119057f7a2be1edSvetoslav Ganov            AccessibilityRecord record = mRecords.get(i);
1026736c2756bf3c14ae9fef7255c119057f7a2be1edSvetoslav Ganov            writeAccessibilityRecordToParcel(record, parcel, flags);
1027736c2756bf3c14ae9fef7255c119057f7a2be1edSvetoslav Ganov        }
1028736c2756bf3c14ae9fef7255c119057f7a2be1edSvetoslav Ganov    }
1029736c2756bf3c14ae9fef7255c119057f7a2be1edSvetoslav Ganov
1030736c2756bf3c14ae9fef7255c119057f7a2be1edSvetoslav Ganov    /**
1031736c2756bf3c14ae9fef7255c119057f7a2be1edSvetoslav Ganov     * Writes an {@link AccessibilityRecord} to a parcel.
1032736c2756bf3c14ae9fef7255c119057f7a2be1edSvetoslav Ganov     *
1033736c2756bf3c14ae9fef7255c119057f7a2be1edSvetoslav Ganov     * @param record The record to write.
1034736c2756bf3c14ae9fef7255c119057f7a2be1edSvetoslav Ganov     * @param parcel The parcel to which to write.
1035736c2756bf3c14ae9fef7255c119057f7a2be1edSvetoslav Ganov     */
1036736c2756bf3c14ae9fef7255c119057f7a2be1edSvetoslav Ganov    private void writeAccessibilityRecordToParcel(AccessibilityRecord record, Parcel parcel,
1037736c2756bf3c14ae9fef7255c119057f7a2be1edSvetoslav Ganov            int flags) {
1038736c2756bf3c14ae9fef7255c119057f7a2be1edSvetoslav Ganov        parcel.writeInt(record.mBooleanProperties);
1039736c2756bf3c14ae9fef7255c119057f7a2be1edSvetoslav Ganov        parcel.writeInt(record.mCurrentItemIndex);
1040736c2756bf3c14ae9fef7255c119057f7a2be1edSvetoslav Ganov        parcel.writeInt(record.mItemCount);
1041736c2756bf3c14ae9fef7255c119057f7a2be1edSvetoslav Ganov        parcel.writeInt(record.mFromIndex);
1042a0156177cdc809795dd8bc5a19943dd2b6f82b66Svetoslav Ganov        parcel.writeInt(record.mToIndex);
1043a0156177cdc809795dd8bc5a19943dd2b6f82b66Svetoslav Ganov        parcel.writeInt(record.mScrollX);
1044a0156177cdc809795dd8bc5a19943dd2b6f82b66Svetoslav Ganov        parcel.writeInt(record.mScrollY);
1045d9ee72fddb8be40e414a831fb80458dc48699613Svetoslav Ganov        parcel.writeInt(record.mMaxScrollX);
1046d9ee72fddb8be40e414a831fb80458dc48699613Svetoslav Ganov        parcel.writeInt(record.mMaxScrollY);
1047736c2756bf3c14ae9fef7255c119057f7a2be1edSvetoslav Ganov        parcel.writeInt(record.mAddedCount);
1048736c2756bf3c14ae9fef7255c119057f7a2be1edSvetoslav Ganov        parcel.writeInt(record.mRemovedCount);
1049736c2756bf3c14ae9fef7255c119057f7a2be1edSvetoslav Ganov        TextUtils.writeToParcel(record.mClassName, parcel, flags);
1050736c2756bf3c14ae9fef7255c119057f7a2be1edSvetoslav Ganov        TextUtils.writeToParcel(record.mContentDescription, parcel, flags);
1051736c2756bf3c14ae9fef7255c119057f7a2be1edSvetoslav Ganov        TextUtils.writeToParcel(record.mBeforeText, parcel, flags);
1052736c2756bf3c14ae9fef7255c119057f7a2be1edSvetoslav Ganov        parcel.writeParcelable(record.mParcelableData, flags);
1053736c2756bf3c14ae9fef7255c119057f7a2be1edSvetoslav Ganov        parcel.writeList(record.mText);
1054eeee4d2c01d3c4ed99e4891dbc75c7de69a803faSvetoslav Ganov        parcel.writeInt(record.mSourceWindowId);
1055021078554b902179442a345a9d080a165c3b5139Svetoslav Ganov        parcel.writeLong(record.mSourceNodeId);
1056eeee4d2c01d3c4ed99e4891dbc75c7de69a803faSvetoslav Ganov        parcel.writeInt(record.mSealed ? 1 : 0);
105775986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov    }
105875986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov
1059736c2756bf3c14ae9fef7255c119057f7a2be1edSvetoslav Ganov    /**
1060736c2756bf3c14ae9fef7255c119057f7a2be1edSvetoslav Ganov     * {@inheritDoc}
1061736c2756bf3c14ae9fef7255c119057f7a2be1edSvetoslav Ganov     */
106275986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov    public int describeContents() {
106375986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov        return 0;
106475986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov    }
106575986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov
106675986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov    @Override
106775986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov    public String toString() {
106875986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov        StringBuilder builder = new StringBuilder();
106938e8b4e5bc3c93affdffbc064fd9db5aeccc3e8eSvetoslav Ganov        builder.append("EventType: ").append(eventTypeToString(mEventType));
1070cc4053e031371456fe54d51bbad1db721db4ae38Svetoslav Ganov        builder.append("; EventTime: ").append(mEventTime);
1071cc4053e031371456fe54d51bbad1db721db4ae38Svetoslav Ganov        builder.append("; PackageName: ").append(mPackageName);
10722b435aada3d274a9c08d334946fff1ab9ba15b48Svetoslav Ganov        builder.append("; MovementGranularity: ").append(mMovementGranularity);
10736d17a936f73976971135aa1e6248662533343292Svetoslav Ganov        builder.append("; Action: ").append(mAction);
1074736c2756bf3c14ae9fef7255c119057f7a2be1edSvetoslav Ganov        builder.append(super.toString());
10758643aa0179e598e78d938c59035389054535a229Svetoslav Ganov        if (DEBUG) {
1076736c2756bf3c14ae9fef7255c119057f7a2be1edSvetoslav Ganov            builder.append("\n");
1077eeee4d2c01d3c4ed99e4891dbc75c7de69a803faSvetoslav Ganov            builder.append("; sourceWindowId: ").append(mSourceWindowId);
1078021078554b902179442a345a9d080a165c3b5139Svetoslav Ganov            builder.append("; mSourceNodeId: ").append(mSourceNodeId);
10798643aa0179e598e78d938c59035389054535a229Svetoslav Ganov            for (int i = 0; i < mRecords.size(); i++) {
10808643aa0179e598e78d938c59035389054535a229Svetoslav Ganov                AccessibilityRecord record = mRecords.get(i);
10818643aa0179e598e78d938c59035389054535a229Svetoslav Ganov                builder.append("  Record ");
10828643aa0179e598e78d938c59035389054535a229Svetoslav Ganov                builder.append(i);
10838643aa0179e598e78d938c59035389054535a229Svetoslav Ganov                builder.append(":");
10848643aa0179e598e78d938c59035389054535a229Svetoslav Ganov                builder.append(" [ ClassName: " + record.mClassName);
10858643aa0179e598e78d938c59035389054535a229Svetoslav Ganov                builder.append("; Text: " + record.mText);
10868643aa0179e598e78d938c59035389054535a229Svetoslav Ganov                builder.append("; ContentDescription: " + record.mContentDescription);
10878643aa0179e598e78d938c59035389054535a229Svetoslav Ganov                builder.append("; ItemCount: " + record.mItemCount);
10888643aa0179e598e78d938c59035389054535a229Svetoslav Ganov                builder.append("; CurrentItemIndex: " + record.mCurrentItemIndex);
10898643aa0179e598e78d938c59035389054535a229Svetoslav Ganov                builder.append("; IsEnabled: " + record.isEnabled());
10908643aa0179e598e78d938c59035389054535a229Svetoslav Ganov                builder.append("; IsPassword: " + record.isPassword());
10918643aa0179e598e78d938c59035389054535a229Svetoslav Ganov                builder.append("; IsChecked: " + record.isChecked());
10928643aa0179e598e78d938c59035389054535a229Svetoslav Ganov                builder.append("; IsFullScreen: " + record.isFullScreen());
1093a0156177cdc809795dd8bc5a19943dd2b6f82b66Svetoslav Ganov                builder.append("; Scrollable: " + record.isScrollable());
10948643aa0179e598e78d938c59035389054535a229Svetoslav Ganov                builder.append("; BeforeText: " + record.mBeforeText);
10958643aa0179e598e78d938c59035389054535a229Svetoslav Ganov                builder.append("; FromIndex: " + record.mFromIndex);
1096a0156177cdc809795dd8bc5a19943dd2b6f82b66Svetoslav Ganov                builder.append("; ToIndex: " + record.mToIndex);
1097a0156177cdc809795dd8bc5a19943dd2b6f82b66Svetoslav Ganov                builder.append("; ScrollX: " + record.mScrollX);
1098a0156177cdc809795dd8bc5a19943dd2b6f82b66Svetoslav Ganov                builder.append("; ScrollY: " + record.mScrollY);
10998643aa0179e598e78d938c59035389054535a229Svetoslav Ganov                builder.append("; AddedCount: " + record.mAddedCount);
11008643aa0179e598e78d938c59035389054535a229Svetoslav Ganov                builder.append("; RemovedCount: " + record.mRemovedCount);
11018643aa0179e598e78d938c59035389054535a229Svetoslav Ganov                builder.append("; ParcelableData: " + record.mParcelableData);
11028643aa0179e598e78d938c59035389054535a229Svetoslav Ganov                builder.append(" ]");
11038643aa0179e598e78d938c59035389054535a229Svetoslav Ganov                builder.append("\n");
11048643aa0179e598e78d938c59035389054535a229Svetoslav Ganov            }
11058643aa0179e598e78d938c59035389054535a229Svetoslav Ganov        } else {
1106e4aa13b20166219a62916a92294055e7cc5c9f10Svetoslav Ganov            builder.append("; recordCount: ").append(getRecordCount());
1107736c2756bf3c14ae9fef7255c119057f7a2be1edSvetoslav Ganov        }
110875986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov        return builder.toString();
110975986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov    }
111075986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov
111175986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov    /**
1112cc4053e031371456fe54d51bbad1db721db4ae38Svetoslav Ganov     * Returns the string representation of an event type. For example,
1113cc4053e031371456fe54d51bbad1db721db4ae38Svetoslav Ganov     * {@link #TYPE_VIEW_CLICKED} is represented by the string TYPE_VIEW_CLICKED.
1114cc4053e031371456fe54d51bbad1db721db4ae38Svetoslav Ganov     *
111538e8b4e5bc3c93affdffbc064fd9db5aeccc3e8eSvetoslav Ganov     * @param eventType The event type
1116cc4053e031371456fe54d51bbad1db721db4ae38Svetoslav Ganov     * @return The string representation.
1117cc4053e031371456fe54d51bbad1db721db4ae38Svetoslav Ganov     */
111838e8b4e5bc3c93affdffbc064fd9db5aeccc3e8eSvetoslav Ganov    public static String eventTypeToString(int eventType) {
11196ce77cdd6aff7193c746cd1eb87d5babf9158bacSvetoslav Ganov        if (eventType == TYPES_ALL_MASK) {
11206ce77cdd6aff7193c746cd1eb87d5babf9158bacSvetoslav Ganov            return "TYPES_ALL_MASK";
1121cc4053e031371456fe54d51bbad1db721db4ae38Svetoslav Ganov        }
11226ce77cdd6aff7193c746cd1eb87d5babf9158bacSvetoslav Ganov        StringBuilder builder = new StringBuilder();
11236ce77cdd6aff7193c746cd1eb87d5babf9158bacSvetoslav Ganov        int eventTypeCount = 0;
11246ce77cdd6aff7193c746cd1eb87d5babf9158bacSvetoslav Ganov        while (eventType != 0) {
11256ce77cdd6aff7193c746cd1eb87d5babf9158bacSvetoslav Ganov            final int eventTypeFlag = 1 << Integer.numberOfTrailingZeros(eventType);
11266ce77cdd6aff7193c746cd1eb87d5babf9158bacSvetoslav Ganov            eventType &= ~eventTypeFlag;
11276ce77cdd6aff7193c746cd1eb87d5babf9158bacSvetoslav Ganov            switch (eventTypeFlag) {
11286ce77cdd6aff7193c746cd1eb87d5babf9158bacSvetoslav Ganov                case TYPE_VIEW_CLICKED: {
11296ce77cdd6aff7193c746cd1eb87d5babf9158bacSvetoslav Ganov                    if (eventTypeCount > 0) {
11306ce77cdd6aff7193c746cd1eb87d5babf9158bacSvetoslav Ganov                        builder.append(", ");
11316ce77cdd6aff7193c746cd1eb87d5babf9158bacSvetoslav Ganov                    }
11326ce77cdd6aff7193c746cd1eb87d5babf9158bacSvetoslav Ganov                    builder.append("TYPE_VIEW_CLICKED");
11336ce77cdd6aff7193c746cd1eb87d5babf9158bacSvetoslav Ganov                    eventTypeCount++;
11346ce77cdd6aff7193c746cd1eb87d5babf9158bacSvetoslav Ganov                } break;
11356ce77cdd6aff7193c746cd1eb87d5babf9158bacSvetoslav Ganov                case TYPE_VIEW_LONG_CLICKED: {
11366ce77cdd6aff7193c746cd1eb87d5babf9158bacSvetoslav Ganov                    if (eventTypeCount > 0) {
11376ce77cdd6aff7193c746cd1eb87d5babf9158bacSvetoslav Ganov                        builder.append(", ");
11386ce77cdd6aff7193c746cd1eb87d5babf9158bacSvetoslav Ganov                    }
11396ce77cdd6aff7193c746cd1eb87d5babf9158bacSvetoslav Ganov                    builder.append("TYPE_VIEW_LONG_CLICKED");
11406ce77cdd6aff7193c746cd1eb87d5babf9158bacSvetoslav Ganov                    eventTypeCount++;
11416ce77cdd6aff7193c746cd1eb87d5babf9158bacSvetoslav Ganov                } break;
11426ce77cdd6aff7193c746cd1eb87d5babf9158bacSvetoslav Ganov                case TYPE_VIEW_SELECTED: {
11436ce77cdd6aff7193c746cd1eb87d5babf9158bacSvetoslav Ganov                    if (eventTypeCount > 0) {
11446ce77cdd6aff7193c746cd1eb87d5babf9158bacSvetoslav Ganov                        builder.append(", ");
11456ce77cdd6aff7193c746cd1eb87d5babf9158bacSvetoslav Ganov                    }
11466ce77cdd6aff7193c746cd1eb87d5babf9158bacSvetoslav Ganov                    builder.append("TYPE_VIEW_SELECTED");
11476ce77cdd6aff7193c746cd1eb87d5babf9158bacSvetoslav Ganov                    eventTypeCount++;
11486ce77cdd6aff7193c746cd1eb87d5babf9158bacSvetoslav Ganov                } break;
11496ce77cdd6aff7193c746cd1eb87d5babf9158bacSvetoslav Ganov                case TYPE_VIEW_FOCUSED: {
11506ce77cdd6aff7193c746cd1eb87d5babf9158bacSvetoslav Ganov                    if (eventTypeCount > 0) {
11516ce77cdd6aff7193c746cd1eb87d5babf9158bacSvetoslav Ganov                        builder.append(", ");
11526ce77cdd6aff7193c746cd1eb87d5babf9158bacSvetoslav Ganov                    }
11536ce77cdd6aff7193c746cd1eb87d5babf9158bacSvetoslav Ganov                    builder.append("TYPE_VIEW_FOCUSED");
11546ce77cdd6aff7193c746cd1eb87d5babf9158bacSvetoslav Ganov                    eventTypeCount++;
11556ce77cdd6aff7193c746cd1eb87d5babf9158bacSvetoslav Ganov                } break;
11566ce77cdd6aff7193c746cd1eb87d5babf9158bacSvetoslav Ganov                case TYPE_VIEW_TEXT_CHANGED: {
11576ce77cdd6aff7193c746cd1eb87d5babf9158bacSvetoslav Ganov                    if (eventTypeCount > 0) {
11586ce77cdd6aff7193c746cd1eb87d5babf9158bacSvetoslav Ganov                        builder.append(", ");
11596ce77cdd6aff7193c746cd1eb87d5babf9158bacSvetoslav Ganov                    }
11606ce77cdd6aff7193c746cd1eb87d5babf9158bacSvetoslav Ganov                    builder.append("TYPE_VIEW_TEXT_CHANGED");
11616ce77cdd6aff7193c746cd1eb87d5babf9158bacSvetoslav Ganov                    eventTypeCount++;
11626ce77cdd6aff7193c746cd1eb87d5babf9158bacSvetoslav Ganov                } break;
11636ce77cdd6aff7193c746cd1eb87d5babf9158bacSvetoslav Ganov                case TYPE_WINDOW_STATE_CHANGED: {
11646ce77cdd6aff7193c746cd1eb87d5babf9158bacSvetoslav Ganov                    if (eventTypeCount > 0) {
11656ce77cdd6aff7193c746cd1eb87d5babf9158bacSvetoslav Ganov                        builder.append(", ");
11666ce77cdd6aff7193c746cd1eb87d5babf9158bacSvetoslav Ganov                    }
11676ce77cdd6aff7193c746cd1eb87d5babf9158bacSvetoslav Ganov                    builder.append("TYPE_WINDOW_STATE_CHANGED");
11686ce77cdd6aff7193c746cd1eb87d5babf9158bacSvetoslav Ganov                    eventTypeCount++;
11696ce77cdd6aff7193c746cd1eb87d5babf9158bacSvetoslav Ganov                } break;
11706ce77cdd6aff7193c746cd1eb87d5babf9158bacSvetoslav Ganov                case TYPE_VIEW_HOVER_ENTER: {
11716ce77cdd6aff7193c746cd1eb87d5babf9158bacSvetoslav Ganov                    if (eventTypeCount > 0) {
11726ce77cdd6aff7193c746cd1eb87d5babf9158bacSvetoslav Ganov                        builder.append(", ");
11736ce77cdd6aff7193c746cd1eb87d5babf9158bacSvetoslav Ganov                    }
11746ce77cdd6aff7193c746cd1eb87d5babf9158bacSvetoslav Ganov                    builder.append("TYPE_VIEW_HOVER_ENTER");
11756ce77cdd6aff7193c746cd1eb87d5babf9158bacSvetoslav Ganov                    eventTypeCount++;
11766ce77cdd6aff7193c746cd1eb87d5babf9158bacSvetoslav Ganov                } break;
11776ce77cdd6aff7193c746cd1eb87d5babf9158bacSvetoslav Ganov                case TYPE_VIEW_HOVER_EXIT: {
11786ce77cdd6aff7193c746cd1eb87d5babf9158bacSvetoslav Ganov                    if (eventTypeCount > 0) {
11796ce77cdd6aff7193c746cd1eb87d5babf9158bacSvetoslav Ganov                        builder.append(", ");
11806ce77cdd6aff7193c746cd1eb87d5babf9158bacSvetoslav Ganov                    }
11816ce77cdd6aff7193c746cd1eb87d5babf9158bacSvetoslav Ganov                    builder.append("TYPE_VIEW_HOVER_EXIT");
11826ce77cdd6aff7193c746cd1eb87d5babf9158bacSvetoslav Ganov                    eventTypeCount++;
11836ce77cdd6aff7193c746cd1eb87d5babf9158bacSvetoslav Ganov                } break;
11846ce77cdd6aff7193c746cd1eb87d5babf9158bacSvetoslav Ganov                case TYPE_NOTIFICATION_STATE_CHANGED: {
11856ce77cdd6aff7193c746cd1eb87d5babf9158bacSvetoslav Ganov                    if (eventTypeCount > 0) {
11866ce77cdd6aff7193c746cd1eb87d5babf9158bacSvetoslav Ganov                        builder.append(", ");
11876ce77cdd6aff7193c746cd1eb87d5babf9158bacSvetoslav Ganov                    }
11886ce77cdd6aff7193c746cd1eb87d5babf9158bacSvetoslav Ganov                    builder.append("TYPE_NOTIFICATION_STATE_CHANGED");
11896ce77cdd6aff7193c746cd1eb87d5babf9158bacSvetoslav Ganov                    eventTypeCount++;
11906ce77cdd6aff7193c746cd1eb87d5babf9158bacSvetoslav Ganov                } break;
11916ce77cdd6aff7193c746cd1eb87d5babf9158bacSvetoslav Ganov                case TYPE_TOUCH_EXPLORATION_GESTURE_START: {
11926ce77cdd6aff7193c746cd1eb87d5babf9158bacSvetoslav Ganov                    if (eventTypeCount > 0) {
11936ce77cdd6aff7193c746cd1eb87d5babf9158bacSvetoslav Ganov                        builder.append(", ");
11946ce77cdd6aff7193c746cd1eb87d5babf9158bacSvetoslav Ganov                    }
11956ce77cdd6aff7193c746cd1eb87d5babf9158bacSvetoslav Ganov                    builder.append("TYPE_TOUCH_EXPLORATION_GESTURE_START");
11966ce77cdd6aff7193c746cd1eb87d5babf9158bacSvetoslav Ganov                    eventTypeCount++;
11976ce77cdd6aff7193c746cd1eb87d5babf9158bacSvetoslav Ganov                } break;
11986ce77cdd6aff7193c746cd1eb87d5babf9158bacSvetoslav Ganov                case TYPE_TOUCH_EXPLORATION_GESTURE_END: {
11996ce77cdd6aff7193c746cd1eb87d5babf9158bacSvetoslav Ganov                    if (eventTypeCount > 0) {
12006ce77cdd6aff7193c746cd1eb87d5babf9158bacSvetoslav Ganov                        builder.append(", ");
12016ce77cdd6aff7193c746cd1eb87d5babf9158bacSvetoslav Ganov                    }
12026ce77cdd6aff7193c746cd1eb87d5babf9158bacSvetoslav Ganov                    builder.append("TYPE_TOUCH_EXPLORATION_GESTURE_END");
12036ce77cdd6aff7193c746cd1eb87d5babf9158bacSvetoslav Ganov                    eventTypeCount++;
12046ce77cdd6aff7193c746cd1eb87d5babf9158bacSvetoslav Ganov                } break;
12056ce77cdd6aff7193c746cd1eb87d5babf9158bacSvetoslav Ganov                case TYPE_WINDOW_CONTENT_CHANGED: {
12066ce77cdd6aff7193c746cd1eb87d5babf9158bacSvetoslav Ganov                    if (eventTypeCount > 0) {
12076ce77cdd6aff7193c746cd1eb87d5babf9158bacSvetoslav Ganov                        builder.append(", ");
12086ce77cdd6aff7193c746cd1eb87d5babf9158bacSvetoslav Ganov                    }
12096ce77cdd6aff7193c746cd1eb87d5babf9158bacSvetoslav Ganov                    builder.append("TYPE_WINDOW_CONTENT_CHANGED");
12106ce77cdd6aff7193c746cd1eb87d5babf9158bacSvetoslav Ganov                    eventTypeCount++;
12116ce77cdd6aff7193c746cd1eb87d5babf9158bacSvetoslav Ganov                } break;
12126ce77cdd6aff7193c746cd1eb87d5babf9158bacSvetoslav Ganov                case TYPE_VIEW_TEXT_SELECTION_CHANGED: {
12136ce77cdd6aff7193c746cd1eb87d5babf9158bacSvetoslav Ganov                    if (eventTypeCount > 0) {
12146ce77cdd6aff7193c746cd1eb87d5babf9158bacSvetoslav Ganov                        builder.append(", ");
12156ce77cdd6aff7193c746cd1eb87d5babf9158bacSvetoslav Ganov                    }
12166ce77cdd6aff7193c746cd1eb87d5babf9158bacSvetoslav Ganov                    builder.append("TYPE_VIEW_TEXT_SELECTION_CHANGED");
12176ce77cdd6aff7193c746cd1eb87d5babf9158bacSvetoslav Ganov                    eventTypeCount++;
12186ce77cdd6aff7193c746cd1eb87d5babf9158bacSvetoslav Ganov                } break;
12196ce77cdd6aff7193c746cd1eb87d5babf9158bacSvetoslav Ganov                case TYPE_VIEW_SCROLLED: {
12206ce77cdd6aff7193c746cd1eb87d5babf9158bacSvetoslav Ganov                    if (eventTypeCount > 0) {
12216ce77cdd6aff7193c746cd1eb87d5babf9158bacSvetoslav Ganov                        builder.append(", ");
12226ce77cdd6aff7193c746cd1eb87d5babf9158bacSvetoslav Ganov                    }
12236ce77cdd6aff7193c746cd1eb87d5babf9158bacSvetoslav Ganov                    builder.append("TYPE_VIEW_SCROLLED");
12246ce77cdd6aff7193c746cd1eb87d5babf9158bacSvetoslav Ganov                    eventTypeCount++;
12256ce77cdd6aff7193c746cd1eb87d5babf9158bacSvetoslav Ganov                } break;
12266ce77cdd6aff7193c746cd1eb87d5babf9158bacSvetoslav Ganov                case TYPE_ANNOUNCEMENT: {
12276ce77cdd6aff7193c746cd1eb87d5babf9158bacSvetoslav Ganov                    if (eventTypeCount > 0) {
12286ce77cdd6aff7193c746cd1eb87d5babf9158bacSvetoslav Ganov                        builder.append(", ");
12296ce77cdd6aff7193c746cd1eb87d5babf9158bacSvetoslav Ganov                    }
12306ce77cdd6aff7193c746cd1eb87d5babf9158bacSvetoslav Ganov                    builder.append("TYPE_ANNOUNCEMENT");
12316ce77cdd6aff7193c746cd1eb87d5babf9158bacSvetoslav Ganov                    eventTypeCount++;
12326ce77cdd6aff7193c746cd1eb87d5babf9158bacSvetoslav Ganov                } break;
12336ce77cdd6aff7193c746cd1eb87d5babf9158bacSvetoslav Ganov                case TYPE_VIEW_ACCESSIBILITY_FOCUSED: {
12346ce77cdd6aff7193c746cd1eb87d5babf9158bacSvetoslav Ganov                    if (eventTypeCount > 0) {
12356ce77cdd6aff7193c746cd1eb87d5babf9158bacSvetoslav Ganov                        builder.append(", ");
12366ce77cdd6aff7193c746cd1eb87d5babf9158bacSvetoslav Ganov                    }
12376ce77cdd6aff7193c746cd1eb87d5babf9158bacSvetoslav Ganov                    builder.append("TYPE_VIEW_ACCESSIBILITY_FOCUSED");
12386ce77cdd6aff7193c746cd1eb87d5babf9158bacSvetoslav Ganov                    eventTypeCount++;
12396ce77cdd6aff7193c746cd1eb87d5babf9158bacSvetoslav Ganov                } break;
12406ce77cdd6aff7193c746cd1eb87d5babf9158bacSvetoslav Ganov                case TYPE_VIEW_ACCESSIBILITY_FOCUS_CLEARED: {
12416ce77cdd6aff7193c746cd1eb87d5babf9158bacSvetoslav Ganov                    if (eventTypeCount > 0) {
12426ce77cdd6aff7193c746cd1eb87d5babf9158bacSvetoslav Ganov                        builder.append(", ");
12436ce77cdd6aff7193c746cd1eb87d5babf9158bacSvetoslav Ganov                    }
12446ce77cdd6aff7193c746cd1eb87d5babf9158bacSvetoslav Ganov                    builder.append("TYPE_VIEW_ACCESSIBILITY_FOCUS_CLEARED");
12456ce77cdd6aff7193c746cd1eb87d5babf9158bacSvetoslav Ganov                    eventTypeCount++;
12466ce77cdd6aff7193c746cd1eb87d5babf9158bacSvetoslav Ganov                } break;
12476ce77cdd6aff7193c746cd1eb87d5babf9158bacSvetoslav Ganov                case TYPE_VIEW_TEXT_TRAVERSED_AT_MOVEMENT_GRANULARITY: {
12486ce77cdd6aff7193c746cd1eb87d5babf9158bacSvetoslav Ganov                    if (eventTypeCount > 0) {
12496ce77cdd6aff7193c746cd1eb87d5babf9158bacSvetoslav Ganov                        builder.append(", ");
12506ce77cdd6aff7193c746cd1eb87d5babf9158bacSvetoslav Ganov                    }
1251abad55d860be793b8b9b3e288a74214da89fb368Svetoslav                    builder.append("TYPE_VIEW_TEXT_TRAVERSED_AT_MOVEMENT_GRANULARITY");
12526ce77cdd6aff7193c746cd1eb87d5babf9158bacSvetoslav Ganov                    eventTypeCount++;
12536ce77cdd6aff7193c746cd1eb87d5babf9158bacSvetoslav Ganov                } break;
12546ce77cdd6aff7193c746cd1eb87d5babf9158bacSvetoslav Ganov                case TYPE_GESTURE_DETECTION_START: {
12556ce77cdd6aff7193c746cd1eb87d5babf9158bacSvetoslav Ganov                    if (eventTypeCount > 0) {
12566ce77cdd6aff7193c746cd1eb87d5babf9158bacSvetoslav Ganov                        builder.append(", ");
12576ce77cdd6aff7193c746cd1eb87d5babf9158bacSvetoslav Ganov                    }
12586ce77cdd6aff7193c746cd1eb87d5babf9158bacSvetoslav Ganov                    builder.append("TYPE_GESTURE_DETECTION_START");
12596ce77cdd6aff7193c746cd1eb87d5babf9158bacSvetoslav Ganov                    eventTypeCount++;
12606ce77cdd6aff7193c746cd1eb87d5babf9158bacSvetoslav Ganov                } break;
12616ce77cdd6aff7193c746cd1eb87d5babf9158bacSvetoslav Ganov                case TYPE_GESTURE_DETECTION_END: {
12626ce77cdd6aff7193c746cd1eb87d5babf9158bacSvetoslav Ganov                    if (eventTypeCount > 0) {
12636ce77cdd6aff7193c746cd1eb87d5babf9158bacSvetoslav Ganov                        builder.append(", ");
12646ce77cdd6aff7193c746cd1eb87d5babf9158bacSvetoslav Ganov                    }
12656ce77cdd6aff7193c746cd1eb87d5babf9158bacSvetoslav Ganov                    builder.append("TYPE_GESTURE_DETECTION_END");
12666ce77cdd6aff7193c746cd1eb87d5babf9158bacSvetoslav Ganov                    eventTypeCount++;
12676ce77cdd6aff7193c746cd1eb87d5babf9158bacSvetoslav Ganov                } break;
12686ce77cdd6aff7193c746cd1eb87d5babf9158bacSvetoslav Ganov                case TYPE_TOUCH_INTERACTION_START: {
12696ce77cdd6aff7193c746cd1eb87d5babf9158bacSvetoslav Ganov                    if (eventTypeCount > 0) {
12706ce77cdd6aff7193c746cd1eb87d5babf9158bacSvetoslav Ganov                        builder.append(", ");
12716ce77cdd6aff7193c746cd1eb87d5babf9158bacSvetoslav Ganov                    }
12726ce77cdd6aff7193c746cd1eb87d5babf9158bacSvetoslav Ganov                    builder.append("TYPE_TOUCH_INTERACTION_START");
12736ce77cdd6aff7193c746cd1eb87d5babf9158bacSvetoslav Ganov                    eventTypeCount++;
12746ce77cdd6aff7193c746cd1eb87d5babf9158bacSvetoslav Ganov                } break;
12756ce77cdd6aff7193c746cd1eb87d5babf9158bacSvetoslav Ganov                case TYPE_TOUCH_INTERACTION_END: {
12766ce77cdd6aff7193c746cd1eb87d5babf9158bacSvetoslav Ganov                    if (eventTypeCount > 0) {
12776ce77cdd6aff7193c746cd1eb87d5babf9158bacSvetoslav Ganov                        builder.append(", ");
12786ce77cdd6aff7193c746cd1eb87d5babf9158bacSvetoslav Ganov                    }
12796ce77cdd6aff7193c746cd1eb87d5babf9158bacSvetoslav Ganov                    builder.append("TYPE_TOUCH_INTERACTION_END");
12806ce77cdd6aff7193c746cd1eb87d5babf9158bacSvetoslav Ganov                    eventTypeCount++;
12816ce77cdd6aff7193c746cd1eb87d5babf9158bacSvetoslav Ganov                } break;
12826ce77cdd6aff7193c746cd1eb87d5babf9158bacSvetoslav Ganov            }
12836ce77cdd6aff7193c746cd1eb87d5babf9158bacSvetoslav Ganov        }
12846ce77cdd6aff7193c746cd1eb87d5babf9158bacSvetoslav Ganov        if (eventTypeCount > 1) {
12856ce77cdd6aff7193c746cd1eb87d5babf9158bacSvetoslav Ganov            builder.insert(0, '[');
12866ce77cdd6aff7193c746cd1eb87d5babf9158bacSvetoslav Ganov            builder.append(']');
12876ce77cdd6aff7193c746cd1eb87d5babf9158bacSvetoslav Ganov        }
12886ce77cdd6aff7193c746cd1eb87d5babf9158bacSvetoslav Ganov        return builder.toString();
1289cc4053e031371456fe54d51bbad1db721db4ae38Svetoslav Ganov    }
1290cc4053e031371456fe54d51bbad1db721db4ae38Svetoslav Ganov
1291cc4053e031371456fe54d51bbad1db721db4ae38Svetoslav Ganov    /**
129275986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov     * @see Parcelable.Creator
129375986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov     */
129475986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov    public static final Parcelable.Creator<AccessibilityEvent> CREATOR =
129575986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov            new Parcelable.Creator<AccessibilityEvent>() {
129675986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov        public AccessibilityEvent createFromParcel(Parcel parcel) {
129775986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov            AccessibilityEvent event = AccessibilityEvent.obtain();
129875986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov            event.initFromParcel(parcel);
129975986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov            return event;
130075986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov        }
130175986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov
130275986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov        public AccessibilityEvent[] newArray(int size) {
130375986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov            return new AccessibilityEvent[size];
130475986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov        }
130575986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov    };
130675986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov}
1307