blob: b6a8ced29f7296e766d77e0e7415ef99aada6162 [file] [log] [blame]
Adam He3e01bc32019-12-13 14:30:13 -08001/*
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
17package android.service.autofill;
18
19import android.annotation.NonNull;
Feng Cao4b0ef392020-02-25 18:18:36 -080020import android.annotation.Size;
Adam He3e01bc32019-12-13 14:30:13 -080021import android.app.slice.Slice;
22import android.os.Parcel;
23import android.os.Parcelable;
24import android.view.inline.InlinePresentationSpec;
25
26import com.android.internal.util.DataClass;
27
Feng Cao4b0ef392020-02-25 18:18:36 -080028import java.util.List;
29
Adam He3e01bc32019-12-13 14:30:13 -080030/**
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)
38public final class InlinePresentation implements Parcelable {
39
Feng Cao91994982020-01-22 13:32:36 -080040
41 /**
42 * Represents the UI content and the action for the inline suggestion.
43 */
Adam He3e01bc32019-12-13 14:30:13 -080044 private final @NonNull Slice mSlice;
45
Feng Cao91994982020-01-22 13:32:36 -080046 /**
47 * Specifies the UI specification for the inline suggestion.
48 */
Adam He3e01bc32019-12-13 14:30:13 -080049 private final @NonNull InlinePresentationSpec mInlinePresentationSpec;
50
Feng Cao91994982020-01-22 13:32:36 -080051 /**
Ahaan Ugale8893d302020-03-24 19:27:26 -070052 * Indicates whether the UI should be pinned, hence non-scrollable and non-filterable, in the
53 * host.
Feng Cao91994982020-01-22 13:32:36 -080054 */
55 private final boolean mPinned;
56
Feng Cao4b0ef392020-02-25 18:18:36 -080057 /**
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 He3e01bc32019-12-13 14:30:13 -080069
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 Cao91994982020-01-22 13:32:36 -080084 /**
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 He3e01bc32019-12-13 14:30:13 -080094 @DataClass.Generated.Member
95 public InlinePresentation(
96 @NonNull Slice slice,
Feng Cao91994982020-01-22 13:32:36 -080097 @NonNull InlinePresentationSpec inlinePresentationSpec,
98 boolean pinned) {
Adam He3e01bc32019-12-13 14:30:13 -080099 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 Cao91994982020-01-22 13:32:36 -0800105 this.mPinned = pinned;
Adam He3e01bc32019-12-13 14:30:13 -0800106
107 // onConstructed(); // You can define this method to get a callback
108 }
109
Feng Cao91994982020-01-22 13:32:36 -0800110 /**
111 * Represents the UI content and the action for the inline suggestion.
112 */
Adam He3e01bc32019-12-13 14:30:13 -0800113 @DataClass.Generated.Member
114 public @NonNull Slice getSlice() {
115 return mSlice;
116 }
117
Feng Cao91994982020-01-22 13:32:36 -0800118 /**
119 * Specifies the UI specification for the inline suggestion.
120 */
Adam He3e01bc32019-12-13 14:30:13 -0800121 @DataClass.Generated.Member
122 public @NonNull InlinePresentationSpec getInlinePresentationSpec() {
123 return mInlinePresentationSpec;
124 }
125
Feng Cao91994982020-01-22 13:32:36 -0800126 /**
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 He3e01bc32019-12-13 14:30:13 -0800134 @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 Cao91994982020-01-22 13:32:36 -0800142 "inlinePresentationSpec = " + mInlinePresentationSpec + ", " +
143 "pinned = " + mPinned +
Adam He3e01bc32019-12-13 14:30:13 -0800144 " }";
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 Cao91994982020-01-22 13:32:36 -0800161 && java.util.Objects.equals(mInlinePresentationSpec, that.mInlinePresentationSpec)
162 && mPinned == that.mPinned;
Adam He3e01bc32019-12-13 14:30:13 -0800163 }
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 Cao91994982020-01-22 13:32:36 -0800174 _hash = 31 * _hash + Boolean.hashCode(mPinned);
Adam He3e01bc32019-12-13 14:30:13 -0800175 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 Cao91994982020-01-22 13:32:36 -0800184 byte flg = 0;
185 if (mPinned) flg |= 0x4;
186 dest.writeByte(flg);
Adam He3e01bc32019-12-13 14:30:13 -0800187 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 Cao91994982020-01-22 13:32:36 -0800202 byte flg = in.readByte();
203 boolean pinned = (flg & 0x4) != 0;
Adam He3e01bc32019-12-13 14:30:13 -0800204 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 Cao91994982020-01-22 13:32:36 -0800213 this.mPinned = pinned;
Adam He3e01bc32019-12-13 14:30:13 -0800214
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 Cao4b0ef392020-02-25 18:18:36 -0800233 time = 1582753782651L,
Adam He3e01bc32019-12-13 14:30:13 -0800234 codegenVersion = "1.0.14",
235 sourceFile = "frameworks/base/core/java/android/service/autofill/InlinePresentation.java",
Feng Cao4b0ef392020-02-25 18:18:36 -0800236 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 He3e01bc32019-12-13 14:30:13 -0800237 @Deprecated
238 private void __metadata() {}
239
240
241 //@formatter:on
242 // End of generated code
243
244}