From 30601459a707e27c0302e8793fca473f0fb8c9ca Mon Sep 17 00:00:00 2001 From: Phil Weaver Date: Mon, 16 Apr 2018 14:23:04 -0700 Subject: [PATCH] A11y isHeading takes old API into account Bug: 77729403 Test: New linked CTS test Change-Id: Idd87fa98619a77a45431beb00683bf6e8a3674b3 --- .../android/view/accessibility/AccessibilityNodeInfo.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/core/java/android/view/accessibility/AccessibilityNodeInfo.java b/core/java/android/view/accessibility/AccessibilityNodeInfo.java index 03f1c1243755d..f172a4860ad48 100644 --- a/core/java/android/view/accessibility/AccessibilityNodeInfo.java +++ b/core/java/android/view/accessibility/AccessibilityNodeInfo.java @@ -2413,11 +2413,16 @@ public class AccessibilityNodeInfo implements Parcelable { /** * Returns whether node represents a heading. + *

Note: Returns {@code true} if either {@link #setHeading(boolean)} + * marks this node as a heading or if the node has a {@link CollectionItemInfo} that marks + * it as such, to accomodate apps that use the now-deprecated API.

* * @return {@code true} if the node is a heading, {@code false} otherwise. */ public boolean isHeading() { - return getBooleanProperty(BOOLEAN_PROPERTY_IS_HEADING); + if (getBooleanProperty(BOOLEAN_PROPERTY_IS_HEADING)) return true; + CollectionItemInfo itemInfo = getCollectionItemInfo(); + return ((itemInfo != null) && itemInfo.mHeading); } /**