Removed inlinePresentation from Dataset ctor and added

setInlinePresentation.

Fixes: 148380267
Test: atest android.autofillservice.cts.DatasetTest
Change-Id: I32f5d4eab3b9d7d82020aaaccf734694303ffe0b
This commit is contained in:
Adam He
2020-03-12 16:20:16 -07:00
parent eaf14b274a
commit afc744fd2f
4 changed files with 22 additions and 21 deletions

View File

@@ -43012,12 +43012,12 @@ package android.service.autofill {
}
public static final class Dataset.Builder {
ctor public Dataset.Builder(@NonNull android.widget.RemoteViews, @NonNull android.service.autofill.InlinePresentation);
ctor public Dataset.Builder(@NonNull android.widget.RemoteViews);
ctor public Dataset.Builder();
method @NonNull public android.service.autofill.Dataset build();
method @NonNull public android.service.autofill.Dataset.Builder setAuthentication(@Nullable android.content.IntentSender);
method @NonNull public android.service.autofill.Dataset.Builder setId(@Nullable String);
method @NonNull public android.service.autofill.Dataset.Builder setInlinePresentation(@NonNull android.service.autofill.InlinePresentation);
method @NonNull public android.service.autofill.Dataset.Builder setValue(@NonNull android.view.autofill.AutofillId, @Nullable android.view.autofill.AutofillValue);
method @NonNull public android.service.autofill.Dataset.Builder setValue(@NonNull android.view.autofill.AutofillId, @Nullable android.view.autofill.AutofillValue, @NonNull android.widget.RemoteViews);
method @NonNull public android.service.autofill.Dataset.Builder setValue(@NonNull android.view.autofill.AutofillId, @Nullable android.view.autofill.AutofillValue, @Nullable java.util.regex.Pattern);
@@ -82233,3 +82233,4 @@ package org.xmlpull.v1.sax2 {
}
}

View File

@@ -9808,7 +9808,7 @@ package android.service.autofill {
public static final class Dataset.Builder {
ctor public Dataset.Builder(@NonNull android.service.autofill.InlinePresentation);
method @NonNull public android.service.autofill.Dataset.Builder setInlinePresentation(@NonNull android.view.autofill.AutofillId, @Nullable android.view.autofill.AutofillValue, @Nullable java.util.regex.Pattern, @NonNull android.service.autofill.InlinePresentation);
method @NonNull public android.service.autofill.Dataset.Builder setFieldInlinePresentation(@NonNull android.view.autofill.AutofillId, @Nullable android.view.autofill.AutofillValue, @Nullable java.util.regex.Pattern, @NonNull android.service.autofill.InlinePresentation);
}
public abstract class InlineSuggestionRenderService extends android.app.Service {

View File

@@ -3134,7 +3134,7 @@ package android.service.autofill {
public static final class Dataset.Builder {
ctor public Dataset.Builder(@NonNull android.service.autofill.InlinePresentation);
method @NonNull public android.service.autofill.Dataset.Builder setInlinePresentation(@NonNull android.view.autofill.AutofillId, @Nullable android.view.autofill.AutofillValue, @Nullable java.util.regex.Pattern, @NonNull android.service.autofill.InlinePresentation);
method @NonNull public android.service.autofill.Dataset.Builder setFieldInlinePresentation(@NonNull android.view.autofill.AutofillId, @Nullable android.view.autofill.AutofillValue, @Nullable java.util.regex.Pattern, @NonNull android.service.autofill.InlinePresentation);
}
public final class DateTransformation extends android.service.autofill.InternalTransformation implements android.os.Parcelable android.service.autofill.Transformation {

View File

@@ -228,22 +228,6 @@ public final class Dataset implements Parcelable {
private boolean mDestroyed;
@Nullable private String mId;
/**
* Creates a new builder.
*
* @param presentation The presentation used to visualize this dataset.
* @param inlinePresentation The {@link InlinePresentation} used to visualize this dataset
* as inline suggestions. If the dataset supports inline suggestions,
* this should not be null.
*/
public Builder(@NonNull RemoteViews presentation,
@NonNull InlinePresentation inlinePresentation) {
Preconditions.checkNotNull(presentation, "presentation must be non-null");
Preconditions.checkNotNull(inlinePresentation, "inlinePresentation must be non-null");
mPresentation = presentation;
mInlinePresentation = inlinePresentation;
}
/**
* Creates a new builder.
*
@@ -281,6 +265,22 @@ public final class Dataset implements Parcelable {
public Builder() {
}
/**
* Sets the {@link InlinePresentation} used to visualize this dataset as inline suggestions.
* If the dataset supports inline suggestions this should not be null.
*
* @throws IllegalStateException if {@link #build()} was already called.
*
* @return this builder.
*/
public @NonNull Builder setInlinePresentation(
@NonNull InlinePresentation inlinePresentation) {
throwIfDestroyed();
Preconditions.checkNotNull(inlinePresentation, "inlinePresentation must be non-null");
mInlinePresentation = inlinePresentation;
return this;
}
/**
* Triggers a custom UI before before autofilling the screen with the contents of this
* dataset.
@@ -600,7 +600,7 @@ public final class Dataset implements Parcelable {
*/
@SystemApi
@TestApi
public @NonNull Builder setInlinePresentation(@NonNull AutofillId id,
public @NonNull Builder setFieldInlinePresentation(@NonNull AutofillId id,
@Nullable AutofillValue value, @Nullable Pattern filter,
@NonNull InlinePresentation inlinePresentation) {
throwIfDestroyed();
@@ -700,7 +700,7 @@ public final class Dataset implements Parcelable {
final Builder builder = presentation != null
? inlinePresentation == null
? new Builder(presentation)
: new Builder(presentation, inlinePresentation)
: new Builder(presentation).setInlinePresentation(inlinePresentation)
: inlinePresentation == null
? new Builder()
: new Builder(inlinePresentation);