Svet Ganov | 013efe1 | 2017-04-13 21:56:16 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2017 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.IntDef; |
| 20 | import android.annotation.NonNull; |
| 21 | import android.annotation.Nullable; |
Svet Ganov | 013efe1 | 2017-04-13 21:56:16 -0700 | [diff] [blame] | 22 | import android.os.Bundle; |
Svet Ganov | 013efe1 | 2017-04-13 21:56:16 -0700 | [diff] [blame] | 23 | import android.os.Parcel; |
| 24 | import android.os.Parcelable; |
Felipe Leme | 2ef19c1 | 2017-06-05 11:32:32 -0700 | [diff] [blame] | 25 | import android.view.View; |
Adam He | bc67f2e | 2019-11-13 14:34:56 -0800 | [diff] [blame] | 26 | import android.view.inputmethod.InlineSuggestionsRequest; |
Philip P. Moltmann | 121e526 | 2017-04-25 13:33:41 -0700 | [diff] [blame] | 27 | |
Eugene Susla | 3b2fe61 | 2019-08-06 18:47:14 -0700 | [diff] [blame] | 28 | import com.android.internal.util.DataClass; |
Svet Ganov | 013efe1 | 2017-04-13 21:56:16 -0700 | [diff] [blame] | 29 | import com.android.internal.util.Preconditions; |
| 30 | |
| 31 | import java.lang.annotation.Retention; |
| 32 | import java.lang.annotation.RetentionPolicy; |
Philip P. Moltmann | 121e526 | 2017-04-25 13:33:41 -0700 | [diff] [blame] | 33 | import java.util.ArrayList; |
Jeff Sharkey | 000ce80 | 2017-04-29 13:13:27 -0600 | [diff] [blame] | 34 | import java.util.List; |
Svet Ganov | 013efe1 | 2017-04-13 21:56:16 -0700 | [diff] [blame] | 35 | |
| 36 | /** |
Felipe Leme | 2ef19c1 | 2017-06-05 11:32:32 -0700 | [diff] [blame] | 37 | * This class represents a request to an autofill service |
Svet Ganov | 013efe1 | 2017-04-13 21:56:16 -0700 | [diff] [blame] | 38 | * to interpret the screen and provide information to the system which views are |
| 39 | * interesting for saving and what are the possible ways to fill the inputs on |
| 40 | * the screen if applicable. |
| 41 | * |
Felipe Leme | a012d7e | 2017-09-06 15:19:11 -0700 | [diff] [blame] | 42 | * @see AutofillService#onFillRequest(FillRequest, android.os.CancellationSignal, FillCallback) |
Svet Ganov | 013efe1 | 2017-04-13 21:56:16 -0700 | [diff] [blame] | 43 | */ |
Eugene Susla | 3b2fe61 | 2019-08-06 18:47:14 -0700 | [diff] [blame] | 44 | @DataClass( |
| 45 | genToString = true, |
| 46 | genHiddenConstructor = true, |
| 47 | genHiddenConstDefs = true) |
Svet Ganov | 013efe1 | 2017-04-13 21:56:16 -0700 | [diff] [blame] | 48 | public final class FillRequest implements Parcelable { |
Felipe Leme | 2ef19c1 | 2017-06-05 11:32:32 -0700 | [diff] [blame] | 49 | |
Svet Ganov | 013efe1 | 2017-04-13 21:56:16 -0700 | [diff] [blame] | 50 | /** |
| 51 | * Indicates autofill was explicitly requested by the user. |
Felipe Leme | 2ef19c1 | 2017-06-05 11:32:32 -0700 | [diff] [blame] | 52 | * |
| 53 | * <p>Users typically make an explicit request to autofill a screen in two situations: |
| 54 | * <ul> |
| 55 | * <li>The app disabled autofill (using {@link View#setImportantForAutofill(int)}. |
| 56 | * <li>The service could not figure out how to autofill a screen (but the user knows the |
| 57 | * service has data for that app). |
| 58 | * </ul> |
| 59 | * |
| 60 | * <p>This flag is particularly useful for the second case. For example, the service could offer |
| 61 | * a complex UI where the user can map which screen views belong to each user data, or it could |
| 62 | * offer a simpler UI where the user picks the data for just the view used to trigger the |
| 63 | * request (that would be the view whose |
| 64 | * {@link android.app.assist.AssistStructure.ViewNode#isFocused()} method returns {@code true}). |
| 65 | * |
| 66 | * <p>An explicit autofill request is triggered when the |
| 67 | * {@link android.view.autofill.AutofillManager#requestAutofill(View)} or |
| 68 | * {@link android.view.autofill.AutofillManager#requestAutofill(View, int, android.graphics.Rect)} |
Jeff Sharkey | 67f9d50 | 2017-08-05 13:49:13 -0600 | [diff] [blame] | 69 | * is called. For example, standard {@link android.widget.TextView} views show an |
| 70 | * {@code AUTOFILL} option in the overflow menu that triggers such request. |
Svet Ganov | 013efe1 | 2017-04-13 21:56:16 -0700 | [diff] [blame] | 71 | */ |
Eugene Susla | 3b2fe61 | 2019-08-06 18:47:14 -0700 | [diff] [blame] | 72 | public static final @RequestFlags int FLAG_MANUAL_REQUEST = 0x1; |
Svet Ganov | 013efe1 | 2017-04-13 21:56:16 -0700 | [diff] [blame] | 73 | |
Felipe Leme | eacd74d | 2018-08-02 10:36:34 -0700 | [diff] [blame] | 74 | /** |
| 75 | * Indicates this request was made using |
| 76 | * <a href="AutofillService.html#CompatibilityMode">compatibility mode</a>. |
| 77 | */ |
Eugene Susla | 3b2fe61 | 2019-08-06 18:47:14 -0700 | [diff] [blame] | 78 | public static final @RequestFlags int FLAG_COMPATIBILITY_MODE_REQUEST = 0x2; |
Felipe Leme | eacd74d | 2018-08-02 10:36:34 -0700 | [diff] [blame] | 79 | |
Adam He | ef0fe208 | 2019-10-25 11:58:15 -0700 | [diff] [blame] | 80 | /** |
| 81 | * Indicates the request came from a password field. |
| 82 | * |
| 83 | * (TODO: b/141703197) Temporary fix for augmented autofill showing passwords. |
| 84 | * |
| 85 | * @hide |
| 86 | */ |
| 87 | public static final @RequestFlags int FLAG_PASSWORD_INPUT_TYPE = 0x4; |
| 88 | |
lpeter | 8e81531 | 2020-05-08 01:29:59 +0800 | [diff] [blame] | 89 | /** |
| 90 | * Indicates the view was not focused. |
| 91 | * |
| 92 | * <p><b>Note:</b> Defines the flag value to 0x10, because the flag value 0x08 has been defined |
| 93 | * in {@link AutofillManager}.</p> |
| 94 | * |
| 95 | * @hide |
| 96 | */ |
| 97 | public static final @RequestFlags int FLAG_VIEW_NOT_FOCUSED = 0x10; |
| 98 | |
Svet Ganov | 013efe1 | 2017-04-13 21:56:16 -0700 | [diff] [blame] | 99 | /** @hide */ |
Philip P. Moltmann | c761963 | 2017-04-25 11:57:37 -0700 | [diff] [blame] | 100 | public static final int INVALID_REQUEST_ID = Integer.MIN_VALUE; |
| 101 | |
Svet Ganov | 013efe1 | 2017-04-13 21:56:16 -0700 | [diff] [blame] | 102 | /** |
Felipe Leme | 2ef19c1 | 2017-06-05 11:32:32 -0700 | [diff] [blame] | 103 | * Gets the unique id of this request. |
Svet Ganov | 013efe1 | 2017-04-13 21:56:16 -0700 | [diff] [blame] | 104 | */ |
Eugene Susla | 3b2fe61 | 2019-08-06 18:47:14 -0700 | [diff] [blame] | 105 | private final int mId; |
| 106 | |
| 107 | /** |
| 108 | * Gets the contexts associated with each previous fill request. |
| 109 | * |
| 110 | * <p><b>Note:</b> Starting on Android {@link android.os.Build.VERSION_CODES#Q}, it could also |
| 111 | * include contexts from requests whose {@link SaveInfo} had the |
| 112 | * {@link SaveInfo#FLAG_DELAY_SAVE} flag. |
| 113 | */ |
| 114 | private final @NonNull List<FillContext> mFillContexts; |
| 115 | |
| 116 | /** |
| 117 | * Gets the latest client state bundle set by the service in a |
| 118 | * {@link FillResponse.Builder#setClientState(Bundle) fill response}. |
| 119 | * |
| 120 | * <p><b>Note:</b> Prior to Android {@link android.os.Build.VERSION_CODES#P}, only client state |
| 121 | * bundles set by {@link FillResponse.Builder#setClientState(Bundle)} were considered. On |
| 122 | * Android {@link android.os.Build.VERSION_CODES#P} and higher, bundles set in the result of |
| 123 | * an authenticated request through the |
| 124 | * {@link android.view.autofill.AutofillManager#EXTRA_CLIENT_STATE} extra are |
| 125 | * also considered (and take precedence when set). |
| 126 | * |
| 127 | * @return The client state. |
| 128 | */ |
| 129 | private final @Nullable Bundle mClientState; |
Svet Ganov | 013efe1 | 2017-04-13 21:56:16 -0700 | [diff] [blame] | 130 | |
| 131 | /** |
Felipe Leme | 2ef19c1 | 2017-06-05 11:32:32 -0700 | [diff] [blame] | 132 | * Gets the flags associated with this request. |
Svet Ganov | 013efe1 | 2017-04-13 21:56:16 -0700 | [diff] [blame] | 133 | * |
Felipe Leme | a7de402 | 2019-02-19 17:16:45 -0800 | [diff] [blame] | 134 | * @return any combination of {@link #FLAG_MANUAL_REQUEST} and |
| 135 | * {@link #FLAG_COMPATIBILITY_MODE_REQUEST}. |
Svet Ganov | 013efe1 | 2017-04-13 21:56:16 -0700 | [diff] [blame] | 136 | */ |
Eugene Susla | 3b2fe61 | 2019-08-06 18:47:14 -0700 | [diff] [blame] | 137 | private final @RequestFlags int mFlags; |
| 138 | |
Adam He | bc67f2e | 2019-11-13 14:34:56 -0800 | [diff] [blame] | 139 | /** |
Adam He | 045c020 | 2020-04-17 15:20:01 -0700 | [diff] [blame] | 140 | * Gets the {@link InlineSuggestionsRequest} associated |
Adam He | bc67f2e | 2019-11-13 14:34:56 -0800 | [diff] [blame] | 141 | * with this request. |
| 142 | * |
Adam He | 045c020 | 2020-04-17 15:20:01 -0700 | [diff] [blame] | 143 | * <p>Autofill Framework will send a {@code @non-null} {@link InlineSuggestionsRequest} if |
| 144 | * currently inline suggestions are supported and can be displayed. If the Autofill service |
| 145 | * wants to show inline suggestions, they may return {@link Dataset} with valid |
| 146 | * {@link InlinePresentation}.</p> |
| 147 | * |
| 148 | * <p>The Autofill Service must set supportsInlineSuggestions in its XML to enable support |
| 149 | * for inline suggestions.</p> |
Adam He | bc67f2e | 2019-11-13 14:34:56 -0800 | [diff] [blame] | 150 | * |
| 151 | * @return the suggestionspec |
| 152 | */ |
| 153 | private final @Nullable InlineSuggestionsRequest mInlineSuggestionsRequest; |
| 154 | |
Eugene Susla | 3b2fe61 | 2019-08-06 18:47:14 -0700 | [diff] [blame] | 155 | private void onConstructed() { |
| 156 | Preconditions.checkCollectionElementsNotNull(mFillContexts, "contexts"); |
| 157 | } |
| 158 | |
| 159 | |
| 160 | |
Adam He | 045c020 | 2020-04-17 15:20:01 -0700 | [diff] [blame] | 161 | // Code below generated by codegen v1.0.15. |
Eugene Susla | 3b2fe61 | 2019-08-06 18:47:14 -0700 | [diff] [blame] | 162 | // |
| 163 | // DO NOT MODIFY! |
Adam He | bc67f2e | 2019-11-13 14:34:56 -0800 | [diff] [blame] | 164 | // CHECKSTYLE:OFF Generated code |
Eugene Susla | 3b2fe61 | 2019-08-06 18:47:14 -0700 | [diff] [blame] | 165 | // |
| 166 | // To regenerate run: |
| 167 | // $ codegen $ANDROID_BUILD_TOP/frameworks/base/core/java/android/service/autofill/FillRequest.java |
| 168 | // |
Adam He | bc67f2e | 2019-11-13 14:34:56 -0800 | [diff] [blame] | 169 | // To exclude the generated code from IntelliJ auto-formatting enable (one-time): |
| 170 | // Settings > Editor > Code Style > Formatter Control |
| 171 | //@formatter:off |
| 172 | |
Eugene Susla | 3b2fe61 | 2019-08-06 18:47:14 -0700 | [diff] [blame] | 173 | |
| 174 | /** @hide */ |
| 175 | @IntDef(flag = true, prefix = "FLAG_", value = { |
| 176 | FLAG_MANUAL_REQUEST, |
Adam He | ef0fe208 | 2019-10-25 11:58:15 -0700 | [diff] [blame] | 177 | FLAG_COMPATIBILITY_MODE_REQUEST, |
lpeter | 8e81531 | 2020-05-08 01:29:59 +0800 | [diff] [blame] | 178 | FLAG_PASSWORD_INPUT_TYPE, |
| 179 | FLAG_VIEW_NOT_FOCUSED |
Eugene Susla | 3b2fe61 | 2019-08-06 18:47:14 -0700 | [diff] [blame] | 180 | }) |
| 181 | @Retention(RetentionPolicy.SOURCE) |
| 182 | @DataClass.Generated.Member |
| 183 | public @interface RequestFlags {} |
| 184 | |
| 185 | /** @hide */ |
| 186 | @DataClass.Generated.Member |
| 187 | public static String requestFlagsToString(@RequestFlags int value) { |
| 188 | return com.android.internal.util.BitUtils.flagsToString( |
| 189 | value, FillRequest::singleRequestFlagsToString); |
| 190 | } |
| 191 | |
| 192 | @DataClass.Generated.Member |
| 193 | static String singleRequestFlagsToString(@RequestFlags int value) { |
| 194 | switch (value) { |
| 195 | case FLAG_MANUAL_REQUEST: |
| 196 | return "FLAG_MANUAL_REQUEST"; |
| 197 | case FLAG_COMPATIBILITY_MODE_REQUEST: |
| 198 | return "FLAG_COMPATIBILITY_MODE_REQUEST"; |
Adam He | ef0fe208 | 2019-10-25 11:58:15 -0700 | [diff] [blame] | 199 | case FLAG_PASSWORD_INPUT_TYPE: |
| 200 | return "FLAG_PASSWORD_INPUT_TYPE"; |
lpeter | 8e81531 | 2020-05-08 01:29:59 +0800 | [diff] [blame] | 201 | case FLAG_VIEW_NOT_FOCUSED: |
| 202 | return "FLAG_VIEW_NOT_FOCUSED"; |
Eugene Susla | 3b2fe61 | 2019-08-06 18:47:14 -0700 | [diff] [blame] | 203 | default: return Integer.toHexString(value); |
| 204 | } |
| 205 | } |
| 206 | |
| 207 | /** |
| 208 | * Creates a new FillRequest. |
| 209 | * |
| 210 | * @param id |
| 211 | * Gets the unique id of this request. |
| 212 | * @param fillContexts |
| 213 | * Gets the contexts associated with each previous fill request. |
| 214 | * |
| 215 | * <p><b>Note:</b> Starting on Android {@link android.os.Build.VERSION_CODES#Q}, it could also |
| 216 | * include contexts from requests whose {@link SaveInfo} had the |
| 217 | * {@link SaveInfo#FLAG_DELAY_SAVE} flag. |
| 218 | * @param clientState |
| 219 | * Gets the latest client state bundle set by the service in a |
| 220 | * {@link FillResponse.Builder#setClientState(Bundle) fill response}. |
| 221 | * |
| 222 | * <p><b>Note:</b> Prior to Android {@link android.os.Build.VERSION_CODES#P}, only client state |
| 223 | * bundles set by {@link FillResponse.Builder#setClientState(Bundle)} were considered. On |
| 224 | * Android {@link android.os.Build.VERSION_CODES#P} and higher, bundles set in the result of |
| 225 | * an authenticated request through the |
| 226 | * {@link android.view.autofill.AutofillManager#EXTRA_CLIENT_STATE} extra are |
| 227 | * also considered (and take precedence when set). |
| 228 | * @param flags |
| 229 | * Gets the flags associated with this request. |
| 230 | * |
| 231 | * @return any combination of {@link #FLAG_MANUAL_REQUEST} and |
| 232 | * {@link #FLAG_COMPATIBILITY_MODE_REQUEST}. |
Adam He | bc67f2e | 2019-11-13 14:34:56 -0800 | [diff] [blame] | 233 | * @param inlineSuggestionsRequest |
Adam He | 045c020 | 2020-04-17 15:20:01 -0700 | [diff] [blame] | 234 | * Gets the {@link InlineSuggestionsRequest} associated |
Adam He | bc67f2e | 2019-11-13 14:34:56 -0800 | [diff] [blame] | 235 | * with this request. |
| 236 | * |
Adam He | 045c020 | 2020-04-17 15:20:01 -0700 | [diff] [blame] | 237 | * <p>Autofill Framework will send a {@code @non-null} {@link InlineSuggestionsRequest} if |
| 238 | * currently inline suggestions are supported and can be displayed. If the Autofill service |
| 239 | * wants to show inline suggestions, they may return {@link Dataset} with valid |
| 240 | * {@link InlinePresentation}.</p> |
| 241 | * |
| 242 | * <p>The Autofill Service must set supportsInlineSuggestions in its XML to enable support |
| 243 | * for inline suggestions.</p> |
Eugene Susla | 3b2fe61 | 2019-08-06 18:47:14 -0700 | [diff] [blame] | 244 | * @hide |
| 245 | */ |
| 246 | @DataClass.Generated.Member |
| 247 | public FillRequest( |
| 248 | int id, |
| 249 | @NonNull List<FillContext> fillContexts, |
| 250 | @Nullable Bundle clientState, |
Adam He | bc67f2e | 2019-11-13 14:34:56 -0800 | [diff] [blame] | 251 | @RequestFlags int flags, |
| 252 | @Nullable InlineSuggestionsRequest inlineSuggestionsRequest) { |
Eugene Susla | 3b2fe61 | 2019-08-06 18:47:14 -0700 | [diff] [blame] | 253 | this.mId = id; |
| 254 | this.mFillContexts = fillContexts; |
| 255 | com.android.internal.util.AnnotationValidations.validate( |
| 256 | NonNull.class, null, mFillContexts); |
| 257 | this.mClientState = clientState; |
| 258 | this.mFlags = flags; |
| 259 | |
| 260 | Preconditions.checkFlagsArgument( |
| 261 | mFlags, |
| 262 | FLAG_MANUAL_REQUEST |
Adam He | ef0fe208 | 2019-10-25 11:58:15 -0700 | [diff] [blame] | 263 | | FLAG_COMPATIBILITY_MODE_REQUEST |
lpeter | 8e81531 | 2020-05-08 01:29:59 +0800 | [diff] [blame] | 264 | | FLAG_PASSWORD_INPUT_TYPE |
| 265 | | FLAG_VIEW_NOT_FOCUSED); |
Adam He | bc67f2e | 2019-11-13 14:34:56 -0800 | [diff] [blame] | 266 | this.mInlineSuggestionsRequest = inlineSuggestionsRequest; |
Eugene Susla | 3b2fe61 | 2019-08-06 18:47:14 -0700 | [diff] [blame] | 267 | |
| 268 | onConstructed(); |
| 269 | } |
| 270 | |
| 271 | /** |
| 272 | * Gets the unique id of this request. |
| 273 | */ |
| 274 | @DataClass.Generated.Member |
| 275 | public int getId() { |
| 276 | return mId; |
Svet Ganov | 013efe1 | 2017-04-13 21:56:16 -0700 | [diff] [blame] | 277 | } |
| 278 | |
| 279 | /** |
Felipe Leme | 2ef19c1 | 2017-06-05 11:32:32 -0700 | [diff] [blame] | 280 | * Gets the contexts associated with each previous fill request. |
Felipe Leme | c7ee7af | 2018-08-27 12:36:16 -0700 | [diff] [blame] | 281 | * |
| 282 | * <p><b>Note:</b> Starting on Android {@link android.os.Build.VERSION_CODES#Q}, it could also |
| 283 | * include contexts from requests whose {@link SaveInfo} had the |
| 284 | * {@link SaveInfo#FLAG_DELAY_SAVE} flag. |
Svet Ganov | 013efe1 | 2017-04-13 21:56:16 -0700 | [diff] [blame] | 285 | */ |
Eugene Susla | 3b2fe61 | 2019-08-06 18:47:14 -0700 | [diff] [blame] | 286 | @DataClass.Generated.Member |
Jeff Sharkey | 000ce80 | 2017-04-29 13:13:27 -0600 | [diff] [blame] | 287 | public @NonNull List<FillContext> getFillContexts() { |
Eugene Susla | 3b2fe61 | 2019-08-06 18:47:14 -0700 | [diff] [blame] | 288 | return mFillContexts; |
Felipe Leme | a012d7e | 2017-09-06 15:19:11 -0700 | [diff] [blame] | 289 | } |
| 290 | |
Svet Ganov | 013efe1 | 2017-04-13 21:56:16 -0700 | [diff] [blame] | 291 | /** |
Felipe Leme | d37f53e | 2017-12-07 10:41:10 -0800 | [diff] [blame] | 292 | * Gets the latest client state bundle set by the service in a |
| 293 | * {@link FillResponse.Builder#setClientState(Bundle) fill response}. |
Felipe Leme | 2ef19c1 | 2017-06-05 11:32:32 -0700 | [diff] [blame] | 294 | * |
Felipe Leme | d37f53e | 2017-12-07 10:41:10 -0800 | [diff] [blame] | 295 | * <p><b>Note:</b> Prior to Android {@link android.os.Build.VERSION_CODES#P}, only client state |
| 296 | * bundles set by {@link FillResponse.Builder#setClientState(Bundle)} were considered. On |
| 297 | * Android {@link android.os.Build.VERSION_CODES#P} and higher, bundles set in the result of |
| 298 | * an authenticated request through the |
| 299 | * {@link android.view.autofill.AutofillManager#EXTRA_CLIENT_STATE} extra are |
| 300 | * also considered (and take precedence when set). |
Svet Ganov | 013efe1 | 2017-04-13 21:56:16 -0700 | [diff] [blame] | 301 | * |
| 302 | * @return The client state. |
| 303 | */ |
Eugene Susla | 3b2fe61 | 2019-08-06 18:47:14 -0700 | [diff] [blame] | 304 | @DataClass.Generated.Member |
Svet Ganov | 013efe1 | 2017-04-13 21:56:16 -0700 | [diff] [blame] | 305 | public @Nullable Bundle getClientState() { |
| 306 | return mClientState; |
| 307 | } |
| 308 | |
Eugene Susla | 3b2fe61 | 2019-08-06 18:47:14 -0700 | [diff] [blame] | 309 | /** |
| 310 | * Gets the flags associated with this request. |
| 311 | * |
| 312 | * @return any combination of {@link #FLAG_MANUAL_REQUEST} and |
| 313 | * {@link #FLAG_COMPATIBILITY_MODE_REQUEST}. |
| 314 | */ |
| 315 | @DataClass.Generated.Member |
| 316 | public @RequestFlags int getFlags() { |
| 317 | return mFlags; |
Svet Ganov | 013efe1 | 2017-04-13 21:56:16 -0700 | [diff] [blame] | 318 | } |
| 319 | |
Adam He | bc67f2e | 2019-11-13 14:34:56 -0800 | [diff] [blame] | 320 | /** |
Adam He | 045c020 | 2020-04-17 15:20:01 -0700 | [diff] [blame] | 321 | * Gets the {@link InlineSuggestionsRequest} associated |
Adam He | bc67f2e | 2019-11-13 14:34:56 -0800 | [diff] [blame] | 322 | * with this request. |
| 323 | * |
Adam He | 045c020 | 2020-04-17 15:20:01 -0700 | [diff] [blame] | 324 | * <p>Autofill Framework will send a {@code @non-null} {@link InlineSuggestionsRequest} if |
| 325 | * currently inline suggestions are supported and can be displayed. If the Autofill service |
| 326 | * wants to show inline suggestions, they may return {@link Dataset} with valid |
| 327 | * {@link InlinePresentation}.</p> |
| 328 | * |
| 329 | * <p>The Autofill Service must set supportsInlineSuggestions in its XML to enable support |
| 330 | * for inline suggestions.</p> |
Adam He | bc67f2e | 2019-11-13 14:34:56 -0800 | [diff] [blame] | 331 | * |
| 332 | * @return the suggestionspec |
| 333 | */ |
| 334 | @DataClass.Generated.Member |
| 335 | public @Nullable InlineSuggestionsRequest getInlineSuggestionsRequest() { |
| 336 | return mInlineSuggestionsRequest; |
| 337 | } |
| 338 | |
Svet Ganov | 013efe1 | 2017-04-13 21:56:16 -0700 | [diff] [blame] | 339 | @Override |
Eugene Susla | 3b2fe61 | 2019-08-06 18:47:14 -0700 | [diff] [blame] | 340 | @DataClass.Generated.Member |
| 341 | public String toString() { |
| 342 | // You can override field toString logic by defining methods like: |
| 343 | // String fieldNameToString() { ... } |
| 344 | |
| 345 | return "FillRequest { " + |
| 346 | "id = " + mId + ", " + |
| 347 | "fillContexts = " + mFillContexts + ", " + |
| 348 | "clientState = " + mClientState + ", " + |
Adam He | bc67f2e | 2019-11-13 14:34:56 -0800 | [diff] [blame] | 349 | "flags = " + requestFlagsToString(mFlags) + ", " + |
| 350 | "inlineSuggestionsRequest = " + mInlineSuggestionsRequest + |
Eugene Susla | 3b2fe61 | 2019-08-06 18:47:14 -0700 | [diff] [blame] | 351 | " }"; |
Svet Ganov | 013efe1 | 2017-04-13 21:56:16 -0700 | [diff] [blame] | 352 | } |
| 353 | |
Eugene Susla | 3b2fe61 | 2019-08-06 18:47:14 -0700 | [diff] [blame] | 354 | @Override |
| 355 | @DataClass.Generated.Member |
Adam He | bc67f2e | 2019-11-13 14:34:56 -0800 | [diff] [blame] | 356 | public void writeToParcel(@NonNull Parcel dest, int flags) { |
Eugene Susla | 3b2fe61 | 2019-08-06 18:47:14 -0700 | [diff] [blame] | 357 | // You can override field parcelling by defining methods like: |
| 358 | // void parcelFieldName(Parcel dest, int flags) { ... } |
Svet Ganov | 013efe1 | 2017-04-13 21:56:16 -0700 | [diff] [blame] | 359 | |
Eugene Susla | 3b2fe61 | 2019-08-06 18:47:14 -0700 | [diff] [blame] | 360 | byte flg = 0; |
| 361 | if (mClientState != null) flg |= 0x4; |
Adam He | bc67f2e | 2019-11-13 14:34:56 -0800 | [diff] [blame] | 362 | if (mInlineSuggestionsRequest != null) flg |= 0x10; |
Eugene Susla | 3b2fe61 | 2019-08-06 18:47:14 -0700 | [diff] [blame] | 363 | dest.writeByte(flg); |
| 364 | dest.writeInt(mId); |
| 365 | dest.writeParcelableList(mFillContexts, flags); |
| 366 | if (mClientState != null) dest.writeBundle(mClientState); |
| 367 | dest.writeInt(mFlags); |
Adam He | bc67f2e | 2019-11-13 14:34:56 -0800 | [diff] [blame] | 368 | if (mInlineSuggestionsRequest != null) dest.writeTypedObject(mInlineSuggestionsRequest, flags); |
Eugene Susla | 3b2fe61 | 2019-08-06 18:47:14 -0700 | [diff] [blame] | 369 | } |
| 370 | |
| 371 | @Override |
| 372 | @DataClass.Generated.Member |
| 373 | public int describeContents() { return 0; } |
| 374 | |
Adam He | bc67f2e | 2019-11-13 14:34:56 -0800 | [diff] [blame] | 375 | /** @hide */ |
| 376 | @SuppressWarnings({"unchecked", "RedundantCast"}) |
| 377 | @DataClass.Generated.Member |
| 378 | /* package-private */ FillRequest(@NonNull Parcel in) { |
| 379 | // You can override field unparcelling by defining methods like: |
| 380 | // static FieldType unparcelFieldName(Parcel in) { ... } |
| 381 | |
| 382 | byte flg = in.readByte(); |
| 383 | int id = in.readInt(); |
| 384 | List<FillContext> fillContexts = new ArrayList<>(); |
| 385 | in.readParcelableList(fillContexts, FillContext.class.getClassLoader()); |
| 386 | Bundle clientState = (flg & 0x4) == 0 ? null : in.readBundle(); |
| 387 | int flags = in.readInt(); |
| 388 | InlineSuggestionsRequest inlineSuggestionsRequest = (flg & 0x10) == 0 ? null : (InlineSuggestionsRequest) in.readTypedObject(InlineSuggestionsRequest.CREATOR); |
| 389 | |
| 390 | this.mId = id; |
| 391 | this.mFillContexts = fillContexts; |
| 392 | com.android.internal.util.AnnotationValidations.validate( |
| 393 | NonNull.class, null, mFillContexts); |
| 394 | this.mClientState = clientState; |
| 395 | this.mFlags = flags; |
| 396 | |
| 397 | Preconditions.checkFlagsArgument( |
| 398 | mFlags, |
| 399 | FLAG_MANUAL_REQUEST |
Adam He | ef0fe208 | 2019-10-25 11:58:15 -0700 | [diff] [blame] | 400 | | FLAG_COMPATIBILITY_MODE_REQUEST |
lpeter | 8e81531 | 2020-05-08 01:29:59 +0800 | [diff] [blame] | 401 | | FLAG_PASSWORD_INPUT_TYPE |
| 402 | | FLAG_VIEW_NOT_FOCUSED); |
Adam He | bc67f2e | 2019-11-13 14:34:56 -0800 | [diff] [blame] | 403 | this.mInlineSuggestionsRequest = inlineSuggestionsRequest; |
| 404 | |
| 405 | onConstructed(); |
| 406 | } |
| 407 | |
Eugene Susla | 3b2fe61 | 2019-08-06 18:47:14 -0700 | [diff] [blame] | 408 | @DataClass.Generated.Member |
| 409 | public static final @NonNull Parcelable.Creator<FillRequest> CREATOR |
| 410 | = new Parcelable.Creator<FillRequest>() { |
Svet Ganov | 013efe1 | 2017-04-13 21:56:16 -0700 | [diff] [blame] | 411 | @Override |
| 412 | public FillRequest[] newArray(int size) { |
| 413 | return new FillRequest[size]; |
| 414 | } |
Eugene Susla | 3b2fe61 | 2019-08-06 18:47:14 -0700 | [diff] [blame] | 415 | |
| 416 | @Override |
Adam He | bc67f2e | 2019-11-13 14:34:56 -0800 | [diff] [blame] | 417 | public FillRequest createFromParcel(@NonNull Parcel in) { |
| 418 | return new FillRequest(in); |
Eugene Susla | 3b2fe61 | 2019-08-06 18:47:14 -0700 | [diff] [blame] | 419 | } |
Svet Ganov | 013efe1 | 2017-04-13 21:56:16 -0700 | [diff] [blame] | 420 | }; |
Eugene Susla | 3b2fe61 | 2019-08-06 18:47:14 -0700 | [diff] [blame] | 421 | |
| 422 | @DataClass.Generated( |
lpeter | 8e81531 | 2020-05-08 01:29:59 +0800 | [diff] [blame] | 423 | time = 1589280816805L, |
Adam He | 045c020 | 2020-04-17 15:20:01 -0700 | [diff] [blame] | 424 | codegenVersion = "1.0.15", |
Eugene Susla | 3b2fe61 | 2019-08-06 18:47:14 -0700 | [diff] [blame] | 425 | sourceFile = "frameworks/base/core/java/android/service/autofill/FillRequest.java", |
lpeter | 8e81531 | 2020-05-08 01:29:59 +0800 | [diff] [blame] | 426 | inputSignatures = "public static final @android.service.autofill.FillRequest.RequestFlags int FLAG_MANUAL_REQUEST\npublic static final @android.service.autofill.FillRequest.RequestFlags int FLAG_COMPATIBILITY_MODE_REQUEST\npublic static final @android.service.autofill.FillRequest.RequestFlags int FLAG_PASSWORD_INPUT_TYPE\npublic static final @android.service.autofill.FillRequest.RequestFlags int FLAG_VIEW_NOT_FOCUSED\npublic static final int INVALID_REQUEST_ID\nprivate final int mId\nprivate final @android.annotation.NonNull java.util.List<android.service.autofill.FillContext> mFillContexts\nprivate final @android.annotation.Nullable android.os.Bundle mClientState\nprivate final @android.service.autofill.FillRequest.RequestFlags int mFlags\nprivate final @android.annotation.Nullable android.view.inputmethod.InlineSuggestionsRequest mInlineSuggestionsRequest\nprivate void onConstructed()\nclass FillRequest extends java.lang.Object implements [android.os.Parcelable]\n@com.android.internal.util.DataClass(genToString=true, genHiddenConstructor=true, genHiddenConstDefs=true)") |
Eugene Susla | 3b2fe61 | 2019-08-06 18:47:14 -0700 | [diff] [blame] | 427 | @Deprecated |
| 428 | private void __metadata() {} |
| 429 | |
Adam He | bc67f2e | 2019-11-13 14:34:56 -0800 | [diff] [blame] | 430 | |
| 431 | //@formatter:on |
| 432 | // End of generated code |
| 433 | |
Svet Ganov | 013efe1 | 2017-04-13 21:56:16 -0700 | [diff] [blame] | 434 | } |