Feng Cao | 04830a3 | 2019-11-13 00:45:19 -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.view.inputmethod; |
| 18 | |
| 19 | import android.annotation.NonNull; |
Feng Cao | 16b2de5 | 2020-01-09 17:27:27 -0800 | [diff] [blame] | 20 | import android.annotation.Nullable; |
| 21 | import android.app.ActivityThread; |
Feng Cao | 77636e8 | 2020-03-30 19:57:12 -0700 | [diff] [blame] | 22 | import android.compat.annotation.UnsupportedAppUsage; |
Feng Cao | 5f7e99e | 2020-02-14 19:27:46 -0800 | [diff] [blame] | 23 | import android.os.Bundle; |
Adam He | 4011625 | 2020-02-04 14:55:39 -0800 | [diff] [blame] | 24 | import android.os.IBinder; |
Feng Cao | 5f7e99e | 2020-02-14 19:27:46 -0800 | [diff] [blame] | 25 | import android.os.LocaleList; |
Svet Ganov | 02fdd34 | 2020-02-20 20:48:34 -0800 | [diff] [blame] | 26 | import android.os.Parcel; |
Feng Cao | 04830a3 | 2019-11-13 00:45:19 -0800 | [diff] [blame] | 27 | import android.os.Parcelable; |
Svet Ganov | 02fdd34 | 2020-02-20 20:48:34 -0800 | [diff] [blame] | 28 | import android.view.Display; |
Adam He | f27433a | 2020-03-25 15:11:18 -0700 | [diff] [blame] | 29 | import android.widget.inline.InlinePresentationSpec; |
Feng Cao | 04830a3 | 2019-11-13 00:45:19 -0800 | [diff] [blame] | 30 | |
| 31 | import com.android.internal.util.DataClass; |
| 32 | import com.android.internal.util.Preconditions; |
Feng Cao | 59b682f | 2020-03-30 17:43:16 -0700 | [diff] [blame] | 33 | import com.android.internal.widget.InlinePresentationStyleUtils; |
Feng Cao | 04830a3 | 2019-11-13 00:45:19 -0800 | [diff] [blame] | 34 | |
| 35 | import java.util.ArrayList; |
| 36 | import java.util.List; |
| 37 | |
| 38 | /** |
| 39 | * This class represents an inline suggestion request made by one app to get suggestions from the |
| 40 | * other source. See {@link InlineSuggestion} for more information. |
| 41 | */ |
| 42 | @DataClass(genEqualsHashCode = true, genToString = true, genBuilder = true) |
| 43 | public final class InlineSuggestionsRequest implements Parcelable { |
| 44 | |
| 45 | /** Constant used to indicate not putting a cap on the number of suggestions to return. */ |
| 46 | public static final int SUGGESTION_COUNT_UNLIMITED = Integer.MAX_VALUE; |
| 47 | |
Feng Cao | 7a0f002 | 2019-12-17 18:49:24 -0800 | [diff] [blame] | 48 | /** |
Feng Cao | 44dc2bd | 2020-03-09 23:02:33 -0700 | [diff] [blame] | 49 | * Max number of suggestions expected from the response. It must be a positive value. |
| 50 | * Defaults to {@code SUGGESTION_COUNT_UNLIMITED} if not set. |
Feng Cao | 7a0f002 | 2019-12-17 18:49:24 -0800 | [diff] [blame] | 51 | */ |
Feng Cao | 04830a3 | 2019-11-13 00:45:19 -0800 | [diff] [blame] | 52 | private final int mMaxSuggestionCount; |
Feng Cao | 7a0f002 | 2019-12-17 18:49:24 -0800 | [diff] [blame] | 53 | |
| 54 | /** |
| 55 | * The {@link InlinePresentationSpec} for each suggestion in the response. If the max suggestion |
| 56 | * count is larger than the number of specs in the list, then the last spec is used for the |
Feng Cao | 44dc2bd | 2020-03-09 23:02:33 -0700 | [diff] [blame] | 57 | * remainder of the suggestions. The list should not be empty. |
Feng Cao | 7a0f002 | 2019-12-17 18:49:24 -0800 | [diff] [blame] | 58 | */ |
Adam He | f27433a | 2020-03-25 15:11:18 -0700 | [diff] [blame] | 59 | private final @NonNull List<InlinePresentationSpec> mInlinePresentationSpecs; |
Feng Cao | 04830a3 | 2019-11-13 00:45:19 -0800 | [diff] [blame] | 60 | |
Feng Cao | 16b2de5 | 2020-01-09 17:27:27 -0800 | [diff] [blame] | 61 | /** |
| 62 | * The package name of the app that requests for the inline suggestions and will host the |
| 63 | * embedded suggestion views. The app does not have to set the value for the field because |
| 64 | * it'll be set by the system for safety reasons. |
| 65 | */ |
| 66 | private @NonNull String mHostPackageName; |
| 67 | |
| 68 | /** |
Feng Cao | 5f7e99e | 2020-02-14 19:27:46 -0800 | [diff] [blame] | 69 | * The IME provided locales for the request. If non-empty, the inline suggestions should |
| 70 | * return languages from the supported locales. If not provided, it'll default to system locale. |
| 71 | */ |
| 72 | private @NonNull LocaleList mSupportedLocales; |
| 73 | |
Svet Ganov | 02fdd34 | 2020-02-20 20:48:34 -0800 | [diff] [blame] | 74 | /** |
| 75 | * The extras state propagated from the IME to pass extra data. |
| 76 | */ |
Feng Cao | edb332c | 2020-03-30 14:26:42 -0700 | [diff] [blame] | 77 | private @NonNull Bundle mExtras; |
Svet Ganov | 02fdd34 | 2020-02-20 20:48:34 -0800 | [diff] [blame] | 78 | |
Feng Cao | 5f7e99e | 2020-02-14 19:27:46 -0800 | [diff] [blame] | 79 | /** |
Adam He | 4011625 | 2020-02-04 14:55:39 -0800 | [diff] [blame] | 80 | * The host input token of the IME that made the request. This will be set by the system for |
| 81 | * safety reasons. |
| 82 | * |
| 83 | * @hide |
| 84 | */ |
| 85 | private @Nullable IBinder mHostInputToken; |
| 86 | |
| 87 | /** |
Svet Ganov | 02fdd34 | 2020-02-20 20:48:34 -0800 | [diff] [blame] | 88 | * The host display id of the IME that made the request. This will be set by the system for |
| 89 | * safety reasons. |
| 90 | * |
| 91 | * @hide |
Feng Cao | 16b2de5 | 2020-01-09 17:27:27 -0800 | [diff] [blame] | 92 | */ |
Svet Ganov | 02fdd34 | 2020-02-20 20:48:34 -0800 | [diff] [blame] | 93 | private int mHostDisplayId; |
Feng Cao | 16b2de5 | 2020-01-09 17:27:27 -0800 | [diff] [blame] | 94 | |
Adam He | 4011625 | 2020-02-04 14:55:39 -0800 | [diff] [blame] | 95 | /** |
Adam He | f27433a | 2020-03-25 15:11:18 -0700 | [diff] [blame] | 96 | * The {@link InlinePresentationSpec} for each suggestion in the response. If the max suggestion |
| 97 | * count is larger than the number of specs in the list, then the last spec is used for the |
| 98 | * remainder of the suggestions. The list should not be empty. |
| 99 | * |
| 100 | * @hide |
| 101 | * @removed |
| 102 | */ |
Feng Cao | 77636e8 | 2020-03-30 19:57:12 -0700 | [diff] [blame] | 103 | @UnsupportedAppUsage |
| 104 | @NonNull |
| 105 | public List<android.view.inline.InlinePresentationSpec> getPresentationSpecs() { |
| 106 | return android.view.inline.InlinePresentationSpec.fromWidgets(mInlinePresentationSpecs); |
Adam He | f27433a | 2020-03-25 15:11:18 -0700 | [diff] [blame] | 107 | } |
| 108 | |
| 109 | /** |
Adam He | 4011625 | 2020-02-04 14:55:39 -0800 | [diff] [blame] | 110 | * @hide |
| 111 | * @see {@link #mHostInputToken}. |
| 112 | */ |
| 113 | public void setHostInputToken(IBinder hostInputToken) { |
| 114 | mHostInputToken = hostInputToken; |
| 115 | } |
| 116 | |
Feng Cao | 59b682f | 2020-03-30 17:43:16 -0700 | [diff] [blame] | 117 | private boolean extrasEquals(@NonNull Bundle extras) { |
| 118 | return InlinePresentationStyleUtils.bundleEquals(mExtras, extras); |
| 119 | } |
| 120 | |
Svet Ganov | 02fdd34 | 2020-02-20 20:48:34 -0800 | [diff] [blame] | 121 | // TODO(b/149609075): remove once IBinder parcelling is natively supported |
| 122 | private void parcelHostInputToken(@NonNull Parcel parcel, int flags) { |
| 123 | parcel.writeStrongBinder(mHostInputToken); |
| 124 | } |
| 125 | |
| 126 | // TODO(b/149609075): remove once IBinder parcelling is natively supported |
| 127 | private @Nullable IBinder unparcelHostInputToken(Parcel parcel) { |
| 128 | return parcel.readStrongBinder(); |
| 129 | } |
| 130 | |
| 131 | /** |
| 132 | * @hide |
| 133 | * @see {@link #mHostDisplayId}. |
| 134 | */ |
| 135 | public void setHostDisplayId(int hostDisplayId) { |
| 136 | mHostDisplayId = hostDisplayId; |
| 137 | } |
| 138 | |
Feng Cao | 04830a3 | 2019-11-13 00:45:19 -0800 | [diff] [blame] | 139 | private void onConstructed() { |
Adam He | f27433a | 2020-03-25 15:11:18 -0700 | [diff] [blame] | 140 | Preconditions.checkState(!mInlinePresentationSpecs.isEmpty()); |
| 141 | Preconditions.checkState(mMaxSuggestionCount >= mInlinePresentationSpecs.size()); |
Feng Cao | 04830a3 | 2019-11-13 00:45:19 -0800 | [diff] [blame] | 142 | } |
| 143 | |
| 144 | private static int defaultMaxSuggestionCount() { |
| 145 | return SUGGESTION_COUNT_UNLIMITED; |
| 146 | } |
| 147 | |
Feng Cao | 16b2de5 | 2020-01-09 17:27:27 -0800 | [diff] [blame] | 148 | private static String defaultHostPackageName() { |
| 149 | return ActivityThread.currentPackageName(); |
| 150 | } |
| 151 | |
Feng Cao | 5f7e99e | 2020-02-14 19:27:46 -0800 | [diff] [blame] | 152 | private static LocaleList defaultSupportedLocales() { |
| 153 | return LocaleList.getDefault(); |
| 154 | } |
| 155 | |
| 156 | @Nullable |
Adam He | 4011625 | 2020-02-04 14:55:39 -0800 | [diff] [blame] | 157 | private static IBinder defaultHostInputToken() { |
| 158 | return null; |
| 159 | } |
| 160 | |
Feng Cao | 5f7e99e | 2020-02-14 19:27:46 -0800 | [diff] [blame] | 161 | @Nullable |
Svet Ganov | 02fdd34 | 2020-02-20 20:48:34 -0800 | [diff] [blame] | 162 | private static int defaultHostDisplayId() { |
| 163 | return Display.INVALID_DISPLAY; |
| 164 | } |
| 165 | |
Feng Cao | edb332c | 2020-03-30 14:26:42 -0700 | [diff] [blame] | 166 | @NonNull |
Feng Cao | 5f7e99e | 2020-02-14 19:27:46 -0800 | [diff] [blame] | 167 | private static Bundle defaultExtras() { |
Feng Cao | edb332c | 2020-03-30 14:26:42 -0700 | [diff] [blame] | 168 | return Bundle.EMPTY; |
Feng Cao | 5f7e99e | 2020-02-14 19:27:46 -0800 | [diff] [blame] | 169 | } |
| 170 | |
Feng Cao | 04830a3 | 2019-11-13 00:45:19 -0800 | [diff] [blame] | 171 | /** @hide */ |
| 172 | abstract static class BaseBuilder { |
Adam He | f27433a | 2020-03-25 15:11:18 -0700 | [diff] [blame] | 173 | /** |
Adam He | f27433a | 2020-03-25 15:11:18 -0700 | [diff] [blame] | 174 | * @hide |
| 175 | * @removed |
| 176 | */ |
Feng Cao | 77636e8 | 2020-03-30 19:57:12 -0700 | [diff] [blame] | 177 | @UnsupportedAppUsage |
| 178 | @NonNull |
| 179 | public Builder addPresentationSpecs( |
Adam He | f27433a | 2020-03-25 15:11:18 -0700 | [diff] [blame] | 180 | @NonNull android.view.inline.InlinePresentationSpec value) { |
Feng Cao | 77636e8 | 2020-03-30 19:57:12 -0700 | [diff] [blame] | 181 | return ((Builder) this).addInlinePresentationSpecs(value.toWidget()); |
Adam He | f27433a | 2020-03-25 15:11:18 -0700 | [diff] [blame] | 182 | } |
| 183 | |
| 184 | abstract Builder setInlinePresentationSpecs( |
| 185 | @NonNull List<android.widget.inline.InlinePresentationSpec> specs); |
Feng Cao | 16b2de5 | 2020-01-09 17:27:27 -0800 | [diff] [blame] | 186 | |
| 187 | abstract Builder setHostPackageName(@Nullable String value); |
Adam He | 4011625 | 2020-02-04 14:55:39 -0800 | [diff] [blame] | 188 | |
| 189 | abstract Builder setHostInputToken(IBinder hostInputToken); |
Svet Ganov | 02fdd34 | 2020-02-20 20:48:34 -0800 | [diff] [blame] | 190 | |
| 191 | abstract Builder setHostDisplayId(int value); |
Feng Cao | 04830a3 | 2019-11-13 00:45:19 -0800 | [diff] [blame] | 192 | } |
| 193 | |
| 194 | |
| 195 | |
Feng Cao | 44dc2bd | 2020-03-09 23:02:33 -0700 | [diff] [blame] | 196 | // Code below generated by codegen v1.0.15. |
Feng Cao | 04830a3 | 2019-11-13 00:45:19 -0800 | [diff] [blame] | 197 | // |
| 198 | // DO NOT MODIFY! |
| 199 | // CHECKSTYLE:OFF Generated code |
| 200 | // |
| 201 | // To regenerate run: |
| 202 | // $ codegen $ANDROID_BUILD_TOP/frameworks/base/core/java/android/view/inputmethod/InlineSuggestionsRequest.java |
| 203 | // |
| 204 | // To exclude the generated code from IntelliJ auto-formatting enable (one-time): |
| 205 | // Settings > Editor > Code Style > Formatter Control |
| 206 | //@formatter:off |
| 207 | |
| 208 | |
| 209 | @DataClass.Generated.Member |
| 210 | /* package-private */ InlineSuggestionsRequest( |
| 211 | int maxSuggestionCount, |
Adam He | f27433a | 2020-03-25 15:11:18 -0700 | [diff] [blame] | 212 | @NonNull List<InlinePresentationSpec> inlinePresentationSpecs, |
Adam He | 4011625 | 2020-02-04 14:55:39 -0800 | [diff] [blame] | 213 | @NonNull String hostPackageName, |
Feng Cao | 5f7e99e | 2020-02-14 19:27:46 -0800 | [diff] [blame] | 214 | @NonNull LocaleList supportedLocales, |
Feng Cao | edb332c | 2020-03-30 14:26:42 -0700 | [diff] [blame] | 215 | @NonNull Bundle extras, |
Feng Cao | 5f7e99e | 2020-02-14 19:27:46 -0800 | [diff] [blame] | 216 | @Nullable IBinder hostInputToken, |
Svet Ganov | 02fdd34 | 2020-02-20 20:48:34 -0800 | [diff] [blame] | 217 | int hostDisplayId) { |
Feng Cao | 04830a3 | 2019-11-13 00:45:19 -0800 | [diff] [blame] | 218 | this.mMaxSuggestionCount = maxSuggestionCount; |
Adam He | f27433a | 2020-03-25 15:11:18 -0700 | [diff] [blame] | 219 | this.mInlinePresentationSpecs = inlinePresentationSpecs; |
Feng Cao | 04830a3 | 2019-11-13 00:45:19 -0800 | [diff] [blame] | 220 | com.android.internal.util.AnnotationValidations.validate( |
Adam He | f27433a | 2020-03-25 15:11:18 -0700 | [diff] [blame] | 221 | NonNull.class, null, mInlinePresentationSpecs); |
Feng Cao | 16b2de5 | 2020-01-09 17:27:27 -0800 | [diff] [blame] | 222 | this.mHostPackageName = hostPackageName; |
| 223 | com.android.internal.util.AnnotationValidations.validate( |
| 224 | NonNull.class, null, mHostPackageName); |
Feng Cao | 5f7e99e | 2020-02-14 19:27:46 -0800 | [diff] [blame] | 225 | this.mSupportedLocales = supportedLocales; |
| 226 | com.android.internal.util.AnnotationValidations.validate( |
| 227 | NonNull.class, null, mSupportedLocales); |
Feng Cao | 5f7e99e | 2020-02-14 19:27:46 -0800 | [diff] [blame] | 228 | this.mExtras = extras; |
Feng Cao | edb332c | 2020-03-30 14:26:42 -0700 | [diff] [blame] | 229 | com.android.internal.util.AnnotationValidations.validate( |
| 230 | NonNull.class, null, mExtras); |
Svet Ganov | 02fdd34 | 2020-02-20 20:48:34 -0800 | [diff] [blame] | 231 | this.mHostInputToken = hostInputToken; |
| 232 | this.mHostDisplayId = hostDisplayId; |
Feng Cao | 04830a3 | 2019-11-13 00:45:19 -0800 | [diff] [blame] | 233 | |
| 234 | onConstructed(); |
| 235 | } |
| 236 | |
Feng Cao | 7a0f002 | 2019-12-17 18:49:24 -0800 | [diff] [blame] | 237 | /** |
Feng Cao | 44dc2bd | 2020-03-09 23:02:33 -0700 | [diff] [blame] | 238 | * Max number of suggestions expected from the response. It must be a positive value. |
| 239 | * Defaults to {@code SUGGESTION_COUNT_UNLIMITED} if not set. |
Feng Cao | 7a0f002 | 2019-12-17 18:49:24 -0800 | [diff] [blame] | 240 | */ |
Feng Cao | 04830a3 | 2019-11-13 00:45:19 -0800 | [diff] [blame] | 241 | @DataClass.Generated.Member |
| 242 | public int getMaxSuggestionCount() { |
| 243 | return mMaxSuggestionCount; |
| 244 | } |
| 245 | |
Feng Cao | 7a0f002 | 2019-12-17 18:49:24 -0800 | [diff] [blame] | 246 | /** |
| 247 | * The {@link InlinePresentationSpec} for each suggestion in the response. If the max suggestion |
| 248 | * count is larger than the number of specs in the list, then the last spec is used for the |
Feng Cao | 44dc2bd | 2020-03-09 23:02:33 -0700 | [diff] [blame] | 249 | * remainder of the suggestions. The list should not be empty. |
Feng Cao | 7a0f002 | 2019-12-17 18:49:24 -0800 | [diff] [blame] | 250 | */ |
Feng Cao | 04830a3 | 2019-11-13 00:45:19 -0800 | [diff] [blame] | 251 | @DataClass.Generated.Member |
Adam He | f27433a | 2020-03-25 15:11:18 -0700 | [diff] [blame] | 252 | public @NonNull List<InlinePresentationSpec> getInlinePresentationSpecs() { |
| 253 | return mInlinePresentationSpecs; |
Feng Cao | 04830a3 | 2019-11-13 00:45:19 -0800 | [diff] [blame] | 254 | } |
| 255 | |
Feng Cao | 16b2de5 | 2020-01-09 17:27:27 -0800 | [diff] [blame] | 256 | /** |
| 257 | * The package name of the app that requests for the inline suggestions and will host the |
| 258 | * embedded suggestion views. The app does not have to set the value for the field because |
| 259 | * it'll be set by the system for safety reasons. |
| 260 | */ |
| 261 | @DataClass.Generated.Member |
| 262 | public @NonNull String getHostPackageName() { |
| 263 | return mHostPackageName; |
| 264 | } |
| 265 | |
Adam He | 4011625 | 2020-02-04 14:55:39 -0800 | [diff] [blame] | 266 | /** |
Feng Cao | 5f7e99e | 2020-02-14 19:27:46 -0800 | [diff] [blame] | 267 | * The IME provided locales for the request. If non-empty, the inline suggestions should |
| 268 | * return languages from the supported locales. If not provided, it'll default to system locale. |
| 269 | */ |
| 270 | @DataClass.Generated.Member |
| 271 | public @NonNull LocaleList getSupportedLocales() { |
| 272 | return mSupportedLocales; |
| 273 | } |
| 274 | |
| 275 | /** |
Svet Ganov | 02fdd34 | 2020-02-20 20:48:34 -0800 | [diff] [blame] | 276 | * The extras state propagated from the IME to pass extra data. |
| 277 | */ |
| 278 | @DataClass.Generated.Member |
Feng Cao | edb332c | 2020-03-30 14:26:42 -0700 | [diff] [blame] | 279 | public @NonNull Bundle getExtras() { |
Svet Ganov | 02fdd34 | 2020-02-20 20:48:34 -0800 | [diff] [blame] | 280 | return mExtras; |
| 281 | } |
| 282 | |
| 283 | /** |
Adam He | 4011625 | 2020-02-04 14:55:39 -0800 | [diff] [blame] | 284 | * The host input token of the IME that made the request. This will be set by the system for |
| 285 | * safety reasons. |
| 286 | * |
| 287 | * @hide |
| 288 | */ |
| 289 | @DataClass.Generated.Member |
| 290 | public @Nullable IBinder getHostInputToken() { |
| 291 | return mHostInputToken; |
| 292 | } |
| 293 | |
Feng Cao | 5f7e99e | 2020-02-14 19:27:46 -0800 | [diff] [blame] | 294 | /** |
Svet Ganov | 02fdd34 | 2020-02-20 20:48:34 -0800 | [diff] [blame] | 295 | * The host display id of the IME that made the request. This will be set by the system for |
| 296 | * safety reasons. |
| 297 | * |
| 298 | * @hide |
Feng Cao | 5f7e99e | 2020-02-14 19:27:46 -0800 | [diff] [blame] | 299 | */ |
| 300 | @DataClass.Generated.Member |
Svet Ganov | 02fdd34 | 2020-02-20 20:48:34 -0800 | [diff] [blame] | 301 | public int getHostDisplayId() { |
| 302 | return mHostDisplayId; |
Feng Cao | 5f7e99e | 2020-02-14 19:27:46 -0800 | [diff] [blame] | 303 | } |
| 304 | |
Feng Cao | 04830a3 | 2019-11-13 00:45:19 -0800 | [diff] [blame] | 305 | @Override |
| 306 | @DataClass.Generated.Member |
| 307 | public String toString() { |
| 308 | // You can override field toString logic by defining methods like: |
| 309 | // String fieldNameToString() { ... } |
| 310 | |
| 311 | return "InlineSuggestionsRequest { " + |
| 312 | "maxSuggestionCount = " + mMaxSuggestionCount + ", " + |
Adam He | f27433a | 2020-03-25 15:11:18 -0700 | [diff] [blame] | 313 | "inlinePresentationSpecs = " + mInlinePresentationSpecs + ", " + |
Adam He | 4011625 | 2020-02-04 14:55:39 -0800 | [diff] [blame] | 314 | "hostPackageName = " + mHostPackageName + ", " + |
Feng Cao | 5f7e99e | 2020-02-14 19:27:46 -0800 | [diff] [blame] | 315 | "supportedLocales = " + mSupportedLocales + ", " + |
Svet Ganov | 02fdd34 | 2020-02-20 20:48:34 -0800 | [diff] [blame] | 316 | "extras = " + mExtras + ", " + |
Feng Cao | 5f7e99e | 2020-02-14 19:27:46 -0800 | [diff] [blame] | 317 | "hostInputToken = " + mHostInputToken + ", " + |
Svet Ganov | 02fdd34 | 2020-02-20 20:48:34 -0800 | [diff] [blame] | 318 | "hostDisplayId = " + mHostDisplayId + |
Feng Cao | 04830a3 | 2019-11-13 00:45:19 -0800 | [diff] [blame] | 319 | " }"; |
| 320 | } |
| 321 | |
| 322 | @Override |
| 323 | @DataClass.Generated.Member |
Feng Cao | 16b2de5 | 2020-01-09 17:27:27 -0800 | [diff] [blame] | 324 | public boolean equals(@Nullable Object o) { |
Feng Cao | 04830a3 | 2019-11-13 00:45:19 -0800 | [diff] [blame] | 325 | // You can override field equality logic by defining either of the methods like: |
| 326 | // boolean fieldNameEquals(InlineSuggestionsRequest other) { ... } |
| 327 | // boolean fieldNameEquals(FieldType otherValue) { ... } |
| 328 | |
| 329 | if (this == o) return true; |
| 330 | if (o == null || getClass() != o.getClass()) return false; |
| 331 | @SuppressWarnings("unchecked") |
| 332 | InlineSuggestionsRequest that = (InlineSuggestionsRequest) o; |
| 333 | //noinspection PointlessBooleanExpression |
| 334 | return true |
| 335 | && mMaxSuggestionCount == that.mMaxSuggestionCount |
Adam He | f27433a | 2020-03-25 15:11:18 -0700 | [diff] [blame] | 336 | && java.util.Objects.equals(mInlinePresentationSpecs, that.mInlinePresentationSpecs) |
Adam He | 4011625 | 2020-02-04 14:55:39 -0800 | [diff] [blame] | 337 | && java.util.Objects.equals(mHostPackageName, that.mHostPackageName) |
Feng Cao | 5f7e99e | 2020-02-14 19:27:46 -0800 | [diff] [blame] | 338 | && java.util.Objects.equals(mSupportedLocales, that.mSupportedLocales) |
Feng Cao | 59b682f | 2020-03-30 17:43:16 -0700 | [diff] [blame] | 339 | && extrasEquals(that.mExtras) |
Feng Cao | 5f7e99e | 2020-02-14 19:27:46 -0800 | [diff] [blame] | 340 | && java.util.Objects.equals(mHostInputToken, that.mHostInputToken) |
Svet Ganov | 02fdd34 | 2020-02-20 20:48:34 -0800 | [diff] [blame] | 341 | && mHostDisplayId == that.mHostDisplayId; |
Feng Cao | 04830a3 | 2019-11-13 00:45:19 -0800 | [diff] [blame] | 342 | } |
| 343 | |
| 344 | @Override |
| 345 | @DataClass.Generated.Member |
| 346 | public int hashCode() { |
| 347 | // You can override field hashCode logic by defining methods like: |
| 348 | // int fieldNameHashCode() { ... } |
| 349 | |
| 350 | int _hash = 1; |
| 351 | _hash = 31 * _hash + mMaxSuggestionCount; |
Adam He | f27433a | 2020-03-25 15:11:18 -0700 | [diff] [blame] | 352 | _hash = 31 * _hash + java.util.Objects.hashCode(mInlinePresentationSpecs); |
Feng Cao | 16b2de5 | 2020-01-09 17:27:27 -0800 | [diff] [blame] | 353 | _hash = 31 * _hash + java.util.Objects.hashCode(mHostPackageName); |
Feng Cao | 5f7e99e | 2020-02-14 19:27:46 -0800 | [diff] [blame] | 354 | _hash = 31 * _hash + java.util.Objects.hashCode(mSupportedLocales); |
Feng Cao | 5f7e99e | 2020-02-14 19:27:46 -0800 | [diff] [blame] | 355 | _hash = 31 * _hash + java.util.Objects.hashCode(mExtras); |
Svet Ganov | 02fdd34 | 2020-02-20 20:48:34 -0800 | [diff] [blame] | 356 | _hash = 31 * _hash + java.util.Objects.hashCode(mHostInputToken); |
| 357 | _hash = 31 * _hash + mHostDisplayId; |
Feng Cao | 04830a3 | 2019-11-13 00:45:19 -0800 | [diff] [blame] | 358 | return _hash; |
| 359 | } |
| 360 | |
| 361 | @Override |
| 362 | @DataClass.Generated.Member |
Svet Ganov | 02fdd34 | 2020-02-20 20:48:34 -0800 | [diff] [blame] | 363 | public void writeToParcel(@NonNull Parcel dest, int flags) { |
Feng Cao | 04830a3 | 2019-11-13 00:45:19 -0800 | [diff] [blame] | 364 | // You can override field parcelling by defining methods like: |
| 365 | // void parcelFieldName(Parcel dest, int flags) { ... } |
| 366 | |
Adam He | 4011625 | 2020-02-04 14:55:39 -0800 | [diff] [blame] | 367 | byte flg = 0; |
Svet Ganov | 02fdd34 | 2020-02-20 20:48:34 -0800 | [diff] [blame] | 368 | if (mHostInputToken != null) flg |= 0x20; |
Adam He | 4011625 | 2020-02-04 14:55:39 -0800 | [diff] [blame] | 369 | dest.writeByte(flg); |
Feng Cao | 04830a3 | 2019-11-13 00:45:19 -0800 | [diff] [blame] | 370 | dest.writeInt(mMaxSuggestionCount); |
Adam He | f27433a | 2020-03-25 15:11:18 -0700 | [diff] [blame] | 371 | dest.writeParcelableList(mInlinePresentationSpecs, flags); |
Feng Cao | 16b2de5 | 2020-01-09 17:27:27 -0800 | [diff] [blame] | 372 | dest.writeString(mHostPackageName); |
Feng Cao | 5f7e99e | 2020-02-14 19:27:46 -0800 | [diff] [blame] | 373 | dest.writeTypedObject(mSupportedLocales, flags); |
Feng Cao | edb332c | 2020-03-30 14:26:42 -0700 | [diff] [blame] | 374 | dest.writeBundle(mExtras); |
Svet Ganov | 02fdd34 | 2020-02-20 20:48:34 -0800 | [diff] [blame] | 375 | parcelHostInputToken(dest, flags); |
| 376 | dest.writeInt(mHostDisplayId); |
Feng Cao | 04830a3 | 2019-11-13 00:45:19 -0800 | [diff] [blame] | 377 | } |
| 378 | |
| 379 | @Override |
| 380 | @DataClass.Generated.Member |
| 381 | public int describeContents() { return 0; } |
| 382 | |
| 383 | /** @hide */ |
| 384 | @SuppressWarnings({"unchecked", "RedundantCast"}) |
| 385 | @DataClass.Generated.Member |
Svet Ganov | 02fdd34 | 2020-02-20 20:48:34 -0800 | [diff] [blame] | 386 | /* package-private */ InlineSuggestionsRequest(@NonNull Parcel in) { |
Feng Cao | 04830a3 | 2019-11-13 00:45:19 -0800 | [diff] [blame] | 387 | // You can override field unparcelling by defining methods like: |
| 388 | // static FieldType unparcelFieldName(Parcel in) { ... } |
| 389 | |
Adam He | 4011625 | 2020-02-04 14:55:39 -0800 | [diff] [blame] | 390 | byte flg = in.readByte(); |
Feng Cao | 04830a3 | 2019-11-13 00:45:19 -0800 | [diff] [blame] | 391 | int maxSuggestionCount = in.readInt(); |
Adam He | f27433a | 2020-03-25 15:11:18 -0700 | [diff] [blame] | 392 | List<InlinePresentationSpec> inlinePresentationSpecs = new ArrayList<>(); |
| 393 | in.readParcelableList(inlinePresentationSpecs, InlinePresentationSpec.class.getClassLoader()); |
Feng Cao | 16b2de5 | 2020-01-09 17:27:27 -0800 | [diff] [blame] | 394 | String hostPackageName = in.readString(); |
Feng Cao | 5f7e99e | 2020-02-14 19:27:46 -0800 | [diff] [blame] | 395 | LocaleList supportedLocales = (LocaleList) in.readTypedObject(LocaleList.CREATOR); |
Feng Cao | edb332c | 2020-03-30 14:26:42 -0700 | [diff] [blame] | 396 | Bundle extras = in.readBundle(); |
Svet Ganov | 02fdd34 | 2020-02-20 20:48:34 -0800 | [diff] [blame] | 397 | IBinder hostInputToken = unparcelHostInputToken(in); |
| 398 | int hostDisplayId = in.readInt(); |
Feng Cao | 04830a3 | 2019-11-13 00:45:19 -0800 | [diff] [blame] | 399 | |
| 400 | this.mMaxSuggestionCount = maxSuggestionCount; |
Adam He | f27433a | 2020-03-25 15:11:18 -0700 | [diff] [blame] | 401 | this.mInlinePresentationSpecs = inlinePresentationSpecs; |
Feng Cao | 04830a3 | 2019-11-13 00:45:19 -0800 | [diff] [blame] | 402 | com.android.internal.util.AnnotationValidations.validate( |
Adam He | f27433a | 2020-03-25 15:11:18 -0700 | [diff] [blame] | 403 | NonNull.class, null, mInlinePresentationSpecs); |
Feng Cao | 16b2de5 | 2020-01-09 17:27:27 -0800 | [diff] [blame] | 404 | this.mHostPackageName = hostPackageName; |
| 405 | com.android.internal.util.AnnotationValidations.validate( |
| 406 | NonNull.class, null, mHostPackageName); |
Feng Cao | 5f7e99e | 2020-02-14 19:27:46 -0800 | [diff] [blame] | 407 | this.mSupportedLocales = supportedLocales; |
| 408 | com.android.internal.util.AnnotationValidations.validate( |
| 409 | NonNull.class, null, mSupportedLocales); |
Feng Cao | 5f7e99e | 2020-02-14 19:27:46 -0800 | [diff] [blame] | 410 | this.mExtras = extras; |
Feng Cao | edb332c | 2020-03-30 14:26:42 -0700 | [diff] [blame] | 411 | com.android.internal.util.AnnotationValidations.validate( |
| 412 | NonNull.class, null, mExtras); |
Svet Ganov | 02fdd34 | 2020-02-20 20:48:34 -0800 | [diff] [blame] | 413 | this.mHostInputToken = hostInputToken; |
| 414 | this.mHostDisplayId = hostDisplayId; |
Feng Cao | 04830a3 | 2019-11-13 00:45:19 -0800 | [diff] [blame] | 415 | |
| 416 | onConstructed(); |
| 417 | } |
| 418 | |
| 419 | @DataClass.Generated.Member |
| 420 | public static final @NonNull Parcelable.Creator<InlineSuggestionsRequest> CREATOR |
| 421 | = new Parcelable.Creator<InlineSuggestionsRequest>() { |
| 422 | @Override |
| 423 | public InlineSuggestionsRequest[] newArray(int size) { |
| 424 | return new InlineSuggestionsRequest[size]; |
| 425 | } |
| 426 | |
| 427 | @Override |
Svet Ganov | 02fdd34 | 2020-02-20 20:48:34 -0800 | [diff] [blame] | 428 | public InlineSuggestionsRequest createFromParcel(@NonNull Parcel in) { |
Feng Cao | 04830a3 | 2019-11-13 00:45:19 -0800 | [diff] [blame] | 429 | return new InlineSuggestionsRequest(in); |
| 430 | } |
| 431 | }; |
| 432 | |
| 433 | /** |
| 434 | * A builder for {@link InlineSuggestionsRequest} |
| 435 | */ |
| 436 | @SuppressWarnings("WeakerAccess") |
| 437 | @DataClass.Generated.Member |
| 438 | public static final class Builder extends BaseBuilder { |
| 439 | |
| 440 | private int mMaxSuggestionCount; |
Adam He | f27433a | 2020-03-25 15:11:18 -0700 | [diff] [blame] | 441 | private @NonNull List<InlinePresentationSpec> mInlinePresentationSpecs; |
Feng Cao | 16b2de5 | 2020-01-09 17:27:27 -0800 | [diff] [blame] | 442 | private @NonNull String mHostPackageName; |
Feng Cao | 5f7e99e | 2020-02-14 19:27:46 -0800 | [diff] [blame] | 443 | private @NonNull LocaleList mSupportedLocales; |
Feng Cao | edb332c | 2020-03-30 14:26:42 -0700 | [diff] [blame] | 444 | private @NonNull Bundle mExtras; |
Svet Ganov | 02fdd34 | 2020-02-20 20:48:34 -0800 | [diff] [blame] | 445 | private @Nullable IBinder mHostInputToken; |
| 446 | private int mHostDisplayId; |
Feng Cao | 04830a3 | 2019-11-13 00:45:19 -0800 | [diff] [blame] | 447 | |
| 448 | private long mBuilderFieldsSet = 0L; |
| 449 | |
Feng Cao | 7a0f002 | 2019-12-17 18:49:24 -0800 | [diff] [blame] | 450 | /** |
| 451 | * Creates a new Builder. |
| 452 | * |
Adam He | f27433a | 2020-03-25 15:11:18 -0700 | [diff] [blame] | 453 | * @param inlinePresentationSpecs |
Feng Cao | 7a0f002 | 2019-12-17 18:49:24 -0800 | [diff] [blame] | 454 | * The {@link InlinePresentationSpec} for each suggestion in the response. If the max suggestion |
| 455 | * count is larger than the number of specs in the list, then the last spec is used for the |
Feng Cao | 44dc2bd | 2020-03-09 23:02:33 -0700 | [diff] [blame] | 456 | * remainder of the suggestions. The list should not be empty. |
Feng Cao | 7a0f002 | 2019-12-17 18:49:24 -0800 | [diff] [blame] | 457 | */ |
Feng Cao | 04830a3 | 2019-11-13 00:45:19 -0800 | [diff] [blame] | 458 | public Builder( |
Adam He | f27433a | 2020-03-25 15:11:18 -0700 | [diff] [blame] | 459 | @NonNull List<InlinePresentationSpec> inlinePresentationSpecs) { |
| 460 | mInlinePresentationSpecs = inlinePresentationSpecs; |
Feng Cao | 04830a3 | 2019-11-13 00:45:19 -0800 | [diff] [blame] | 461 | com.android.internal.util.AnnotationValidations.validate( |
Adam He | f27433a | 2020-03-25 15:11:18 -0700 | [diff] [blame] | 462 | NonNull.class, null, mInlinePresentationSpecs); |
Feng Cao | 04830a3 | 2019-11-13 00:45:19 -0800 | [diff] [blame] | 463 | } |
| 464 | |
Feng Cao | 7a0f002 | 2019-12-17 18:49:24 -0800 | [diff] [blame] | 465 | /** |
Feng Cao | 44dc2bd | 2020-03-09 23:02:33 -0700 | [diff] [blame] | 466 | * Max number of suggestions expected from the response. It must be a positive value. |
| 467 | * Defaults to {@code SUGGESTION_COUNT_UNLIMITED} if not set. |
Feng Cao | 7a0f002 | 2019-12-17 18:49:24 -0800 | [diff] [blame] | 468 | */ |
Feng Cao | 04830a3 | 2019-11-13 00:45:19 -0800 | [diff] [blame] | 469 | @DataClass.Generated.Member |
| 470 | public @NonNull Builder setMaxSuggestionCount(int value) { |
| 471 | checkNotUsed(); |
| 472 | mBuilderFieldsSet |= 0x1; |
| 473 | mMaxSuggestionCount = value; |
| 474 | return this; |
| 475 | } |
| 476 | |
Feng Cao | 7a0f002 | 2019-12-17 18:49:24 -0800 | [diff] [blame] | 477 | /** |
| 478 | * The {@link InlinePresentationSpec} for each suggestion in the response. If the max suggestion |
| 479 | * count is larger than the number of specs in the list, then the last spec is used for the |
Feng Cao | 44dc2bd | 2020-03-09 23:02:33 -0700 | [diff] [blame] | 480 | * remainder of the suggestions. The list should not be empty. |
Feng Cao | 7a0f002 | 2019-12-17 18:49:24 -0800 | [diff] [blame] | 481 | */ |
Feng Cao | 04830a3 | 2019-11-13 00:45:19 -0800 | [diff] [blame] | 482 | @DataClass.Generated.Member |
Adam He | f27433a | 2020-03-25 15:11:18 -0700 | [diff] [blame] | 483 | public @NonNull Builder setInlinePresentationSpecs(@NonNull List<InlinePresentationSpec> value) { |
Feng Cao | 04830a3 | 2019-11-13 00:45:19 -0800 | [diff] [blame] | 484 | checkNotUsed(); |
| 485 | mBuilderFieldsSet |= 0x2; |
Adam He | f27433a | 2020-03-25 15:11:18 -0700 | [diff] [blame] | 486 | mInlinePresentationSpecs = value; |
Feng Cao | 04830a3 | 2019-11-13 00:45:19 -0800 | [diff] [blame] | 487 | return this; |
| 488 | } |
| 489 | |
Adam He | f27433a | 2020-03-25 15:11:18 -0700 | [diff] [blame] | 490 | /** @see #setInlinePresentationSpecs */ |
Feng Cao | 04830a3 | 2019-11-13 00:45:19 -0800 | [diff] [blame] | 491 | @DataClass.Generated.Member |
Adam He | f27433a | 2020-03-25 15:11:18 -0700 | [diff] [blame] | 492 | public @NonNull Builder addInlinePresentationSpecs(@NonNull InlinePresentationSpec value) { |
Feng Cao | 04830a3 | 2019-11-13 00:45:19 -0800 | [diff] [blame] | 493 | // You can refine this method's name by providing item's singular name, e.g.: |
| 494 | // @DataClass.PluralOf("item")) mItems = ... |
| 495 | |
Adam He | f27433a | 2020-03-25 15:11:18 -0700 | [diff] [blame] | 496 | if (mInlinePresentationSpecs == null) setInlinePresentationSpecs(new ArrayList<>()); |
| 497 | mInlinePresentationSpecs.add(value); |
Feng Cao | 04830a3 | 2019-11-13 00:45:19 -0800 | [diff] [blame] | 498 | return this; |
| 499 | } |
| 500 | |
Feng Cao | 16b2de5 | 2020-01-09 17:27:27 -0800 | [diff] [blame] | 501 | /** |
| 502 | * The package name of the app that requests for the inline suggestions and will host the |
| 503 | * embedded suggestion views. The app does not have to set the value for the field because |
| 504 | * it'll be set by the system for safety reasons. |
| 505 | */ |
| 506 | @DataClass.Generated.Member |
| 507 | @Override |
| 508 | @NonNull Builder setHostPackageName(@NonNull String value) { |
| 509 | checkNotUsed(); |
| 510 | mBuilderFieldsSet |= 0x4; |
| 511 | mHostPackageName = value; |
| 512 | return this; |
| 513 | } |
| 514 | |
Adam He | 4011625 | 2020-02-04 14:55:39 -0800 | [diff] [blame] | 515 | /** |
Feng Cao | 5f7e99e | 2020-02-14 19:27:46 -0800 | [diff] [blame] | 516 | * The IME provided locales for the request. If non-empty, the inline suggestions should |
| 517 | * return languages from the supported locales. If not provided, it'll default to system locale. |
| 518 | */ |
| 519 | @DataClass.Generated.Member |
| 520 | public @NonNull Builder setSupportedLocales(@NonNull LocaleList value) { |
| 521 | checkNotUsed(); |
| 522 | mBuilderFieldsSet |= 0x8; |
| 523 | mSupportedLocales = value; |
| 524 | return this; |
| 525 | } |
| 526 | |
| 527 | /** |
Svet Ganov | 02fdd34 | 2020-02-20 20:48:34 -0800 | [diff] [blame] | 528 | * The extras state propagated from the IME to pass extra data. |
| 529 | */ |
| 530 | @DataClass.Generated.Member |
Feng Cao | 1ee5afa | 2020-03-12 20:32:45 -0700 | [diff] [blame] | 531 | public @NonNull Builder setExtras(@NonNull Bundle value) { |
Svet Ganov | 02fdd34 | 2020-02-20 20:48:34 -0800 | [diff] [blame] | 532 | checkNotUsed(); |
| 533 | mBuilderFieldsSet |= 0x10; |
| 534 | mExtras = value; |
| 535 | return this; |
| 536 | } |
| 537 | |
| 538 | /** |
Adam He | 4011625 | 2020-02-04 14:55:39 -0800 | [diff] [blame] | 539 | * The host input token of the IME that made the request. This will be set by the system for |
| 540 | * safety reasons. |
| 541 | * |
| 542 | * @hide |
| 543 | */ |
| 544 | @DataClass.Generated.Member |
| 545 | @Override |
Feng Cao | 1ee5afa | 2020-03-12 20:32:45 -0700 | [diff] [blame] | 546 | @NonNull Builder setHostInputToken(@NonNull IBinder value) { |
Adam He | 4011625 | 2020-02-04 14:55:39 -0800 | [diff] [blame] | 547 | checkNotUsed(); |
Svet Ganov | 02fdd34 | 2020-02-20 20:48:34 -0800 | [diff] [blame] | 548 | mBuilderFieldsSet |= 0x20; |
Adam He | 4011625 | 2020-02-04 14:55:39 -0800 | [diff] [blame] | 549 | mHostInputToken = value; |
| 550 | return this; |
| 551 | } |
| 552 | |
Feng Cao | 5f7e99e | 2020-02-14 19:27:46 -0800 | [diff] [blame] | 553 | /** |
Svet Ganov | 02fdd34 | 2020-02-20 20:48:34 -0800 | [diff] [blame] | 554 | * The host display id of the IME that made the request. This will be set by the system for |
| 555 | * safety reasons. |
| 556 | * |
| 557 | * @hide |
Feng Cao | 5f7e99e | 2020-02-14 19:27:46 -0800 | [diff] [blame] | 558 | */ |
| 559 | @DataClass.Generated.Member |
Svet Ganov | 02fdd34 | 2020-02-20 20:48:34 -0800 | [diff] [blame] | 560 | @Override |
| 561 | @NonNull Builder setHostDisplayId(int value) { |
Feng Cao | 5f7e99e | 2020-02-14 19:27:46 -0800 | [diff] [blame] | 562 | checkNotUsed(); |
Svet Ganov | 02fdd34 | 2020-02-20 20:48:34 -0800 | [diff] [blame] | 563 | mBuilderFieldsSet |= 0x40; |
| 564 | mHostDisplayId = value; |
Feng Cao | 5f7e99e | 2020-02-14 19:27:46 -0800 | [diff] [blame] | 565 | return this; |
| 566 | } |
| 567 | |
Feng Cao | 04830a3 | 2019-11-13 00:45:19 -0800 | [diff] [blame] | 568 | /** Builds the instance. This builder should not be touched after calling this! */ |
| 569 | public @NonNull InlineSuggestionsRequest build() { |
| 570 | checkNotUsed(); |
Svet Ganov | 02fdd34 | 2020-02-20 20:48:34 -0800 | [diff] [blame] | 571 | mBuilderFieldsSet |= 0x80; // Mark builder used |
Feng Cao | 04830a3 | 2019-11-13 00:45:19 -0800 | [diff] [blame] | 572 | |
| 573 | if ((mBuilderFieldsSet & 0x1) == 0) { |
| 574 | mMaxSuggestionCount = defaultMaxSuggestionCount(); |
| 575 | } |
Feng Cao | 16b2de5 | 2020-01-09 17:27:27 -0800 | [diff] [blame] | 576 | if ((mBuilderFieldsSet & 0x4) == 0) { |
| 577 | mHostPackageName = defaultHostPackageName(); |
| 578 | } |
Adam He | 4011625 | 2020-02-04 14:55:39 -0800 | [diff] [blame] | 579 | if ((mBuilderFieldsSet & 0x8) == 0) { |
Feng Cao | 5f7e99e | 2020-02-14 19:27:46 -0800 | [diff] [blame] | 580 | mSupportedLocales = defaultSupportedLocales(); |
| 581 | } |
| 582 | if ((mBuilderFieldsSet & 0x10) == 0) { |
Svet Ganov | 02fdd34 | 2020-02-20 20:48:34 -0800 | [diff] [blame] | 583 | mExtras = defaultExtras(); |
Adam He | 4011625 | 2020-02-04 14:55:39 -0800 | [diff] [blame] | 584 | } |
Feng Cao | 5f7e99e | 2020-02-14 19:27:46 -0800 | [diff] [blame] | 585 | if ((mBuilderFieldsSet & 0x20) == 0) { |
Svet Ganov | 02fdd34 | 2020-02-20 20:48:34 -0800 | [diff] [blame] | 586 | mHostInputToken = defaultHostInputToken(); |
| 587 | } |
| 588 | if ((mBuilderFieldsSet & 0x40) == 0) { |
| 589 | mHostDisplayId = defaultHostDisplayId(); |
Feng Cao | 5f7e99e | 2020-02-14 19:27:46 -0800 | [diff] [blame] | 590 | } |
Feng Cao | 04830a3 | 2019-11-13 00:45:19 -0800 | [diff] [blame] | 591 | InlineSuggestionsRequest o = new InlineSuggestionsRequest( |
| 592 | mMaxSuggestionCount, |
Adam He | f27433a | 2020-03-25 15:11:18 -0700 | [diff] [blame] | 593 | mInlinePresentationSpecs, |
Adam He | 4011625 | 2020-02-04 14:55:39 -0800 | [diff] [blame] | 594 | mHostPackageName, |
Feng Cao | 5f7e99e | 2020-02-14 19:27:46 -0800 | [diff] [blame] | 595 | mSupportedLocales, |
Svet Ganov | 02fdd34 | 2020-02-20 20:48:34 -0800 | [diff] [blame] | 596 | mExtras, |
Feng Cao | 5f7e99e | 2020-02-14 19:27:46 -0800 | [diff] [blame] | 597 | mHostInputToken, |
Svet Ganov | 02fdd34 | 2020-02-20 20:48:34 -0800 | [diff] [blame] | 598 | mHostDisplayId); |
Feng Cao | 04830a3 | 2019-11-13 00:45:19 -0800 | [diff] [blame] | 599 | return o; |
| 600 | } |
| 601 | |
| 602 | private void checkNotUsed() { |
Svet Ganov | 02fdd34 | 2020-02-20 20:48:34 -0800 | [diff] [blame] | 603 | if ((mBuilderFieldsSet & 0x80) != 0) { |
Feng Cao | 04830a3 | 2019-11-13 00:45:19 -0800 | [diff] [blame] | 604 | throw new IllegalStateException( |
| 605 | "This Builder should not be reused. Use a new Builder instance instead"); |
| 606 | } |
| 607 | } |
| 608 | } |
| 609 | |
| 610 | @DataClass.Generated( |
Feng Cao | 59b682f | 2020-03-30 17:43:16 -0700 | [diff] [blame] | 611 | time = 1585768018462L, |
Feng Cao | 44dc2bd | 2020-03-09 23:02:33 -0700 | [diff] [blame] | 612 | codegenVersion = "1.0.15", |
Feng Cao | 04830a3 | 2019-11-13 00:45:19 -0800 | [diff] [blame] | 613 | sourceFile = "frameworks/base/core/java/android/view/inputmethod/InlineSuggestionsRequest.java", |
Feng Cao | 59b682f | 2020-03-30 17:43:16 -0700 | [diff] [blame] | 614 | inputSignatures = "public static final int SUGGESTION_COUNT_UNLIMITED\nprivate final int mMaxSuggestionCount\nprivate final @android.annotation.NonNull java.util.List<android.widget.inline.InlinePresentationSpec> mInlinePresentationSpecs\nprivate @android.annotation.NonNull java.lang.String mHostPackageName\nprivate @android.annotation.NonNull android.os.LocaleList mSupportedLocales\nprivate @android.annotation.NonNull android.os.Bundle mExtras\nprivate @android.annotation.Nullable android.os.IBinder mHostInputToken\nprivate int mHostDisplayId\npublic @android.compat.annotation.UnsupportedAppUsage @android.annotation.NonNull java.util.List<android.view.inline.InlinePresentationSpec> getPresentationSpecs()\npublic void setHostInputToken(android.os.IBinder)\nprivate boolean extrasEquals(android.os.Bundle)\nprivate void parcelHostInputToken(android.os.Parcel,int)\nprivate @android.annotation.Nullable android.os.IBinder unparcelHostInputToken(android.os.Parcel)\npublic void setHostDisplayId(int)\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 int defaultHostDisplayId()\nprivate static @android.annotation.NonNull 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)\npublic @android.compat.annotation.UnsupportedAppUsage @android.annotation.NonNull android.view.inputmethod.InlineSuggestionsRequest.Builder addPresentationSpecs(android.view.inline.InlinePresentationSpec)\nabstract android.view.inputmethod.InlineSuggestionsRequest.Builder setInlinePresentationSpecs(java.util.List<android.widget.inline.InlinePresentationSpec>)\nabstract android.view.inputmethod.InlineSuggestionsRequest.Builder setHostPackageName(java.lang.String)\nabstract android.view.inputmethod.InlineSuggestionsRequest.Builder setHostInputToken(android.os.IBinder)\nabstract android.view.inputmethod.InlineSuggestionsRequest.Builder setHostDisplayId(int)\nclass BaseBuilder extends java.lang.Object implements []") |
Feng Cao | 04830a3 | 2019-11-13 00:45:19 -0800 | [diff] [blame] | 615 | @Deprecated |
| 616 | private void __metadata() {} |
| 617 | |
| 618 | |
| 619 | //@formatter:on |
| 620 | // End of generated code |
| 621 | |
| 622 | } |