18e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav/* 28e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav * Copyright (C) 2014 The Android Open Source Project 38e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav * 48e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav * Licensed under the Apache License, Version 2.0 (the "License"); 58e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav * you may not use this file except in compliance with the License. 68e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav * You may obtain a copy of the License at 78e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav * 88e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav * http://www.apache.org/licenses/LICENSE-2.0 98e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav * 108e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav * Unless required by applicable law or agreed to in writing, software 118e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav * distributed under the License is distributed on an "AS IS" BASIS, 128e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 138e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav * See the License for the specific language governing permissions and 148e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav * limitations under the License. 158e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav */ 168e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav 178e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslavpackage android.view.accessibility; 188e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav 19155edc693eecb64d821a95567e719d0de7ee9c85Phil Weaverimport android.annotation.Nullable; 208e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslavimport android.graphics.Rect; 218e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslavimport android.os.Parcel; 228e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslavimport android.os.Parcelable; 238e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslavimport android.util.LongArray; 248e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslavimport android.util.Pools.SynchronizedPool; 258e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav 268e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav/** 278e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav * This class represents a state snapshot of a window for accessibility 288e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav * purposes. The screen content contains one or more windows where some 298e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav * windows can be descendants of other windows, which is the windows are 308e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav * hierarchically ordered. Note that there is no root window. Hence, the 318e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav * screen content can be seen as a collection of window trees. 328e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav */ 338e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslavpublic final class AccessibilityWindowInfo implements Parcelable { 348e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav 358e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav private static final boolean DEBUG = false; 368e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav 378e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav /** 388e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav * Window type: This is an application window. Such a window shows UI for 398e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav * interacting with an application. 408e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav */ 418e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav public static final int TYPE_APPLICATION = 1; 428e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav 438e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav /** 448e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav * Window type: This is an input method window. Such a window shows UI for 458e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav * inputting text such as keyboard, suggestions, etc. 468e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav */ 478e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav public static final int TYPE_INPUT_METHOD = 2; 488e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav 498e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav /** 508e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav * Window type: This is an system window. Such a window shows UI for 518e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav * interacting with the system. 528e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav */ 538e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav public static final int TYPE_SYSTEM = 3; 548e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav 553a5c721072c60c7ed9c8a95d0a65d0e3cb4eb9bbSvetoslav /** 563a5c721072c60c7ed9c8a95d0a65d0e3cb4eb9bbSvetoslav * Window type: Windows that are overlaid <em>only</em> by an {@link 573a5c721072c60c7ed9c8a95d0a65d0e3cb4eb9bbSvetoslav * android.accessibilityservice.AccessibilityService} for interception of 583a5c721072c60c7ed9c8a95d0a65d0e3cb4eb9bbSvetoslav * user interactions without changing the windows an accessibility service 593a5c721072c60c7ed9c8a95d0a65d0e3cb4eb9bbSvetoslav * can introspect. In particular, an accessibility service can introspect 603a5c721072c60c7ed9c8a95d0a65d0e3cb4eb9bbSvetoslav * only windows that a sighted user can interact with which they can touch 613a5c721072c60c7ed9c8a95d0a65d0e3cb4eb9bbSvetoslav * these windows or can type into these windows. For example, if there 623a5c721072c60c7ed9c8a95d0a65d0e3cb4eb9bbSvetoslav * is a full screen accessibility overlay that is touchable, the windows 633a5c721072c60c7ed9c8a95d0a65d0e3cb4eb9bbSvetoslav * below it will be introspectable by an accessibility service regardless 643a5c721072c60c7ed9c8a95d0a65d0e3cb4eb9bbSvetoslav * they are covered by a touchable window. 653a5c721072c60c7ed9c8a95d0a65d0e3cb4eb9bbSvetoslav */ 663a5c721072c60c7ed9c8a95d0a65d0e3cb4eb9bbSvetoslav public static final int TYPE_ACCESSIBILITY_OVERLAY = 4; 673a5c721072c60c7ed9c8a95d0a65d0e3cb4eb9bbSvetoslav 68315c34e7d62ce4b609f2d08b18a11a2d44e93abaPhil Weaver /** 69315c34e7d62ce4b609f2d08b18a11a2d44e93abaPhil Weaver * Window type: A system window used to divide the screen in split-screen mode. 70315c34e7d62ce4b609f2d08b18a11a2d44e93abaPhil Weaver * This type of window is present only in split-screen mode. 71315c34e7d62ce4b609f2d08b18a11a2d44e93abaPhil Weaver */ 72315c34e7d62ce4b609f2d08b18a11a2d44e93abaPhil Weaver public static final int TYPE_SPLIT_SCREEN_DIVIDER = 5; 73315c34e7d62ce4b609f2d08b18a11a2d44e93abaPhil Weaver 748e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav private static final int UNDEFINED = -1; 758e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav 768e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav private static final int BOOLEAN_PROPERTY_ACTIVE = 1 << 0; 778e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav private static final int BOOLEAN_PROPERTY_FOCUSED = 1 << 1; 783a5c721072c60c7ed9c8a95d0a65d0e3cb4eb9bbSvetoslav private static final int BOOLEAN_PROPERTY_ACCESSIBILITY_FOCUSED = 1 << 2; 798e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav 808e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav // Housekeeping. 818e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav private static final int MAX_POOL_SIZE = 10; 828e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav private static final SynchronizedPool<AccessibilityWindowInfo> sPool = 838e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav new SynchronizedPool<AccessibilityWindowInfo>(MAX_POOL_SIZE); 848e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav 858e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav // Data. 868e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav private int mType = UNDEFINED; 878e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav private int mLayer = UNDEFINED; 888e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav private int mBooleanProperties; 898e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav private int mId = UNDEFINED; 908e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav private int mParentId = UNDEFINED; 918e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav private final Rect mBoundsInScreen = new Rect(); 928e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav private LongArray mChildIds; 93396d549113bc633f719acc643c7dfc5f2a8fae4ePhil Weaver private CharSequence mTitle; 94396d549113bc633f719acc643c7dfc5f2a8fae4ePhil Weaver private int mAnchorId = UNDEFINED; 958e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav 968e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav private int mConnectionId = UNDEFINED; 978e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav 988e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav private AccessibilityWindowInfo() { 998e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav /* do nothing - hide constructor */ 1008e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav } 1018e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav 1028e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav /** 103396d549113bc633f719acc643c7dfc5f2a8fae4ePhil Weaver * Gets the title of the window. 104396d549113bc633f719acc643c7dfc5f2a8fae4ePhil Weaver * 105155edc693eecb64d821a95567e719d0de7ee9c85Phil Weaver * @return The title of the window, or {@code null} if none is available. 106396d549113bc633f719acc643c7dfc5f2a8fae4ePhil Weaver */ 107155edc693eecb64d821a95567e719d0de7ee9c85Phil Weaver @Nullable 108396d549113bc633f719acc643c7dfc5f2a8fae4ePhil Weaver public CharSequence getTitle() { 109396d549113bc633f719acc643c7dfc5f2a8fae4ePhil Weaver return mTitle; 110396d549113bc633f719acc643c7dfc5f2a8fae4ePhil Weaver } 111396d549113bc633f719acc643c7dfc5f2a8fae4ePhil Weaver 112396d549113bc633f719acc643c7dfc5f2a8fae4ePhil Weaver /** 113396d549113bc633f719acc643c7dfc5f2a8fae4ePhil Weaver * Sets the title of the window. 114396d549113bc633f719acc643c7dfc5f2a8fae4ePhil Weaver * 115396d549113bc633f719acc643c7dfc5f2a8fae4ePhil Weaver * @param title The title. 116396d549113bc633f719acc643c7dfc5f2a8fae4ePhil Weaver * 117396d549113bc633f719acc643c7dfc5f2a8fae4ePhil Weaver * @hide 118396d549113bc633f719acc643c7dfc5f2a8fae4ePhil Weaver */ 119396d549113bc633f719acc643c7dfc5f2a8fae4ePhil Weaver public void setTitle(CharSequence title) { 120396d549113bc633f719acc643c7dfc5f2a8fae4ePhil Weaver mTitle = title; 121396d549113bc633f719acc643c7dfc5f2a8fae4ePhil Weaver } 122396d549113bc633f719acc643c7dfc5f2a8fae4ePhil Weaver 123396d549113bc633f719acc643c7dfc5f2a8fae4ePhil Weaver /** 1248e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav * Gets the type of the window. 1258e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav * 1268e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav * @return The type. 1278e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav * 1288e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav * @see #TYPE_APPLICATION 1298e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav * @see #TYPE_INPUT_METHOD 1308e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav * @see #TYPE_SYSTEM 1313a5c721072c60c7ed9c8a95d0a65d0e3cb4eb9bbSvetoslav * @see #TYPE_ACCESSIBILITY_OVERLAY 1328e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav */ 1338e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav public int getType() { 1348e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav return mType; 1358e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav } 1368e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav 1378e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav /** 1388e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav * Sets the type of the window. 1398e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav * 1403a5c721072c60c7ed9c8a95d0a65d0e3cb4eb9bbSvetoslav * @param type The type 1418e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav * 1428e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav * @hide 1438e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav */ 1448e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav public void setType(int type) { 1458e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav mType = type; 1468e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav } 1478e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav 1488e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav /** 1498e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav * Gets the layer which determines the Z-order of the window. Windows 1508e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav * with greater layer appear on top of windows with lesser layer. 1518e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav * 1528e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav * @return The window layer. 1538e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav */ 1548e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav public int getLayer() { 1558e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav return mLayer; 1568e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav } 1578e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav 1588e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav /** 1598e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav * Sets the layer which determines the Z-order of the window. Windows 1608e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav * with greater layer appear on top of windows with lesser layer. 1618e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav * 1623a5c721072c60c7ed9c8a95d0a65d0e3cb4eb9bbSvetoslav * @param layer The window layer. 1638e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav * 1648e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav * @hide 1658e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav */ 1668e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav public void setLayer(int layer) { 1678e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav mLayer = layer; 1688e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav } 1698e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav 1708e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav /** 1718e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav * Gets the root node in the window's hierarchy. 1728e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav * 1738e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav * @return The root node. 1748e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav */ 1758e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav public AccessibilityNodeInfo getRoot() { 1768e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav if (mConnectionId == UNDEFINED) { 1778e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav return null; 1788e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav } 1798e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav AccessibilityInteractionClient client = AccessibilityInteractionClient.getInstance(); 1808e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav return client.findAccessibilityNodeInfoByAccessibilityId(mConnectionId, 1818e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav mId, AccessibilityNodeInfo.ROOT_NODE_ID, 1828e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav true, AccessibilityNodeInfo.FLAG_PREFETCH_DESCENDANTS); 1838e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav } 1848e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav 1858e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav /** 186396d549113bc633f719acc643c7dfc5f2a8fae4ePhil Weaver * Sets the anchor node's ID. 187396d549113bc633f719acc643c7dfc5f2a8fae4ePhil Weaver * 188396d549113bc633f719acc643c7dfc5f2a8fae4ePhil Weaver * @param anchorId The anchor's accessibility id in its window. 189396d549113bc633f719acc643c7dfc5f2a8fae4ePhil Weaver * 190396d549113bc633f719acc643c7dfc5f2a8fae4ePhil Weaver * @hide 191396d549113bc633f719acc643c7dfc5f2a8fae4ePhil Weaver */ 192396d549113bc633f719acc643c7dfc5f2a8fae4ePhil Weaver public void setAnchorId(int anchorId) { 193396d549113bc633f719acc643c7dfc5f2a8fae4ePhil Weaver mAnchorId = anchorId; 194396d549113bc633f719acc643c7dfc5f2a8fae4ePhil Weaver } 195396d549113bc633f719acc643c7dfc5f2a8fae4ePhil Weaver 196396d549113bc633f719acc643c7dfc5f2a8fae4ePhil Weaver /** 197396d549113bc633f719acc643c7dfc5f2a8fae4ePhil Weaver * Gets the node that anchors this window to another. 198396d549113bc633f719acc643c7dfc5f2a8fae4ePhil Weaver * 199396d549113bc633f719acc643c7dfc5f2a8fae4ePhil Weaver * @return The anchor node, or {@code null} if none exists. 200396d549113bc633f719acc643c7dfc5f2a8fae4ePhil Weaver */ 201396d549113bc633f719acc643c7dfc5f2a8fae4ePhil Weaver public AccessibilityNodeInfo getAnchor() { 202396d549113bc633f719acc643c7dfc5f2a8fae4ePhil Weaver if ((mConnectionId == UNDEFINED) || (mAnchorId == UNDEFINED) || (mParentId == UNDEFINED)) { 203396d549113bc633f719acc643c7dfc5f2a8fae4ePhil Weaver return null; 204396d549113bc633f719acc643c7dfc5f2a8fae4ePhil Weaver } 205396d549113bc633f719acc643c7dfc5f2a8fae4ePhil Weaver 206396d549113bc633f719acc643c7dfc5f2a8fae4ePhil Weaver AccessibilityInteractionClient client = AccessibilityInteractionClient.getInstance(); 207396d549113bc633f719acc643c7dfc5f2a8fae4ePhil Weaver return client.findAccessibilityNodeInfoByAccessibilityId(mConnectionId, 208396d549113bc633f719acc643c7dfc5f2a8fae4ePhil Weaver mParentId, mAnchorId, true, 0); 209396d549113bc633f719acc643c7dfc5f2a8fae4ePhil Weaver } 210396d549113bc633f719acc643c7dfc5f2a8fae4ePhil Weaver 211396d549113bc633f719acc643c7dfc5f2a8fae4ePhil Weaver /** 212396d549113bc633f719acc643c7dfc5f2a8fae4ePhil Weaver * Gets the parent window. 2138e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav * 214396d549113bc633f719acc643c7dfc5f2a8fae4ePhil Weaver * @return The parent window, or {@code null} if none exists. 2158e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav */ 2168e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav public AccessibilityWindowInfo getParent() { 2178e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav if (mConnectionId == UNDEFINED || mParentId == UNDEFINED) { 2188e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav return null; 2198e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav } 2208e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav AccessibilityInteractionClient client = AccessibilityInteractionClient.getInstance(); 2218e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav return client.getWindow(mConnectionId, mParentId); 2228e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav } 2238e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav 2248e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav /** 2258e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav * Sets the parent window id. 2268e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav * 2278e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav * @param parentId The parent id. 2288e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav * 2298e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav * @hide 2308e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav */ 2318e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav public void setParentId(int parentId) { 2328e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav mParentId = parentId; 2338e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav } 2348e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav 2358e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav /** 2368e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav * Gets the unique window id. 2378e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav * 2388e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav * @return windowId The window id. 2398e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav */ 2408e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav public int getId() { 2418e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav return mId; 2428e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav } 2438e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav 2448e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav /** 2458e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav * Sets the unique window id. 2468e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav * 2473a5c721072c60c7ed9c8a95d0a65d0e3cb4eb9bbSvetoslav * @param id The window id. 2488e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav * 2498e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav * @hide 2508e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav */ 2518e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav public void setId(int id) { 2528e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav mId = id; 2538e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav } 2548e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav 2558e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav /** 2568e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav * Sets the unique id of the IAccessibilityServiceConnection over which 2578e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav * this instance can send requests to the system. 2588e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav * 2598e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav * @param connectionId The connection id. 2608e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav * 2618e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav * @hide 2628e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav */ 2638e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav public void setConnectionId(int connectionId) { 2648e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav mConnectionId = connectionId; 2658e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav } 2668e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav 2678e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav /** 2688e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav * Gets the bounds of this window in the screen. 2698e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav * 2708e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav * @param outBounds The out window bounds. 2718e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav */ 2728e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav public void getBoundsInScreen(Rect outBounds) { 2738e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav outBounds.set(mBoundsInScreen); 2748e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav } 2758e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav 2768e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav /** 2778e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav * Sets the bounds of this window in the screen. 2788e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav * 2798e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav * @param bounds The out window bounds. 2808e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav * 2818e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav * @hide 2828e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav */ 2838e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav public void setBoundsInScreen(Rect bounds) { 2848e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav mBoundsInScreen.set(bounds); 2858e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav } 2868e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav 2878e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav /** 2888e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav * Gets if this window is active. An active window is the one 2898e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav * the user is currently touching or the window has input focus 2908e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav * and the user is not touching any window. 2918e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav * 2928e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav * @return Whether this is the active window. 2938e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav */ 2948e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav public boolean isActive() { 2958e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav return getBooleanProperty(BOOLEAN_PROPERTY_ACTIVE); 2968e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav } 2978e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav 2988e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav /** 2998e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav * Sets if this window is active, which is this is the window 3008e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav * the user is currently touching or the window has input focus 3018e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav * and the user is not touching any window. 3028e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav * 3033a5c721072c60c7ed9c8a95d0a65d0e3cb4eb9bbSvetoslav * @param active Whether this is the active window. 3048e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav * 3058e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav * @hide 3068e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav */ 3078e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav public void setActive(boolean active) { 3088e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav setBooleanProperty(BOOLEAN_PROPERTY_ACTIVE, active); 3098e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav } 3108e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav 3118e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav /** 3128e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav * Gets if this window has input focus. 3138e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav * 3148e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav * @return Whether has input focus. 3158e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav */ 3168e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav public boolean isFocused() { 3178e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav return getBooleanProperty(BOOLEAN_PROPERTY_FOCUSED); 3188e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav } 3198e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav 3208e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav /** 3218e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav * Sets if this window has input focus. 3228e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav * 3233a5c721072c60c7ed9c8a95d0a65d0e3cb4eb9bbSvetoslav * @param focused Whether has input focus. 3248e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav * 3258e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav * @hide 3268e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav */ 3278e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav public void setFocused(boolean focused) { 3288e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav setBooleanProperty(BOOLEAN_PROPERTY_FOCUSED, focused); 3298e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav } 3308e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav 3318e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav /** 33204cab1bcc46b05cbb72632c53ad83943f705b494Svetoslav * Gets if this window has accessibility focus. 33304cab1bcc46b05cbb72632c53ad83943f705b494Svetoslav * 33404cab1bcc46b05cbb72632c53ad83943f705b494Svetoslav * @return Whether has accessibility focus. 33504cab1bcc46b05cbb72632c53ad83943f705b494Svetoslav */ 33604cab1bcc46b05cbb72632c53ad83943f705b494Svetoslav public boolean isAccessibilityFocused() { 3373a5c721072c60c7ed9c8a95d0a65d0e3cb4eb9bbSvetoslav return getBooleanProperty(BOOLEAN_PROPERTY_ACCESSIBILITY_FOCUSED); 33804cab1bcc46b05cbb72632c53ad83943f705b494Svetoslav } 33904cab1bcc46b05cbb72632c53ad83943f705b494Svetoslav 34004cab1bcc46b05cbb72632c53ad83943f705b494Svetoslav /** 34104cab1bcc46b05cbb72632c53ad83943f705b494Svetoslav * Sets if this window has accessibility focus. 34204cab1bcc46b05cbb72632c53ad83943f705b494Svetoslav * 3433a5c721072c60c7ed9c8a95d0a65d0e3cb4eb9bbSvetoslav * @param focused Whether has accessibility focus. 34404cab1bcc46b05cbb72632c53ad83943f705b494Svetoslav * 34504cab1bcc46b05cbb72632c53ad83943f705b494Svetoslav * @hide 34604cab1bcc46b05cbb72632c53ad83943f705b494Svetoslav */ 34704cab1bcc46b05cbb72632c53ad83943f705b494Svetoslav public void setAccessibilityFocused(boolean focused) { 3483a5c721072c60c7ed9c8a95d0a65d0e3cb4eb9bbSvetoslav setBooleanProperty(BOOLEAN_PROPERTY_ACCESSIBILITY_FOCUSED, focused); 34904cab1bcc46b05cbb72632c53ad83943f705b494Svetoslav } 35004cab1bcc46b05cbb72632c53ad83943f705b494Svetoslav 35104cab1bcc46b05cbb72632c53ad83943f705b494Svetoslav /** 3528e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav * Gets the number of child windows. 3538e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav * 3548e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav * @return The child count. 3558e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav */ 3568e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav public int getChildCount() { 3578e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav return (mChildIds != null) ? mChildIds.size() : 0; 3588e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav } 3598e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav 3608e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav /** 3618e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav * Gets the child window at a given index. 3628e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav * 3638e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav * @param index The index. 3648e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav * @return The child. 3658e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav */ 3668e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav public AccessibilityWindowInfo getChild(int index) { 3678e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav if (mChildIds == null) { 3688e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav throw new IndexOutOfBoundsException(); 3698e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav } 3708e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav if (mConnectionId == UNDEFINED) { 3718e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav return null; 3728e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav } 3738e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav final int childId = (int) mChildIds.get(index); 3748e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav AccessibilityInteractionClient client = AccessibilityInteractionClient.getInstance(); 3758e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav return client.getWindow(mConnectionId, childId); 3768e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav } 3778e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav 3788e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav /** 3798e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav * Adds a child window. 3808e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav * 3818e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav * @param childId The child window id. 3828e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav * 3838e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav * @hide 3848e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav */ 3858e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav public void addChild(int childId) { 3868e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav if (mChildIds == null) { 3878e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav mChildIds = new LongArray(); 3888e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav } 3898e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav mChildIds.add(childId); 3908e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav } 3918e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav 3928e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav /** 3938e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav * Returns a cached instance if such is available or a new one is 3948e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav * created. 3958e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav * 3968e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav * @return An instance. 3978e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav */ 3988e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav public static AccessibilityWindowInfo obtain() { 3998e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav AccessibilityWindowInfo info = sPool.acquire(); 4008e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav if (info == null) { 4018e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav info = new AccessibilityWindowInfo(); 4028e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav } 4038e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav return info; 4048e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav } 4058e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav 4068e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav /** 4078e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav * Returns a cached instance if such is available or a new one is 4088e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav * created. The returned instance is initialized from the given 4098e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav * <code>info</code>. 4108e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav * 4118e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav * @param info The other info. 4128e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav * @return An instance. 4138e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav */ 4148e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav public static AccessibilityWindowInfo obtain(AccessibilityWindowInfo info) { 4158e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav AccessibilityWindowInfo infoClone = obtain(); 4168e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav 4178e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav infoClone.mType = info.mType; 4188e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav infoClone.mLayer = info.mLayer; 4198e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav infoClone.mBooleanProperties = info.mBooleanProperties; 4208e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav infoClone.mId = info.mId; 4218e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav infoClone.mParentId = info.mParentId; 4228e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav infoClone.mBoundsInScreen.set(info.mBoundsInScreen); 423396d549113bc633f719acc643c7dfc5f2a8fae4ePhil Weaver infoClone.mTitle = info.mTitle; 424396d549113bc633f719acc643c7dfc5f2a8fae4ePhil Weaver infoClone.mAnchorId = info.mAnchorId; 4258e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav 4268e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav if (info.mChildIds != null && info.mChildIds.size() > 0) { 4278e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav if (infoClone.mChildIds == null) { 4288e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav infoClone.mChildIds = info.mChildIds.clone(); 4298e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav } else { 4308e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav infoClone.mChildIds.addAll(info.mChildIds); 4318e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav } 4328e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav } 4338e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav 4348e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav infoClone.mConnectionId = info.mConnectionId; 4358e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav 4368e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav return infoClone; 4378e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav } 4388e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav 4398e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav /** 4408e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav * Return an instance back to be reused. 4418e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav * <p> 4428e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav * <strong>Note:</strong> You must not touch the object after calling this function. 4438e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav * </p> 4448e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav * 4458e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav * @throws IllegalStateException If the info is already recycled. 4468e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav */ 4478e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav public void recycle() { 4488e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav clear(); 4498e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav sPool.release(this); 4508e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav } 4518e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav 4528e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav @Override 4538e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav public int describeContents() { 4548e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav return 0; 4558e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav } 4568e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav 4578e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav @Override 4588e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav public void writeToParcel(Parcel parcel, int flags) { 4598e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav parcel.writeInt(mType); 4608e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav parcel.writeInt(mLayer); 4618e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav parcel.writeInt(mBooleanProperties); 4628e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav parcel.writeInt(mId); 4638e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav parcel.writeInt(mParentId); 4648e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav mBoundsInScreen.writeToParcel(parcel, flags); 465396d549113bc633f719acc643c7dfc5f2a8fae4ePhil Weaver parcel.writeCharSequence(mTitle); 466396d549113bc633f719acc643c7dfc5f2a8fae4ePhil Weaver parcel.writeInt(mAnchorId); 4678e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav 4688e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav final LongArray childIds = mChildIds; 4698e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav if (childIds == null) { 4708e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav parcel.writeInt(0); 4718e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav } else { 4728e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav final int childCount = childIds.size(); 4738e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav parcel.writeInt(childCount); 4748e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav for (int i = 0; i < childCount; i++) { 4758e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav parcel.writeInt((int) childIds.get(i)); 4768e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav } 4778e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav } 4788e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav 4798e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav parcel.writeInt(mConnectionId); 4808e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav } 4818e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav 4828e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav private void initFromParcel(Parcel parcel) { 4838e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav mType = parcel.readInt(); 4848e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav mLayer = parcel.readInt(); 4858e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav mBooleanProperties = parcel.readInt(); 4868e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav mId = parcel.readInt(); 4878e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav mParentId = parcel.readInt(); 4888e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav mBoundsInScreen.readFromParcel(parcel); 489396d549113bc633f719acc643c7dfc5f2a8fae4ePhil Weaver mTitle = parcel.readCharSequence(); 490396d549113bc633f719acc643c7dfc5f2a8fae4ePhil Weaver mAnchorId = parcel.readInt(); 4918e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav 4928e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav final int childCount = parcel.readInt(); 4938e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav if (childCount > 0) { 4948e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav if (mChildIds == null) { 4958e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav mChildIds = new LongArray(childCount); 4968e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav } 4978e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav for (int i = 0; i < childCount; i++) { 4988e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav final int childId = parcel.readInt(); 4998e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav mChildIds.add(childId); 5008e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav } 5018e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav } 5028e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav 5038e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav mConnectionId = parcel.readInt(); 5048e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav } 5058e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav 5068e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav @Override 5078e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav public int hashCode() { 5088e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav return mId; 5098e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav } 5108e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav 5118e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav @Override 5128e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav public boolean equals(Object obj) { 5138e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav if (this == obj) { 5148e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav return true; 5158e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav } 5168e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav if (obj == null) { 5178e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav return false; 5188e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav } 5198e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav if (getClass() != obj.getClass()) { 5208e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav return false; 5218e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav } 5228e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav AccessibilityWindowInfo other = (AccessibilityWindowInfo) obj; 5238e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav return (mId == other.mId); 5248e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav } 5258e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav 5268e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav @Override 5278e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav public String toString() { 5288e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav StringBuilder builder = new StringBuilder(); 5298e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav builder.append("AccessibilityWindowInfo["); 530396d549113bc633f719acc643c7dfc5f2a8fae4ePhil Weaver builder.append("title=").append(mTitle); 5318e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav builder.append("id=").append(mId); 5328e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav builder.append(", type=").append(typeToString(mType)); 5338e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav builder.append(", layer=").append(mLayer); 5348e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav builder.append(", bounds=").append(mBoundsInScreen); 5358e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav builder.append(", focused=").append(isFocused()); 5368e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav builder.append(", active=").append(isActive()); 5378e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav if (DEBUG) { 5388e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav builder.append(", parent=").append(mParentId); 5398e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav builder.append(", children=["); 5408e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav if (mChildIds != null) { 5418e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav final int childCount = mChildIds.size(); 5428e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav for (int i = 0; i < childCount; i++) { 5438e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav builder.append(mChildIds.get(i)); 5448e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav if (i < childCount - 1) { 5458e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav builder.append(','); 5468e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav } 5478e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav } 5488e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav } else { 5498e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav builder.append("null"); 5508e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav } 5518e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav builder.append(']'); 5528e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav } else { 5538e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav builder.append(", hasParent=").append(mParentId != UNDEFINED); 554396d549113bc633f719acc643c7dfc5f2a8fae4ePhil Weaver builder.append(", isAnchored=").append(mAnchorId != UNDEFINED); 5558e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav builder.append(", hasChildren=").append(mChildIds != null 5568e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav && mChildIds.size() > 0); 5578e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav } 5588e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav builder.append(']'); 5598e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav return builder.toString(); 5608e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav } 5618e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav 5628e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav /** 5638e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav * Clears the internal state. 5648e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav */ 5658e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav private void clear() { 5668e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav mType = UNDEFINED; 5678e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav mLayer = UNDEFINED; 5688e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav mBooleanProperties = 0; 5698e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav mId = UNDEFINED; 5708e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav mParentId = UNDEFINED; 5718e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav mBoundsInScreen.setEmpty(); 5728e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav if (mChildIds != null) { 5738e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav mChildIds.clear(); 5748e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav } 5758e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav mConnectionId = UNDEFINED; 576396d549113bc633f719acc643c7dfc5f2a8fae4ePhil Weaver mAnchorId = UNDEFINED; 577396d549113bc633f719acc643c7dfc5f2a8fae4ePhil Weaver mTitle = null; 5788e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav } 5798e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav 5808e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav /** 5818e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav * Gets the value of a boolean property. 5828e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav * 5838e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav * @param property The property. 5848e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav * @return The value. 5858e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav */ 5868e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav private boolean getBooleanProperty(int property) { 5878e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav return (mBooleanProperties & property) != 0; 5888e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav } 5898e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav 5908e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav /** 5918e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav * Sets a boolean property. 5928e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav * 5938e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav * @param property The property. 5948e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav * @param value The value. 5958e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav * 5968e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav * @throws IllegalStateException If called from an AccessibilityService. 5978e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav */ 5988e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav private void setBooleanProperty(int property, boolean value) { 5998e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav if (value) { 6008e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav mBooleanProperties |= property; 6018e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav } else { 6028e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav mBooleanProperties &= ~property; 6038e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav } 6048e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav } 6058e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav 6068e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav private static String typeToString(int type) { 6078e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav switch (type) { 6088e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav case TYPE_APPLICATION: { 6098e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav return "TYPE_APPLICATION"; 6108e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav } 6118e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav case TYPE_INPUT_METHOD: { 6128e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav return "TYPE_INPUT_METHOD"; 6138e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav } 6148e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav case TYPE_SYSTEM: { 6158e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav return "TYPE_SYSTEM"; 6168e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav } 6173a5c721072c60c7ed9c8a95d0a65d0e3cb4eb9bbSvetoslav case TYPE_ACCESSIBILITY_OVERLAY: { 6183a5c721072c60c7ed9c8a95d0a65d0e3cb4eb9bbSvetoslav return "TYPE_ACCESSIBILITY_OVERLAY"; 6193a5c721072c60c7ed9c8a95d0a65d0e3cb4eb9bbSvetoslav } 620315c34e7d62ce4b609f2d08b18a11a2d44e93abaPhil Weaver case TYPE_SPLIT_SCREEN_DIVIDER: { 621315c34e7d62ce4b609f2d08b18a11a2d44e93abaPhil Weaver return "TYPE_SPLIT_SCREEN_DIVIDER"; 622315c34e7d62ce4b609f2d08b18a11a2d44e93abaPhil Weaver } 6238e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav default: 6248e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav return "<UNKNOWN>"; 6258e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav } 6268e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav } 6278e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav 6288e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav /** 6298e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav * Checks whether this window changed. The argument should be 6308e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav * another state of the same window, which is have the same id 6318e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav * and type as they never change. 6328e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav * 6338e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav * @param other The new state. 6348e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav * @return Whether something changed. 6358e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav * 6368e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav * @hide 6378e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav */ 6388e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav public boolean changed(AccessibilityWindowInfo other) { 6398e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav if (other.mId != mId) { 6408e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav throw new IllegalArgumentException("Not same window."); 6418e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav } 6428e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav if (other.mType != mType) { 6438e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav throw new IllegalArgumentException("Not same type."); 6448e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav } 645650989b0b5c6679c400db92017e9fafeb43b313eAndreas Gampe if (!mBoundsInScreen.equals(other.mBoundsInScreen)) { 6468e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav return true; 6478e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav } 6488e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav if (mLayer != other.mLayer) { 6498e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav return true; 6508e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav } 6518e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav if (mBooleanProperties != other.mBooleanProperties) { 6528e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav return true; 6538e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav } 6548e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav if (mParentId != other.mParentId) { 6558e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav return true; 6568e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav } 6578e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav if (mChildIds == null) { 6588e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav if (other.mChildIds != null) { 6598e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav return true; 6608e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav } 6618e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav } else if (!mChildIds.equals(other.mChildIds)) { 6628e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav return true; 6638e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav } 6648e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav return false; 6658e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav } 6668e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav 6678e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav public static final Parcelable.Creator<AccessibilityWindowInfo> CREATOR = 6688e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav new Creator<AccessibilityWindowInfo>() { 6698e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav @Override 6708e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav public AccessibilityWindowInfo createFromParcel(Parcel parcel) { 6718e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav AccessibilityWindowInfo info = obtain(); 6728e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav info.initFromParcel(parcel); 6738e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav return info; 6748e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav } 6758e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav 6768e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav @Override 6778e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav public AccessibilityWindowInfo[] newArray(int size) { 6788e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav return new AccessibilityWindowInfo[size]; 6798e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav } 6808e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav }; 6818e3feb15c5aec2c72b0ef120a1da325e1e8f0ddaSvetoslav} 682