summaryrefslogtreecommitdiff
path: root/core/java
diff options
context:
space:
mode:
authorPhil Weaver <pweaver@google.com>2016-02-10 11:19:52 -0800
committerPhil Weaver <pweaver@google.com>2016-02-10 11:19:52 -0800
commit4354b340bbc105c556f84202699050d7fc225a25 (patch)
tree42fa9f0a8ad2726fe63320d5f2a79dae22a18f75 /core/java
parentcc494765faea28adeca7584d75c97933ffaf309b (diff)
Fix ViewPager crash for a11y z order.
The ViewPager requires measure/layout to initialize a list used in getChildDrawingOrder, and crashes when this method is called too early. Protecting against that by assigning a default value to the drawing order value of AccessibilityNodeInfo if the View bounds have not yet been set. Bug: 27076826 Change-Id: Ic42dbb81d15340f6b021626b1c27ad5abce7e7d1
Diffstat (limited to 'core/java')
-rw-r--r--core/java/android/view/View.java9
1 files changed, 9 insertions, 0 deletions
diff --git a/core/java/android/view/View.java b/core/java/android/view/View.java
index f52b29077f27..a06a5b0063bb 100644
--- a/core/java/android/view/View.java
+++ b/core/java/android/view/View.java
@@ -6851,6 +6851,15 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
* @param info The info whose drawing order should be populated
*/
private void populateAccessibilityNodeInfoDrawingOrderInParent(AccessibilityNodeInfo info) {
+ /*
+ * If the view's bounds haven't been set yet, layout has not completed. In that situation,
+ * drawing order may not be well-defined, and some Views with custom drawing order may
+ * not be initialized sufficiently to respond properly getChildDrawingOrder.
+ */
+ if ((mPrivateFlags & PFLAG_HAS_BOUNDS) == 0) {
+ info.setDrawingOrder(0);
+ return;
+ }
int drawingOrderInParent = 1;
// Iterate up the hierarchy if parents are not important for a11y
View viewAtDrawingLevel = this;