Adam He | 3e01bc3 | 2019-12-13 14:30:13 -0800 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2019 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.service.autofill; |
| 18 | |
| 19 | import android.annotation.NonNull; |
Feng Cao | 4b0ef39 | 2020-02-25 18:18:36 -0800 | [diff] [blame] | 20 | import android.annotation.Size; |
Adam He | 3e01bc3 | 2019-12-13 14:30:13 -0800 | [diff] [blame] | 21 | import android.app.slice.Slice; |
| 22 | import android.os.Parcel; |
| 23 | import android.os.Parcelable; |
| 24 | import android.view.inline.InlinePresentationSpec; |
| 25 | |
| 26 | import com.android.internal.util.DataClass; |
| 27 | |
Feng Cao | 4b0ef39 | 2020-02-25 18:18:36 -0800 | [diff] [blame] | 28 | import java.util.List; |
| 29 | |
Adam He | 3e01bc3 | 2019-12-13 14:30:13 -0800 | [diff] [blame] | 30 | /** |
| 31 | * Wrapper class holding a {@link Slice} and an {@link InlinePresentationSpec} for rendering UI |
| 32 | * for an Inline Suggestion. |
| 33 | */ |
| 34 | @DataClass( |
| 35 | genToString = true, |
| 36 | genHiddenConstDefs = true, |
| 37 | genEqualsHashCode = true) |
| 38 | public final class InlinePresentation implements Parcelable { |
| 39 | |
Feng Cao | 9199498 | 2020-01-22 13:32:36 -0800 | [diff] [blame] | 40 | |
| 41 | /** |
| 42 | * Represents the UI content and the action for the inline suggestion. |
| 43 | */ |
Adam He | 3e01bc3 | 2019-12-13 14:30:13 -0800 | [diff] [blame] | 44 | private final @NonNull Slice mSlice; |
| 45 | |
Feng Cao | 9199498 | 2020-01-22 13:32:36 -0800 | [diff] [blame] | 46 | /** |
| 47 | * Specifies the UI specification for the inline suggestion. |
| 48 | */ |
Adam He | 3e01bc3 | 2019-12-13 14:30:13 -0800 | [diff] [blame] | 49 | private final @NonNull InlinePresentationSpec mInlinePresentationSpec; |
| 50 | |
Feng Cao | 9199498 | 2020-01-22 13:32:36 -0800 | [diff] [blame] | 51 | /** |
Ahaan Ugale | 8893d30 | 2020-03-24 19:27:26 -0700 | [diff] [blame] | 52 | * Indicates whether the UI should be pinned, hence non-scrollable and non-filterable, in the |
| 53 | * host. |
Feng Cao | 9199498 | 2020-01-22 13:32:36 -0800 | [diff] [blame] | 54 | */ |
| 55 | private final boolean mPinned; |
| 56 | |
Feng Cao | 4b0ef39 | 2020-02-25 18:18:36 -0800 | [diff] [blame] | 57 | /** |
| 58 | * Returns the autofill hints set in the slice. |
| 59 | * |
| 60 | * @hide |
| 61 | */ |
| 62 | @NonNull |
| 63 | @Size(min = 0) |
| 64 | public String[] getAutofillHints() { |
| 65 | List<String> hints = mSlice.getHints(); |
| 66 | return hints.toArray(new String[hints.size()]); |
| 67 | } |
| 68 | |
Adam He | 3e01bc3 | 2019-12-13 14:30:13 -0800 | [diff] [blame] | 69 | |
| 70 | |
| 71 | // Code below generated by codegen v1.0.14. |
| 72 | // |
| 73 | // DO NOT MODIFY! |
| 74 | // CHECKSTYLE:OFF Generated code |
| 75 | // |
| 76 | // To regenerate run: |
| 77 | // $ codegen $ANDROID_BUILD_TOP/frameworks/base/core/java/android/service/autofill/InlinePresentation.java |
| 78 | // |
| 79 | // To exclude the generated code from IntelliJ auto-formatting enable (one-time): |
| 80 | // Settings > Editor > Code Style > Formatter Control |
| 81 | //@formatter:off |
| 82 | |
| 83 | |
Feng Cao | 9199498 | 2020-01-22 13:32:36 -0800 | [diff] [blame] | 84 | /** |
| 85 | * Creates a new InlinePresentation. |
| 86 | * |
| 87 | * @param slice |
| 88 | * Represents the UI content and the action for the inline suggestion. |
| 89 | * @param inlinePresentationSpec |
| 90 | * Specifies the UI specification for the inline suggestion. |
| 91 | * @param pinned |
| 92 | * Indicates whether the UI should be pinned, hence non-scrollable, in the host. |
| 93 | */ |
Adam He | 3e01bc3 | 2019-12-13 14:30:13 -0800 | [diff] [blame] | 94 | @DataClass.Generated.Member |
| 95 | public InlinePresentation( |
| 96 | @NonNull Slice slice, |
Feng Cao | 9199498 | 2020-01-22 13:32:36 -0800 | [diff] [blame] | 97 | @NonNull InlinePresentationSpec inlinePresentationSpec, |
| 98 | boolean pinned) { |
Adam He | 3e01bc3 | 2019-12-13 14:30:13 -0800 | [diff] [blame] | 99 | this.mSlice = slice; |
| 100 | com.android.internal.util.AnnotationValidations.validate( |
| 101 | NonNull.class, null, mSlice); |
| 102 | this.mInlinePresentationSpec = inlinePresentationSpec; |
| 103 | com.android.internal.util.AnnotationValidations.validate( |
| 104 | NonNull.class, null, mInlinePresentationSpec); |
Feng Cao | 9199498 | 2020-01-22 13:32:36 -0800 | [diff] [blame] | 105 | this.mPinned = pinned; |
Adam He | 3e01bc3 | 2019-12-13 14:30:13 -0800 | [diff] [blame] | 106 | |
| 107 | // onConstructed(); // You can define this method to get a callback |
| 108 | } |
| 109 | |
Feng Cao | 9199498 | 2020-01-22 13:32:36 -0800 | [diff] [blame] | 110 | /** |
| 111 | * Represents the UI content and the action for the inline suggestion. |
| 112 | */ |
Adam He | 3e01bc3 | 2019-12-13 14:30:13 -0800 | [diff] [blame] | 113 | @DataClass.Generated.Member |
| 114 | public @NonNull Slice getSlice() { |
| 115 | return mSlice; |
| 116 | } |
| 117 | |
Feng Cao | 9199498 | 2020-01-22 13:32:36 -0800 | [diff] [blame] | 118 | /** |
| 119 | * Specifies the UI specification for the inline suggestion. |
| 120 | */ |
Adam He | 3e01bc3 | 2019-12-13 14:30:13 -0800 | [diff] [blame] | 121 | @DataClass.Generated.Member |
| 122 | public @NonNull InlinePresentationSpec getInlinePresentationSpec() { |
| 123 | return mInlinePresentationSpec; |
| 124 | } |
| 125 | |
Feng Cao | 9199498 | 2020-01-22 13:32:36 -0800 | [diff] [blame] | 126 | /** |
| 127 | * Indicates whether the UI should be pinned, hence non-scrollable, in the host. |
| 128 | */ |
| 129 | @DataClass.Generated.Member |
| 130 | public boolean isPinned() { |
| 131 | return mPinned; |
| 132 | } |
| 133 | |
Adam He | 3e01bc3 | 2019-12-13 14:30:13 -0800 | [diff] [blame] | 134 | @Override |
| 135 | @DataClass.Generated.Member |
| 136 | public String toString() { |
| 137 | // You can override field toString logic by defining methods like: |
| 138 | // String fieldNameToString() { ... } |
| 139 | |
| 140 | return "InlinePresentation { " + |
| 141 | "slice = " + mSlice + ", " + |
Feng Cao | 9199498 | 2020-01-22 13:32:36 -0800 | [diff] [blame] | 142 | "inlinePresentationSpec = " + mInlinePresentationSpec + ", " + |
| 143 | "pinned = " + mPinned + |
Adam He | 3e01bc3 | 2019-12-13 14:30:13 -0800 | [diff] [blame] | 144 | " }"; |
| 145 | } |
| 146 | |
| 147 | @Override |
| 148 | @DataClass.Generated.Member |
| 149 | public boolean equals(@android.annotation.Nullable Object o) { |
| 150 | // You can override field equality logic by defining either of the methods like: |
| 151 | // boolean fieldNameEquals(InlinePresentation other) { ... } |
| 152 | // boolean fieldNameEquals(FieldType otherValue) { ... } |
| 153 | |
| 154 | if (this == o) return true; |
| 155 | if (o == null || getClass() != o.getClass()) return false; |
| 156 | @SuppressWarnings("unchecked") |
| 157 | InlinePresentation that = (InlinePresentation) o; |
| 158 | //noinspection PointlessBooleanExpression |
| 159 | return true |
| 160 | && java.util.Objects.equals(mSlice, that.mSlice) |
Feng Cao | 9199498 | 2020-01-22 13:32:36 -0800 | [diff] [blame] | 161 | && java.util.Objects.equals(mInlinePresentationSpec, that.mInlinePresentationSpec) |
| 162 | && mPinned == that.mPinned; |
Adam He | 3e01bc3 | 2019-12-13 14:30:13 -0800 | [diff] [blame] | 163 | } |
| 164 | |
| 165 | @Override |
| 166 | @DataClass.Generated.Member |
| 167 | public int hashCode() { |
| 168 | // You can override field hashCode logic by defining methods like: |
| 169 | // int fieldNameHashCode() { ... } |
| 170 | |
| 171 | int _hash = 1; |
| 172 | _hash = 31 * _hash + java.util.Objects.hashCode(mSlice); |
| 173 | _hash = 31 * _hash + java.util.Objects.hashCode(mInlinePresentationSpec); |
Feng Cao | 9199498 | 2020-01-22 13:32:36 -0800 | [diff] [blame] | 174 | _hash = 31 * _hash + Boolean.hashCode(mPinned); |
Adam He | 3e01bc3 | 2019-12-13 14:30:13 -0800 | [diff] [blame] | 175 | return _hash; |
| 176 | } |
| 177 | |
| 178 | @Override |
| 179 | @DataClass.Generated.Member |
| 180 | public void writeToParcel(@NonNull Parcel dest, int flags) { |
| 181 | // You can override field parcelling by defining methods like: |
| 182 | // void parcelFieldName(Parcel dest, int flags) { ... } |
| 183 | |
Feng Cao | 9199498 | 2020-01-22 13:32:36 -0800 | [diff] [blame] | 184 | byte flg = 0; |
| 185 | if (mPinned) flg |= 0x4; |
| 186 | dest.writeByte(flg); |
Adam He | 3e01bc3 | 2019-12-13 14:30:13 -0800 | [diff] [blame] | 187 | dest.writeTypedObject(mSlice, flags); |
| 188 | dest.writeTypedObject(mInlinePresentationSpec, flags); |
| 189 | } |
| 190 | |
| 191 | @Override |
| 192 | @DataClass.Generated.Member |
| 193 | public int describeContents() { return 0; } |
| 194 | |
| 195 | /** @hide */ |
| 196 | @SuppressWarnings({"unchecked", "RedundantCast"}) |
| 197 | @DataClass.Generated.Member |
| 198 | /* package-private */ InlinePresentation(@NonNull Parcel in) { |
| 199 | // You can override field unparcelling by defining methods like: |
| 200 | // static FieldType unparcelFieldName(Parcel in) { ... } |
| 201 | |
Feng Cao | 9199498 | 2020-01-22 13:32:36 -0800 | [diff] [blame] | 202 | byte flg = in.readByte(); |
| 203 | boolean pinned = (flg & 0x4) != 0; |
Adam He | 3e01bc3 | 2019-12-13 14:30:13 -0800 | [diff] [blame] | 204 | Slice slice = (Slice) in.readTypedObject(Slice.CREATOR); |
| 205 | InlinePresentationSpec inlinePresentationSpec = (InlinePresentationSpec) in.readTypedObject(InlinePresentationSpec.CREATOR); |
| 206 | |
| 207 | this.mSlice = slice; |
| 208 | com.android.internal.util.AnnotationValidations.validate( |
| 209 | NonNull.class, null, mSlice); |
| 210 | this.mInlinePresentationSpec = inlinePresentationSpec; |
| 211 | com.android.internal.util.AnnotationValidations.validate( |
| 212 | NonNull.class, null, mInlinePresentationSpec); |
Feng Cao | 9199498 | 2020-01-22 13:32:36 -0800 | [diff] [blame] | 213 | this.mPinned = pinned; |
Adam He | 3e01bc3 | 2019-12-13 14:30:13 -0800 | [diff] [blame] | 214 | |
| 215 | // onConstructed(); // You can define this method to get a callback |
| 216 | } |
| 217 | |
| 218 | @DataClass.Generated.Member |
| 219 | public static final @NonNull Parcelable.Creator<InlinePresentation> CREATOR |
| 220 | = new Parcelable.Creator<InlinePresentation>() { |
| 221 | @Override |
| 222 | public InlinePresentation[] newArray(int size) { |
| 223 | return new InlinePresentation[size]; |
| 224 | } |
| 225 | |
| 226 | @Override |
| 227 | public InlinePresentation createFromParcel(@NonNull Parcel in) { |
| 228 | return new InlinePresentation(in); |
| 229 | } |
| 230 | }; |
| 231 | |
| 232 | @DataClass.Generated( |
Feng Cao | 4b0ef39 | 2020-02-25 18:18:36 -0800 | [diff] [blame] | 233 | time = 1582753782651L, |
Adam He | 3e01bc3 | 2019-12-13 14:30:13 -0800 | [diff] [blame] | 234 | codegenVersion = "1.0.14", |
| 235 | sourceFile = "frameworks/base/core/java/android/service/autofill/InlinePresentation.java", |
Feng Cao | 4b0ef39 | 2020-02-25 18:18:36 -0800 | [diff] [blame] | 236 | inputSignatures = "private final @android.annotation.NonNull android.app.slice.Slice mSlice\nprivate final @android.annotation.NonNull android.view.inline.InlinePresentationSpec mInlinePresentationSpec\nprivate final boolean mPinned\npublic @android.annotation.NonNull @android.annotation.Size(min=0L) java.lang.String[] getAutofillHints()\nclass InlinePresentation extends java.lang.Object implements [android.os.Parcelable]\n@com.android.internal.util.DataClass(genToString=true, genHiddenConstDefs=true, genEqualsHashCode=true)") |
Adam He | 3e01bc3 | 2019-12-13 14:30:13 -0800 | [diff] [blame] | 237 | @Deprecated |
| 238 | private void __metadata() {} |
| 239 | |
| 240 | |
| 241 | //@formatter:on |
| 242 | // End of generated code |
| 243 | |
| 244 | } |