diff options
| author | Feng Cao <fengcao@google.com> | 2020-03-30 14:26:42 -0700 |
|---|---|---|
| committer | Feng Cao <fengcao@google.com> | 2020-03-31 14:50:51 -0700 |
| commit | edb332c645ecc64b92bb7ef7c0d875015ffe173d (patch) | |
| tree | 7dc0bfc54e2718456002d4c2b4f136b98589dfcd /core/java/android/widget/inline | |
| parent | c068acb6aeb3d86226f8eaccad7ddee8d4dfd8db (diff) | |
Replace Nullable bundle with NonNull and use Bundle.EMPTY
Test: atest InlineSuggestionsRequestTest
Bug: 152525467
Change-Id: Ie510e08ced8be4cc8df486f1acfa6eb330d194ef
Diffstat (limited to 'core/java/android/widget/inline')
| -rw-r--r-- | core/java/android/widget/inline/InlinePresentationSpec.java | 39 |
1 files changed, 20 insertions, 19 deletions
diff --git a/core/java/android/widget/inline/InlinePresentationSpec.java b/core/java/android/widget/inline/InlinePresentationSpec.java index 886790268737..00eb3ce271a1 100644 --- a/core/java/android/widget/inline/InlinePresentationSpec.java +++ b/core/java/android/widget/inline/InlinePresentationSpec.java @@ -41,14 +41,15 @@ public final class InlinePresentationSpec implements Parcelable { private final Size mMaxSize; /** - * The extras encoding the UI style information. Defaults to {@code null} in which case the - * default system UI style will be used. + * The extras encoding the UI style information. Defaults to {@code Bundle.Empty} in which case + * the default system UI style will be used. */ - @Nullable + @NonNull private final Bundle mStyle; + @NonNull private static Bundle defaultStyle() { - return null; + return Bundle.EMPTY; } /** @hide */ @@ -75,7 +76,7 @@ public final class InlinePresentationSpec implements Parcelable { /* package-private */ InlinePresentationSpec( @NonNull Size minSize, @NonNull Size maxSize, - @Nullable Bundle style) { + @NonNull Bundle style) { this.mMinSize = minSize; com.android.internal.util.AnnotationValidations.validate( NonNull.class, null, mMinSize); @@ -83,6 +84,8 @@ public final class InlinePresentationSpec implements Parcelable { com.android.internal.util.AnnotationValidations.validate( NonNull.class, null, mMaxSize); this.mStyle = style; + com.android.internal.util.AnnotationValidations.validate( + NonNull.class, null, mStyle); // onConstructed(); // You can define this method to get a callback } @@ -104,11 +107,11 @@ public final class InlinePresentationSpec implements Parcelable { } /** - * The extras encoding the UI style information. Defaults to {@code null} in which case the - * default system UI style will be used. + * The extras encoding the UI style information. Defaults to {@code Bundle.Empty} in which case + * the default system UI style will be used. */ @DataClass.Generated.Member - public @Nullable Bundle getStyle() { + public @NonNull Bundle getStyle() { return mStyle; } @@ -162,12 +165,9 @@ public final class InlinePresentationSpec implements Parcelable { // You can override field parcelling by defining methods like: // void parcelFieldName(Parcel dest, int flags) { ... } - byte flg = 0; - if (mStyle != null) flg |= 0x4; - dest.writeByte(flg); dest.writeSize(mMinSize); dest.writeSize(mMaxSize); - if (mStyle != null) dest.writeBundle(mStyle); + dest.writeBundle(mStyle); } @Override @@ -181,10 +181,9 @@ public final class InlinePresentationSpec implements Parcelable { // You can override field unparcelling by defining methods like: // static FieldType unparcelFieldName(Parcel in) { ... } - byte flg = in.readByte(); Size minSize = (Size) in.readSize(); Size maxSize = (Size) in.readSize(); - Bundle style = (flg & 0x4) == 0 ? null : in.readBundle(); + Bundle style = in.readBundle(); this.mMinSize = minSize; com.android.internal.util.AnnotationValidations.validate( @@ -193,6 +192,8 @@ public final class InlinePresentationSpec implements Parcelable { com.android.internal.util.AnnotationValidations.validate( NonNull.class, null, mMaxSize); this.mStyle = style; + com.android.internal.util.AnnotationValidations.validate( + NonNull.class, null, mStyle); // onConstructed(); // You can define this method to get a callback } @@ -220,7 +221,7 @@ public final class InlinePresentationSpec implements Parcelable { private @NonNull Size mMinSize; private @NonNull Size mMaxSize; - private @Nullable Bundle mStyle; + private @NonNull Bundle mStyle; private long mBuilderFieldsSet = 0L; @@ -244,8 +245,8 @@ public final class InlinePresentationSpec implements Parcelable { } /** - * The extras encoding the UI style information. Defaults to {@code null} in which case the - * default system UI style will be used. + * The extras encoding the UI style information. Defaults to {@code Bundle.Empty} in which case + * the default system UI style will be used. */ @DataClass.Generated.Member public @NonNull Builder setStyle(@NonNull Bundle value) { @@ -279,10 +280,10 @@ public final class InlinePresentationSpec implements Parcelable { } @DataClass.Generated( - time = 1585174247896L, + time = 1585605466300L, codegenVersion = "1.0.15", sourceFile = "frameworks/base/core/java/android/widget/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 android.os.Bundle mStyle\nprivate static android.os.Bundle 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 []") + inputSignatures = "private final @android.annotation.NonNull android.util.Size mMinSize\nprivate final @android.annotation.NonNull android.util.Size mMaxSize\nprivate final @android.annotation.NonNull android.os.Bundle mStyle\nprivate static @android.annotation.NonNull android.os.Bundle 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() {} |
