Loading api/current.txt +2 −0 Original line number Diff line number Diff line Loading @@ -25180,6 +25180,7 @@ package android.view.accessibility { method public boolean isPassword(); method public boolean isScrollable(); method public boolean isSelected(); method public boolean isVisibleToUser(); method public static android.view.accessibility.AccessibilityNodeInfo obtain(android.view.View); method public static android.view.accessibility.AccessibilityNodeInfo obtain(android.view.View, int); method public static android.view.accessibility.AccessibilityNodeInfo obtain(); Loading Loading @@ -25209,6 +25210,7 @@ package android.view.accessibility { method public void setSource(android.view.View); method public void setSource(android.view.View, int); method public void setText(java.lang.CharSequence); method public void setVisibleToUser(boolean); method public void writeToParcel(android.os.Parcel, int); field public static final int ACTION_ACCESSIBILITY_FOCUS = 64; // 0x40 field public static final java.lang.String ACTION_ARGUMENT_HTML_ELEMENT_STRING = "ACTION_ARGUMENT_HTML_ELEMENT_STRING"; core/java/android/view/AccessibilityInteractionController.java +21 −11 Original line number Diff line number Diff line Loading @@ -126,6 +126,16 @@ final class AccessibilityInteractionController { } } private boolean isShown(View view) { // The first two checks are made also made by isShown() which // however traverses the tree up to the parent to catch that. // Therefore, we do some fail fast check to minimize the up // tree traversal. return (view.mAttachInfo != null && view.mAttachInfo.mWindowVisibility == View.VISIBLE && view.isShown()); } public void findAccessibilityNodeInfoByAccessibilityIdClientThread( long accessibilityNodeId, int interactionId, IAccessibilityInteractionConnectionCallback callback, int flags, int interrogatingPid, Loading Loading @@ -174,7 +184,7 @@ final class AccessibilityInteractionController { } else { root = findViewByAccessibilityId(accessibilityViewId); } if (root != null && root.isDisplayedOnScreen()) { if (root != null && isShown(root)) { mPrefetcher.prefetchAccessibilityNodeInfos(root, virtualDescendantId, flags, infos); } } finally { Loading Loading @@ -236,7 +246,7 @@ final class AccessibilityInteractionController { } if (root != null) { View target = root.findViewById(viewId); if (target != null && target.isDisplayedOnScreen()) { if (target != null && isShown(target)) { info = target.createAccessibilityNodeInfo(); } } Loading Loading @@ -298,7 +308,7 @@ final class AccessibilityInteractionController { } else { root = mViewRootImpl.mView; } if (root != null && root.isDisplayedOnScreen()) { if (root != null && isShown(root)) { AccessibilityNodeProvider provider = root.getAccessibilityNodeProvider(); if (provider != null) { infos = provider.findAccessibilityNodeInfosByText(text, Loading @@ -315,7 +325,7 @@ final class AccessibilityInteractionController { final int viewCount = foundViews.size(); for (int i = 0; i < viewCount; i++) { View foundView = foundViews.get(i); if (foundView.isDisplayedOnScreen()) { if (isShown(foundView)) { provider = foundView.getAccessibilityNodeProvider(); if (provider != null) { List<AccessibilityNodeInfo> infosFromProvider = Loading Loading @@ -390,7 +400,7 @@ final class AccessibilityInteractionController { } else { root = mViewRootImpl.mView; } if (root != null && root.isDisplayedOnScreen()) { if (root != null && isShown(root)) { switch (focusType) { case AccessibilityNodeInfo.FOCUS_ACCESSIBILITY: { View host = mViewRootImpl.mAccessibilityFocusedHost; Loading @@ -411,7 +421,7 @@ final class AccessibilityInteractionController { case AccessibilityNodeInfo.FOCUS_INPUT: { // Input focus cannot go to virtual views. View target = root.findFocus(); if (target != null && target.isDisplayedOnScreen()) { if (target != null && isShown(target)) { focused = target.createAccessibilityNodeInfo(); } } break; Loading Loading @@ -477,7 +487,7 @@ final class AccessibilityInteractionController { } else { root = mViewRootImpl.mView; } if (root != null && root.isDisplayedOnScreen()) { if (root != null && isShown(root)) { if ((direction & View.FOCUS_ACCESSIBILITY) == View.FOCUS_ACCESSIBILITY) { AccessibilityNodeProvider provider = root.getAccessibilityNodeProvider(); if (provider != null) { Loading Loading @@ -565,7 +575,7 @@ final class AccessibilityInteractionController { } else { target = mViewRootImpl.mView; } if (target != null && target.isDisplayedOnScreen()) { if (target != null && isShown(target)) { AccessibilityNodeProvider provider = target.getAccessibilityNodeProvider(); if (provider != null) { succeeded = provider.performAction(virtualDescendantId, action, Loading @@ -590,7 +600,7 @@ final class AccessibilityInteractionController { return null; } View foundView = root.findViewByAccessibilityId(accessibilityId); if (foundView != null && !foundView.isDisplayedOnScreen()) { if (foundView != null && !isShown(foundView)) { return null; } return foundView; Loading Loading @@ -670,7 +680,7 @@ final class AccessibilityInteractionController { } View child = children.getChildAt(i); if (child.getAccessibilityViewId() != current.getAccessibilityViewId() && child.isDisplayedOnScreen()) { && isShown(child)) { AccessibilityNodeInfo info = null; AccessibilityNodeProvider provider = child.getAccessibilityNodeProvider(); if (provider == null) { Loading Loading @@ -706,7 +716,7 @@ final class AccessibilityInteractionController { return; } View child = children.getChildAt(i); if (child.isDisplayedOnScreen()) { if (isShown(child)) { AccessibilityNodeProvider provider = child.getAccessibilityNodeProvider(); if (provider == null) { AccessibilityNodeInfo info = child.createAccessibilityNodeInfo(); Loading core/java/android/view/View.java +54 −6 Original line number Diff line number Diff line Loading @@ -4665,6 +4665,51 @@ public class View implements Drawable.Callback, Drawable.Callback2, KeyEvent.Cal } } /** * Gets the location of this view in screen coordintates. * * @param outRect The output location */ private void getBoundsOnScreen(Rect outRect) { if (mAttachInfo == null) { return; } RectF position = mAttachInfo.mTmpTransformRect; position.setEmpty(); if (!hasIdentityMatrix()) { getMatrix().mapRect(position); } position.offset(mLeft, mRight); ViewParent parent = mParent; while (parent instanceof View) { View parentView = (View) parent; position.offset(-parentView.mScrollX, -parentView.mScrollY); if (!parentView.hasIdentityMatrix()) { parentView.getMatrix().mapRect(position); } position.offset(parentView.mLeft, parentView.mTop); parent = parentView.mParent; } if (parent instanceof ViewRootImpl) { ViewRootImpl viewRootImpl = (ViewRootImpl) parent; position.offset(0, -viewRootImpl.mCurScrollY); } position.offset(mAttachInfo.mWindowLeft, mAttachInfo.mWindowTop); outRect.set((int) (position.left + 0.5f), (int) (position.top + 0.5f), (int) (position.right + 0.5f), (int) (position.bottom + 0.5f)); } /** * @see #onInitializeAccessibilityNodeInfo(AccessibilityNodeInfo) * Loading @@ -4675,8 +4720,7 @@ public class View implements Drawable.Callback, Drawable.Callback2, KeyEvent.Cal getDrawingRect(bounds); info.setBoundsInParent(bounds); getGlobalVisibleRect(bounds); bounds.offset(mAttachInfo.mWindowLeft, mAttachInfo.mWindowTop); getBoundsOnScreen(bounds); info.setBoundsInScreen(bounds); if ((mPrivateFlags & IS_ROOT_NAMESPACE) == 0) { Loading @@ -4686,6 +4730,8 @@ public class View implements Drawable.Callback, Drawable.Callback2, KeyEvent.Cal } } info.setVisibleToUser(isVisibleToUser()); info.setPackageName(mContext.getPackageName()); info.setClassName(View.class.getName()); info.setContentDescription(getContentDescription()); Loading Loading @@ -4736,11 +4782,13 @@ public class View implements Drawable.Callback, Drawable.Callback2, KeyEvent.Cal } /** * Computes whether this view is visible on the screen. * Computes whether this view is visible to the user. Such a view is * attached, visible, all its predecessors are visible, it is not clipped * entirely by its predecessors, and has an alpha greater than zero. * * @return Whether the view is visible on the screen. */ boolean isDisplayedOnScreen() { private boolean isVisibleToUser() { // The first two checks are made also made by isShown() which // however traverses the tree up to the parent to catch that. // Therefore, we do some fail fast check to minimize the up Loading Loading @@ -6395,9 +6443,9 @@ public class View implements Drawable.Callback, Drawable.Callback2, KeyEvent.Cal boolean includeForAccessibility() { if (mAttachInfo != null) { if (!mAttachInfo.mIncludeNotImportantViews) { return isImportantForAccessibility() && isDisplayedOnScreen(); return isImportantForAccessibility(); } else { return isDisplayedOnScreen(); return true; } } return false; Loading core/java/android/view/accessibility/AccessibilityNodeInfo.java +27 −0 Original line number Diff line number Diff line Loading @@ -287,6 +287,8 @@ public class AccessibilityNodeInfo implements Parcelable { private static final int PROPERTY_ACCESSIBILITY_FOCUSED = 0x00000400; private static final int PROPERTY_VISIBLE_TO_USER = 0x00000800; /** * Bits that provide the id of a virtual descendant of a view. */ Loading Loading @@ -909,6 +911,31 @@ public class AccessibilityNodeInfo implements Parcelable { setBooleanProperty(PROPERTY_FOCUSED, focused); } /** * Sets whether this node is visible to the user. * * @return Whether the node is visible to the user. */ public boolean isVisibleToUser() { return getBooleanProperty(PROPERTY_VISIBLE_TO_USER); } /** * Sets whether this node is visible to the user. * <p> * <strong>Note:</strong> Cannot be called from an * {@link android.accessibilityservice.AccessibilityService}. * This class is made immutable before being delivered to an AccessibilityService. * </p> * * @param visibleToUser Whether the node is visible to the user. * * @throws IllegalStateException If called from an AccessibilityService. */ public void setVisibleToUser(boolean visibleToUser) { setBooleanProperty(PROPERTY_VISIBLE_TO_USER, visibleToUser); } /** * Gets whether this node is accessibility focused. * Loading Loading
api/current.txt +2 −0 Original line number Diff line number Diff line Loading @@ -25180,6 +25180,7 @@ package android.view.accessibility { method public boolean isPassword(); method public boolean isScrollable(); method public boolean isSelected(); method public boolean isVisibleToUser(); method public static android.view.accessibility.AccessibilityNodeInfo obtain(android.view.View); method public static android.view.accessibility.AccessibilityNodeInfo obtain(android.view.View, int); method public static android.view.accessibility.AccessibilityNodeInfo obtain(); Loading Loading @@ -25209,6 +25210,7 @@ package android.view.accessibility { method public void setSource(android.view.View); method public void setSource(android.view.View, int); method public void setText(java.lang.CharSequence); method public void setVisibleToUser(boolean); method public void writeToParcel(android.os.Parcel, int); field public static final int ACTION_ACCESSIBILITY_FOCUS = 64; // 0x40 field public static final java.lang.String ACTION_ARGUMENT_HTML_ELEMENT_STRING = "ACTION_ARGUMENT_HTML_ELEMENT_STRING";
core/java/android/view/AccessibilityInteractionController.java +21 −11 Original line number Diff line number Diff line Loading @@ -126,6 +126,16 @@ final class AccessibilityInteractionController { } } private boolean isShown(View view) { // The first two checks are made also made by isShown() which // however traverses the tree up to the parent to catch that. // Therefore, we do some fail fast check to minimize the up // tree traversal. return (view.mAttachInfo != null && view.mAttachInfo.mWindowVisibility == View.VISIBLE && view.isShown()); } public void findAccessibilityNodeInfoByAccessibilityIdClientThread( long accessibilityNodeId, int interactionId, IAccessibilityInteractionConnectionCallback callback, int flags, int interrogatingPid, Loading Loading @@ -174,7 +184,7 @@ final class AccessibilityInteractionController { } else { root = findViewByAccessibilityId(accessibilityViewId); } if (root != null && root.isDisplayedOnScreen()) { if (root != null && isShown(root)) { mPrefetcher.prefetchAccessibilityNodeInfos(root, virtualDescendantId, flags, infos); } } finally { Loading Loading @@ -236,7 +246,7 @@ final class AccessibilityInteractionController { } if (root != null) { View target = root.findViewById(viewId); if (target != null && target.isDisplayedOnScreen()) { if (target != null && isShown(target)) { info = target.createAccessibilityNodeInfo(); } } Loading Loading @@ -298,7 +308,7 @@ final class AccessibilityInteractionController { } else { root = mViewRootImpl.mView; } if (root != null && root.isDisplayedOnScreen()) { if (root != null && isShown(root)) { AccessibilityNodeProvider provider = root.getAccessibilityNodeProvider(); if (provider != null) { infos = provider.findAccessibilityNodeInfosByText(text, Loading @@ -315,7 +325,7 @@ final class AccessibilityInteractionController { final int viewCount = foundViews.size(); for (int i = 0; i < viewCount; i++) { View foundView = foundViews.get(i); if (foundView.isDisplayedOnScreen()) { if (isShown(foundView)) { provider = foundView.getAccessibilityNodeProvider(); if (provider != null) { List<AccessibilityNodeInfo> infosFromProvider = Loading Loading @@ -390,7 +400,7 @@ final class AccessibilityInteractionController { } else { root = mViewRootImpl.mView; } if (root != null && root.isDisplayedOnScreen()) { if (root != null && isShown(root)) { switch (focusType) { case AccessibilityNodeInfo.FOCUS_ACCESSIBILITY: { View host = mViewRootImpl.mAccessibilityFocusedHost; Loading @@ -411,7 +421,7 @@ final class AccessibilityInteractionController { case AccessibilityNodeInfo.FOCUS_INPUT: { // Input focus cannot go to virtual views. View target = root.findFocus(); if (target != null && target.isDisplayedOnScreen()) { if (target != null && isShown(target)) { focused = target.createAccessibilityNodeInfo(); } } break; Loading Loading @@ -477,7 +487,7 @@ final class AccessibilityInteractionController { } else { root = mViewRootImpl.mView; } if (root != null && root.isDisplayedOnScreen()) { if (root != null && isShown(root)) { if ((direction & View.FOCUS_ACCESSIBILITY) == View.FOCUS_ACCESSIBILITY) { AccessibilityNodeProvider provider = root.getAccessibilityNodeProvider(); if (provider != null) { Loading Loading @@ -565,7 +575,7 @@ final class AccessibilityInteractionController { } else { target = mViewRootImpl.mView; } if (target != null && target.isDisplayedOnScreen()) { if (target != null && isShown(target)) { AccessibilityNodeProvider provider = target.getAccessibilityNodeProvider(); if (provider != null) { succeeded = provider.performAction(virtualDescendantId, action, Loading @@ -590,7 +600,7 @@ final class AccessibilityInteractionController { return null; } View foundView = root.findViewByAccessibilityId(accessibilityId); if (foundView != null && !foundView.isDisplayedOnScreen()) { if (foundView != null && !isShown(foundView)) { return null; } return foundView; Loading Loading @@ -670,7 +680,7 @@ final class AccessibilityInteractionController { } View child = children.getChildAt(i); if (child.getAccessibilityViewId() != current.getAccessibilityViewId() && child.isDisplayedOnScreen()) { && isShown(child)) { AccessibilityNodeInfo info = null; AccessibilityNodeProvider provider = child.getAccessibilityNodeProvider(); if (provider == null) { Loading Loading @@ -706,7 +716,7 @@ final class AccessibilityInteractionController { return; } View child = children.getChildAt(i); if (child.isDisplayedOnScreen()) { if (isShown(child)) { AccessibilityNodeProvider provider = child.getAccessibilityNodeProvider(); if (provider == null) { AccessibilityNodeInfo info = child.createAccessibilityNodeInfo(); Loading
core/java/android/view/View.java +54 −6 Original line number Diff line number Diff line Loading @@ -4665,6 +4665,51 @@ public class View implements Drawable.Callback, Drawable.Callback2, KeyEvent.Cal } } /** * Gets the location of this view in screen coordintates. * * @param outRect The output location */ private void getBoundsOnScreen(Rect outRect) { if (mAttachInfo == null) { return; } RectF position = mAttachInfo.mTmpTransformRect; position.setEmpty(); if (!hasIdentityMatrix()) { getMatrix().mapRect(position); } position.offset(mLeft, mRight); ViewParent parent = mParent; while (parent instanceof View) { View parentView = (View) parent; position.offset(-parentView.mScrollX, -parentView.mScrollY); if (!parentView.hasIdentityMatrix()) { parentView.getMatrix().mapRect(position); } position.offset(parentView.mLeft, parentView.mTop); parent = parentView.mParent; } if (parent instanceof ViewRootImpl) { ViewRootImpl viewRootImpl = (ViewRootImpl) parent; position.offset(0, -viewRootImpl.mCurScrollY); } position.offset(mAttachInfo.mWindowLeft, mAttachInfo.mWindowTop); outRect.set((int) (position.left + 0.5f), (int) (position.top + 0.5f), (int) (position.right + 0.5f), (int) (position.bottom + 0.5f)); } /** * @see #onInitializeAccessibilityNodeInfo(AccessibilityNodeInfo) * Loading @@ -4675,8 +4720,7 @@ public class View implements Drawable.Callback, Drawable.Callback2, KeyEvent.Cal getDrawingRect(bounds); info.setBoundsInParent(bounds); getGlobalVisibleRect(bounds); bounds.offset(mAttachInfo.mWindowLeft, mAttachInfo.mWindowTop); getBoundsOnScreen(bounds); info.setBoundsInScreen(bounds); if ((mPrivateFlags & IS_ROOT_NAMESPACE) == 0) { Loading @@ -4686,6 +4730,8 @@ public class View implements Drawable.Callback, Drawable.Callback2, KeyEvent.Cal } } info.setVisibleToUser(isVisibleToUser()); info.setPackageName(mContext.getPackageName()); info.setClassName(View.class.getName()); info.setContentDescription(getContentDescription()); Loading Loading @@ -4736,11 +4782,13 @@ public class View implements Drawable.Callback, Drawable.Callback2, KeyEvent.Cal } /** * Computes whether this view is visible on the screen. * Computes whether this view is visible to the user. Such a view is * attached, visible, all its predecessors are visible, it is not clipped * entirely by its predecessors, and has an alpha greater than zero. * * @return Whether the view is visible on the screen. */ boolean isDisplayedOnScreen() { private boolean isVisibleToUser() { // The first two checks are made also made by isShown() which // however traverses the tree up to the parent to catch that. // Therefore, we do some fail fast check to minimize the up Loading Loading @@ -6395,9 +6443,9 @@ public class View implements Drawable.Callback, Drawable.Callback2, KeyEvent.Cal boolean includeForAccessibility() { if (mAttachInfo != null) { if (!mAttachInfo.mIncludeNotImportantViews) { return isImportantForAccessibility() && isDisplayedOnScreen(); return isImportantForAccessibility(); } else { return isDisplayedOnScreen(); return true; } } return false; Loading
core/java/android/view/accessibility/AccessibilityNodeInfo.java +27 −0 Original line number Diff line number Diff line Loading @@ -287,6 +287,8 @@ public class AccessibilityNodeInfo implements Parcelable { private static final int PROPERTY_ACCESSIBILITY_FOCUSED = 0x00000400; private static final int PROPERTY_VISIBLE_TO_USER = 0x00000800; /** * Bits that provide the id of a virtual descendant of a view. */ Loading Loading @@ -909,6 +911,31 @@ public class AccessibilityNodeInfo implements Parcelable { setBooleanProperty(PROPERTY_FOCUSED, focused); } /** * Sets whether this node is visible to the user. * * @return Whether the node is visible to the user. */ public boolean isVisibleToUser() { return getBooleanProperty(PROPERTY_VISIBLE_TO_USER); } /** * Sets whether this node is visible to the user. * <p> * <strong>Note:</strong> Cannot be called from an * {@link android.accessibilityservice.AccessibilityService}. * This class is made immutable before being delivered to an AccessibilityService. * </p> * * @param visibleToUser Whether the node is visible to the user. * * @throws IllegalStateException If called from an AccessibilityService. */ public void setVisibleToUser(boolean visibleToUser) { setBooleanProperty(PROPERTY_VISIBLE_TO_USER, visibleToUser); } /** * Gets whether this node is accessibility focused. * Loading