From f8a8174cd5bc8aff63befd6ca6d96d21e89260bd Mon Sep 17 00:00:00 2001 From: Felipe Leme Date: Fri, 17 Mar 2017 18:05:01 -0700 Subject: Changes on Assist structure to handle virtual child for autofill: - Removed overloaded newChild() methods. - Added a setAutofillId(parent, virtualId). - Changed view so AutofillId is set on all relevant methods. Test: VirtualContainerActivityTest (with new tests) pass Bug: 36056207 Change-Id: Ia11344f95c2756e83307c54052878e9dbe471873 --- core/java/android/view/ViewStructure.java | 35 +++++-------------------------- 1 file changed, 5 insertions(+), 30 deletions(-) (limited to 'core/java/android/view/ViewStructure.java') diff --git a/core/java/android/view/ViewStructure.java b/core/java/android/view/ViewStructure.java index 989cb13d3e69..e4eb014d5e0f 100644 --- a/core/java/android/view/ViewStructure.java +++ b/core/java/android/view/ViewStructure.java @@ -16,6 +16,7 @@ package android.view; +import android.annotation.NonNull; import android.annotation.Nullable; import android.graphics.Matrix; import android.graphics.Rect; @@ -268,20 +269,6 @@ public abstract class ViewStructure { */ public abstract ViewStructure newChild(int index); - /** - * Create a new child {@link ViewStructure} in this view for autofill purposes. - * - * @param index the index (in the list of children) to put the new child at (see - * {@link #addChildCount(int)} and {@link #setChildCount(int)}. - * @param virtualId an opaque ID to the Android System (although it could be meaningful to the - * {@link View} creating the {@link ViewStructure}), but it's the same id used on - * {@link View#autofill(android.util.SparseArray)}. - * @param flags currently {@code 0}. - * - * @return Returns an fresh {@link ViewStructure} ready to be filled in. - */ - public abstract ViewStructure newChild(int index, int virtualId, int flags); - /** * Like {@link #newChild}, but allows the caller to asynchronously populate the returned * child. It can transfer the returned {@link ViewStructure} to another thread for it @@ -293,25 +280,13 @@ public abstract class ViewStructure { public abstract ViewStructure asyncNewChild(int index); /** - * Like {@link #newChild(int, int, int)}, but allows the caller to asynchronously - * populate the returned child. - * - *

It can transfer the returned {@link ViewStructure} to another thread for it to build its - * content (and children etc). - * - *

Once done, some thread must call {@link #asyncCommit()} to tell the containing - * {@link ViewStructure} that the async population is done. + * Sets the {@link AutofillId} for this virtual node. * - * @param index the index (in the list of children) to put the new child at (see - * {@link #addChildCount(int)} and {@link #setChildCount(int)}. - * @param virtualId an opaque ID to the Android System (although it could be meaningful to the - * {@link View} creating the {@link ViewStructure}), but it's the same id used on + * @param parent parent node. + * @param virtualId an opaque ID to the Android System; it's the same id used on * {@link View#autofill(android.util.SparseArray)}. - * @param flags currently {@code 0}. - * - * @return Returns an fresh {@link ViewStructure} ready to be filled in. */ - public abstract ViewStructure asyncNewChild(int index, int virtualId, int flags); + public abstract void setAutofillId(@NonNull ViewStructure parent, int virtualId); /** * Sets the {@link View#getAutofillType()} that can be used to autofill this node. -- cgit v1.2.3