AccessibilityEvent.java revision 4213804541a8b05cd0587b138a2fd9a3b7fd9350
175986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov/* 275986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov * Copyright (C) 2009 The Android Open Source Project 375986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov * 475986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov * Licensed under the Apache License, Version 2.0 (the "License"); 575986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov * you may not use this file except in compliance with the License. 675986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov * You may obtain a copy of the License at 775986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov * 875986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov * http://www.apache.org/licenses/LICENSE-2.0 975986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov * 1075986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov * Unless required by applicable law or agreed to in writing, software 1175986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov * distributed under the License is distributed on an "AS IS" BASIS, 1275986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 1375986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov * See the License for the specific language governing permissions and 1475986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov * limitations under the License. 1575986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov */ 1675986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov 1775986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganovpackage android.view.accessibility; 1875986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov 1975986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganovimport android.os.Parcel; 2075986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganovimport android.os.Parcelable; 2175986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganovimport android.text.TextUtils; 2275986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov 2375986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganovimport java.util.ArrayList; 24eeee4d2c01d3c4ed99e4891dbc75c7de69a803faSvetoslav Ganovimport java.util.List; 2575986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov 2675986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov/** 2738e8b4e5bc3c93affdffbc064fd9db5aeccc3e8eSvetoslav Ganov * <p> 2875986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov * This class represents accessibility events that are sent by the system when 2975986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov * something notable happens in the user interface. For example, when a 3075986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov * {@link android.widget.Button} is clicked, a {@link android.view.View} is focused, etc. 3138e8b4e5bc3c93affdffbc064fd9db5aeccc3e8eSvetoslav Ganov * </p> 3275986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov * <p> 33736c2756bf3c14ae9fef7255c119057f7a2be1edSvetoslav Ganov * An accessibility event is fired by an individual view which populates the event with 3438e8b4e5bc3c93affdffbc064fd9db5aeccc3e8eSvetoslav Ganov * data for its state and requests from its parent to send the event to interested 3538e8b4e5bc3c93affdffbc064fd9db5aeccc3e8eSvetoslav Ganov * parties. The parent can optionally add an {@link AccessibilityRecord} for itself before 3638e8b4e5bc3c93affdffbc064fd9db5aeccc3e8eSvetoslav Ganov * dispatching a similar request to its parent. A parent can also choose not to respect the 3738e8b4e5bc3c93affdffbc064fd9db5aeccc3e8eSvetoslav Ganov * request for sending an event. The accessibility event is sent by the topmost view in the 3838e8b4e5bc3c93affdffbc064fd9db5aeccc3e8eSvetoslav Ganov * view tree. Therefore, an {@link android.accessibilityservice.AccessibilityService} can 3938e8b4e5bc3c93affdffbc064fd9db5aeccc3e8eSvetoslav Ganov * explore all records in an accessibility event to obtain more information about the 4038e8b4e5bc3c93affdffbc064fd9db5aeccc3e8eSvetoslav Ganov * context in which the event was fired. 4138e8b4e5bc3c93affdffbc064fd9db5aeccc3e8eSvetoslav Ganov * </p> 42736c2756bf3c14ae9fef7255c119057f7a2be1edSvetoslav Ganov * <p> 4338e8b4e5bc3c93affdffbc064fd9db5aeccc3e8eSvetoslav Ganov * The main purpose of an accessibility event is to expose enough information for an 4438e8b4e5bc3c93affdffbc064fd9db5aeccc3e8eSvetoslav Ganov * {@link android.accessibilityservice.AccessibilityService} to provide meaningful feedback 4538e8b4e5bc3c93affdffbc064fd9db5aeccc3e8eSvetoslav Ganov * to the user. Sometimes however, an accessibility service may need more contextual 4638e8b4e5bc3c93affdffbc064fd9db5aeccc3e8eSvetoslav Ganov * information then the one in the event pay-load. In such cases the service can obtain 4738e8b4e5bc3c93affdffbc064fd9db5aeccc3e8eSvetoslav Ganov * the event source which is an {@link AccessibilityNodeInfo} (snapshot of a View state) 4838e8b4e5bc3c93affdffbc064fd9db5aeccc3e8eSvetoslav Ganov * which can be used for exploring the window content. Note that the privilege for accessing 4938e8b4e5bc3c93affdffbc064fd9db5aeccc3e8eSvetoslav Ganov * an event's source, thus the window content, has to be explicitly requested. For more 5038e8b4e5bc3c93affdffbc064fd9db5aeccc3e8eSvetoslav Ganov * details refer to {@link android.accessibilityservice.AccessibilityService}. If an 5138e8b4e5bc3c93affdffbc064fd9db5aeccc3e8eSvetoslav Ganov * accessibility service has not requested to retrieve the window content the event will 5238e8b4e5bc3c93affdffbc064fd9db5aeccc3e8eSvetoslav Ganov * not contain reference to its source. Also for events of type 5338e8b4e5bc3c93affdffbc064fd9db5aeccc3e8eSvetoslav Ganov * {@link #TYPE_NOTIFICATION_STATE_CHANGED} the source is never available. 5438e8b4e5bc3c93affdffbc064fd9db5aeccc3e8eSvetoslav Ganov * </p> 55736c2756bf3c14ae9fef7255c119057f7a2be1edSvetoslav Ganov * <p> 5675986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov * This class represents various semantically different accessibility event 5738e8b4e5bc3c93affdffbc064fd9db5aeccc3e8eSvetoslav Ganov * types. Each event type has an associated set of related properties. In other 5875986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov * words, each event type is characterized via a subset of the properties exposed 5975986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov * by this class. For each event type there is a corresponding constant defined 6038e8b4e5bc3c93affdffbc064fd9db5aeccc3e8eSvetoslav Ganov * in this class. Follows a specification of the event types and their associated properties: 6138e8b4e5bc3c93affdffbc064fd9db5aeccc3e8eSvetoslav Ganov * </p> 62e1302edd40c5cc264f842e17e3796e0a11d6f045Joe Fernandez * <div class="special reference"> 63e1302edd40c5cc264f842e17e3796e0a11d6f045Joe Fernandez * <h3>Developer Guides</h3> 64e1302edd40c5cc264f842e17e3796e0a11d6f045Joe Fernandez * <p>For more information about creating and processing AccessibilityEvents, read the 65e1302edd40c5cc264f842e17e3796e0a11d6f045Joe Fernandez * <a href="{@docRoot}guide/topics/ui/accessibility/index.html">Accessibility</a> 66e1302edd40c5cc264f842e17e3796e0a11d6f045Joe Fernandez * developer guide.</p> 67e1302edd40c5cc264f842e17e3796e0a11d6f045Joe Fernandez * </div> 6875986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov * <p> 6938e8b4e5bc3c93affdffbc064fd9db5aeccc3e8eSvetoslav Ganov * <b>VIEW TYPES</b></br> 7038e8b4e5bc3c93affdffbc064fd9db5aeccc3e8eSvetoslav Ganov * </p> 7175986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov * <p> 7275986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov * <b>View clicked</b> - represents the event of clicking on a {@link android.view.View} 7338e8b4e5bc3c93affdffbc064fd9db5aeccc3e8eSvetoslav Ganov * like {@link android.widget.Button}, {@link android.widget.CompoundButton}, etc.</br> 7438e8b4e5bc3c93affdffbc064fd9db5aeccc3e8eSvetoslav Ganov * <em>Type:</em>{@link #TYPE_VIEW_CLICKED}</br> 7538e8b4e5bc3c93affdffbc064fd9db5aeccc3e8eSvetoslav Ganov * <em>Properties:</em></br> 76a0156177cdc809795dd8bc5a19943dd2b6f82b66Svetoslav Ganov * <ul> 7782e236d72ac197d6673d0b4d484fe5f0b9436731Svetoslav Ganov * <li>{@link #getEventType()} - The type of the event.</li> 7838e8b4e5bc3c93affdffbc064fd9db5aeccc3e8eSvetoslav Ganov * <li>{@link #getSource()} - The source info (for registered clients).</li> 79a0156177cdc809795dd8bc5a19943dd2b6f82b66Svetoslav Ganov * <li>{@link #getClassName()} - The class name of the source.</li> 80a0156177cdc809795dd8bc5a19943dd2b6f82b66Svetoslav Ganov * <li>{@link #getPackageName()} - The package name of the source.</li> 81a0156177cdc809795dd8bc5a19943dd2b6f82b66Svetoslav Ganov * <li>{@link #getEventTime()} - The event time.</li> 8282e236d72ac197d6673d0b4d484fe5f0b9436731Svetoslav Ganov * <li>{@link #getText()} - The text of the source's sub-tree.</li> 83a0156177cdc809795dd8bc5a19943dd2b6f82b66Svetoslav Ganov * <li>{@link #isEnabled()} - Whether the source is enabled.</li> 84a0156177cdc809795dd8bc5a19943dd2b6f82b66Svetoslav Ganov * <li>{@link #isPassword()} - Whether the source is password.</li> 85a0156177cdc809795dd8bc5a19943dd2b6f82b66Svetoslav Ganov * <li>{@link #isChecked()} - Whether the source is checked.</li> 8682e236d72ac197d6673d0b4d484fe5f0b9436731Svetoslav Ganov * <li>{@link #getContentDescription()} - The content description of the source.</li> 87d9ee72fddb8be40e414a831fb80458dc48699613Svetoslav Ganov * <li>{@link #getScrollX()} - The offset of the source left edge in pixels 88d9ee72fddb8be40e414a831fb80458dc48699613Svetoslav Ganov * (without descendants of AdapterView).</li> 89d9ee72fddb8be40e414a831fb80458dc48699613Svetoslav Ganov * <li>{@link #getScrollY()} - The offset of the source top edge in pixels 90d9ee72fddb8be40e414a831fb80458dc48699613Svetoslav Ganov * (without descendants of AdapterView).</li> 91d9ee72fddb8be40e414a831fb80458dc48699613Svetoslav Ganov * <li>{@link #getFromIndex()} - The zero based index of the first visible item of the source, 92d9ee72fddb8be40e414a831fb80458dc48699613Svetoslav Ganov * inclusive (for descendants of AdapterView).</li> 93d9ee72fddb8be40e414a831fb80458dc48699613Svetoslav Ganov * <li>{@link #getToIndex()} - The zero based index of the last visible item of the source, 94d9ee72fddb8be40e414a831fb80458dc48699613Svetoslav Ganov * inclusive (for descendants of AdapterView).</li> 95d9ee72fddb8be40e414a831fb80458dc48699613Svetoslav Ganov * <li>{@link #getItemCount()} - The total items of the source 96d9ee72fddb8be40e414a831fb80458dc48699613Svetoslav Ganov * (for descendants of AdapterView).</li> 97a0156177cdc809795dd8bc5a19943dd2b6f82b66Svetoslav Ganov * </ul> 9838e8b4e5bc3c93affdffbc064fd9db5aeccc3e8eSvetoslav Ganov * </p> 9975986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov * <p> 10075986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov * <b>View long clicked</b> - represents the event of long clicking on a {@link android.view.View} 10138e8b4e5bc3c93affdffbc064fd9db5aeccc3e8eSvetoslav Ganov * like {@link android.widget.Button}, {@link android.widget.CompoundButton}, etc </br> 10238e8b4e5bc3c93affdffbc064fd9db5aeccc3e8eSvetoslav Ganov * <em>Type:</em>{@link #TYPE_VIEW_LONG_CLICKED}</br> 10338e8b4e5bc3c93affdffbc064fd9db5aeccc3e8eSvetoslav Ganov * <em>Properties:</em></br> 104a0156177cdc809795dd8bc5a19943dd2b6f82b66Svetoslav Ganov * <ul> 10582e236d72ac197d6673d0b4d484fe5f0b9436731Svetoslav Ganov * <li>{@link #getEventType()} - The type of the event.</li> 10638e8b4e5bc3c93affdffbc064fd9db5aeccc3e8eSvetoslav Ganov * <li>{@link #getSource()} - The source info (for registered clients).</li> 107a0156177cdc809795dd8bc5a19943dd2b6f82b66Svetoslav Ganov * <li>{@link #getClassName()} - The class name of the source.</li> 108a0156177cdc809795dd8bc5a19943dd2b6f82b66Svetoslav Ganov * <li>{@link #getPackageName()} - The package name of the source.</li> 109a0156177cdc809795dd8bc5a19943dd2b6f82b66Svetoslav Ganov * <li>{@link #getEventTime()} - The event time.</li> 11082e236d72ac197d6673d0b4d484fe5f0b9436731Svetoslav Ganov * <li>{@link #getText()} - The text of the source's sub-tree.</li> 111a0156177cdc809795dd8bc5a19943dd2b6f82b66Svetoslav Ganov * <li>{@link #isEnabled()} - Whether the source is enabled.</li> 112a0156177cdc809795dd8bc5a19943dd2b6f82b66Svetoslav Ganov * <li>{@link #isPassword()} - Whether the source is password.</li> 113a0156177cdc809795dd8bc5a19943dd2b6f82b66Svetoslav Ganov * <li>{@link #isChecked()} - Whether the source is checked.</li> 11482e236d72ac197d6673d0b4d484fe5f0b9436731Svetoslav Ganov * <li>{@link #getContentDescription()} - The content description of the source.</li> 115d9ee72fddb8be40e414a831fb80458dc48699613Svetoslav Ganov * <li>{@link #getScrollX()} - The offset of the source left edge in pixels 116d9ee72fddb8be40e414a831fb80458dc48699613Svetoslav Ganov * (without descendants of AdapterView).</li> 117d9ee72fddb8be40e414a831fb80458dc48699613Svetoslav Ganov * <li>{@link #getScrollY()} - The offset of the source top edge in pixels 118d9ee72fddb8be40e414a831fb80458dc48699613Svetoslav Ganov * (without descendants of AdapterView).</li> 119d9ee72fddb8be40e414a831fb80458dc48699613Svetoslav Ganov * <li>{@link #getFromIndex()} - The zero based index of the first visible item of the source, 120d9ee72fddb8be40e414a831fb80458dc48699613Svetoslav Ganov * inclusive (for descendants of AdapterView).</li> 121d9ee72fddb8be40e414a831fb80458dc48699613Svetoslav Ganov * <li>{@link #getToIndex()} - The zero based index of the last visible item of the source, 122d9ee72fddb8be40e414a831fb80458dc48699613Svetoslav Ganov * inclusive (for descendants of AdapterView).</li> 123d9ee72fddb8be40e414a831fb80458dc48699613Svetoslav Ganov * <li>{@link #getItemCount()} - The total items of the source 124d9ee72fddb8be40e414a831fb80458dc48699613Svetoslav Ganov * (for descendants of AdapterView).</li> 125a0156177cdc809795dd8bc5a19943dd2b6f82b66Svetoslav Ganov * </ul> 12638e8b4e5bc3c93affdffbc064fd9db5aeccc3e8eSvetoslav Ganov * </p> 12775986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov * <p> 12875986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov * <b>View selected</b> - represents the event of selecting an item usually in 12938e8b4e5bc3c93affdffbc064fd9db5aeccc3e8eSvetoslav Ganov * the context of an {@link android.widget.AdapterView}.</br> 13038e8b4e5bc3c93affdffbc064fd9db5aeccc3e8eSvetoslav Ganov * <em>Type:</em> {@link #TYPE_VIEW_SELECTED}</br> 13138e8b4e5bc3c93affdffbc064fd9db5aeccc3e8eSvetoslav Ganov * <em>Properties:</em></br> 132a0156177cdc809795dd8bc5a19943dd2b6f82b66Svetoslav Ganov * <ul> 13382e236d72ac197d6673d0b4d484fe5f0b9436731Svetoslav Ganov * <li>{@link #getEventType()} - The type of the event.</li> 13438e8b4e5bc3c93affdffbc064fd9db5aeccc3e8eSvetoslav Ganov * <li>{@link #getSource()} - The source info (for registered clients).</li> 135a0156177cdc809795dd8bc5a19943dd2b6f82b66Svetoslav Ganov * <li>{@link #getClassName()} - The class name of the source.</li> 136a0156177cdc809795dd8bc5a19943dd2b6f82b66Svetoslav Ganov * <li>{@link #getPackageName()} - The package name of the source.</li> 137a0156177cdc809795dd8bc5a19943dd2b6f82b66Svetoslav Ganov * <li>{@link #getEventTime()} - The event time.</li> 13882e236d72ac197d6673d0b4d484fe5f0b9436731Svetoslav Ganov * <li>{@link #getText()} - The text of the source's sub-tree.</li> 139a0156177cdc809795dd8bc5a19943dd2b6f82b66Svetoslav Ganov * <li>{@link #isEnabled()} - Whether the source is enabled.</li> 140a0156177cdc809795dd8bc5a19943dd2b6f82b66Svetoslav Ganov * <li>{@link #isPassword()} - Whether the source is password.</li> 141a0156177cdc809795dd8bc5a19943dd2b6f82b66Svetoslav Ganov * <li>{@link #isChecked()} - Whether the source is checked.</li> 14238e8b4e5bc3c93affdffbc064fd9db5aeccc3e8eSvetoslav Ganov * <li>{@link #getItemCount()} - The number of selectable items of the source.</li> 143a0156177cdc809795dd8bc5a19943dd2b6f82b66Svetoslav Ganov * <li>{@link #getCurrentItemIndex()} - The currently selected item index.</li> 14482e236d72ac197d6673d0b4d484fe5f0b9436731Svetoslav Ganov * <li>{@link #getContentDescription()} - The content description of the source.</li> 145d9ee72fddb8be40e414a831fb80458dc48699613Svetoslav Ganov * <li>{@link #getScrollX()} - The offset of the source left edge in pixels 146d9ee72fddb8be40e414a831fb80458dc48699613Svetoslav Ganov * (without descendants of AdapterView).</li> 147d9ee72fddb8be40e414a831fb80458dc48699613Svetoslav Ganov * <li>{@link #getScrollY()} - The offset of the source top edge in pixels 148d9ee72fddb8be40e414a831fb80458dc48699613Svetoslav Ganov * (without descendants of AdapterView).</li> 149d9ee72fddb8be40e414a831fb80458dc48699613Svetoslav Ganov * <li>{@link #getFromIndex()} - The zero based index of the first visible item of the source, 150d9ee72fddb8be40e414a831fb80458dc48699613Svetoslav Ganov * inclusive (for descendants of AdapterView).</li> 151d9ee72fddb8be40e414a831fb80458dc48699613Svetoslav Ganov * <li>{@link #getToIndex()} - The zero based index of the last visible item of the source, 152d9ee72fddb8be40e414a831fb80458dc48699613Svetoslav Ganov * inclusive (for descendants of AdapterView).</li> 153d9ee72fddb8be40e414a831fb80458dc48699613Svetoslav Ganov * <li>{@link #getItemCount()} - The total items of the source 154d9ee72fddb8be40e414a831fb80458dc48699613Svetoslav Ganov * (for descendants of AdapterView).</li> 155a0156177cdc809795dd8bc5a19943dd2b6f82b66Svetoslav Ganov * </ul> 15638e8b4e5bc3c93affdffbc064fd9db5aeccc3e8eSvetoslav Ganov * </p> 15775986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov * <p> 15875986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov * <b>View focused</b> - represents the event of focusing a 15938e8b4e5bc3c93affdffbc064fd9db5aeccc3e8eSvetoslav Ganov * {@link android.view.View}.</br> 16038e8b4e5bc3c93affdffbc064fd9db5aeccc3e8eSvetoslav Ganov * <em>Type:</em> {@link #TYPE_VIEW_FOCUSED}</br> 16138e8b4e5bc3c93affdffbc064fd9db5aeccc3e8eSvetoslav Ganov * <em>Properties:</em></br> 162a0156177cdc809795dd8bc5a19943dd2b6f82b66Svetoslav Ganov * <ul> 16382e236d72ac197d6673d0b4d484fe5f0b9436731Svetoslav Ganov * <li>{@link #getEventType()} - The type of the event.</li> 16438e8b4e5bc3c93affdffbc064fd9db5aeccc3e8eSvetoslav Ganov * <li>{@link #getSource()} - The source info (for registered clients).</li> 165a0156177cdc809795dd8bc5a19943dd2b6f82b66Svetoslav Ganov * <li>{@link #getClassName()} - The class name of the source.</li> 166a0156177cdc809795dd8bc5a19943dd2b6f82b66Svetoslav Ganov * <li>{@link #getPackageName()} - The package name of the source.</li> 167a0156177cdc809795dd8bc5a19943dd2b6f82b66Svetoslav Ganov * <li>{@link #getEventTime()} - The event time.</li> 16882e236d72ac197d6673d0b4d484fe5f0b9436731Svetoslav Ganov * <li>{@link #getText()} - The text of the source's sub-tree.</li> 169a0156177cdc809795dd8bc5a19943dd2b6f82b66Svetoslav Ganov * <li>{@link #isEnabled()} - Whether the source is enabled.</li> 170a0156177cdc809795dd8bc5a19943dd2b6f82b66Svetoslav Ganov * <li>{@link #isPassword()} - Whether the source is password.</li> 171a0156177cdc809795dd8bc5a19943dd2b6f82b66Svetoslav Ganov * <li>{@link #isChecked()} - Whether the source is checked.</li> 17238e8b4e5bc3c93affdffbc064fd9db5aeccc3e8eSvetoslav Ganov * <li>{@link #getItemCount()} - The number of focusable items on the screen.</li> 173a0156177cdc809795dd8bc5a19943dd2b6f82b66Svetoslav Ganov * <li>{@link #getCurrentItemIndex()} - The currently focused item index.</li> 17482e236d72ac197d6673d0b4d484fe5f0b9436731Svetoslav Ganov * <li>{@link #getContentDescription()} - The content description of the source.</li> 175d9ee72fddb8be40e414a831fb80458dc48699613Svetoslav Ganov * <li>{@link #getScrollX()} - The offset of the source left edge in pixels 176d9ee72fddb8be40e414a831fb80458dc48699613Svetoslav Ganov * (without descendants of AdapterView).</li> 177d9ee72fddb8be40e414a831fb80458dc48699613Svetoslav Ganov * <li>{@link #getScrollY()} - The offset of the source top edge in pixels 178d9ee72fddb8be40e414a831fb80458dc48699613Svetoslav Ganov * (without descendants of AdapterView).</li> 179d9ee72fddb8be40e414a831fb80458dc48699613Svetoslav Ganov * <li>{@link #getFromIndex()} - The zero based index of the first visible item of the source, 180d9ee72fddb8be40e414a831fb80458dc48699613Svetoslav Ganov * inclusive (for descendants of AdapterView).</li> 181d9ee72fddb8be40e414a831fb80458dc48699613Svetoslav Ganov * <li>{@link #getToIndex()} - The zero based index of the last visible item of the source, 182d9ee72fddb8be40e414a831fb80458dc48699613Svetoslav Ganov * inclusive (for descendants of AdapterView).</li> 183d9ee72fddb8be40e414a831fb80458dc48699613Svetoslav Ganov * <li>{@link #getItemCount()} - The total items of the source 184d9ee72fddb8be40e414a831fb80458dc48699613Svetoslav Ganov * (for descendants of AdapterView).</li> 185a0156177cdc809795dd8bc5a19943dd2b6f82b66Svetoslav Ganov * </ul> 18638e8b4e5bc3c93affdffbc064fd9db5aeccc3e8eSvetoslav Ganov * </p> 18775986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov * <p> 18875986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov * <b>View text changed</b> - represents the event of changing the text of an 18938e8b4e5bc3c93affdffbc064fd9db5aeccc3e8eSvetoslav Ganov * {@link android.widget.EditText}.</br> 19038e8b4e5bc3c93affdffbc064fd9db5aeccc3e8eSvetoslav Ganov * <em>Type:</em> {@link #TYPE_VIEW_TEXT_CHANGED}</br> 19138e8b4e5bc3c93affdffbc064fd9db5aeccc3e8eSvetoslav Ganov * <em>Properties:</em></br> 192a0156177cdc809795dd8bc5a19943dd2b6f82b66Svetoslav Ganov * <ul> 19382e236d72ac197d6673d0b4d484fe5f0b9436731Svetoslav Ganov * <li>{@link #getEventType()} - The type of the event.</li> 19438e8b4e5bc3c93affdffbc064fd9db5aeccc3e8eSvetoslav Ganov * <li>{@link #getSource()} - The source info (for registered clients).</li> 195a0156177cdc809795dd8bc5a19943dd2b6f82b66Svetoslav Ganov * <li>{@link #getClassName()} - The class name of the source.</li> 196a0156177cdc809795dd8bc5a19943dd2b6f82b66Svetoslav Ganov * <li>{@link #getPackageName()} - The package name of the source.</li> 197a0156177cdc809795dd8bc5a19943dd2b6f82b66Svetoslav Ganov * <li>{@link #getEventTime()} - The event time.</li> 198a0156177cdc809795dd8bc5a19943dd2b6f82b66Svetoslav Ganov * <li>{@link #getText()} - The text of the source.</li> 199a0156177cdc809795dd8bc5a19943dd2b6f82b66Svetoslav Ganov * <li>{@link #isEnabled()} - Whether the source is enabled.</li> 200a0156177cdc809795dd8bc5a19943dd2b6f82b66Svetoslav Ganov * <li>{@link #isPassword()} - Whether the source is password.</li> 201a0156177cdc809795dd8bc5a19943dd2b6f82b66Svetoslav Ganov * <li>{@link #isChecked()} - Whether the source is checked.</li> 202a0156177cdc809795dd8bc5a19943dd2b6f82b66Svetoslav Ganov * <li>{@link #getFromIndex()} - The text change start index.</li> 203a0156177cdc809795dd8bc5a19943dd2b6f82b66Svetoslav Ganov * <li>{@link #getAddedCount()} - The number of added characters.</li> 204a0156177cdc809795dd8bc5a19943dd2b6f82b66Svetoslav Ganov * <li>{@link #getRemovedCount()} - The number of removed characters.</li> 205a0156177cdc809795dd8bc5a19943dd2b6f82b66Svetoslav Ganov * <li>{@link #getBeforeText()} - The text of the source before the change.</li> 20682e236d72ac197d6673d0b4d484fe5f0b9436731Svetoslav Ganov * <li>{@link #getContentDescription()} - The content description of the source.</li> 207a0156177cdc809795dd8bc5a19943dd2b6f82b66Svetoslav Ganov * </ul> 20838e8b4e5bc3c93affdffbc064fd9db5aeccc3e8eSvetoslav Ganov * </p> 209a0156177cdc809795dd8bc5a19943dd2b6f82b66Svetoslav Ganov * <p> 210a0156177cdc809795dd8bc5a19943dd2b6f82b66Svetoslav Ganov * <b>View text selection changed</b> - represents the event of changing the text 21138e8b4e5bc3c93affdffbc064fd9db5aeccc3e8eSvetoslav Ganov * selection of an {@link android.widget.EditText}.</br> 21238e8b4e5bc3c93affdffbc064fd9db5aeccc3e8eSvetoslav Ganov * <em>Type:</em> {@link #TYPE_VIEW_TEXT_SELECTION_CHANGED} </br> 21338e8b4e5bc3c93affdffbc064fd9db5aeccc3e8eSvetoslav Ganov * <em>Properties:</em></br> 214a0156177cdc809795dd8bc5a19943dd2b6f82b66Svetoslav Ganov * <ul> 21582e236d72ac197d6673d0b4d484fe5f0b9436731Svetoslav Ganov * <li>{@link #getEventType()} - The type of the event.</li> 21638e8b4e5bc3c93affdffbc064fd9db5aeccc3e8eSvetoslav Ganov * <li>{@link #getSource()} - The source info (for registered clients).</li> 217a0156177cdc809795dd8bc5a19943dd2b6f82b66Svetoslav Ganov * <li>{@link #getClassName()} - The class name of the source.</li> 218a0156177cdc809795dd8bc5a19943dd2b6f82b66Svetoslav Ganov * <li>{@link #getPackageName()} - The package name of the source.</li> 219a0156177cdc809795dd8bc5a19943dd2b6f82b66Svetoslav Ganov * <li>{@link #getEventTime()} - The event time.</li> 220a0156177cdc809795dd8bc5a19943dd2b6f82b66Svetoslav Ganov * <li>{@link #getText()} - The text of the source.</li> 221a0156177cdc809795dd8bc5a19943dd2b6f82b66Svetoslav Ganov * <li>{@link #isPassword()} - Whether the source is password.</li> 222a0156177cdc809795dd8bc5a19943dd2b6f82b66Svetoslav Ganov * <li>{@link #getFromIndex()} - The selection start index.</li> 223a0156177cdc809795dd8bc5a19943dd2b6f82b66Svetoslav Ganov * <li>{@link #getToIndex()} - The selection end index.</li> 224a0156177cdc809795dd8bc5a19943dd2b6f82b66Svetoslav Ganov * <li>{@link #getItemCount()} - The length of the source text.</li> 22582e236d72ac197d6673d0b4d484fe5f0b9436731Svetoslav Ganov * <li>{@link #isEnabled()} - Whether the source is enabled.</li> 22682e236d72ac197d6673d0b4d484fe5f0b9436731Svetoslav Ganov * <li>{@link #getContentDescription()} - The content description of the source.</li> 22738e8b4e5bc3c93affdffbc064fd9db5aeccc3e8eSvetoslav Ganov * </ul> 22838e8b4e5bc3c93affdffbc064fd9db5aeccc3e8eSvetoslav Ganov * </p> 229a0156177cdc809795dd8bc5a19943dd2b6f82b66Svetoslav Ganov * <p> 230a0156177cdc809795dd8bc5a19943dd2b6f82b66Svetoslav Ganov * <b>View scrolled</b> - represents the event of scrolling a view. If 231a0156177cdc809795dd8bc5a19943dd2b6f82b66Svetoslav Ganov * the source is a descendant of {@link android.widget.AdapterView} the 232a0156177cdc809795dd8bc5a19943dd2b6f82b66Svetoslav Ganov * scroll is reported in terms of visible items - the first visible item, 233a0156177cdc809795dd8bc5a19943dd2b6f82b66Svetoslav Ganov * the last visible item, and the total items - because the the source 23482e236d72ac197d6673d0b4d484fe5f0b9436731Svetoslav Ganov * is unaware of its pixel size since its adapter is responsible for 235a0156177cdc809795dd8bc5a19943dd2b6f82b66Svetoslav Ganov * creating views. In all other cases the scroll is reported as the current 236a0156177cdc809795dd8bc5a19943dd2b6f82b66Svetoslav Ganov * scroll on the X and Y axis respectively plus the height of the source in 23738e8b4e5bc3c93affdffbc064fd9db5aeccc3e8eSvetoslav Ganov * pixels.</br> 23838e8b4e5bc3c93affdffbc064fd9db5aeccc3e8eSvetoslav Ganov * <em>Type:</em> {@link #TYPE_VIEW_SCROLLED}</br> 23938e8b4e5bc3c93affdffbc064fd9db5aeccc3e8eSvetoslav Ganov * <em>Properties:</em></br> 240a0156177cdc809795dd8bc5a19943dd2b6f82b66Svetoslav Ganov * <ul> 24182e236d72ac197d6673d0b4d484fe5f0b9436731Svetoslav Ganov * <li>{@link #getEventType()} - The type of the event.</li> 24238e8b4e5bc3c93affdffbc064fd9db5aeccc3e8eSvetoslav Ganov * <li>{@link #getSource()} - The source info (for registered clients).</li> 243a0156177cdc809795dd8bc5a19943dd2b6f82b66Svetoslav Ganov * <li>{@link #getClassName()} - The class name of the source.</li> 244a0156177cdc809795dd8bc5a19943dd2b6f82b66Svetoslav Ganov * <li>{@link #getPackageName()} - The package name of the source.</li> 245a0156177cdc809795dd8bc5a19943dd2b6f82b66Svetoslav Ganov * <li>{@link #getEventTime()} - The event time.</li> 24682e236d72ac197d6673d0b4d484fe5f0b9436731Svetoslav Ganov * <li>{@link #getText()} - The text of the source's sub-tree.</li> 247a0156177cdc809795dd8bc5a19943dd2b6f82b66Svetoslav Ganov * <li>{@link #isEnabled()} - Whether the source is enabled.</li> 24882e236d72ac197d6673d0b4d484fe5f0b9436731Svetoslav Ganov * <li>{@link #getContentDescription()} - The content description of the source.</li> 249d9ee72fddb8be40e414a831fb80458dc48699613Svetoslav Ganov * <li>{@link #getScrollX()} - The offset of the source left edge in pixels 250d9ee72fddb8be40e414a831fb80458dc48699613Svetoslav Ganov * (without descendants of AdapterView).</li> 251d9ee72fddb8be40e414a831fb80458dc48699613Svetoslav Ganov * <li>{@link #getScrollY()} - The offset of the source top edge in pixels 252d9ee72fddb8be40e414a831fb80458dc48699613Svetoslav Ganov * (without descendants of AdapterView).</li> 253d9ee72fddb8be40e414a831fb80458dc48699613Svetoslav Ganov * <li>{@link #getFromIndex()} - The zero based index of the first visible item of the source, 254d9ee72fddb8be40e414a831fb80458dc48699613Svetoslav Ganov * inclusive (for descendants of AdapterView).</li> 255d9ee72fddb8be40e414a831fb80458dc48699613Svetoslav Ganov * <li>{@link #getToIndex()} - The zero based index of the last visible item of the source, 256d9ee72fddb8be40e414a831fb80458dc48699613Svetoslav Ganov * inclusive (for descendants of AdapterView).</li> 257d9ee72fddb8be40e414a831fb80458dc48699613Svetoslav Ganov * <li>{@link #getItemCount()} - The total items of the source 258d9ee72fddb8be40e414a831fb80458dc48699613Svetoslav Ganov * (for descendants of AdapterView).</li> 25938e8b4e5bc3c93affdffbc064fd9db5aeccc3e8eSvetoslav Ganov * </ul> 26082e236d72ac197d6673d0b4d484fe5f0b9436731Svetoslav Ganov * <em>Note:</em> This event type is not dispatched to descendants though 26182e236d72ac197d6673d0b4d484fe5f0b9436731Svetoslav Ganov * {@link android.view.View#dispatchPopulateAccessibilityEvent(AccessibilityEvent) 26282e236d72ac197d6673d0b4d484fe5f0b9436731Svetoslav Ganov * View.dispatchPopulateAccessibilityEvent(AccessibilityEvent)}, hence the event 26382e236d72ac197d6673d0b4d484fe5f0b9436731Svetoslav Ganov * source {@link android.view.View} and the sub-tree rooted at it will not receive 26482e236d72ac197d6673d0b4d484fe5f0b9436731Svetoslav Ganov * calls to {@link android.view.View#onPopulateAccessibilityEvent(AccessibilityEvent) 26582e236d72ac197d6673d0b4d484fe5f0b9436731Svetoslav Ganov * View.onPopulateAccessibilityEvent(AccessibilityEvent)}. The preferred way to add 26682e236d72ac197d6673d0b4d484fe5f0b9436731Svetoslav Ganov * text content to such events is by setting the 26782e236d72ac197d6673d0b4d484fe5f0b9436731Svetoslav Ganov * {@link android.R.styleable#View_contentDescription contentDescription} of the source 26882e236d72ac197d6673d0b4d484fe5f0b9436731Svetoslav Ganov * view.</br> 26938e8b4e5bc3c93affdffbc064fd9db5aeccc3e8eSvetoslav Ganov * </p> 27075986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov * <p> 27138e8b4e5bc3c93affdffbc064fd9db5aeccc3e8eSvetoslav Ganov * <b>TRANSITION TYPES</b></br> 27238e8b4e5bc3c93affdffbc064fd9db5aeccc3e8eSvetoslav Ganov * </p> 27382e236d72ac197d6673d0b4d484fe5f0b9436731Svetoslav Ganov * <p> 274eeee4d2c01d3c4ed99e4891dbc75c7de69a803faSvetoslav Ganov * <b>Window state changed</b> - represents the event of opening a 27575986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov * {@link android.widget.PopupWindow}, {@link android.view.Menu}, 27638e8b4e5bc3c93affdffbc064fd9db5aeccc3e8eSvetoslav Ganov * {@link android.app.Dialog}, etc.</br> 27738e8b4e5bc3c93affdffbc064fd9db5aeccc3e8eSvetoslav Ganov * <em>Type:</em> {@link #TYPE_WINDOW_STATE_CHANGED}</br> 27838e8b4e5bc3c93affdffbc064fd9db5aeccc3e8eSvetoslav Ganov * <em>Properties:</em></br> 279a0156177cdc809795dd8bc5a19943dd2b6f82b66Svetoslav Ganov * <ul> 28082e236d72ac197d6673d0b4d484fe5f0b9436731Svetoslav Ganov * <li>{@link #getEventType()} - The type of the event.</li> 28138e8b4e5bc3c93affdffbc064fd9db5aeccc3e8eSvetoslav Ganov * <li>{@link #getSource()} - The source info (for registered clients).</li> 282a0156177cdc809795dd8bc5a19943dd2b6f82b66Svetoslav Ganov * <li>{@link #getClassName()} - The class name of the source.</li> 283a0156177cdc809795dd8bc5a19943dd2b6f82b66Svetoslav Ganov * <li>{@link #getPackageName()} - The package name of the source.</li> 284a0156177cdc809795dd8bc5a19943dd2b6f82b66Svetoslav Ganov * <li>{@link #getEventTime()} - The event time.</li> 28582e236d72ac197d6673d0b4d484fe5f0b9436731Svetoslav Ganov * <li>{@link #getText()} - The text of the source's sub-tree.</li> 28682e236d72ac197d6673d0b4d484fe5f0b9436731Svetoslav Ganov * <li>{@link #isEnabled()} - Whether the source is enabled.</li> 287a0156177cdc809795dd8bc5a19943dd2b6f82b66Svetoslav Ganov * </ul> 28838e8b4e5bc3c93affdffbc064fd9db5aeccc3e8eSvetoslav Ganov * </p> 28975986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov * <p> 290eeee4d2c01d3c4ed99e4891dbc75c7de69a803faSvetoslav Ganov * <b>Window content changed</b> - represents the event of change in the 291eeee4d2c01d3c4ed99e4891dbc75c7de69a803faSvetoslav Ganov * content of a window. This change can be adding/removing view, changing 29238e8b4e5bc3c93affdffbc064fd9db5aeccc3e8eSvetoslav Ganov * a view size, etc.</br> 29382e236d72ac197d6673d0b4d484fe5f0b9436731Svetoslav Ganov * </p> 29438e8b4e5bc3c93affdffbc064fd9db5aeccc3e8eSvetoslav Ganov * <p> 29538e8b4e5bc3c93affdffbc064fd9db5aeccc3e8eSvetoslav Ganov * <strong>Note:</strong> This event is fired only for the window source of the 29682e236d72ac197d6673d0b4d484fe5f0b9436731Svetoslav Ganov * last accessibility event different from {@link #TYPE_NOTIFICATION_STATE_CHANGED} 29738e8b4e5bc3c93affdffbc064fd9db5aeccc3e8eSvetoslav Ganov * and its purpose is to notify clients that the content of the user interaction 29882e236d72ac197d6673d0b4d484fe5f0b9436731Svetoslav Ganov * window has changed.</br> 29938e8b4e5bc3c93affdffbc064fd9db5aeccc3e8eSvetoslav Ganov * <em>Type:</em> {@link #TYPE_WINDOW_CONTENT_CHANGED}</br> 30038e8b4e5bc3c93affdffbc064fd9db5aeccc3e8eSvetoslav Ganov * <em>Properties:</em></br> 301a0156177cdc809795dd8bc5a19943dd2b6f82b66Svetoslav Ganov * <ul> 30282e236d72ac197d6673d0b4d484fe5f0b9436731Svetoslav Ganov * <li>{@link #getEventType()} - The type of the event.</li> 30338e8b4e5bc3c93affdffbc064fd9db5aeccc3e8eSvetoslav Ganov * <li>{@link #getSource()} - The source info (for registered clients).</li> 304a0156177cdc809795dd8bc5a19943dd2b6f82b66Svetoslav Ganov * <li>{@link #getClassName()} - The class name of the source.</li> 305a0156177cdc809795dd8bc5a19943dd2b6f82b66Svetoslav Ganov * <li>{@link #getPackageName()} - The package name of the source.</li> 306a0156177cdc809795dd8bc5a19943dd2b6f82b66Svetoslav Ganov * <li>{@link #getEventTime()} - The event time.</li> 30738e8b4e5bc3c93affdffbc064fd9db5aeccc3e8eSvetoslav Ganov * </ul> 30882e236d72ac197d6673d0b4d484fe5f0b9436731Svetoslav Ganov * <em>Note:</em> This event type is not dispatched to descendants though 30982e236d72ac197d6673d0b4d484fe5f0b9436731Svetoslav Ganov * {@link android.view.View#dispatchPopulateAccessibilityEvent(AccessibilityEvent) 31082e236d72ac197d6673d0b4d484fe5f0b9436731Svetoslav Ganov * View.dispatchPopulateAccessibilityEvent(AccessibilityEvent)}, hence the event 31182e236d72ac197d6673d0b4d484fe5f0b9436731Svetoslav Ganov * source {@link android.view.View} and the sub-tree rooted at it will not receive 31282e236d72ac197d6673d0b4d484fe5f0b9436731Svetoslav Ganov * calls to {@link android.view.View#onPopulateAccessibilityEvent(AccessibilityEvent) 31382e236d72ac197d6673d0b4d484fe5f0b9436731Svetoslav Ganov * View.onPopulateAccessibilityEvent(AccessibilityEvent)}. The preferred way to add 31482e236d72ac197d6673d0b4d484fe5f0b9436731Svetoslav Ganov * text content to such events is by setting the 31582e236d72ac197d6673d0b4d484fe5f0b9436731Svetoslav Ganov * {@link android.R.styleable#View_contentDescription contentDescription} of the source 31682e236d72ac197d6673d0b4d484fe5f0b9436731Svetoslav Ganov * view.</br> 31782e236d72ac197d6673d0b4d484fe5f0b9436731Svetoslav Ganov * </p> 318eeee4d2c01d3c4ed99e4891dbc75c7de69a803faSvetoslav Ganov * <p> 31938e8b4e5bc3c93affdffbc064fd9db5aeccc3e8eSvetoslav Ganov * <b>NOTIFICATION TYPES</b></br> 32082e236d72ac197d6673d0b4d484fe5f0b9436731Svetoslav Ganov * </p> 32175986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov * <p> 32238e8b4e5bc3c93affdffbc064fd9db5aeccc3e8eSvetoslav Ganov * <b>Notification state changed</b> - represents the event showing 32382e236d72ac197d6673d0b4d484fe5f0b9436731Svetoslav Ganov * {@link android.app.Notification}.</br> 32438e8b4e5bc3c93affdffbc064fd9db5aeccc3e8eSvetoslav Ganov * <em>Type:</em> {@link #TYPE_NOTIFICATION_STATE_CHANGED}</br> 32538e8b4e5bc3c93affdffbc064fd9db5aeccc3e8eSvetoslav Ganov * <em>Properties:</em></br> 326a0156177cdc809795dd8bc5a19943dd2b6f82b66Svetoslav Ganov * <ul> 32782e236d72ac197d6673d0b4d484fe5f0b9436731Svetoslav Ganov * <li>{@link #getEventType()} - The type of the event.</li> 328a0156177cdc809795dd8bc5a19943dd2b6f82b66Svetoslav Ganov * <li>{@link #getClassName()} - The class name of the source.</li> 329a0156177cdc809795dd8bc5a19943dd2b6f82b66Svetoslav Ganov * <li>{@link #getPackageName()} - The package name of the source.</li> 330a0156177cdc809795dd8bc5a19943dd2b6f82b66Svetoslav Ganov * <li>{@link #getEventTime()} - The event time.</li> 33182e236d72ac197d6673d0b4d484fe5f0b9436731Svetoslav Ganov * <li>{@link #getText()} - The text of the source's sub-tree.</li> 332a0156177cdc809795dd8bc5a19943dd2b6f82b66Svetoslav Ganov * <li>{@link #getParcelableData()} - The posted {@link android.app.Notification}.</li> 33382e236d72ac197d6673d0b4d484fe5f0b9436731Svetoslav Ganov * <li>{@link #getText()} - Text for providing more context.</li> 334a0156177cdc809795dd8bc5a19943dd2b6f82b66Svetoslav Ganov * </ul> 33582e236d72ac197d6673d0b4d484fe5f0b9436731Svetoslav Ganov * <em>Note:</em> This event type is not dispatched to descendants though 33682e236d72ac197d6673d0b4d484fe5f0b9436731Svetoslav Ganov * {@link android.view.View#dispatchPopulateAccessibilityEvent(AccessibilityEvent) 33782e236d72ac197d6673d0b4d484fe5f0b9436731Svetoslav Ganov * View.dispatchPopulateAccessibilityEvent(AccessibilityEvent)}, hence the event 33882e236d72ac197d6673d0b4d484fe5f0b9436731Svetoslav Ganov * source {@link android.view.View} and the sub-tree rooted at it will not receive 33982e236d72ac197d6673d0b4d484fe5f0b9436731Svetoslav Ganov * calls to {@link android.view.View#onPopulateAccessibilityEvent(AccessibilityEvent) 34082e236d72ac197d6673d0b4d484fe5f0b9436731Svetoslav Ganov * View.onPopulateAccessibilityEvent(AccessibilityEvent)}. The preferred way to add 34182e236d72ac197d6673d0b4d484fe5f0b9436731Svetoslav Ganov * text content to such events is by setting the 34282e236d72ac197d6673d0b4d484fe5f0b9436731Svetoslav Ganov * {@link android.R.styleable#View_contentDescription contentDescription} of the source 34382e236d72ac197d6673d0b4d484fe5f0b9436731Svetoslav Ganov * view.</br> 34482e236d72ac197d6673d0b4d484fe5f0b9436731Svetoslav Ganov * </p> 34582e236d72ac197d6673d0b4d484fe5f0b9436731Svetoslav Ganov * <p> 34682e236d72ac197d6673d0b4d484fe5f0b9436731Svetoslav Ganov * <b>EXPLORATION TYPES</b></br> 34782e236d72ac197d6673d0b4d484fe5f0b9436731Svetoslav Ganov * </p> 34882e236d72ac197d6673d0b4d484fe5f0b9436731Svetoslav Ganov * <p> 34982e236d72ac197d6673d0b4d484fe5f0b9436731Svetoslav Ganov * <b>View hover enter</b> - represents the event of beginning to hover 35082e236d72ac197d6673d0b4d484fe5f0b9436731Svetoslav Ganov * over a {@link android.view.View}. The hover may be generated via 35182e236d72ac197d6673d0b4d484fe5f0b9436731Svetoslav Ganov * exploring the screen by touch or via a pointing device.</br> 35282e236d72ac197d6673d0b4d484fe5f0b9436731Svetoslav Ganov * <em>Type:</em> {@link #TYPE_VIEW_HOVER_ENTER}</br> 35382e236d72ac197d6673d0b4d484fe5f0b9436731Svetoslav Ganov * <em>Properties:</em></br> 35482e236d72ac197d6673d0b4d484fe5f0b9436731Svetoslav Ganov * <ul> 35582e236d72ac197d6673d0b4d484fe5f0b9436731Svetoslav Ganov * <li>{@link #getEventType()} - The type of the event.</li> 35682e236d72ac197d6673d0b4d484fe5f0b9436731Svetoslav Ganov * <li>{@link #getSource()} - The source info (for registered clients).</li> 35782e236d72ac197d6673d0b4d484fe5f0b9436731Svetoslav Ganov * <li>{@link #getClassName()} - The class name of the source.</li> 35882e236d72ac197d6673d0b4d484fe5f0b9436731Svetoslav Ganov * <li>{@link #getPackageName()} - The package name of the source.</li> 35982e236d72ac197d6673d0b4d484fe5f0b9436731Svetoslav Ganov * <li>{@link #getEventTime()} - The event time.</li> 36082e236d72ac197d6673d0b4d484fe5f0b9436731Svetoslav Ganov * <li>{@link #getText()} - The text of the source's sub-tree.</li> 36182e236d72ac197d6673d0b4d484fe5f0b9436731Svetoslav Ganov * <li>{@link #isEnabled()} - Whether the source is enabled.</li> 36282e236d72ac197d6673d0b4d484fe5f0b9436731Svetoslav Ganov * <li>{@link #getContentDescription()} - The content description of the source.</li> 363d9ee72fddb8be40e414a831fb80458dc48699613Svetoslav Ganov * <li>{@link #getScrollX()} - The offset of the source left edge in pixels 364d9ee72fddb8be40e414a831fb80458dc48699613Svetoslav Ganov * (without descendants of AdapterView).</li> 365d9ee72fddb8be40e414a831fb80458dc48699613Svetoslav Ganov * <li>{@link #getScrollY()} - The offset of the source top edge in pixels 366d9ee72fddb8be40e414a831fb80458dc48699613Svetoslav Ganov * (without descendants of AdapterView).</li> 367d9ee72fddb8be40e414a831fb80458dc48699613Svetoslav Ganov * <li>{@link #getFromIndex()} - The zero based index of the first visible item of the source, 368d9ee72fddb8be40e414a831fb80458dc48699613Svetoslav Ganov * inclusive (for descendants of AdapterView).</li> 369d9ee72fddb8be40e414a831fb80458dc48699613Svetoslav Ganov * <li>{@link #getToIndex()} - The zero based index of the last visible item of the source, 370d9ee72fddb8be40e414a831fb80458dc48699613Svetoslav Ganov * inclusive (for descendants of AdapterView).</li> 371d9ee72fddb8be40e414a831fb80458dc48699613Svetoslav Ganov * <li>{@link #getItemCount()} - The total items of the source 372d9ee72fddb8be40e414a831fb80458dc48699613Svetoslav Ganov * (for descendants of AdapterView).</li> 37382e236d72ac197d6673d0b4d484fe5f0b9436731Svetoslav Ganov * </ul> 37482e236d72ac197d6673d0b4d484fe5f0b9436731Svetoslav Ganov * </p> 37582e236d72ac197d6673d0b4d484fe5f0b9436731Svetoslav Ganov * <b>View hover exit</b> - represents the event of stopping 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_EXIT}</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 * <p> 40282e236d72ac197d6673d0b4d484fe5f0b9436731Svetoslav Ganov * <b>Touch exploration gesture start</b> - represents the event of starting a touch 40382e236d72ac197d6673d0b4d484fe5f0b9436731Svetoslav Ganov * exploring gesture.</br> 40482e236d72ac197d6673d0b4d484fe5f0b9436731Svetoslav Ganov * <em>Type:</em> {@link #TYPE_TOUCH_EXPLORATION_GESTURE_START}</br> 40582e236d72ac197d6673d0b4d484fe5f0b9436731Svetoslav Ganov * <em>Properties:</em></br> 40682e236d72ac197d6673d0b4d484fe5f0b9436731Svetoslav Ganov * <ul> 40782e236d72ac197d6673d0b4d484fe5f0b9436731Svetoslav Ganov * <li>{@link #getEventType()} - The type of the event.</li> 40882e236d72ac197d6673d0b4d484fe5f0b9436731Svetoslav Ganov * </ul> 40982e236d72ac197d6673d0b4d484fe5f0b9436731Svetoslav Ganov * <em>Note:</em> This event type is not dispatched to descendants though 41082e236d72ac197d6673d0b4d484fe5f0b9436731Svetoslav Ganov * {@link android.view.View#dispatchPopulateAccessibilityEvent(AccessibilityEvent) 41182e236d72ac197d6673d0b4d484fe5f0b9436731Svetoslav Ganov * View.dispatchPopulateAccessibilityEvent(AccessibilityEvent)}, hence the event 41282e236d72ac197d6673d0b4d484fe5f0b9436731Svetoslav Ganov * source {@link android.view.View} and the sub-tree rooted at it will not receive 41382e236d72ac197d6673d0b4d484fe5f0b9436731Svetoslav Ganov * calls to {@link android.view.View#onPopulateAccessibilityEvent(AccessibilityEvent) 41482e236d72ac197d6673d0b4d484fe5f0b9436731Svetoslav Ganov * View.onPopulateAccessibilityEvent(AccessibilityEvent)}. The preferred way to add 41582e236d72ac197d6673d0b4d484fe5f0b9436731Svetoslav Ganov * text content to such events is by setting the 41682e236d72ac197d6673d0b4d484fe5f0b9436731Svetoslav Ganov * {@link android.R.styleable#View_contentDescription contentDescription} of the source 41782e236d72ac197d6673d0b4d484fe5f0b9436731Svetoslav Ganov * view.</br> 41882e236d72ac197d6673d0b4d484fe5f0b9436731Svetoslav Ganov * </p> 41982e236d72ac197d6673d0b4d484fe5f0b9436731Svetoslav Ganov * <p> 42082e236d72ac197d6673d0b4d484fe5f0b9436731Svetoslav Ganov * <b>Touch exploration gesture end</b> - represents the event of ending a touch 42182e236d72ac197d6673d0b4d484fe5f0b9436731Svetoslav Ganov * exploring gesture.</br> 42282e236d72ac197d6673d0b4d484fe5f0b9436731Svetoslav Ganov * <em>Type:</em> {@link #TYPE_TOUCH_EXPLORATION_GESTURE_END}</br> 42382e236d72ac197d6673d0b4d484fe5f0b9436731Svetoslav Ganov * <em>Properties:</em></br> 42482e236d72ac197d6673d0b4d484fe5f0b9436731Svetoslav Ganov * <ul> 42582e236d72ac197d6673d0b4d484fe5f0b9436731Svetoslav Ganov * <li>{@link #getEventType()} - The type of the event.</li> 42682e236d72ac197d6673d0b4d484fe5f0b9436731Svetoslav Ganov * </ul> 42782e236d72ac197d6673d0b4d484fe5f0b9436731Svetoslav Ganov * <em>Note:</em> This event type is not dispatched to descendants though 42882e236d72ac197d6673d0b4d484fe5f0b9436731Svetoslav Ganov * {@link android.view.View#dispatchPopulateAccessibilityEvent(AccessibilityEvent) 42982e236d72ac197d6673d0b4d484fe5f0b9436731Svetoslav Ganov * View.dispatchPopulateAccessibilityEvent(AccessibilityEvent)}, hence the event 43082e236d72ac197d6673d0b4d484fe5f0b9436731Svetoslav Ganov * source {@link android.view.View} and the sub-tree rooted at it will not receive 43182e236d72ac197d6673d0b4d484fe5f0b9436731Svetoslav Ganov * calls to {@link android.view.View#onPopulateAccessibilityEvent(AccessibilityEvent) 43282e236d72ac197d6673d0b4d484fe5f0b9436731Svetoslav Ganov * View.onPopulateAccessibilityEvent(AccessibilityEvent)}. The preferred way to add 43382e236d72ac197d6673d0b4d484fe5f0b9436731Svetoslav Ganov * text content to such events is by setting the 43482e236d72ac197d6673d0b4d484fe5f0b9436731Svetoslav Ganov * {@link android.R.styleable#View_contentDescription contentDescription} of the source 43582e236d72ac197d6673d0b4d484fe5f0b9436731Svetoslav Ganov * view.</br> 43638e8b4e5bc3c93affdffbc064fd9db5aeccc3e8eSvetoslav Ganov * </p> 43775986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov * <p> 43851ab90cab1609cf0ddd2dfe5a660f020d823d4d5Svetoslav Ganov * <b>MISCELLANEOUS TYPES</b></br> 43951ab90cab1609cf0ddd2dfe5a660f020d823d4d5Svetoslav Ganov * </p> 44051ab90cab1609cf0ddd2dfe5a660f020d823d4d5Svetoslav Ganov * <p> 44151ab90cab1609cf0ddd2dfe5a660f020d823d4d5Svetoslav Ganov * <b>Announcement</b> - represents the event of an application making an 44251ab90cab1609cf0ddd2dfe5a660f020d823d4d5Svetoslav Ganov * announcement. Usually this announcement is related to some sort of a context 44351ab90cab1609cf0ddd2dfe5a660f020d823d4d5Svetoslav Ganov * change for which none of the events representing UI transitions is a good fit. 44451ab90cab1609cf0ddd2dfe5a660f020d823d4d5Svetoslav Ganov * For example, announcing a new page in a book.</br> 44551ab90cab1609cf0ddd2dfe5a660f020d823d4d5Svetoslav Ganov * <em>Type:</em> {@link #TYPE_ANNOUNCEMENT}</br> 44651ab90cab1609cf0ddd2dfe5a660f020d823d4d5Svetoslav Ganov * <em>Properties:</em></br> 44751ab90cab1609cf0ddd2dfe5a660f020d823d4d5Svetoslav Ganov * <ul> 44851ab90cab1609cf0ddd2dfe5a660f020d823d4d5Svetoslav Ganov * <li>{@link #getEventType()} - The type of the event.</li> 44951ab90cab1609cf0ddd2dfe5a660f020d823d4d5Svetoslav Ganov * <li>{@link #getSource()} - The source info (for registered clients).</li> 45051ab90cab1609cf0ddd2dfe5a660f020d823d4d5Svetoslav Ganov * <li>{@link #getClassName()} - The class name of the source.</li> 45151ab90cab1609cf0ddd2dfe5a660f020d823d4d5Svetoslav Ganov * <li>{@link #getPackageName()} - The package name of the source.</li> 45251ab90cab1609cf0ddd2dfe5a660f020d823d4d5Svetoslav Ganov * <li>{@link #getEventTime()} - The event time.</li> 45351ab90cab1609cf0ddd2dfe5a660f020d823d4d5Svetoslav Ganov * <li>{@link #getText()} - The text of the announcement.</li> 45451ab90cab1609cf0ddd2dfe5a660f020d823d4d5Svetoslav Ganov * <li>{@link #isEnabled()} - Whether the source is enabled.</li> 45551ab90cab1609cf0ddd2dfe5a660f020d823d4d5Svetoslav Ganov * </ul> 45651ab90cab1609cf0ddd2dfe5a660f020d823d4d5Svetoslav Ganov * </p> 45751ab90cab1609cf0ddd2dfe5a660f020d823d4d5Svetoslav Ganov * <p> 45875986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov * <b>Security note</b> 45975986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov * <p> 46038e8b4e5bc3c93affdffbc064fd9db5aeccc3e8eSvetoslav Ganov * Since an event contains the text of its source privacy can be compromised by leaking 46175986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov * sensitive information such as passwords. To address this issue any event fired in response 46275986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov * to manipulation of a PASSWORD field does NOT CONTAIN the text of the password. 46382e236d72ac197d6673d0b4d484fe5f0b9436731Svetoslav Ganov * </p> 46475986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov * 46575986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov * @see android.view.accessibility.AccessibilityManager 46675986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov * @see android.accessibilityservice.AccessibilityService 46738e8b4e5bc3c93affdffbc064fd9db5aeccc3e8eSvetoslav Ganov * @see AccessibilityNodeInfo 46875986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov */ 469736c2756bf3c14ae9fef7255c119057f7a2be1edSvetoslav Ganovpublic final class AccessibilityEvent extends AccessibilityRecord implements Parcelable { 4708643aa0179e598e78d938c59035389054535a229Svetoslav Ganov private static final boolean DEBUG = false; 47175986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov 47275986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov /** 47375986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov * Invalid selection/focus position. 47475986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov * 47575986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov * @see #getCurrentItemIndex() 47675986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov */ 47775986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov public static final int INVALID_POSITION = -1; 47875986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov 47975986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov /** 48075986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov * Maximum length of the text fields. 48175986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov * 48275986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov * @see #getBeforeText() 48375986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov * @see #getText() 484c0a8cd10a5829bf4e94ee073ba6f553128e9d8e9Svetoslav Ganov * </br> 485c0a8cd10a5829bf4e94ee073ba6f553128e9d8e9Svetoslav Ganov * Note: This constant is no longer needed since there 486c0a8cd10a5829bf4e94ee073ba6f553128e9d8e9Svetoslav Ganov * is no limit on the length of text that is contained 487c0a8cd10a5829bf4e94ee073ba6f553128e9d8e9Svetoslav Ganov * in an accessibility event anymore. 48875986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov */ 489c0a8cd10a5829bf4e94ee073ba6f553128e9d8e9Svetoslav Ganov @Deprecated 49075986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov public static final int MAX_TEXT_LENGTH = 500; 49175986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov 49275986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov /** 49375986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov * Represents the event of clicking on a {@link android.view.View} like 49475986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov * {@link android.widget.Button}, {@link android.widget.CompoundButton}, etc. 49575986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov */ 49675986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov public static final int TYPE_VIEW_CLICKED = 0x00000001; 49775986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov 49875986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov /** 49975986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov * Represents the event of long clicking on a {@link android.view.View} like 50075986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov * {@link android.widget.Button}, {@link android.widget.CompoundButton}, etc. 50175986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov */ 50275986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov public static final int TYPE_VIEW_LONG_CLICKED = 0x00000002; 50375986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov 50475986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov /** 50575986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov * Represents the event of selecting an item usually in the context of an 50675986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov * {@link android.widget.AdapterView}. 50775986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov */ 50875986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov public static final int TYPE_VIEW_SELECTED = 0x00000004; 50975986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov 51075986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov /** 5114213804541a8b05cd0587b138a2fd9a3b7fd9350Svetoslav Ganov * Represents the event of setting input focus of a {@link android.view.View}. 51275986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov */ 51375986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov public static final int TYPE_VIEW_FOCUSED = 0x00000008; 51475986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov 51575986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov /** 51675986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov * Represents the event of changing the text of an {@link android.widget.EditText}. 51775986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov */ 51875986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov public static final int TYPE_VIEW_TEXT_CHANGED = 0x00000010; 51975986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov 52075986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov /** 52138e8b4e5bc3c93affdffbc064fd9db5aeccc3e8eSvetoslav Ganov * Represents the event of opening a {@link android.widget.PopupWindow}, 52275986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov * {@link android.view.Menu}, {@link android.app.Dialog}, etc. 52375986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov */ 52475986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov public static final int TYPE_WINDOW_STATE_CHANGED = 0x00000020; 52575986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov 52675986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov /** 52738e8b4e5bc3c93affdffbc064fd9db5aeccc3e8eSvetoslav Ganov * Represents the event showing a {@link android.app.Notification}. 52875986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov */ 52975986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov public static final int TYPE_NOTIFICATION_STATE_CHANGED = 0x00000040; 53075986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov 53175986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov /** 532736c2756bf3c14ae9fef7255c119057f7a2be1edSvetoslav Ganov * Represents the event of a hover enter over a {@link android.view.View}. 533736c2756bf3c14ae9fef7255c119057f7a2be1edSvetoslav Ganov */ 534736c2756bf3c14ae9fef7255c119057f7a2be1edSvetoslav Ganov public static final int TYPE_VIEW_HOVER_ENTER = 0x00000080; 535736c2756bf3c14ae9fef7255c119057f7a2be1edSvetoslav Ganov 536736c2756bf3c14ae9fef7255c119057f7a2be1edSvetoslav Ganov /** 537736c2756bf3c14ae9fef7255c119057f7a2be1edSvetoslav Ganov * Represents the event of a hover exit over a {@link android.view.View}. 538736c2756bf3c14ae9fef7255c119057f7a2be1edSvetoslav Ganov */ 539736c2756bf3c14ae9fef7255c119057f7a2be1edSvetoslav Ganov public static final int TYPE_VIEW_HOVER_EXIT = 0x00000100; 540736c2756bf3c14ae9fef7255c119057f7a2be1edSvetoslav Ganov 541736c2756bf3c14ae9fef7255c119057f7a2be1edSvetoslav Ganov /** 542736c2756bf3c14ae9fef7255c119057f7a2be1edSvetoslav Ganov * Represents the event of starting a touch exploration gesture. 543736c2756bf3c14ae9fef7255c119057f7a2be1edSvetoslav Ganov */ 544736c2756bf3c14ae9fef7255c119057f7a2be1edSvetoslav Ganov public static final int TYPE_TOUCH_EXPLORATION_GESTURE_START = 0x00000200; 545736c2756bf3c14ae9fef7255c119057f7a2be1edSvetoslav Ganov 546736c2756bf3c14ae9fef7255c119057f7a2be1edSvetoslav Ganov /** 547736c2756bf3c14ae9fef7255c119057f7a2be1edSvetoslav Ganov * Represents the event of ending a touch exploration gesture. 548736c2756bf3c14ae9fef7255c119057f7a2be1edSvetoslav Ganov */ 549736c2756bf3c14ae9fef7255c119057f7a2be1edSvetoslav Ganov public static final int TYPE_TOUCH_EXPLORATION_GESTURE_END = 0x00000400; 550736c2756bf3c14ae9fef7255c119057f7a2be1edSvetoslav Ganov 551736c2756bf3c14ae9fef7255c119057f7a2be1edSvetoslav Ganov /** 5524213804541a8b05cd0587b138a2fd9a3b7fd9350Svetoslav Ganov * Represents the event of changing the content of a window and more 5534213804541a8b05cd0587b138a2fd9a3b7fd9350Svetoslav Ganov * specifically the sub-tree rooted at the event's source. 554eeee4d2c01d3c4ed99e4891dbc75c7de69a803faSvetoslav Ganov */ 555eeee4d2c01d3c4ed99e4891dbc75c7de69a803faSvetoslav Ganov public static final int TYPE_WINDOW_CONTENT_CHANGED = 0x00000800; 556eeee4d2c01d3c4ed99e4891dbc75c7de69a803faSvetoslav Ganov 557eeee4d2c01d3c4ed99e4891dbc75c7de69a803faSvetoslav Ganov /** 558a0156177cdc809795dd8bc5a19943dd2b6f82b66Svetoslav Ganov * Represents the event of scrolling a view. 559a0156177cdc809795dd8bc5a19943dd2b6f82b66Svetoslav Ganov */ 560a0156177cdc809795dd8bc5a19943dd2b6f82b66Svetoslav Ganov public static final int TYPE_VIEW_SCROLLED = 0x00001000; 561a0156177cdc809795dd8bc5a19943dd2b6f82b66Svetoslav Ganov 562a0156177cdc809795dd8bc5a19943dd2b6f82b66Svetoslav Ganov /** 563a0156177cdc809795dd8bc5a19943dd2b6f82b66Svetoslav Ganov * Represents the event of changing the selection in an {@link android.widget.EditText}. 564a0156177cdc809795dd8bc5a19943dd2b6f82b66Svetoslav Ganov */ 565a0156177cdc809795dd8bc5a19943dd2b6f82b66Svetoslav Ganov public static final int TYPE_VIEW_TEXT_SELECTION_CHANGED = 0x00002000; 566a0156177cdc809795dd8bc5a19943dd2b6f82b66Svetoslav Ganov 567a0156177cdc809795dd8bc5a19943dd2b6f82b66Svetoslav Ganov /** 56851ab90cab1609cf0ddd2dfe5a660f020d823d4d5Svetoslav Ganov * Represents the event of an application making an announcement. 56951ab90cab1609cf0ddd2dfe5a660f020d823d4d5Svetoslav Ganov */ 57051ab90cab1609cf0ddd2dfe5a660f020d823d4d5Svetoslav Ganov public static final int TYPE_ANNOUNCEMENT = 0x00004000; 57151ab90cab1609cf0ddd2dfe5a660f020d823d4d5Svetoslav Ganov 57251ab90cab1609cf0ddd2dfe5a660f020d823d4d5Svetoslav Ganov /** 5734213804541a8b05cd0587b138a2fd9a3b7fd9350Svetoslav Ganov * Represents the event of gaining accessibility focus. 5744213804541a8b05cd0587b138a2fd9a3b7fd9350Svetoslav Ganov */ 5754213804541a8b05cd0587b138a2fd9a3b7fd9350Svetoslav Ganov public static final int TYPE_VIEW_ACCESSIBILITY_FOCUSED = 0x00008000; 5764213804541a8b05cd0587b138a2fd9a3b7fd9350Svetoslav Ganov 5774213804541a8b05cd0587b138a2fd9a3b7fd9350Svetoslav Ganov /** 5784213804541a8b05cd0587b138a2fd9a3b7fd9350Svetoslav Ganov * Represents the event of clearing accessibility focus. 5794213804541a8b05cd0587b138a2fd9a3b7fd9350Svetoslav Ganov */ 5804213804541a8b05cd0587b138a2fd9a3b7fd9350Svetoslav Ganov public static final int TYPE_VIEW_ACCESSIBILITY_FOCUS_CLEARED = 0x00010000; 5814213804541a8b05cd0587b138a2fd9a3b7fd9350Svetoslav Ganov 5824213804541a8b05cd0587b138a2fd9a3b7fd9350Svetoslav Ganov /** 58375986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov * Mask for {@link AccessibilityEvent} all types. 58475986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov * 58575986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov * @see #TYPE_VIEW_CLICKED 58675986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov * @see #TYPE_VIEW_LONG_CLICKED 58775986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov * @see #TYPE_VIEW_SELECTED 58875986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov * @see #TYPE_VIEW_FOCUSED 58975986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov * @see #TYPE_VIEW_TEXT_CHANGED 59075986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov * @see #TYPE_WINDOW_STATE_CHANGED 59175986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov * @see #TYPE_NOTIFICATION_STATE_CHANGED 59238e8b4e5bc3c93affdffbc064fd9db5aeccc3e8eSvetoslav Ganov * @see #TYPE_VIEW_HOVER_ENTER 59338e8b4e5bc3c93affdffbc064fd9db5aeccc3e8eSvetoslav Ganov * @see #TYPE_VIEW_HOVER_EXIT 59438e8b4e5bc3c93affdffbc064fd9db5aeccc3e8eSvetoslav Ganov * @see #TYPE_TOUCH_EXPLORATION_GESTURE_START 59538e8b4e5bc3c93affdffbc064fd9db5aeccc3e8eSvetoslav Ganov * @see #TYPE_TOUCH_EXPLORATION_GESTURE_END 59638e8b4e5bc3c93affdffbc064fd9db5aeccc3e8eSvetoslav Ganov * @see #TYPE_WINDOW_CONTENT_CHANGED 59738e8b4e5bc3c93affdffbc064fd9db5aeccc3e8eSvetoslav Ganov * @see #TYPE_VIEW_SCROLLED 59838e8b4e5bc3c93affdffbc064fd9db5aeccc3e8eSvetoslav Ganov * @see #TYPE_VIEW_TEXT_SELECTION_CHANGED 59951ab90cab1609cf0ddd2dfe5a660f020d823d4d5Svetoslav Ganov * @see #TYPE_ANNOUNCEMENT 60075986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov */ 60175986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov public static final int TYPES_ALL_MASK = 0xFFFFFFFF; 60275986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov 603736c2756bf3c14ae9fef7255c119057f7a2be1edSvetoslav Ganov private static final int MAX_POOL_SIZE = 10; 604887e1a17eb9b12448f5929791b564565b2665aabSvetoslav Ganov private static final Object sPoolLock = new Object(); 60575986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov private static AccessibilityEvent sPool; 60675986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov private static int sPoolSize; 60775986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov private AccessibilityEvent mNext; 608736c2756bf3c14ae9fef7255c119057f7a2be1edSvetoslav Ganov private boolean mIsInPool; 60975986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov 61075986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov private int mEventType; 6113fb3d7c4e756bd32d5abde0abca9ab52d559bc84Adam Powell private CharSequence mPackageName; 612736c2756bf3c14ae9fef7255c119057f7a2be1edSvetoslav Ganov private long mEventTime; 6133fb3d7c4e756bd32d5abde0abca9ab52d559bc84Adam Powell 614736c2756bf3c14ae9fef7255c119057f7a2be1edSvetoslav Ganov private final ArrayList<AccessibilityRecord> mRecords = new ArrayList<AccessibilityRecord>(); 61575986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov 61675986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov /* 61775986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov * Hide constructor from clients. 61875986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov */ 61975986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov private AccessibilityEvent() { 6208643aa0179e598e78d938c59035389054535a229Svetoslav Ganov } 62175986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov 6228643aa0179e598e78d938c59035389054535a229Svetoslav Ganov /** 6238643aa0179e598e78d938c59035389054535a229Svetoslav Ganov * Initialize an event from another one. 6248643aa0179e598e78d938c59035389054535a229Svetoslav Ganov * 6258643aa0179e598e78d938c59035389054535a229Svetoslav Ganov * @param event The event to initialize from. 6268643aa0179e598e78d938c59035389054535a229Svetoslav Ganov */ 6278643aa0179e598e78d938c59035389054535a229Svetoslav Ganov void init(AccessibilityEvent event) { 6288643aa0179e598e78d938c59035389054535a229Svetoslav Ganov super.init(event); 6298643aa0179e598e78d938c59035389054535a229Svetoslav Ganov mEventType = event.mEventType; 6308643aa0179e598e78d938c59035389054535a229Svetoslav Ganov mEventTime = event.mEventTime; 6318643aa0179e598e78d938c59035389054535a229Svetoslav Ganov mPackageName = event.mPackageName; 632eeee4d2c01d3c4ed99e4891dbc75c7de69a803faSvetoslav Ganov } 633eeee4d2c01d3c4ed99e4891dbc75c7de69a803faSvetoslav Ganov 634eeee4d2c01d3c4ed99e4891dbc75c7de69a803faSvetoslav Ganov /** 635eeee4d2c01d3c4ed99e4891dbc75c7de69a803faSvetoslav Ganov * Sets if this instance is sealed. 636eeee4d2c01d3c4ed99e4891dbc75c7de69a803faSvetoslav Ganov * 637eeee4d2c01d3c4ed99e4891dbc75c7de69a803faSvetoslav Ganov * @param sealed Whether is sealed. 638eeee4d2c01d3c4ed99e4891dbc75c7de69a803faSvetoslav Ganov * 639eeee4d2c01d3c4ed99e4891dbc75c7de69a803faSvetoslav Ganov * @hide 640eeee4d2c01d3c4ed99e4891dbc75c7de69a803faSvetoslav Ganov */ 641eeee4d2c01d3c4ed99e4891dbc75c7de69a803faSvetoslav Ganov @Override 642eeee4d2c01d3c4ed99e4891dbc75c7de69a803faSvetoslav Ganov public void setSealed(boolean sealed) { 643eeee4d2c01d3c4ed99e4891dbc75c7de69a803faSvetoslav Ganov super.setSealed(sealed); 644eeee4d2c01d3c4ed99e4891dbc75c7de69a803faSvetoslav Ganov List<AccessibilityRecord> records = mRecords; 645eeee4d2c01d3c4ed99e4891dbc75c7de69a803faSvetoslav Ganov final int recordCount = records.size(); 646eeee4d2c01d3c4ed99e4891dbc75c7de69a803faSvetoslav Ganov for (int i = 0; i < recordCount; i++) { 647eeee4d2c01d3c4ed99e4891dbc75c7de69a803faSvetoslav Ganov AccessibilityRecord record = records.get(i); 648eeee4d2c01d3c4ed99e4891dbc75c7de69a803faSvetoslav Ganov record.setSealed(sealed); 649eeee4d2c01d3c4ed99e4891dbc75c7de69a803faSvetoslav Ganov } 65075986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov } 65175986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov 65275986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov /** 653736c2756bf3c14ae9fef7255c119057f7a2be1edSvetoslav Ganov * Gets the number of records contained in the event. 65475986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov * 655736c2756bf3c14ae9fef7255c119057f7a2be1edSvetoslav Ganov * @return The number of records. 65675986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov */ 657736c2756bf3c14ae9fef7255c119057f7a2be1edSvetoslav Ganov public int getRecordCount() { 658736c2756bf3c14ae9fef7255c119057f7a2be1edSvetoslav Ganov return mRecords.size(); 65975986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov } 66075986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov 66175986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov /** 662736c2756bf3c14ae9fef7255c119057f7a2be1edSvetoslav Ganov * Appends an {@link AccessibilityRecord} to the end of event records. 66375986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov * 664736c2756bf3c14ae9fef7255c119057f7a2be1edSvetoslav Ganov * @param record The record to append. 6658643aa0179e598e78d938c59035389054535a229Svetoslav Ganov * 6668643aa0179e598e78d938c59035389054535a229Svetoslav Ganov * @throws IllegalStateException If called from an AccessibilityService. 66775986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov */ 668736c2756bf3c14ae9fef7255c119057f7a2be1edSvetoslav Ganov public void appendRecord(AccessibilityRecord record) { 6698643aa0179e598e78d938c59035389054535a229Svetoslav Ganov enforceNotSealed(); 670736c2756bf3c14ae9fef7255c119057f7a2be1edSvetoslav Ganov mRecords.add(record); 67175986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov } 67275986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov 67375986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov /** 67438e8b4e5bc3c93affdffbc064fd9db5aeccc3e8eSvetoslav Ganov * Gets the record at a given index. 67575986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov * 676736c2756bf3c14ae9fef7255c119057f7a2be1edSvetoslav Ganov * @param index The index. 67738e8b4e5bc3c93affdffbc064fd9db5aeccc3e8eSvetoslav Ganov * @return The record at the specified index. 67875986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov */ 679736c2756bf3c14ae9fef7255c119057f7a2be1edSvetoslav Ganov public AccessibilityRecord getRecord(int index) { 680736c2756bf3c14ae9fef7255c119057f7a2be1edSvetoslav Ganov return mRecords.get(index); 68175986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov } 68275986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov 68375986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov /** 68475986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov * Gets the event type. 68575986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov * 68675986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov * @return The event type. 68775986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov */ 68875986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov public int getEventType() { 68975986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov return mEventType; 69075986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov } 69175986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov 69275986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov /** 69375986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov * Sets the event type. 69475986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov * 69575986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov * @param eventType The event type. 6968643aa0179e598e78d938c59035389054535a229Svetoslav Ganov * 6978643aa0179e598e78d938c59035389054535a229Svetoslav Ganov * @throws IllegalStateException If called from an AccessibilityService. 69875986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov */ 69975986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov public void setEventType(int eventType) { 7008643aa0179e598e78d938c59035389054535a229Svetoslav Ganov enforceNotSealed(); 70175986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov mEventType = eventType; 70275986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov } 70375986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov 70475986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov /** 70575986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov * Gets the time in which this event was sent. 70675986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov * 70775986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov * @return The event time. 70875986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov */ 70975986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov public long getEventTime() { 71075986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov return mEventTime; 71175986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov } 71275986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov 71375986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov /** 71475986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov * Sets the time in which this event was sent. 71575986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov * 71675986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov * @param eventTime The event time. 7178643aa0179e598e78d938c59035389054535a229Svetoslav Ganov * 7188643aa0179e598e78d938c59035389054535a229Svetoslav Ganov * @throws IllegalStateException If called from an AccessibilityService. 71975986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov */ 72075986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov public void setEventTime(long eventTime) { 7218643aa0179e598e78d938c59035389054535a229Svetoslav Ganov enforceNotSealed(); 72275986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov mEventTime = eventTime; 72375986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov } 72475986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov 72575986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov /** 72675986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov * Gets the package name of the source. 72775986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov * 72875986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov * @return The package name. 72975986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov */ 73075986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov public CharSequence getPackageName() { 73175986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov return mPackageName; 73275986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov } 73375986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov 73475986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov /** 73575986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov * Sets the package name of the source. 73675986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov * 73775986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov * @param packageName The package name. 7388643aa0179e598e78d938c59035389054535a229Svetoslav Ganov * 7398643aa0179e598e78d938c59035389054535a229Svetoslav Ganov * @throws IllegalStateException If called from an AccessibilityService. 74075986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov */ 74175986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov public void setPackageName(CharSequence packageName) { 7428643aa0179e598e78d938c59035389054535a229Svetoslav Ganov enforceNotSealed(); 74375986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov mPackageName = packageName; 74475986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov } 74575986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov 74675986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov /** 74775986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov * Returns a cached instance if such is available or a new one is 74838e8b4e5bc3c93affdffbc064fd9db5aeccc3e8eSvetoslav Ganov * instantiated with its type property set. 74975986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov * 75075986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov * @param eventType The event type. 75175986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov * @return An instance. 75275986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov */ 75375986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov public static AccessibilityEvent obtain(int eventType) { 75475986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov AccessibilityEvent event = AccessibilityEvent.obtain(); 75575986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov event.setEventType(eventType); 75675986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov return event; 75775986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov } 75875986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov 75975986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov /** 76075986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov * Returns a cached instance if such is available or a new one is 76135bfedeaba724aeadc6f6c890269cb6bf7ef42f5Svetoslav Ganov * created. The returned instance is initialized from the given 76235bfedeaba724aeadc6f6c890269cb6bf7ef42f5Svetoslav Ganov * <code>event</code>. 7638643aa0179e598e78d938c59035389054535a229Svetoslav Ganov * 7648643aa0179e598e78d938c59035389054535a229Svetoslav Ganov * @param event The other event. 7658643aa0179e598e78d938c59035389054535a229Svetoslav Ganov * @return An instance. 7668643aa0179e598e78d938c59035389054535a229Svetoslav Ganov */ 7678643aa0179e598e78d938c59035389054535a229Svetoslav Ganov public static AccessibilityEvent obtain(AccessibilityEvent event) { 7688643aa0179e598e78d938c59035389054535a229Svetoslav Ganov AccessibilityEvent eventClone = AccessibilityEvent.obtain(); 7698643aa0179e598e78d938c59035389054535a229Svetoslav Ganov eventClone.init(event); 7708643aa0179e598e78d938c59035389054535a229Svetoslav Ganov 7718643aa0179e598e78d938c59035389054535a229Svetoslav Ganov final int recordCount = event.mRecords.size(); 7728643aa0179e598e78d938c59035389054535a229Svetoslav Ganov for (int i = 0; i < recordCount; i++) { 7738643aa0179e598e78d938c59035389054535a229Svetoslav Ganov AccessibilityRecord record = event.mRecords.get(i); 7748643aa0179e598e78d938c59035389054535a229Svetoslav Ganov AccessibilityRecord recordClone = AccessibilityRecord.obtain(record); 7758643aa0179e598e78d938c59035389054535a229Svetoslav Ganov eventClone.mRecords.add(recordClone); 7768643aa0179e598e78d938c59035389054535a229Svetoslav Ganov } 7778643aa0179e598e78d938c59035389054535a229Svetoslav Ganov 7788643aa0179e598e78d938c59035389054535a229Svetoslav Ganov return eventClone; 7798643aa0179e598e78d938c59035389054535a229Svetoslav Ganov } 7808643aa0179e598e78d938c59035389054535a229Svetoslav Ganov 7818643aa0179e598e78d938c59035389054535a229Svetoslav Ganov /** 7828643aa0179e598e78d938c59035389054535a229Svetoslav Ganov * Returns a cached instance if such is available or a new one is 78375986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov * instantiated. 78475986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov * 78575986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov * @return An instance. 78675986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov */ 78775986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov public static AccessibilityEvent obtain() { 788887e1a17eb9b12448f5929791b564565b2665aabSvetoslav Ganov synchronized (sPoolLock) { 78975986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov if (sPool != null) { 79075986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov AccessibilityEvent event = sPool; 79175986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov sPool = sPool.mNext; 79275986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov sPoolSize--; 79375986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov event.mNext = null; 79475986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov event.mIsInPool = false; 79575986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov return event; 79675986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov } 79775986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov return new AccessibilityEvent(); 79875986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov } 79975986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov } 80075986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov 80175986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov /** 80238e8b4e5bc3c93affdffbc064fd9db5aeccc3e8eSvetoslav Ganov * Recycles an instance back to be reused. 80375986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov * <p> 80438e8b4e5bc3c93affdffbc064fd9db5aeccc3e8eSvetoslav Ganov * <b>Note: You must not touch the object after calling this function.</b> 80538e8b4e5bc3c93affdffbc064fd9db5aeccc3e8eSvetoslav Ganov * </p> 806887e1a17eb9b12448f5929791b564565b2665aabSvetoslav Ganov * 807887e1a17eb9b12448f5929791b564565b2665aabSvetoslav Ganov * @throws IllegalStateException If the event is already recycled. 80875986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov */ 809736c2756bf3c14ae9fef7255c119057f7a2be1edSvetoslav Ganov @Override 81075986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov public void recycle() { 81175986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov if (mIsInPool) { 812887e1a17eb9b12448f5929791b564565b2665aabSvetoslav Ganov throw new IllegalStateException("Event already recycled!"); 81375986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov } 81475986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov clear(); 815887e1a17eb9b12448f5929791b564565b2665aabSvetoslav Ganov synchronized (sPoolLock) { 81675986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov if (sPoolSize <= MAX_POOL_SIZE) { 81775986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov mNext = sPool; 81875986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov sPool = this; 81975986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov mIsInPool = true; 82075986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov sPoolSize++; 82175986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov } 82275986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov } 82375986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov } 82475986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov 82575986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov /** 82675986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov * Clears the state of this instance. 8278643aa0179e598e78d938c59035389054535a229Svetoslav Ganov * 8288643aa0179e598e78d938c59035389054535a229Svetoslav Ganov * @hide 82975986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov */ 830736c2756bf3c14ae9fef7255c119057f7a2be1edSvetoslav Ganov @Override 831736c2756bf3c14ae9fef7255c119057f7a2be1edSvetoslav Ganov protected void clear() { 832736c2756bf3c14ae9fef7255c119057f7a2be1edSvetoslav Ganov super.clear(); 83375986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov mEventType = 0; 8343fb3d7c4e756bd32d5abde0abca9ab52d559bc84Adam Powell mPackageName = null; 835736c2756bf3c14ae9fef7255c119057f7a2be1edSvetoslav Ganov mEventTime = 0; 836736c2756bf3c14ae9fef7255c119057f7a2be1edSvetoslav Ganov while (!mRecords.isEmpty()) { 837736c2756bf3c14ae9fef7255c119057f7a2be1edSvetoslav Ganov AccessibilityRecord record = mRecords.remove(0); 838736c2756bf3c14ae9fef7255c119057f7a2be1edSvetoslav Ganov record.recycle(); 8393fb3d7c4e756bd32d5abde0abca9ab52d559bc84Adam Powell } 840ac84d3ba81f08036308b17e1ab919e43987a3df5Svetoslav Ganov } 841ac84d3ba81f08036308b17e1ab919e43987a3df5Svetoslav Ganov 842ac84d3ba81f08036308b17e1ab919e43987a3df5Svetoslav Ganov /** 8433fb3d7c4e756bd32d5abde0abca9ab52d559bc84Adam Powell * Creates a new instance from a {@link Parcel}. 8443fb3d7c4e756bd32d5abde0abca9ab52d559bc84Adam Powell * 8453fb3d7c4e756bd32d5abde0abca9ab52d559bc84Adam Powell * @param parcel A parcel containing the state of a {@link AccessibilityEvent}. 846ac84d3ba81f08036308b17e1ab919e43987a3df5Svetoslav Ganov */ 8473fb3d7c4e756bd32d5abde0abca9ab52d559bc84Adam Powell public void initFromParcel(Parcel parcel) { 848d116d7c78a9c53f30a73bf273bd7618312cf3847Svetoslav Ganov mSealed = (parcel.readInt() == 1); 8493fb3d7c4e756bd32d5abde0abca9ab52d559bc84Adam Powell mEventType = parcel.readInt(); 8503fb3d7c4e756bd32d5abde0abca9ab52d559bc84Adam Powell mPackageName = TextUtils.CHAR_SEQUENCE_CREATOR.createFromParcel(parcel); 851736c2756bf3c14ae9fef7255c119057f7a2be1edSvetoslav Ganov mEventTime = parcel.readLong(); 852d116d7c78a9c53f30a73bf273bd7618312cf3847Svetoslav Ganov mConnectionId = parcel.readInt(); 853736c2756bf3c14ae9fef7255c119057f7a2be1edSvetoslav Ganov readAccessibilityRecordFromParcel(this, parcel); 854736c2756bf3c14ae9fef7255c119057f7a2be1edSvetoslav Ganov 855736c2756bf3c14ae9fef7255c119057f7a2be1edSvetoslav Ganov // Read the records. 856736c2756bf3c14ae9fef7255c119057f7a2be1edSvetoslav Ganov final int recordCount = parcel.readInt(); 857736c2756bf3c14ae9fef7255c119057f7a2be1edSvetoslav Ganov for (int i = 0; i < recordCount; i++) { 858736c2756bf3c14ae9fef7255c119057f7a2be1edSvetoslav Ganov AccessibilityRecord record = AccessibilityRecord.obtain(); 85934e350daf89aed09ac748c2185f4506772a63b3fSvetoslav Ganov readAccessibilityRecordFromParcel(record, parcel); 860d116d7c78a9c53f30a73bf273bd7618312cf3847Svetoslav Ganov record.mConnectionId = mConnectionId; 861736c2756bf3c14ae9fef7255c119057f7a2be1edSvetoslav Ganov mRecords.add(record); 862736c2756bf3c14ae9fef7255c119057f7a2be1edSvetoslav Ganov } 8633fb3d7c4e756bd32d5abde0abca9ab52d559bc84Adam Powell } 8643fb3d7c4e756bd32d5abde0abca9ab52d559bc84Adam Powell 865736c2756bf3c14ae9fef7255c119057f7a2be1edSvetoslav Ganov /** 866736c2756bf3c14ae9fef7255c119057f7a2be1edSvetoslav Ganov * Reads an {@link AccessibilityRecord} from a parcel. 867736c2756bf3c14ae9fef7255c119057f7a2be1edSvetoslav Ganov * 868736c2756bf3c14ae9fef7255c119057f7a2be1edSvetoslav Ganov * @param record The record to initialize. 869736c2756bf3c14ae9fef7255c119057f7a2be1edSvetoslav Ganov * @param parcel The parcel to read from. 870736c2756bf3c14ae9fef7255c119057f7a2be1edSvetoslav Ganov */ 871736c2756bf3c14ae9fef7255c119057f7a2be1edSvetoslav Ganov private void readAccessibilityRecordFromParcel(AccessibilityRecord record, 872736c2756bf3c14ae9fef7255c119057f7a2be1edSvetoslav Ganov Parcel parcel) { 873736c2756bf3c14ae9fef7255c119057f7a2be1edSvetoslav Ganov record.mBooleanProperties = parcel.readInt(); 874736c2756bf3c14ae9fef7255c119057f7a2be1edSvetoslav Ganov record.mCurrentItemIndex = parcel.readInt(); 875736c2756bf3c14ae9fef7255c119057f7a2be1edSvetoslav Ganov record.mItemCount = parcel.readInt(); 876736c2756bf3c14ae9fef7255c119057f7a2be1edSvetoslav Ganov record.mFromIndex = parcel.readInt(); 877a0156177cdc809795dd8bc5a19943dd2b6f82b66Svetoslav Ganov record.mToIndex = parcel.readInt(); 878a0156177cdc809795dd8bc5a19943dd2b6f82b66Svetoslav Ganov record.mScrollX = parcel.readInt(); 879a0156177cdc809795dd8bc5a19943dd2b6f82b66Svetoslav Ganov record.mScrollY = parcel.readInt(); 880d9ee72fddb8be40e414a831fb80458dc48699613Svetoslav Ganov record.mMaxScrollX = parcel.readInt(); 881d9ee72fddb8be40e414a831fb80458dc48699613Svetoslav Ganov record.mMaxScrollY = parcel.readInt(); 882736c2756bf3c14ae9fef7255c119057f7a2be1edSvetoslav Ganov record.mAddedCount = parcel.readInt(); 883736c2756bf3c14ae9fef7255c119057f7a2be1edSvetoslav Ganov record.mRemovedCount = parcel.readInt(); 884736c2756bf3c14ae9fef7255c119057f7a2be1edSvetoslav Ganov record.mClassName = TextUtils.CHAR_SEQUENCE_CREATOR.createFromParcel(parcel); 885736c2756bf3c14ae9fef7255c119057f7a2be1edSvetoslav Ganov record.mContentDescription = TextUtils.CHAR_SEQUENCE_CREATOR.createFromParcel(parcel); 886736c2756bf3c14ae9fef7255c119057f7a2be1edSvetoslav Ganov record.mBeforeText = TextUtils.CHAR_SEQUENCE_CREATOR.createFromParcel(parcel); 887736c2756bf3c14ae9fef7255c119057f7a2be1edSvetoslav Ganov record.mParcelableData = parcel.readParcelable(null); 888736c2756bf3c14ae9fef7255c119057f7a2be1edSvetoslav Ganov parcel.readList(record.mText, null); 889eeee4d2c01d3c4ed99e4891dbc75c7de69a803faSvetoslav Ganov record.mSourceWindowId = parcel.readInt(); 890021078554b902179442a345a9d080a165c3b5139Svetoslav Ganov record.mSourceNodeId = parcel.readLong(); 891eeee4d2c01d3c4ed99e4891dbc75c7de69a803faSvetoslav Ganov record.mSealed = (parcel.readInt() == 1); 892736c2756bf3c14ae9fef7255c119057f7a2be1edSvetoslav Ganov } 893736c2756bf3c14ae9fef7255c119057f7a2be1edSvetoslav Ganov 894736c2756bf3c14ae9fef7255c119057f7a2be1edSvetoslav Ganov /** 895736c2756bf3c14ae9fef7255c119057f7a2be1edSvetoslav Ganov * {@inheritDoc} 896736c2756bf3c14ae9fef7255c119057f7a2be1edSvetoslav Ganov */ 89775986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov public void writeToParcel(Parcel parcel, int flags) { 8988643aa0179e598e78d938c59035389054535a229Svetoslav Ganov parcel.writeInt(isSealed() ? 1 : 0); 89975986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov parcel.writeInt(mEventType); 9003fb3d7c4e756bd32d5abde0abca9ab52d559bc84Adam Powell TextUtils.writeToParcel(mPackageName, parcel, 0); 901736c2756bf3c14ae9fef7255c119057f7a2be1edSvetoslav Ganov parcel.writeLong(mEventTime); 902d116d7c78a9c53f30a73bf273bd7618312cf3847Svetoslav Ganov parcel.writeInt(mConnectionId); 903736c2756bf3c14ae9fef7255c119057f7a2be1edSvetoslav Ganov writeAccessibilityRecordToParcel(this, parcel, flags); 904736c2756bf3c14ae9fef7255c119057f7a2be1edSvetoslav Ganov 905736c2756bf3c14ae9fef7255c119057f7a2be1edSvetoslav Ganov // Write the records. 906736c2756bf3c14ae9fef7255c119057f7a2be1edSvetoslav Ganov final int recordCount = getRecordCount(); 907736c2756bf3c14ae9fef7255c119057f7a2be1edSvetoslav Ganov parcel.writeInt(recordCount); 908736c2756bf3c14ae9fef7255c119057f7a2be1edSvetoslav Ganov for (int i = 0; i < recordCount; i++) { 909736c2756bf3c14ae9fef7255c119057f7a2be1edSvetoslav Ganov AccessibilityRecord record = mRecords.get(i); 910736c2756bf3c14ae9fef7255c119057f7a2be1edSvetoslav Ganov writeAccessibilityRecordToParcel(record, parcel, flags); 911736c2756bf3c14ae9fef7255c119057f7a2be1edSvetoslav Ganov } 912736c2756bf3c14ae9fef7255c119057f7a2be1edSvetoslav Ganov } 913736c2756bf3c14ae9fef7255c119057f7a2be1edSvetoslav Ganov 914736c2756bf3c14ae9fef7255c119057f7a2be1edSvetoslav Ganov /** 915736c2756bf3c14ae9fef7255c119057f7a2be1edSvetoslav Ganov * Writes an {@link AccessibilityRecord} to a parcel. 916736c2756bf3c14ae9fef7255c119057f7a2be1edSvetoslav Ganov * 917736c2756bf3c14ae9fef7255c119057f7a2be1edSvetoslav Ganov * @param record The record to write. 918736c2756bf3c14ae9fef7255c119057f7a2be1edSvetoslav Ganov * @param parcel The parcel to which to write. 919736c2756bf3c14ae9fef7255c119057f7a2be1edSvetoslav Ganov */ 920736c2756bf3c14ae9fef7255c119057f7a2be1edSvetoslav Ganov private void writeAccessibilityRecordToParcel(AccessibilityRecord record, Parcel parcel, 921736c2756bf3c14ae9fef7255c119057f7a2be1edSvetoslav Ganov int flags) { 922736c2756bf3c14ae9fef7255c119057f7a2be1edSvetoslav Ganov parcel.writeInt(record.mBooleanProperties); 923736c2756bf3c14ae9fef7255c119057f7a2be1edSvetoslav Ganov parcel.writeInt(record.mCurrentItemIndex); 924736c2756bf3c14ae9fef7255c119057f7a2be1edSvetoslav Ganov parcel.writeInt(record.mItemCount); 925736c2756bf3c14ae9fef7255c119057f7a2be1edSvetoslav Ganov parcel.writeInt(record.mFromIndex); 926a0156177cdc809795dd8bc5a19943dd2b6f82b66Svetoslav Ganov parcel.writeInt(record.mToIndex); 927a0156177cdc809795dd8bc5a19943dd2b6f82b66Svetoslav Ganov parcel.writeInt(record.mScrollX); 928a0156177cdc809795dd8bc5a19943dd2b6f82b66Svetoslav Ganov parcel.writeInt(record.mScrollY); 929d9ee72fddb8be40e414a831fb80458dc48699613Svetoslav Ganov parcel.writeInt(record.mMaxScrollX); 930d9ee72fddb8be40e414a831fb80458dc48699613Svetoslav Ganov parcel.writeInt(record.mMaxScrollY); 931736c2756bf3c14ae9fef7255c119057f7a2be1edSvetoslav Ganov parcel.writeInt(record.mAddedCount); 932736c2756bf3c14ae9fef7255c119057f7a2be1edSvetoslav Ganov parcel.writeInt(record.mRemovedCount); 933736c2756bf3c14ae9fef7255c119057f7a2be1edSvetoslav Ganov TextUtils.writeToParcel(record.mClassName, parcel, flags); 934736c2756bf3c14ae9fef7255c119057f7a2be1edSvetoslav Ganov TextUtils.writeToParcel(record.mContentDescription, parcel, flags); 935736c2756bf3c14ae9fef7255c119057f7a2be1edSvetoslav Ganov TextUtils.writeToParcel(record.mBeforeText, parcel, flags); 936736c2756bf3c14ae9fef7255c119057f7a2be1edSvetoslav Ganov parcel.writeParcelable(record.mParcelableData, flags); 937736c2756bf3c14ae9fef7255c119057f7a2be1edSvetoslav Ganov parcel.writeList(record.mText); 938eeee4d2c01d3c4ed99e4891dbc75c7de69a803faSvetoslav Ganov parcel.writeInt(record.mSourceWindowId); 939021078554b902179442a345a9d080a165c3b5139Svetoslav Ganov parcel.writeLong(record.mSourceNodeId); 940eeee4d2c01d3c4ed99e4891dbc75c7de69a803faSvetoslav Ganov parcel.writeInt(record.mSealed ? 1 : 0); 94175986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov } 94275986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov 943736c2756bf3c14ae9fef7255c119057f7a2be1edSvetoslav Ganov /** 944736c2756bf3c14ae9fef7255c119057f7a2be1edSvetoslav Ganov * {@inheritDoc} 945736c2756bf3c14ae9fef7255c119057f7a2be1edSvetoslav Ganov */ 94675986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov public int describeContents() { 94775986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov return 0; 94875986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov } 94975986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov 95075986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov @Override 95175986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov public String toString() { 95275986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov StringBuilder builder = new StringBuilder(); 95338e8b4e5bc3c93affdffbc064fd9db5aeccc3e8eSvetoslav Ganov builder.append("EventType: ").append(eventTypeToString(mEventType)); 954cc4053e031371456fe54d51bbad1db721db4ae38Svetoslav Ganov builder.append("; EventTime: ").append(mEventTime); 955cc4053e031371456fe54d51bbad1db721db4ae38Svetoslav Ganov builder.append("; PackageName: ").append(mPackageName); 956736c2756bf3c14ae9fef7255c119057f7a2be1edSvetoslav Ganov builder.append(super.toString()); 9578643aa0179e598e78d938c59035389054535a229Svetoslav Ganov if (DEBUG) { 958736c2756bf3c14ae9fef7255c119057f7a2be1edSvetoslav Ganov builder.append("\n"); 959eeee4d2c01d3c4ed99e4891dbc75c7de69a803faSvetoslav Ganov builder.append("; sourceWindowId: ").append(mSourceWindowId); 960021078554b902179442a345a9d080a165c3b5139Svetoslav Ganov builder.append("; mSourceNodeId: ").append(mSourceNodeId); 9618643aa0179e598e78d938c59035389054535a229Svetoslav Ganov for (int i = 0; i < mRecords.size(); i++) { 9628643aa0179e598e78d938c59035389054535a229Svetoslav Ganov AccessibilityRecord record = mRecords.get(i); 9638643aa0179e598e78d938c59035389054535a229Svetoslav Ganov builder.append(" Record "); 9648643aa0179e598e78d938c59035389054535a229Svetoslav Ganov builder.append(i); 9658643aa0179e598e78d938c59035389054535a229Svetoslav Ganov builder.append(":"); 9668643aa0179e598e78d938c59035389054535a229Svetoslav Ganov builder.append(" [ ClassName: " + record.mClassName); 9678643aa0179e598e78d938c59035389054535a229Svetoslav Ganov builder.append("; Text: " + record.mText); 9688643aa0179e598e78d938c59035389054535a229Svetoslav Ganov builder.append("; ContentDescription: " + record.mContentDescription); 9698643aa0179e598e78d938c59035389054535a229Svetoslav Ganov builder.append("; ItemCount: " + record.mItemCount); 9708643aa0179e598e78d938c59035389054535a229Svetoslav Ganov builder.append("; CurrentItemIndex: " + record.mCurrentItemIndex); 9718643aa0179e598e78d938c59035389054535a229Svetoslav Ganov builder.append("; IsEnabled: " + record.isEnabled()); 9728643aa0179e598e78d938c59035389054535a229Svetoslav Ganov builder.append("; IsPassword: " + record.isPassword()); 9738643aa0179e598e78d938c59035389054535a229Svetoslav Ganov builder.append("; IsChecked: " + record.isChecked()); 9748643aa0179e598e78d938c59035389054535a229Svetoslav Ganov builder.append("; IsFullScreen: " + record.isFullScreen()); 975a0156177cdc809795dd8bc5a19943dd2b6f82b66Svetoslav Ganov builder.append("; Scrollable: " + record.isScrollable()); 9768643aa0179e598e78d938c59035389054535a229Svetoslav Ganov builder.append("; BeforeText: " + record.mBeforeText); 9778643aa0179e598e78d938c59035389054535a229Svetoslav Ganov builder.append("; FromIndex: " + record.mFromIndex); 978a0156177cdc809795dd8bc5a19943dd2b6f82b66Svetoslav Ganov builder.append("; ToIndex: " + record.mToIndex); 979a0156177cdc809795dd8bc5a19943dd2b6f82b66Svetoslav Ganov builder.append("; ScrollX: " + record.mScrollX); 980a0156177cdc809795dd8bc5a19943dd2b6f82b66Svetoslav Ganov builder.append("; ScrollY: " + record.mScrollY); 9818643aa0179e598e78d938c59035389054535a229Svetoslav Ganov builder.append("; AddedCount: " + record.mAddedCount); 9828643aa0179e598e78d938c59035389054535a229Svetoslav Ganov builder.append("; RemovedCount: " + record.mRemovedCount); 9838643aa0179e598e78d938c59035389054535a229Svetoslav Ganov builder.append("; ParcelableData: " + record.mParcelableData); 9848643aa0179e598e78d938c59035389054535a229Svetoslav Ganov builder.append(" ]"); 9858643aa0179e598e78d938c59035389054535a229Svetoslav Ganov builder.append("\n"); 9868643aa0179e598e78d938c59035389054535a229Svetoslav Ganov } 9878643aa0179e598e78d938c59035389054535a229Svetoslav Ganov } else { 988e4aa13b20166219a62916a92294055e7cc5c9f10Svetoslav Ganov builder.append("; recordCount: ").append(getRecordCount()); 989736c2756bf3c14ae9fef7255c119057f7a2be1edSvetoslav Ganov } 99075986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov return builder.toString(); 99175986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov } 99275986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov 99375986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov /** 994cc4053e031371456fe54d51bbad1db721db4ae38Svetoslav Ganov * Returns the string representation of an event type. For example, 995cc4053e031371456fe54d51bbad1db721db4ae38Svetoslav Ganov * {@link #TYPE_VIEW_CLICKED} is represented by the string TYPE_VIEW_CLICKED. 996cc4053e031371456fe54d51bbad1db721db4ae38Svetoslav Ganov * 99738e8b4e5bc3c93affdffbc064fd9db5aeccc3e8eSvetoslav Ganov * @param eventType The event type 998cc4053e031371456fe54d51bbad1db721db4ae38Svetoslav Ganov * @return The string representation. 999cc4053e031371456fe54d51bbad1db721db4ae38Svetoslav Ganov */ 100038e8b4e5bc3c93affdffbc064fd9db5aeccc3e8eSvetoslav Ganov public static String eventTypeToString(int eventType) { 100138e8b4e5bc3c93affdffbc064fd9db5aeccc3e8eSvetoslav Ganov switch (eventType) { 1002cc4053e031371456fe54d51bbad1db721db4ae38Svetoslav Ganov case TYPE_VIEW_CLICKED: 1003cc4053e031371456fe54d51bbad1db721db4ae38Svetoslav Ganov return "TYPE_VIEW_CLICKED"; 1004cc4053e031371456fe54d51bbad1db721db4ae38Svetoslav Ganov case TYPE_VIEW_LONG_CLICKED: 1005cc4053e031371456fe54d51bbad1db721db4ae38Svetoslav Ganov return "TYPE_VIEW_LONG_CLICKED"; 1006cc4053e031371456fe54d51bbad1db721db4ae38Svetoslav Ganov case TYPE_VIEW_SELECTED: 1007cc4053e031371456fe54d51bbad1db721db4ae38Svetoslav Ganov return "TYPE_VIEW_SELECTED"; 1008cc4053e031371456fe54d51bbad1db721db4ae38Svetoslav Ganov case TYPE_VIEW_FOCUSED: 1009cc4053e031371456fe54d51bbad1db721db4ae38Svetoslav Ganov return "TYPE_VIEW_FOCUSED"; 1010cc4053e031371456fe54d51bbad1db721db4ae38Svetoslav Ganov case TYPE_VIEW_TEXT_CHANGED: 1011cc4053e031371456fe54d51bbad1db721db4ae38Svetoslav Ganov return "TYPE_VIEW_TEXT_CHANGED"; 1012cc4053e031371456fe54d51bbad1db721db4ae38Svetoslav Ganov case TYPE_WINDOW_STATE_CHANGED: 1013cc4053e031371456fe54d51bbad1db721db4ae38Svetoslav Ganov return "TYPE_WINDOW_STATE_CHANGED"; 1014cc4053e031371456fe54d51bbad1db721db4ae38Svetoslav Ganov case TYPE_VIEW_HOVER_ENTER: 1015cc4053e031371456fe54d51bbad1db721db4ae38Svetoslav Ganov return "TYPE_VIEW_HOVER_ENTER"; 1016cc4053e031371456fe54d51bbad1db721db4ae38Svetoslav Ganov case TYPE_VIEW_HOVER_EXIT: 1017cc4053e031371456fe54d51bbad1db721db4ae38Svetoslav Ganov return "TYPE_VIEW_HOVER_EXIT"; 1018cc4053e031371456fe54d51bbad1db721db4ae38Svetoslav Ganov case TYPE_NOTIFICATION_STATE_CHANGED: 1019cc4053e031371456fe54d51bbad1db721db4ae38Svetoslav Ganov return "TYPE_NOTIFICATION_STATE_CHANGED"; 1020cc4053e031371456fe54d51bbad1db721db4ae38Svetoslav Ganov case TYPE_TOUCH_EXPLORATION_GESTURE_START: 1021cc4053e031371456fe54d51bbad1db721db4ae38Svetoslav Ganov return "TYPE_TOUCH_EXPLORATION_GESTURE_START"; 1022cc4053e031371456fe54d51bbad1db721db4ae38Svetoslav Ganov case TYPE_TOUCH_EXPLORATION_GESTURE_END: 1023cc4053e031371456fe54d51bbad1db721db4ae38Svetoslav Ganov return "TYPE_TOUCH_EXPLORATION_GESTURE_END"; 1024eeee4d2c01d3c4ed99e4891dbc75c7de69a803faSvetoslav Ganov case TYPE_WINDOW_CONTENT_CHANGED: 1025eeee4d2c01d3c4ed99e4891dbc75c7de69a803faSvetoslav Ganov return "TYPE_WINDOW_CONTENT_CHANGED"; 1026a0156177cdc809795dd8bc5a19943dd2b6f82b66Svetoslav Ganov case TYPE_VIEW_TEXT_SELECTION_CHANGED: 1027a0156177cdc809795dd8bc5a19943dd2b6f82b66Svetoslav Ganov return "TYPE_VIEW_TEXT_SELECTION_CHANGED"; 1028a0156177cdc809795dd8bc5a19943dd2b6f82b66Svetoslav Ganov case TYPE_VIEW_SCROLLED: 1029a0156177cdc809795dd8bc5a19943dd2b6f82b66Svetoslav Ganov return "TYPE_VIEW_SCROLLED"; 103051ab90cab1609cf0ddd2dfe5a660f020d823d4d5Svetoslav Ganov case TYPE_ANNOUNCEMENT: 103151ab90cab1609cf0ddd2dfe5a660f020d823d4d5Svetoslav Ganov return "TYPE_ANNOUNCEMENT"; 10324213804541a8b05cd0587b138a2fd9a3b7fd9350Svetoslav Ganov case TYPE_VIEW_ACCESSIBILITY_FOCUSED: 10334213804541a8b05cd0587b138a2fd9a3b7fd9350Svetoslav Ganov return "TYPE_VIEW_ACCESSIBILITY_FOCUSED"; 10344213804541a8b05cd0587b138a2fd9a3b7fd9350Svetoslav Ganov case TYPE_VIEW_ACCESSIBILITY_FOCUS_CLEARED: 10354213804541a8b05cd0587b138a2fd9a3b7fd9350Svetoslav Ganov return "TYPE_VIEW_ACCESSIBILITY_FOCUS_CLEARED"; 1036cc4053e031371456fe54d51bbad1db721db4ae38Svetoslav Ganov default: 1037cc4053e031371456fe54d51bbad1db721db4ae38Svetoslav Ganov return null; 1038cc4053e031371456fe54d51bbad1db721db4ae38Svetoslav Ganov } 1039cc4053e031371456fe54d51bbad1db721db4ae38Svetoslav Ganov } 1040cc4053e031371456fe54d51bbad1db721db4ae38Svetoslav Ganov 1041cc4053e031371456fe54d51bbad1db721db4ae38Svetoslav Ganov /** 104275986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov * @see Parcelable.Creator 104375986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov */ 104475986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov public static final Parcelable.Creator<AccessibilityEvent> CREATOR = 104575986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov new Parcelable.Creator<AccessibilityEvent>() { 104675986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov public AccessibilityEvent createFromParcel(Parcel parcel) { 104775986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov AccessibilityEvent event = AccessibilityEvent.obtain(); 104875986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov event.initFromParcel(parcel); 104975986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov return event; 105075986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov } 105175986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov 105275986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov public AccessibilityEvent[] newArray(int size) { 105375986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov return new AccessibilityEvent[size]; 105475986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov } 105575986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov }; 105675986cf9bc57ef11ad70f36fb77fbbf5d63af6ecsvetoslavganov} 1057