diff options
| author | Felipe Leme <felipeal@google.com> | 2018-01-03 09:02:27 -0800 |
|---|---|---|
| committer | Felipe Leme <felipeal@google.com> | 2018-01-03 16:09:55 -0800 |
| commit | 5dc45ca3496e9ff0340adeb83bc875d9282deef9 (patch) | |
| tree | 89c9f633173e8be3df11dafd2692023a539dbcd4 /core/java/android/view/ViewStructure.java | |
| parent | ec08381261637219b244f4e1b0073d6ed30b851a (diff) | |
Added new Autofill APIs to get name of id used on android:text.
Such resource id is useful to help the autofill service heuristics to figure out
the meaning of the labels without relying on their localized text. For example,
the id could be "username", while the text could be "Nome do usuario".
Test: atest CtsAutoFillServiceTestCases:LoginWithStringsActivityTest
Fixes: 71552872
Change-Id: I13f7080fb3c67f91492a113115ffa43d185d192a
Diffstat (limited to 'core/java/android/view/ViewStructure.java')
| -rw-r--r-- | core/java/android/view/ViewStructure.java | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/core/java/android/view/ViewStructure.java b/core/java/android/view/ViewStructure.java index d665dde39afe..1d94abeb51a2 100644 --- a/core/java/android/view/ViewStructure.java +++ b/core/java/android/view/ViewStructure.java @@ -26,6 +26,8 @@ import android.util.Pair; import android.view.autofill.AutofillId; import android.view.autofill.AutofillValue; +import com.android.internal.util.Preconditions; + import java.util.List; /** @@ -204,6 +206,16 @@ public abstract class ViewStructure { public abstract void setTextLines(int[] charOffsets, int[] baselines); /** + * Sets the identifier used to set the text associated with this view. + * + * <p>Should only be set when the node is used for autofill purposes - it will be ignored + * when used for Assist. + */ + public void setTextIdEntry(@NonNull String entryName) { + Preconditions.checkNotNull(entryName); + } + + /** * Set optional hint text associated with this view; this is for example the text that is * shown by an EditText when it is empty to indicate to the user the kind of text to input. */ |
