From 5013f9feb23b4d6679db61db7722ae5ec359c1ee Mon Sep 17 00:00:00 2001 From: Felipe Leme Date: Thu, 8 Jun 2017 18:12:32 -0700 Subject: [PATCH] Ignore dispatchProvideStructureForAutofill() when layout is being updated. View already checks if its layout is being updated when calling notifyEnterOrExitForAutoFillIfNeeded(), but that doesn't prevent apps crashing when the autofill process was triggered by another view. Test: existing CtsAutoFillServiceTestCases pass Fixes: 38198484 change-Id: I8e9435ddc4cf21fb648d39aace93f3af0e1fdf4f --- core/java/android/view/View.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/core/java/android/view/View.java b/core/java/android/view/View.java index a9c85f0e1488c..5c926f61df290 100644 --- a/core/java/android/view/View.java +++ b/core/java/android/view/View.java @@ -8065,6 +8065,10 @@ public class View implements Drawable.Callback, KeyEvent.Callback, boolean forAutofill, @AutofillFlags int flags) { if (forAutofill) { structure.setAutofillId(getAutofillId()); + if (!isLaidOut()) { + Log.w(VIEW_LOG_TAG, "dispatchProvideAutofillStructure(): not laid out, ignoring"); + return; + } onProvideAutofillStructure(structure, flags); onProvideAutofillVirtualStructure(structure, flags); } else if (!isAssistBlocked()) {