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