• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2015 The Android Open Source Project
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 package android.view;
18 
19 import static android.service.autofill.Flags.FLAG_AUTOFILL_CREDMAN_DEV_INTEGRATION;
20 import static android.service.autofill.Flags.FLAG_AUTOFILL_W_METRICS;
21 
22 import android.annotation.FlaggedApi;
23 import android.annotation.NonNull;
24 import android.annotation.Nullable;
25 import android.annotation.SuppressLint;
26 import android.credentials.GetCredentialException;
27 import android.credentials.GetCredentialRequest;
28 import android.credentials.GetCredentialResponse;
29 import android.graphics.Matrix;
30 import android.graphics.Rect;
31 import android.os.Bundle;
32 import android.os.LocaleList;
33 import android.os.OutcomeReceiver;
34 import android.util.Pair;
35 import android.view.View.AutofillImportance;
36 import android.view.autofill.AutofillId;
37 import android.view.autofill.AutofillValue;
38 
39 import com.android.internal.util.Preconditions;
40 
41 import java.util.List;
42 
43 /**
44  * <p><code>ViewStructure</code> is a container for storing additional
45  * per-view data generated by {@link View#onProvideStructure
46  * View.onProvideStructure} and {@link View#onProvideAutofillStructure
47  * View.onProvideAutofillStructure}.
48  *
49  * <p>To learn more about using Autofill in your app, read the
50  * <a href="/guide/topics/text/autofill">Autofill Framework</a> guides.
51  *
52  */
53 public abstract class ViewStructure {
54 
55     /**
56      * Key used for writing active child view information to the content capture bundle.
57      *
58      * The value stored under this key will be an ordered list of Autofill IDs of child views.
59      *
60      * TODO(b/241498401): Add @TestApi in Android U
61      * @hide
62      */
63     public static final String EXTRA_ACTIVE_CHILDREN_IDS =
64             "android.view.ViewStructure.extra.ACTIVE_CHILDREN_IDS";
65 
66     /**
67      * Key used for writing the first active child's position to the content capture bundle.
68      *
69      * When active child view information is provided under the
70      * {@link #EXTRA_ACTIVE_CHILDREN_IDS}, the value stored under this key will be the
71      * 0-based position of the first child view in the list relative to the positions of child views
72      * in the containing View's dataset.
73      *
74      * TODO(b/241498401): Add @TestApi in Android U
75      * @hide */
76     public static final String EXTRA_FIRST_ACTIVE_POSITION =
77             "android.view.ViewStructure.extra.FIRST_ACTIVE_POSITION";
78 
79     /**
80      * Key used for confirming whether the view draws graphics containing secure layers.
81      *
82      * <p>Secure layers cannot be read back into main memory and will show up as blank regions
83      * in assist screenshots.
84      *
85      * @see android.view.SurfaceControl#SECURE
86      *
87      * @hide
88      */
89     public static final String EXTRA_CONTAINS_SECURE_LAYERS =
90             "android.view.ViewStructure.extra.CONTAINS_SECURE_LAYERS";
91 
92     /**
93      * Key used for writing the type of the view that generated the virtual structure of its
94      * children.
95      *
96      * <p>For example, if the virtual structure is generated by a webview, the value would be
97      * "WebView". If the virtual structure is generated by a compose view, then the value would be
98      * "ComposeView". The value is of type String.
99      *
100      * <p>This value is added to mainly help with debugging purpose.
101      */
102     @FlaggedApi(FLAG_AUTOFILL_W_METRICS)
103     @SuppressWarnings(
104             "ActionValue") // Lint expects this as
105                            // android.view.contentcapture.extra.VIRTUAL_STRUCTURE_VERSION_NUMBER
106                            // but should not have contentcapture
107     public static final String EXTRA_VIRTUAL_STRUCTURE_TYPE =
108             "android.view.extra.VIRTUAL_STRUCTURE_TYPE";
109 
110     /**
111      * Key used for specifying the version of the view that generated the virtual structure for
112      * itself and its children
113      *
114      * <p>For example, if the virtual structure is generated by a webview of version
115      * "104.0.5112.69", then the value should be "104.0.5112.69"
116      */
117     @FlaggedApi(FLAG_AUTOFILL_W_METRICS)
118     @SuppressWarnings(
119             "ActionValue") // Lint expects this as
120                            // android.view.contentcapture.extra.VIRTUAL_STRUCTURE_TYPE
121                            // but should not have contentcapture
122     public static final String EXTRA_VIRTUAL_STRUCTURE_VERSION_NUMBER =
123             "android.view.extra.VIRTUAL_STRUCTURE_VERSION_NUMBER";
124 
125     /**
126      * Set the identifier for this view.
127      *
128      * @param id The view's identifier, as per {@link View#getId View.getId()}.
129      * @param packageName The package name of the view's identifier, or null if there is none.
130      * @param typeName The type name of the view's identifier, or null if there is none.
131      * @param entryName The entry name of the view's identifier, or null if there is none.
132      */
setId(int id, String packageName, String typeName, String entryName)133     public abstract void setId(int id, String packageName, String typeName, String entryName);
134 
135     /**
136      * Set the basic dimensions of this view.
137      *
138      * @param left The view's left position, in pixels relative to its parent's left edge.
139      * @param top The view's top position, in pixels relative to its parent's top edge.
140      * @param scrollX How much the view's x coordinate space has been scrolled, in pixels.
141      * @param scrollY How much the view's y coordinate space has been scrolled, in pixels.
142      * @param width The view's visible width, in pixels.  This is the width visible on screen,
143      * not the total data width of a scrollable view.
144      * @param height The view's visible height, in pixels.  This is the height visible on
145      * screen, not the total data height of a scrollable view.
146      */
setDimens(int left, int top, int scrollX, int scrollY, int width, int height)147     public abstract void setDimens(int left, int top, int scrollX, int scrollY, int width,
148             int height);
149 
150     /**
151      * Set the transformation matrix associated with this view, as per
152      * {@link View#getMatrix View.getMatrix()}, or null if there is none.
153      */
setTransformation(Matrix matrix)154     public abstract void setTransformation(Matrix matrix);
155 
156     /**
157      * Set the visual elevation (shadow) of the view, as per
158      * {@link View#getZ View.getZ()}.  Note this is <em>not</em> related
159      * to the physical Z-ordering of this view relative to its other siblings (that is how
160      * they overlap when drawing), it is only the visual representation for shadowing.
161      */
setElevation(float elevation)162     public abstract void setElevation(float elevation);
163 
164     /**
165      * Set an alpha transformation that is applied to this view, as per
166      * {@link View#getAlpha View.getAlpha()}.  Value ranges from 0
167      * (completely transparent) to 1 (completely opaque); the default is 1, which means
168      * no transformation.
169      */
setAlpha(float alpha)170     public abstract void setAlpha(float alpha);
171 
172     /**
173      * Set the visibility state of this view, as per
174      * {@link View#getVisibility View.getVisibility()}.
175      */
setVisibility(int visibility)176     public abstract void setVisibility(int visibility);
177 
178     /** @hide */
179     @SuppressWarnings("HiddenAbstractMethod")
setAssistBlocked(boolean state)180     public abstract void setAssistBlocked(boolean state);
181 
182     /**
183      * Set the enabled state of this view, as per {@link View#isEnabled View.isEnabled()}.
184      */
setEnabled(boolean state)185     public abstract void setEnabled(boolean state);
186 
187     /**
188      * Set the clickable state of this view, as per {@link View#isClickable View.isClickable()}.
189      */
setClickable(boolean state)190     public abstract void setClickable(boolean state);
191 
192     /**
193      * Set the long clickable state of this view, as per
194      * {@link View#isLongClickable View.isLongClickable()}.
195      */
setLongClickable(boolean state)196     public abstract void setLongClickable(boolean state);
197 
198     /**
199      * Set the context clickable state of this view, as per
200      * {@link View#isContextClickable View.isContextClickable()}.
201      */
setContextClickable(boolean state)202     public abstract void setContextClickable(boolean state);
203 
204     /**
205      * Set the focusable state of this view, as per {@link View#isFocusable View.isFocusable()}.
206      */
setFocusable(boolean state)207     public abstract void setFocusable(boolean state);
208 
209     /**
210      * Set the focused state of this view, as per {@link View#isFocused View.isFocused()}.
211      */
setFocused(boolean state)212     public abstract void setFocused(boolean state);
213 
214     /**
215      * Set the accessibility focused state of this view, as per
216      * {@link View#isAccessibilityFocused View.isAccessibilityFocused()}.
217      */
setAccessibilityFocused(boolean state)218     public abstract void setAccessibilityFocused(boolean state);
219 
220     /**
221      * Set the checkable state of this view, such as whether it implements the
222      * {@link android.widget.Checkable} interface.
223      */
setCheckable(boolean state)224     public abstract void setCheckable(boolean state);
225 
226     /**
227      * Set the checked state of this view, such as
228      * {@link android.widget.Checkable#isChecked Checkable.isChecked()}.
229      */
setChecked(boolean state)230     public abstract void setChecked(boolean state);
231 
232     /**
233      * Set the selected state of this view, as per {@link View#isSelected View.isSelected()}.
234      */
setSelected(boolean state)235     public abstract void setSelected(boolean state);
236 
237     /**
238      * Set the activated state of this view, as per {@link View#isActivated View.isActivated()}.
239      */
setActivated(boolean state)240     public abstract void setActivated(boolean state);
241 
242     /**
243      * Set the opaque state of this view, as per {@link View#isOpaque View.isOpaque()}.
244      */
setOpaque(boolean opaque)245     public abstract void setOpaque(boolean opaque);
246 
247     /**
248      * Set the class name of the view, as per
249      * {@link View#getAccessibilityClassName View.getAccessibilityClassName()}.
250      */
setClassName(String className)251     public abstract void setClassName(String className);
252 
253     /**
254      * Set the content description of the view, as per
255      * {@link View#getContentDescription View.getContentDescription()}.
256      */
setContentDescription(CharSequence contentDescription)257     public abstract void setContentDescription(CharSequence contentDescription);
258 
259     /**
260      * Set the text that is associated with this view.  There is no selection
261      * associated with the text.  The text may have style spans to supply additional
262      * display and semantic information.
263      */
setText(CharSequence text)264     public abstract void setText(CharSequence text);
265 
266     /**
267      * Like {@link #setText(CharSequence)} but with an active selection
268      * extending from <var>selectionStart</var> through <var>selectionEnd</var>.
269      */
setText(CharSequence text, int selectionStart, int selectionEnd)270     public abstract void setText(CharSequence text, int selectionStart, int selectionEnd);
271 
272     /**
273      * Explicitly set default global style information for text that was previously set with
274      * {@link #setText}.
275      *
276      * @param size The size, in pixels, of the text.
277      * @param fgColor The foreground color, packed as 0xAARRGGBB.
278      * @param bgColor The background color, packed as 0xAARRGGBB.
279      * @param style Style flags, as defined by {@link android.app.assist.AssistStructure.ViewNode}.
280      */
setTextStyle(float size, int fgColor, int bgColor, int style)281     public abstract void setTextStyle(float size, int fgColor, int bgColor, int style);
282 
283     /**
284      * Set line information for test that was previously supplied through
285      * {@link #setText(CharSequence)}.  This provides the line breaking of the text as it
286      * is shown on screen.  This function takes ownership of the provided arrays; you should
287      * not make further modification to them.
288      *
289      * @param charOffsets The offset in to {@link #setText} where a line starts.
290      * @param baselines The baseline where the line is drawn on screen.
291      */
setTextLines(int[] charOffsets, int[] baselines)292     public abstract void setTextLines(int[] charOffsets, int[] baselines);
293 
294     /**
295      * Sets the identifier used to set the text associated with this view.
296      *
297      * <p>Should only be set when the node is used for autofill purposes - it will be ignored
298      * when used for Assist.
299      */
setTextIdEntry(@onNull String entryName)300     public void setTextIdEntry(@NonNull String entryName) {
301         Preconditions.checkNotNull(entryName);
302     }
303 
304     /**
305      * Set optional hint text associated with this view; this is for example the text that is
306      * shown by an EditText when it is empty to indicate to the user the kind of text to input.
307      */
setHint(CharSequence hint)308     public abstract void setHint(CharSequence hint);
309 
310     /**
311      * Sets the identifier used to set the hint associated with this view.
312      *
313      * <p>Used as metadata for fingerprinting view nodes/structures.
314      *
315      * <p>Should only be set when the node is used for autofill purposes - it will be ignored
316      * when used for Assist.
317      */
setHintIdEntry(@onNull String entryName)318     public void setHintIdEntry(@NonNull String entryName) {
319         Preconditions.checkNotNull(entryName);
320     }
321 
322     /**
323      * Retrieve the last {@link #setText(CharSequence)}.
324      */
getText()325     public abstract CharSequence getText();
326 
327     /**
328      * Retrieve the last selection start set by {@link #setText(CharSequence, int, int)}.
329      */
getTextSelectionStart()330     public abstract int getTextSelectionStart();
331 
332     /**
333      * Retrieve the last selection end set by {@link #setText(CharSequence, int, int)}.
334      */
getTextSelectionEnd()335     public abstract int getTextSelectionEnd();
336 
337     /**
338      * Retrieve the last hint set by {@link #setHint}.
339      */
getHint()340     public abstract CharSequence getHint();
341 
342     /**
343      * Get extra data associated with this view structure; the returned Bundle is mutable,
344      * allowing you to view and modify its contents.  Keys placed in the Bundle should use
345      * an appropriate namespace prefix (such as com.google.MY_KEY) to avoid conflicts.
346      */
getExtras()347     public abstract Bundle getExtras();
348 
349     /**
350      * Returns true if {@link #getExtras} has been used to create extra content.
351      */
hasExtras()352     public abstract boolean hasExtras();
353 
354     /**
355      * Set the number of children of this view, which defines the range of indices you can
356      * use with {@link #newChild} and {@link #asyncNewChild}.  Calling this method again
357      * resets all of the child state of the view, removing any children that had previously
358      * been added.
359      */
setChildCount(int num)360     public abstract void setChildCount(int num);
361 
362     /**
363      * Add to this view's child count.  This increases the current child count by
364      * <var>num</var> children beyond what was last set by {@link #setChildCount}
365      * or {@link #addChildCount}.  The index at which the new
366      * child starts in the child
367      * array is returned.
368      *
369      * @param num The number of new children to add.
370      * @return Returns the index in the child array at which the new children start.
371      */
addChildCount(int num)372     public abstract int addChildCount(int num);
373 
374     /**
375      * Return the child count as set by {@link #setChildCount}.
376      */
getChildCount()377     public abstract int getChildCount();
378 
379     /**
380      * Create a new child {@link ViewStructure} in this view, putting into the list of
381      * children at <var>index</var>.
382      *
383      * <p><b>NOTE: </b>you must pre-allocate space for the child first, by calling either
384      * {@link #addChildCount(int)} or {@link #setChildCount(int)}.
385      *
386      * @return Returns an fresh {@link ViewStructure} ready to be filled in.
387      */
newChild(int index)388     public abstract ViewStructure newChild(int index);
389 
390     /**
391      * Like {@link #newChild}, but allows the caller to asynchronously populate the returned
392      * child.  It can transfer the returned {@link ViewStructure} to another thread for it
393      * to build its content (and children etc).  Once done, some thread must call
394      * {@link #asyncCommit} to tell the containing {@link ViewStructure} that the async
395      * population is done.
396      *
397      * <p><b>NOTE: </b>you must pre-allocate space for the child first, by calling either
398      * {@link #addChildCount(int)} or {@link #setChildCount(int)}.
399      *
400      * @return Returns an fresh {@link ViewStructure} ready to be filled in.
401      */
asyncNewChild(int index)402     public abstract ViewStructure asyncNewChild(int index);
403 
404     /**
405      * Gets the {@link GetCredentialRequest} associated with this node.
406      *
407      * <p> If null, no request is associated with this node, and hence no
408      * {@link android.credentials.CredentialManager} request will be fired when this
409      * node is focused.
410      * <p> For details on how a request and callback can be set, see
411      * {@link ViewStructure#setPendingCredentialRequest(GetCredentialRequest, OutcomeReceiver)}
412      */
413     @Nullable
414     @FlaggedApi(FLAG_AUTOFILL_CREDMAN_DEV_INTEGRATION)
getPendingCredentialRequest()415     public GetCredentialRequest getPendingCredentialRequest() {
416         return null;
417     }
418 
419     /**
420      * Gets the {@code callback} associated with this node.
421      *
422      * <p> If null, no callback or request is associated with this node, and hence no
423      * {@link android.credentials.CredentialManager} request will be fired when this
424      * node is focused.
425      * <p> For details on how a request and callback can be set, see
426      * {@link ViewStructure#setPendingCredentialRequest(GetCredentialRequest, OutcomeReceiver)}
427      */
428     @Nullable
429     @FlaggedApi(FLAG_AUTOFILL_CREDMAN_DEV_INTEGRATION)
430     public OutcomeReceiver<
getPendingCredentialCallback()431             GetCredentialResponse, GetCredentialException> getPendingCredentialCallback() {
432         return null;
433     }
434 
435     /**
436      * Gets the {@link AutofillId} associated with this node.
437      */
438     @Nullable
getAutofillId()439     public abstract AutofillId getAutofillId();
440 
441     /**
442      * Sets the {@link AutofillId} associated with this node.
443      */
setAutofillId(@onNull AutofillId id)444     public abstract void setAutofillId(@NonNull AutofillId id);
445 
446     /**
447      * Sets the {@link AutofillId} for this virtual node.
448      *
449      * @param parentId id of the parent node.
450      * @param virtualId an opaque ID to the Android System; it's the same id used on
451      *            {@link View#autofill(android.util.SparseArray)}.
452      */
setAutofillId(@onNull AutofillId parentId, int virtualId)453     public abstract void setAutofillId(@NonNull AutofillId parentId, int virtualId);
454 
455     /**
456      * Sets the {@link View#getAutofillType()} that can be used to autofill this node.
457      */
setAutofillType(@iew.AutofillType int type)458     public abstract void setAutofillType(@View.AutofillType int type);
459 
460     /**
461      * Sets the a hints that helps the autofill service to select the appropriate data to fill the
462      * view.
463      */
setAutofillHints(@ullable String[] hint)464     public abstract void setAutofillHints(@Nullable String[] hint);
465 
466     /**
467      * Sets the {@link AutofillValue} representing the current value of this node.
468      */
setAutofillValue(AutofillValue value)469     public abstract void setAutofillValue(AutofillValue value);
470 
471     /**
472      * Sets the options that can be used to autofill this node.
473      *
474      * <p>Typically used by nodes whose {@link View#getAutofillType()} is a list to indicate the
475      * meaning of each possible value in the list.
476      */
setAutofillOptions(CharSequence[] options)477     public abstract void setAutofillOptions(CharSequence[] options);
478 
479     /**
480      * Sets the {@link View#setImportantForAutofill(int) importantForAutofill mode} of the
481      * view associated with this node.
482      */
setImportantForAutofill(@utofillImportance int mode)483     public void setImportantForAutofill(@AutofillImportance int mode) {}
484 
485     /**
486      * Sets whether the node is a credential. See {@link View#isCredential}.
487      *
488      * @hide
489      */
setIsCredential(boolean isCredential)490     public void setIsCredential(boolean isCredential) {}
491 
492     /**
493      * Sets the MIME types accepted by this view. See {@link View#getReceiveContentMimeTypes()}.
494      *
495      * <p>Should only be set when the node is used for Autofill or Content Capture purposes - it
496      * will be ignored when used for Assist.
497      */
setReceiveContentMimeTypes( @uppressLint"NullableCollection") @ullable String[] mimeTypes)498     public void setReceiveContentMimeTypes(
499             @SuppressLint("NullableCollection") @Nullable String[] mimeTypes) {}
500 
501     /**
502      * Sets the {@link android.text.InputType} bits of this node.
503      *
504      * @param inputType inputType bits as defined by {@link android.text.InputType}.
505      */
setInputType(int inputType)506     public abstract void setInputType(int inputType);
507 
508     /**
509      * Sets whether the data on this node is sensitive; if it is, then its content (text, autofill
510      * value, etc..) is striped before calls to {@link
511      * android.service.autofill.AutofillService#onFillRequest(android.service.autofill.FillRequest,
512      * android.os.CancellationSignal, android.service.autofill.FillCallback)}.
513      *
514      * <p>By default, all nodes are assumed to be sensitive, and only nodes that does not have PII
515      * (Personally Identifiable Information - sensitive data such as email addresses, credit card
516      * numbers, passwords, etc...) should be marked as non-sensitive; a good rule of thumb is to
517      * mark as non-sensitive nodes whose value were statically set from resources.
518      *
519      * <p>Notice that the content of even sensitive nodes are sent to the service (through the
520      * {@link
521      * android.service.autofill.AutofillService#onSaveRequest(android.service.autofill.SaveRequest,
522      * android.service.autofill.SaveCallback)} call) when the user consented to save
523      * thedata, so it is important to set the content of sensitive nodes as well, but mark them as
524      * sensitive.
525      *
526      * <p>Should only be set when the node is used for autofill purposes - it will be ignored
527      * when used for Assist.
528      */
setDataIsSensitive(boolean sensitive)529     public abstract void setDataIsSensitive(boolean sensitive);
530 
531     /**
532      * Sets the minimum width in ems of the text associated with this view, when supported.
533      *
534      * <p>Should only be set when the node is used for autofill purposes - it will be ignored
535      * when used for Assist.
536      */
setMinTextEms(@uppressWarnings"unused") int minEms)537     public void setMinTextEms(@SuppressWarnings("unused") int minEms) {}
538 
539     /**
540      * Sets the maximum width in ems of the text associated with this view, when supported.
541      *
542      * <p>Should only be set when the node is used for autofill purposes - it will be ignored
543      * when used for Assist.
544      */
setMaxTextEms(@uppressWarnings"unused") int maxEms)545     public void setMaxTextEms(@SuppressWarnings("unused") int maxEms) {}
546 
547     /**
548      * Sets the maximum length of the text associated with this view, when supported.
549      *
550      * <p>Should only be set when the node is used for autofill purposes - it will be ignored
551      * when used for Assist.
552      */
setMaxTextLength(@uppressWarnings"unused") int maxLength)553     public void setMaxTextLength(@SuppressWarnings("unused") int maxLength) {}
554 
555     /**
556      * Call when done populating a {@link ViewStructure} returned by
557      * {@link #asyncNewChild}.
558      */
asyncCommit()559     public abstract void asyncCommit();
560 
561     /** @hide */
562     @SuppressWarnings("HiddenAbstractMethod")
getTempRect()563     public abstract Rect getTempRect();
564 
565     /**
566      * Sets the Web domain represented by this node.
567      *
568      * <p>Typically used when the view is a container for an HTML document.
569      *
570      * @param domain RFC 2396-compliant URI representing the domain.
571      */
setWebDomain(@ullable String domain)572     public abstract void setWebDomain(@Nullable String domain);
573 
574     /**
575      * Sets the the list of locales associated with this node.
576      */
setLocaleList(LocaleList localeList)577     public abstract void setLocaleList(LocaleList localeList);
578 
579     /**
580      * Creates a new {@link HtmlInfo.Builder} for the given HTML tag.
581      *
582      * @param tagName name of the HTML tag.
583      * @return a new builder.
584      */
newHtmlInfoBuilder(@onNull String tagName)585     public abstract HtmlInfo.Builder newHtmlInfoBuilder(@NonNull String tagName);
586 
587     /**
588      * Sets the HTML properties of this node when it represents an HTML element.
589      *
590      * <p>Should only be set when the node is used for autofill purposes - it will be ignored
591      * when used for assist.
592      *
593      * @param htmlInfo HTML properties.
594      */
setHtmlInfo(@onNull HtmlInfo htmlInfo)595     public abstract void setHtmlInfo(@NonNull HtmlInfo htmlInfo);
596 
597     /**
598      * Sets a credential request to be fired to {@link android.credentials.CredentialManager}
599      * when this node is focused
600      *
601      * @param request the request to be fired
602      * @param callback the callback where the response or exception, is returned
603      */
604     @FlaggedApi(FLAG_AUTOFILL_CREDMAN_DEV_INTEGRATION)
setPendingCredentialRequest(@onNull GetCredentialRequest request, @NonNull OutcomeReceiver<GetCredentialResponse, GetCredentialException> callback)605     public void setPendingCredentialRequest(@NonNull GetCredentialRequest request,
606             @NonNull OutcomeReceiver<GetCredentialResponse, GetCredentialException> callback) {}
607 
608     /**
609      * Clears the credential request previously set through
610      * {@link ViewStructure#setPendingCredentialRequest(GetCredentialRequest, OutcomeReceiver)}
611      */
612     @FlaggedApi(FLAG_AUTOFILL_CREDMAN_DEV_INTEGRATION)
clearCredentialManagerRequest()613     public void clearCredentialManagerRequest() {}
614 
615     /**
616      * Simplified representation of the HTML properties of a node that represents an HTML element.
617      */
618     public abstract static class HtmlInfo {
619 
620         /**
621          * Gets the HTML tag.
622          */
623         @NonNull
getTag()624         public abstract String getTag();
625 
626         /**
627          * Gets the list of HTML attributes.
628          *
629          * @return list of key/value pairs; could contain pairs with the same keys.
630          */
631         @Nullable
getAttributes()632         public abstract List<Pair<String, String>> getAttributes();
633 
634         /**
635          * Builder for {@link HtmlInfo} objects.
636          */
637         public abstract static class Builder {
638 
639             /**
640              * Adds an HTML attribute.
641              *
642              * @param name name of the attribute.
643              * @param value value of the attribute.
644              * @return same builder, for chaining.
645              */
addAttribute(@onNull String name, @NonNull String value)646             public abstract Builder addAttribute(@NonNull String name, @NonNull String value);
647 
648             /**
649              * Builds the {@link HtmlInfo} object.
650              *
651              * @return a new {@link HtmlInfo} instance.
652              */
build()653             public abstract HtmlInfo build();
654         }
655     }
656 }
657