Merge "Add the locale field and an extra Bundle to the InlineSuggestionsRequest."

This commit is contained in:
TreeHugger Robot
2020-02-18 04:00:52 +00:00
committed by Android (Google) Code Review
4 changed files with 121 additions and 36 deletions

View File

@@ -56486,6 +56486,7 @@ package android.view.inline {
method public int describeContents();
method @NonNull public android.util.Size getMaxSize();
method @NonNull public android.util.Size getMinSize();
method @Nullable public String getStyle();
method public void writeToParcel(@NonNull android.os.Parcel, int);
field @NonNull public static final android.os.Parcelable.Creator<android.view.inline.InlinePresentationSpec> CREATOR;
}
@@ -56690,9 +56691,11 @@ package android.view.inputmethod {
public final class InlineSuggestionsRequest implements android.os.Parcelable {
method public int describeContents();
method @Nullable public android.os.Bundle getExtras();
method @NonNull public String getHostPackageName();
method public int getMaxSuggestionCount();
method @NonNull public java.util.List<android.view.inline.InlinePresentationSpec> getPresentationSpecs();
method @NonNull public android.os.LocaleList getSupportedLocales();
method public void writeToParcel(@NonNull android.os.Parcel, int);
field @NonNull public static final android.os.Parcelable.Creator<android.view.inputmethod.InlineSuggestionsRequest> CREATOR;
field public static final int SUGGESTION_COUNT_UNLIMITED = 2147483647; // 0x7fffffff
@@ -56702,7 +56705,9 @@ package android.view.inputmethod {
ctor public InlineSuggestionsRequest.Builder(@NonNull java.util.List<android.view.inline.InlinePresentationSpec>);
method @NonNull public android.view.inputmethod.InlineSuggestionsRequest.Builder addPresentationSpecs(@NonNull android.view.inline.InlinePresentationSpec);
method @NonNull public android.view.inputmethod.InlineSuggestionsRequest build();
method @NonNull public android.view.inputmethod.InlineSuggestionsRequest.Builder setExtras(@Nullable android.os.Bundle);
method @NonNull public android.view.inputmethod.InlineSuggestionsRequest.Builder setMaxSuggestionCount(int);
method @NonNull public android.view.inputmethod.InlineSuggestionsRequest.Builder setSupportedLocales(@NonNull android.os.LocaleList);
}
public final class InlineSuggestionsResponse implements android.os.Parcelable {

View File

@@ -14081,14 +14081,6 @@ package android.view.contentcapture {
}
package android.view.inline {
public final class InlinePresentationSpec implements android.os.Parcelable {
method @Nullable public String getStyle();
}
}
package android.webkit {
public abstract class CookieManager {

View File

@@ -18,7 +18,6 @@ package android.view.inline;
import android.annotation.NonNull;
import android.annotation.Nullable;
import android.annotation.SystemApi;
import android.os.Parcelable;
import android.util.Size;
@@ -53,15 +52,6 @@ public final class InlinePresentationSpec implements Parcelable {
return null;
}
/**
* @hide
*/
@SystemApi
public @Nullable String getStyle() {
return mStyle;
}
/** @hide */
@DataClass.Suppress({"setMaxSize", "setMinSize"})
abstract static class BaseBuilder {
@@ -114,6 +104,17 @@ public final class InlinePresentationSpec implements Parcelable {
return mMaxSize;
}
/**
* The fully qualified resource name of the UI style resource identifier, defaults to {@code
* null}.
*
* <p> The value can be obtained by calling {@code Resources#getResourceName(int)}.
*/
@DataClass.Generated.Member
public @Nullable String getStyle() {
return mStyle;
}
@Override
@DataClass.Generated.Member
public String toString() {
@@ -283,10 +284,10 @@ public final class InlinePresentationSpec implements Parcelable {
}
@DataClass.Generated(
time = 1581117017522L,
time = 1581736227796L,
codegenVersion = "1.0.14",
sourceFile = "frameworks/base/core/java/android/view/inline/InlinePresentationSpec.java",
inputSignatures = "private final @android.annotation.NonNull android.util.Size mMinSize\nprivate final @android.annotation.NonNull android.util.Size mMaxSize\nprivate final @android.annotation.Nullable java.lang.String mStyle\nprivate static java.lang.String defaultStyle()\npublic @android.annotation.SystemApi @android.annotation.Nullable java.lang.String getStyle()\nclass InlinePresentationSpec extends java.lang.Object implements [android.os.Parcelable]\n@com.android.internal.util.DataClass(genEqualsHashCode=true, genToString=true, genBuilder=true)\nclass BaseBuilder extends java.lang.Object implements []")
inputSignatures = "private final @android.annotation.NonNull android.util.Size mMinSize\nprivate final @android.annotation.NonNull android.util.Size mMaxSize\nprivate final @android.annotation.Nullable java.lang.String mStyle\nprivate static java.lang.String defaultStyle()\nclass InlinePresentationSpec extends java.lang.Object implements [android.os.Parcelable]\n@com.android.internal.util.DataClass(genEqualsHashCode=true, genToString=true, genBuilder=true)\nclass BaseBuilder extends java.lang.Object implements []")
@Deprecated
private void __metadata() {}

View File

@@ -19,7 +19,9 @@ package android.view.inputmethod;
import android.annotation.NonNull;
import android.annotation.Nullable;
import android.app.ActivityThread;
import android.os.Bundle;
import android.os.IBinder;
import android.os.LocaleList;
import android.os.Parcelable;
import android.view.inline.InlinePresentationSpec;
@@ -59,6 +61,13 @@ public final class InlineSuggestionsRequest implements Parcelable {
*/
private @NonNull String mHostPackageName;
/**
* The IME provided locales for the request. If non-empty, the inline suggestions should
* return languages from the supported locales. If not provided, it'll default to system locale.
*/
private @NonNull LocaleList mSupportedLocales;
// TODO(b/149609075): the generated code needs to be manually fixed due to the bug.
/**
* The host input token of the IME that made the request. This will be set by the system for
* safety reasons.
@@ -68,12 +77,9 @@ public final class InlineSuggestionsRequest implements Parcelable {
private @Nullable IBinder mHostInputToken;
/**
* @hide
* @see {@link #mHostPackageName}.
* The extras state propagated from the IME to pass extra data.
*/
public void setHostPackageName(@NonNull String hostPackageName) {
mHostPackageName = hostPackageName;
}
private @Nullable Bundle mExtras;
/**
* @hide
@@ -95,10 +101,20 @@ public final class InlineSuggestionsRequest implements Parcelable {
return ActivityThread.currentPackageName();
}
private static LocaleList defaultSupportedLocales() {
return LocaleList.getDefault();
}
@Nullable
private static IBinder defaultHostInputToken() {
return null;
}
@Nullable
private static Bundle defaultExtras() {
return null;
}
/** @hide */
abstract static class BaseBuilder {
abstract Builder setPresentationSpecs(@NonNull List<InlinePresentationSpec> value);
@@ -128,7 +144,9 @@ public final class InlineSuggestionsRequest implements Parcelable {
int maxSuggestionCount,
@NonNull List<InlinePresentationSpec> presentationSpecs,
@NonNull String hostPackageName,
@Nullable IBinder hostInputToken) {
@NonNull LocaleList supportedLocales,
@Nullable IBinder hostInputToken,
@Nullable Bundle extras) {
this.mMaxSuggestionCount = maxSuggestionCount;
this.mPresentationSpecs = presentationSpecs;
com.android.internal.util.AnnotationValidations.validate(
@@ -136,7 +154,11 @@ public final class InlineSuggestionsRequest implements Parcelable {
this.mHostPackageName = hostPackageName;
com.android.internal.util.AnnotationValidations.validate(
NonNull.class, null, mHostPackageName);
this.mSupportedLocales = supportedLocales;
com.android.internal.util.AnnotationValidations.validate(
NonNull.class, null, mSupportedLocales);
this.mHostInputToken = hostInputToken;
this.mExtras = extras;
onConstructed();
}
@@ -170,6 +192,15 @@ public final class InlineSuggestionsRequest implements Parcelable {
return mHostPackageName;
}
/**
* The IME provided locales for the request. If non-empty, the inline suggestions should
* return languages from the supported locales. If not provided, it'll default to system locale.
*/
@DataClass.Generated.Member
public @NonNull LocaleList getSupportedLocales() {
return mSupportedLocales;
}
/**
* The host input token of the IME that made the request. This will be set by the system for
* safety reasons.
@@ -181,6 +212,14 @@ public final class InlineSuggestionsRequest implements Parcelable {
return mHostInputToken;
}
/**
* The extras state propagated from the IME to pass extra data.
*/
@DataClass.Generated.Member
public @Nullable Bundle getExtras() {
return mExtras;
}
@Override
@DataClass.Generated.Member
public String toString() {
@@ -191,7 +230,9 @@ public final class InlineSuggestionsRequest implements Parcelable {
"maxSuggestionCount = " + mMaxSuggestionCount + ", " +
"presentationSpecs = " + mPresentationSpecs + ", " +
"hostPackageName = " + mHostPackageName + ", " +
"hostInputToken = " + mHostInputToken +
"supportedLocales = " + mSupportedLocales + ", " +
"hostInputToken = " + mHostInputToken + ", " +
"extras = " + mExtras +
" }";
}
@@ -211,7 +252,9 @@ public final class InlineSuggestionsRequest implements Parcelable {
&& mMaxSuggestionCount == that.mMaxSuggestionCount
&& java.util.Objects.equals(mPresentationSpecs, that.mPresentationSpecs)
&& java.util.Objects.equals(mHostPackageName, that.mHostPackageName)
&& java.util.Objects.equals(mHostInputToken, that.mHostInputToken);
&& java.util.Objects.equals(mSupportedLocales, that.mSupportedLocales)
&& java.util.Objects.equals(mHostInputToken, that.mHostInputToken)
&& java.util.Objects.equals(mExtras, that.mExtras);
}
@Override
@@ -224,7 +267,9 @@ public final class InlineSuggestionsRequest implements Parcelable {
_hash = 31 * _hash + mMaxSuggestionCount;
_hash = 31 * _hash + java.util.Objects.hashCode(mPresentationSpecs);
_hash = 31 * _hash + java.util.Objects.hashCode(mHostPackageName);
_hash = 31 * _hash + java.util.Objects.hashCode(mSupportedLocales);
_hash = 31 * _hash + java.util.Objects.hashCode(mHostInputToken);
_hash = 31 * _hash + java.util.Objects.hashCode(mExtras);
return _hash;
}
@@ -235,12 +280,15 @@ public final class InlineSuggestionsRequest implements Parcelable {
// void parcelFieldName(Parcel dest, int flags) { ... }
byte flg = 0;
if (mHostInputToken != null) flg |= 0x8;
if (mHostInputToken != null) flg |= 0x10;
if (mExtras != null) flg |= 0x20;
dest.writeByte(flg);
dest.writeInt(mMaxSuggestionCount);
dest.writeParcelableList(mPresentationSpecs, flags);
dest.writeString(mHostPackageName);
dest.writeTypedObject(mSupportedLocales, flags);
if (mHostInputToken != null) dest.writeStrongBinder(mHostInputToken);
if (mExtras != null) dest.writeBundle(mExtras);
}
@Override
@@ -259,7 +307,9 @@ public final class InlineSuggestionsRequest implements Parcelable {
List<InlinePresentationSpec> presentationSpecs = new ArrayList<>();
in.readParcelableList(presentationSpecs, InlinePresentationSpec.class.getClassLoader());
String hostPackageName = in.readString();
IBinder hostInputToken = (flg & 0x8) == 0 ? null : in.readStrongBinder();
LocaleList supportedLocales = (LocaleList) in.readTypedObject(LocaleList.CREATOR);
IBinder hostInputToken = (flg & 0x10) == 0 ? null : in.readStrongBinder();
Bundle extras = (flg & 0x20) == 0 ? null : in.readBundle();
this.mMaxSuggestionCount = maxSuggestionCount;
this.mPresentationSpecs = presentationSpecs;
@@ -268,7 +318,11 @@ public final class InlineSuggestionsRequest implements Parcelable {
this.mHostPackageName = hostPackageName;
com.android.internal.util.AnnotationValidations.validate(
NonNull.class, null, mHostPackageName);
this.mSupportedLocales = supportedLocales;
com.android.internal.util.AnnotationValidations.validate(
NonNull.class, null, mSupportedLocales);
this.mHostInputToken = hostInputToken;
this.mExtras = extras;
onConstructed();
}
@@ -297,7 +351,9 @@ public final class InlineSuggestionsRequest implements Parcelable {
private int mMaxSuggestionCount;
private @NonNull List<InlinePresentationSpec> mPresentationSpecs;
private @NonNull String mHostPackageName;
private @NonNull LocaleList mSupportedLocales;
private @Nullable IBinder mHostInputToken;
private @Nullable Bundle mExtras;
private long mBuilderFieldsSet = 0L;
@@ -367,6 +423,18 @@ public final class InlineSuggestionsRequest implements Parcelable {
return this;
}
/**
* The IME provided locales for the request. If non-empty, the inline suggestions should
* return languages from the supported locales. If not provided, it'll default to system locale.
*/
@DataClass.Generated.Member
public @NonNull Builder setSupportedLocales(@NonNull LocaleList value) {
checkNotUsed();
mBuilderFieldsSet |= 0x8;
mSupportedLocales = value;
return this;
}
/**
* The host input token of the IME that made the request. This will be set by the system for
* safety reasons.
@@ -377,15 +445,26 @@ public final class InlineSuggestionsRequest implements Parcelable {
@Override
@NonNull Builder setHostInputToken(@Nullable IBinder value) {
checkNotUsed();
mBuilderFieldsSet |= 0x8;
mBuilderFieldsSet |= 0x10;
mHostInputToken = value;
return this;
}
/**
* The extras state propagated from the IME to pass extra data.
*/
@DataClass.Generated.Member
public @NonNull Builder setExtras(@Nullable Bundle value) {
checkNotUsed();
mBuilderFieldsSet |= 0x20;
mExtras = value;
return this;
}
/** Builds the instance. This builder should not be touched after calling this! */
public @NonNull InlineSuggestionsRequest build() {
checkNotUsed();
mBuilderFieldsSet |= 0x10; // Mark builder used
mBuilderFieldsSet |= 0x40; // Mark builder used
if ((mBuilderFieldsSet & 0x1) == 0) {
mMaxSuggestionCount = defaultMaxSuggestionCount();
@@ -394,18 +473,26 @@ public final class InlineSuggestionsRequest implements Parcelable {
mHostPackageName = defaultHostPackageName();
}
if ((mBuilderFieldsSet & 0x8) == 0) {
mSupportedLocales = defaultSupportedLocales();
}
if ((mBuilderFieldsSet & 0x10) == 0) {
mHostInputToken = defaultHostInputToken();
}
if ((mBuilderFieldsSet & 0x20) == 0) {
mExtras = defaultExtras();
}
InlineSuggestionsRequest o = new InlineSuggestionsRequest(
mMaxSuggestionCount,
mPresentationSpecs,
mHostPackageName,
mHostInputToken);
mSupportedLocales,
mHostInputToken,
mExtras);
return o;
}
private void checkNotUsed() {
if ((mBuilderFieldsSet & 0x10) != 0) {
if ((mBuilderFieldsSet & 0x40) != 0) {
throw new IllegalStateException(
"This Builder should not be reused. Use a new Builder instance instead");
}
@@ -413,10 +500,10 @@ public final class InlineSuggestionsRequest implements Parcelable {
}
@DataClass.Generated(
time = 1581555687721L,
time = 1581747892762L,
codegenVersion = "1.0.14",
sourceFile = "frameworks/base/core/java/android/view/inputmethod/InlineSuggestionsRequest.java",
inputSignatures = "public static final int SUGGESTION_COUNT_UNLIMITED\nprivate final int mMaxSuggestionCount\nprivate final @android.annotation.NonNull java.util.List<android.view.inline.InlinePresentationSpec> mPresentationSpecs\nprivate @android.annotation.NonNull java.lang.String mHostPackageName\nprivate @android.annotation.Nullable android.os.IBinder mHostInputToken\npublic void setHostPackageName(java.lang.String)\npublic void setHostInputToken(android.os.IBinder)\nprivate void onConstructed()\nprivate static int defaultMaxSuggestionCount()\nprivate static java.lang.String defaultHostPackageName()\nprivate static android.os.IBinder defaultHostInputToken()\nclass InlineSuggestionsRequest extends java.lang.Object implements [android.os.Parcelable]\n@com.android.internal.util.DataClass(genEqualsHashCode=true, genToString=true, genBuilder=true)\nabstract android.view.inputmethod.InlineSuggestionsRequest.Builder setPresentationSpecs(java.util.List<android.view.inline.InlinePresentationSpec>)\nabstract android.view.inputmethod.InlineSuggestionsRequest.Builder setHostPackageName(java.lang.String)\nabstract android.view.inputmethod.InlineSuggestionsRequest.Builder setHostInputToken(android.os.IBinder)\nclass BaseBuilder extends java.lang.Object implements []")
inputSignatures = "public static final int SUGGESTION_COUNT_UNLIMITED\nprivate final int mMaxSuggestionCount\nprivate final @android.annotation.NonNull java.util.List<android.view.inline.InlinePresentationSpec> mPresentationSpecs\nprivate @android.annotation.NonNull java.lang.String mHostPackageName\nprivate @android.annotation.NonNull android.os.LocaleList mSupportedLocales\nprivate @android.annotation.Nullable android.os.IBinder mHostInputToken\nprivate @android.annotation.Nullable android.os.Bundle mExtras\npublic void setHostInputToken(android.os.IBinder)\nprivate void onConstructed()\nprivate static int defaultMaxSuggestionCount()\nprivate static java.lang.String defaultHostPackageName()\nprivate static android.os.LocaleList defaultSupportedLocales()\nprivate static @android.annotation.Nullable android.os.IBinder defaultHostInputToken()\nprivate static @android.annotation.Nullable android.os.Bundle defaultExtras()\nclass InlineSuggestionsRequest extends java.lang.Object implements [android.os.Parcelable]\n@com.android.internal.util.DataClass(genEqualsHashCode=true, genToString=true, genBuilder=true)\nabstract android.view.inputmethod.InlineSuggestionsRequest.Builder setPresentationSpecs(java.util.List<android.view.inline.InlinePresentationSpec>)\nabstract android.view.inputmethod.InlineSuggestionsRequest.Builder setHostPackageName(java.lang.String)\nabstract android.view.inputmethod.InlineSuggestionsRequest.Builder setHostInputToken(android.os.IBinder)\nclass BaseBuilder extends java.lang.Object implements []")
@Deprecated
private void __metadata() {}