From 1bdf3f070b9058058296fe4a36252cec877d88fa Mon Sep 17 00:00:00 2001 From: Felipe Leme Date: Tue, 7 Feb 2017 13:40:55 -0800 Subject: [PATCH] Set autofill id on virtual structures. ViewStructure.newChild(virtualId) uses the AutoFillId of the parent, which was not set anymore due do a previous refactoring, and was causing this method to crash a custom view when onProvideAutoFillVirtualStructure() was called on it. Test: manual verification Bug: 31001899 Change-Id: I602b421b0ec3a926ffdd52253d5b2498c4217d02 --- core/java/android/view/View.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/core/java/android/view/View.java b/core/java/android/view/View.java index 5ea5b0e834a40..29632af0bf086 100644 --- a/core/java/android/view/View.java +++ b/core/java/android/view/View.java @@ -7171,6 +7171,9 @@ public class View implements Drawable.Callback, KeyEvent.Callback, boolean blocked = forAutoFill ? isAutoFillBlocked() : isAssistBlocked(); if (!blocked) { if (forAutoFill) { + // The auto-fill id needs to be unique, but its value doesn't matter, + // so it's better to reuse the accessibility id to save space. + structure.setAutoFillId(getAccessibilityViewId()); // NOTE: flags are not currently supported, hence 0 onProvideAutoFillStructure(structure, 0); onProvideAutoFillVirtualStructure(structure, 0);