1 /* 2 * Copyright (C) 2023 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.hardware.face; 18 19 20 import static android.os.PowerManager.WAKE_REASON_UNKNOWN; 21 22 import android.annotation.IntDef; 23 import android.annotation.NonNull; 24 import android.annotation.Nullable; 25 import android.hardware.biometrics.AuthenticateOptions; 26 import android.os.Parcelable; 27 import android.os.PowerManager; 28 29 import com.android.internal.util.DataClass; 30 31 import java.lang.annotation.Retention; 32 import java.lang.annotation.RetentionPolicy; 33 34 /** 35 * Additional options when requesting Face authentication or detection. 36 * 37 * @hide 38 */ 39 @DataClass( 40 genParcelable = true, 41 genAidl = true, 42 genBuilder = true, 43 genSetters = true, 44 genEqualsHashCode = true 45 ) 46 public class FaceAuthenticateOptions implements AuthenticateOptions, Parcelable { 47 48 /** The user id for this operation. */ 49 private final int mUserId; defaultUserId()50 private static int defaultUserId() { 51 return 0; 52 } 53 54 /** The sensor id for this operation. */ 55 private int mSensorId; defaultSensorId()56 private static int defaultSensorId() { 57 return -1; 58 } 59 60 /** The current doze state of the device. */ 61 @AuthenticateOptions.DisplayState 62 private final int mDisplayState; defaultDisplayState()63 private static int defaultDisplayState() { 64 return DISPLAY_STATE_UNKNOWN; 65 } 66 67 public static final int AUTHENTICATE_REASON_UNKNOWN = 0; 68 public static final int AUTHENTICATE_REASON_STARTED_WAKING_UP = 1; 69 public static final int AUTHENTICATE_REASON_PRIMARY_BOUNCER_SHOWN = 2; 70 public static final int AUTHENTICATE_REASON_ASSISTANT_VISIBLE = 3; 71 public static final int AUTHENTICATE_REASON_ALTERNATE_BIOMETRIC_BOUNCER_SHOWN = 4; 72 public static final int AUTHENTICATE_REASON_NOTIFICATION_PANEL_CLICKED = 5; 73 public static final int AUTHENTICATE_REASON_OCCLUDING_APP_REQUESTED = 6; 74 public static final int AUTHENTICATE_REASON_PICK_UP_GESTURE_TRIGGERED = 7; 75 public static final int AUTHENTICATE_REASON_QS_EXPANDED = 8; 76 public static final int AUTHENTICATE_REASON_SWIPE_UP_ON_BOUNCER = 9; 77 public static final int AUTHENTICATE_REASON_UDFPS_POINTER_DOWN = 10; 78 79 /** 80 * The reason for this operation when requested by the system (sysui), 81 * otherwise AUTHENTICATE_REASON_UNKNOWN. 82 * 83 * See frameworks/base/packages/SystemUI/src/com/android/keyguard/FaceAuthReason.kt 84 * for more details about each reason. 85 */ 86 @AuthenticateReason 87 private final int mAuthenticateReason; defaultAuthenticateReason()88 private static int defaultAuthenticateReason() { 89 return AUTHENTICATE_REASON_UNKNOWN; 90 } 91 92 /** A reason if this request was triggered due to a power event or WAKE_REASON_UNKNOWN. */ 93 @PowerManager.WakeReason 94 private final int mWakeReason; defaultWakeReason()95 private static int defaultWakeReason() { 96 return WAKE_REASON_UNKNOWN; 97 } 98 99 /** 100 * The package name for that operation that should be used for 101 * {@link android.app.AppOpsManager} verification. 102 * 103 * This option may be overridden by the FingerprintManager using the caller's context. 104 */ 105 @NonNull 106 private String mOpPackageName; defaultOpPackageName()107 private static String defaultOpPackageName() { 108 return ""; 109 } 110 111 /** 112 * The attribution tag, if any. 113 * 114 * This option may be overridden by the FingerprintManager using the caller's context. 115 */ 116 @Nullable 117 private String mAttributionTag; defaultAttributionTag()118 private static String defaultAttributionTag() { 119 return null; 120 } 121 122 123 /** If the authentication is requested due to mandatory biometrics being active. */ 124 private boolean mIsMandatoryBiometrics; 125 126 // Code below generated by codegen v1.0.23. 127 // 128 // DO NOT MODIFY! 129 // CHECKSTYLE:OFF Generated code 130 // 131 // To regenerate run: 132 // $ codegen $ANDROID_BUILD_TOP/frameworks/base/core/java/android/hardware/face/FaceAuthenticateOptions.java 133 // 134 // To exclude the generated code from IntelliJ auto-formatting enable (one-time): 135 // Settings > Editor > Code Style > Formatter Control 136 //@formatter:off 137 138 139 @IntDef(prefix = "AUTHENTICATE_REASON_", value = { 140 AUTHENTICATE_REASON_UNKNOWN, 141 AUTHENTICATE_REASON_STARTED_WAKING_UP, 142 AUTHENTICATE_REASON_PRIMARY_BOUNCER_SHOWN, 143 AUTHENTICATE_REASON_ASSISTANT_VISIBLE, 144 AUTHENTICATE_REASON_ALTERNATE_BIOMETRIC_BOUNCER_SHOWN, 145 AUTHENTICATE_REASON_NOTIFICATION_PANEL_CLICKED, 146 AUTHENTICATE_REASON_OCCLUDING_APP_REQUESTED, 147 AUTHENTICATE_REASON_PICK_UP_GESTURE_TRIGGERED, 148 AUTHENTICATE_REASON_QS_EXPANDED, 149 AUTHENTICATE_REASON_SWIPE_UP_ON_BOUNCER, 150 AUTHENTICATE_REASON_UDFPS_POINTER_DOWN 151 }) 152 @Retention(RetentionPolicy.SOURCE) 153 @DataClass.Generated.Member 154 public @interface AuthenticateReason {} 155 156 @DataClass.Generated.Member authenticateReasonToString(@uthenticateReason int value)157 public static String authenticateReasonToString(@AuthenticateReason int value) { 158 switch (value) { 159 case AUTHENTICATE_REASON_UNKNOWN: 160 return "AUTHENTICATE_REASON_UNKNOWN"; 161 case AUTHENTICATE_REASON_STARTED_WAKING_UP: 162 return "AUTHENTICATE_REASON_STARTED_WAKING_UP"; 163 case AUTHENTICATE_REASON_PRIMARY_BOUNCER_SHOWN: 164 return "AUTHENTICATE_REASON_PRIMARY_BOUNCER_SHOWN"; 165 case AUTHENTICATE_REASON_ASSISTANT_VISIBLE: 166 return "AUTHENTICATE_REASON_ASSISTANT_VISIBLE"; 167 case AUTHENTICATE_REASON_ALTERNATE_BIOMETRIC_BOUNCER_SHOWN: 168 return "AUTHENTICATE_REASON_ALTERNATE_BIOMETRIC_BOUNCER_SHOWN"; 169 case AUTHENTICATE_REASON_NOTIFICATION_PANEL_CLICKED: 170 return "AUTHENTICATE_REASON_NOTIFICATION_PANEL_CLICKED"; 171 case AUTHENTICATE_REASON_OCCLUDING_APP_REQUESTED: 172 return "AUTHENTICATE_REASON_OCCLUDING_APP_REQUESTED"; 173 case AUTHENTICATE_REASON_PICK_UP_GESTURE_TRIGGERED: 174 return "AUTHENTICATE_REASON_PICK_UP_GESTURE_TRIGGERED"; 175 case AUTHENTICATE_REASON_QS_EXPANDED: 176 return "AUTHENTICATE_REASON_QS_EXPANDED"; 177 case AUTHENTICATE_REASON_SWIPE_UP_ON_BOUNCER: 178 return "AUTHENTICATE_REASON_SWIPE_UP_ON_BOUNCER"; 179 case AUTHENTICATE_REASON_UDFPS_POINTER_DOWN: 180 return "AUTHENTICATE_REASON_UDFPS_POINTER_DOWN"; 181 default: return Integer.toHexString(value); 182 } 183 } 184 185 @DataClass.Generated.Member FaceAuthenticateOptions( int userId, int sensorId, @AuthenticateOptions.DisplayState int displayState, @AuthenticateReason int authenticateReason, @PowerManager.WakeReason int wakeReason, @NonNull String opPackageName, @Nullable String attributionTag, boolean isMandatoryBiometrics)186 /* package-private */ FaceAuthenticateOptions( 187 int userId, 188 int sensorId, 189 @AuthenticateOptions.DisplayState int displayState, 190 @AuthenticateReason int authenticateReason, 191 @PowerManager.WakeReason int wakeReason, 192 @NonNull String opPackageName, 193 @Nullable String attributionTag, 194 boolean isMandatoryBiometrics) { 195 this.mUserId = userId; 196 this.mSensorId = sensorId; 197 this.mDisplayState = displayState; 198 com.android.internal.util.AnnotationValidations.validate( 199 AuthenticateOptions.DisplayState.class, null, mDisplayState); 200 this.mAuthenticateReason = authenticateReason; 201 202 if (!(mAuthenticateReason == AUTHENTICATE_REASON_UNKNOWN) 203 && !(mAuthenticateReason == AUTHENTICATE_REASON_STARTED_WAKING_UP) 204 && !(mAuthenticateReason == AUTHENTICATE_REASON_PRIMARY_BOUNCER_SHOWN) 205 && !(mAuthenticateReason == AUTHENTICATE_REASON_ASSISTANT_VISIBLE) 206 && !(mAuthenticateReason == AUTHENTICATE_REASON_ALTERNATE_BIOMETRIC_BOUNCER_SHOWN) 207 && !(mAuthenticateReason == AUTHENTICATE_REASON_NOTIFICATION_PANEL_CLICKED) 208 && !(mAuthenticateReason == AUTHENTICATE_REASON_OCCLUDING_APP_REQUESTED) 209 && !(mAuthenticateReason == AUTHENTICATE_REASON_PICK_UP_GESTURE_TRIGGERED) 210 && !(mAuthenticateReason == AUTHENTICATE_REASON_QS_EXPANDED) 211 && !(mAuthenticateReason == AUTHENTICATE_REASON_SWIPE_UP_ON_BOUNCER) 212 && !(mAuthenticateReason == AUTHENTICATE_REASON_UDFPS_POINTER_DOWN)) { 213 throw new java.lang.IllegalArgumentException( 214 "authenticateReason was " + mAuthenticateReason + " but must be one of: " 215 + "AUTHENTICATE_REASON_UNKNOWN(" + AUTHENTICATE_REASON_UNKNOWN + "), " 216 + "AUTHENTICATE_REASON_STARTED_WAKING_UP(" + AUTHENTICATE_REASON_STARTED_WAKING_UP + "), " 217 + "AUTHENTICATE_REASON_PRIMARY_BOUNCER_SHOWN(" + AUTHENTICATE_REASON_PRIMARY_BOUNCER_SHOWN + "), " 218 + "AUTHENTICATE_REASON_ASSISTANT_VISIBLE(" + AUTHENTICATE_REASON_ASSISTANT_VISIBLE + "), " 219 + "AUTHENTICATE_REASON_ALTERNATE_BIOMETRIC_BOUNCER_SHOWN(" + AUTHENTICATE_REASON_ALTERNATE_BIOMETRIC_BOUNCER_SHOWN + "), " 220 + "AUTHENTICATE_REASON_NOTIFICATION_PANEL_CLICKED(" + AUTHENTICATE_REASON_NOTIFICATION_PANEL_CLICKED + "), " 221 + "AUTHENTICATE_REASON_OCCLUDING_APP_REQUESTED(" + AUTHENTICATE_REASON_OCCLUDING_APP_REQUESTED + "), " 222 + "AUTHENTICATE_REASON_PICK_UP_GESTURE_TRIGGERED(" + AUTHENTICATE_REASON_PICK_UP_GESTURE_TRIGGERED + "), " 223 + "AUTHENTICATE_REASON_QS_EXPANDED(" + AUTHENTICATE_REASON_QS_EXPANDED + "), " 224 + "AUTHENTICATE_REASON_SWIPE_UP_ON_BOUNCER(" + AUTHENTICATE_REASON_SWIPE_UP_ON_BOUNCER + "), " 225 + "AUTHENTICATE_REASON_UDFPS_POINTER_DOWN(" + AUTHENTICATE_REASON_UDFPS_POINTER_DOWN + ")"); 226 } 227 228 this.mWakeReason = wakeReason; 229 com.android.internal.util.AnnotationValidations.validate( 230 PowerManager.WakeReason.class, null, mWakeReason); 231 this.mOpPackageName = opPackageName; 232 com.android.internal.util.AnnotationValidations.validate( 233 NonNull.class, null, mOpPackageName); 234 this.mAttributionTag = attributionTag; 235 this.mIsMandatoryBiometrics = isMandatoryBiometrics; 236 237 // onConstructed(); // You can define this method to get a callback 238 } 239 240 /** 241 * The user id for this operation. 242 */ 243 @DataClass.Generated.Member getUserId()244 public int getUserId() { 245 return mUserId; 246 } 247 248 /** 249 * The sensor id for this operation. 250 */ 251 @DataClass.Generated.Member getSensorId()252 public int getSensorId() { 253 return mSensorId; 254 } 255 256 /** 257 * The current doze state of the device. 258 */ 259 @DataClass.Generated.Member getDisplayState()260 public @AuthenticateOptions.DisplayState int getDisplayState() { 261 return mDisplayState; 262 } 263 264 /** 265 * The reason for this operation when requested by the system (sysui), 266 * otherwise AUTHENTICATE_REASON_UNKNOWN. 267 * 268 * See frameworks/base/packages/SystemUI/src/com/android/keyguard/FaceAuthReason.kt 269 * for more details about each reason. 270 */ 271 @DataClass.Generated.Member getAuthenticateReason()272 public @AuthenticateReason int getAuthenticateReason() { 273 return mAuthenticateReason; 274 } 275 276 /** 277 * A reason if this request was triggered due to a power event or WAKE_REASON_UNKNOWN. 278 */ 279 @DataClass.Generated.Member getWakeReason()280 public @PowerManager.WakeReason int getWakeReason() { 281 return mWakeReason; 282 } 283 284 /** 285 * The package name for that operation that should be used for 286 * {@link android.app.AppOpsManager} verification. 287 * 288 * This option may be overridden by the FingerprintManager using the caller's context. 289 */ 290 @DataClass.Generated.Member getOpPackageName()291 public @NonNull String getOpPackageName() { 292 return mOpPackageName; 293 } 294 295 /** 296 * The attribution tag, if any. 297 * 298 * This option may be overridden by the FingerprintManager using the caller's context. 299 */ 300 @DataClass.Generated.Member getAttributionTag()301 public @Nullable String getAttributionTag() { 302 return mAttributionTag; 303 } 304 305 /** 306 * If the authentication is requested due to mandatory biometrics being active. 307 */ 308 @DataClass.Generated.Member isMandatoryBiometrics()309 public boolean isMandatoryBiometrics() { 310 return mIsMandatoryBiometrics; 311 } 312 313 /** 314 * The sensor id for this operation. 315 */ 316 @DataClass.Generated.Member setSensorId( int value)317 public @NonNull FaceAuthenticateOptions setSensorId( int value) { 318 mSensorId = value; 319 return this; 320 } 321 322 /** 323 * The package name for that operation that should be used for 324 * {@link android.app.AppOpsManager} verification. 325 * 326 * This option may be overridden by the FingerprintManager using the caller's context. 327 */ 328 @DataClass.Generated.Member setOpPackageName(@onNull String value)329 public @NonNull FaceAuthenticateOptions setOpPackageName(@NonNull String value) { 330 mOpPackageName = value; 331 com.android.internal.util.AnnotationValidations.validate( 332 NonNull.class, null, mOpPackageName); 333 return this; 334 } 335 336 /** 337 * The attribution tag, if any. 338 * 339 * This option may be overridden by the FingerprintManager using the caller's context. 340 */ 341 @DataClass.Generated.Member setAttributionTag(@onNull String value)342 public @NonNull FaceAuthenticateOptions setAttributionTag(@NonNull String value) { 343 mAttributionTag = value; 344 return this; 345 } 346 347 /** 348 * If the authentication is requested due to mandatory biometrics being active. 349 */ 350 @DataClass.Generated.Member setIsMandatoryBiometrics( boolean value)351 public @NonNull FaceAuthenticateOptions setIsMandatoryBiometrics( boolean value) { 352 mIsMandatoryBiometrics = value; 353 return this; 354 } 355 356 @Override 357 @DataClass.Generated.Member equals(@ullable Object o)358 public boolean equals(@Nullable Object o) { 359 // You can override field equality logic by defining either of the methods like: 360 // boolean fieldNameEquals(FaceAuthenticateOptions other) { ... } 361 // boolean fieldNameEquals(FieldType otherValue) { ... } 362 363 if (this == o) return true; 364 if (o == null || getClass() != o.getClass()) return false; 365 @SuppressWarnings("unchecked") 366 FaceAuthenticateOptions that = (FaceAuthenticateOptions) o; 367 //noinspection PointlessBooleanExpression 368 return true 369 && mUserId == that.mUserId 370 && mSensorId == that.mSensorId 371 && mDisplayState == that.mDisplayState 372 && mAuthenticateReason == that.mAuthenticateReason 373 && mWakeReason == that.mWakeReason 374 && java.util.Objects.equals(mOpPackageName, that.mOpPackageName) 375 && java.util.Objects.equals(mAttributionTag, that.mAttributionTag) 376 && mIsMandatoryBiometrics == that.mIsMandatoryBiometrics; 377 } 378 379 @Override 380 @DataClass.Generated.Member hashCode()381 public int hashCode() { 382 // You can override field hashCode logic by defining methods like: 383 // int fieldNameHashCode() { ... } 384 385 int _hash = 1; 386 _hash = 31 * _hash + mUserId; 387 _hash = 31 * _hash + mSensorId; 388 _hash = 31 * _hash + mDisplayState; 389 _hash = 31 * _hash + mAuthenticateReason; 390 _hash = 31 * _hash + mWakeReason; 391 _hash = 31 * _hash + java.util.Objects.hashCode(mOpPackageName); 392 _hash = 31 * _hash + java.util.Objects.hashCode(mAttributionTag); 393 _hash = 31 * _hash + Boolean.hashCode(mIsMandatoryBiometrics); 394 return _hash; 395 } 396 397 @Override 398 @DataClass.Generated.Member writeToParcel(@onNull android.os.Parcel dest, int flags)399 public void writeToParcel(@NonNull android.os.Parcel dest, int flags) { 400 // You can override field parcelling by defining methods like: 401 // void parcelFieldName(Parcel dest, int flags) { ... } 402 403 int flg = 0; 404 if (mIsMandatoryBiometrics) flg |= 0x80; 405 if (mAttributionTag != null) flg |= 0x40; 406 dest.writeInt(flg); 407 dest.writeInt(mUserId); 408 dest.writeInt(mSensorId); 409 dest.writeInt(mDisplayState); 410 dest.writeInt(mAuthenticateReason); 411 dest.writeInt(mWakeReason); 412 dest.writeString(mOpPackageName); 413 if (mAttributionTag != null) dest.writeString(mAttributionTag); 414 } 415 416 @Override 417 @DataClass.Generated.Member describeContents()418 public int describeContents() { return 0; } 419 420 /** @hide */ 421 @SuppressWarnings({"unchecked", "RedundantCast"}) 422 @DataClass.Generated.Member FaceAuthenticateOptions(@onNull android.os.Parcel in)423 protected FaceAuthenticateOptions(@NonNull android.os.Parcel in) { 424 // You can override field unparcelling by defining methods like: 425 // static FieldType unparcelFieldName(Parcel in) { ... } 426 427 int flg = in.readInt(); 428 boolean isMandatoryBiometrics = (flg & 0x80) != 0; 429 int userId = in.readInt(); 430 int sensorId = in.readInt(); 431 int displayState = in.readInt(); 432 int authenticateReason = in.readInt(); 433 int wakeReason = in.readInt(); 434 String opPackageName = in.readString(); 435 String attributionTag = (flg & 0x40) == 0 ? null : in.readString(); 436 437 this.mUserId = userId; 438 this.mSensorId = sensorId; 439 this.mDisplayState = displayState; 440 com.android.internal.util.AnnotationValidations.validate( 441 AuthenticateOptions.DisplayState.class, null, mDisplayState); 442 this.mAuthenticateReason = authenticateReason; 443 444 if (!(mAuthenticateReason == AUTHENTICATE_REASON_UNKNOWN) 445 && !(mAuthenticateReason == AUTHENTICATE_REASON_STARTED_WAKING_UP) 446 && !(mAuthenticateReason == AUTHENTICATE_REASON_PRIMARY_BOUNCER_SHOWN) 447 && !(mAuthenticateReason == AUTHENTICATE_REASON_ASSISTANT_VISIBLE) 448 && !(mAuthenticateReason == AUTHENTICATE_REASON_ALTERNATE_BIOMETRIC_BOUNCER_SHOWN) 449 && !(mAuthenticateReason == AUTHENTICATE_REASON_NOTIFICATION_PANEL_CLICKED) 450 && !(mAuthenticateReason == AUTHENTICATE_REASON_OCCLUDING_APP_REQUESTED) 451 && !(mAuthenticateReason == AUTHENTICATE_REASON_PICK_UP_GESTURE_TRIGGERED) 452 && !(mAuthenticateReason == AUTHENTICATE_REASON_QS_EXPANDED) 453 && !(mAuthenticateReason == AUTHENTICATE_REASON_SWIPE_UP_ON_BOUNCER) 454 && !(mAuthenticateReason == AUTHENTICATE_REASON_UDFPS_POINTER_DOWN)) { 455 throw new java.lang.IllegalArgumentException( 456 "authenticateReason was " + mAuthenticateReason + " but must be one of: " 457 + "AUTHENTICATE_REASON_UNKNOWN(" + AUTHENTICATE_REASON_UNKNOWN + "), " 458 + "AUTHENTICATE_REASON_STARTED_WAKING_UP(" + AUTHENTICATE_REASON_STARTED_WAKING_UP + "), " 459 + "AUTHENTICATE_REASON_PRIMARY_BOUNCER_SHOWN(" + AUTHENTICATE_REASON_PRIMARY_BOUNCER_SHOWN + "), " 460 + "AUTHENTICATE_REASON_ASSISTANT_VISIBLE(" + AUTHENTICATE_REASON_ASSISTANT_VISIBLE + "), " 461 + "AUTHENTICATE_REASON_ALTERNATE_BIOMETRIC_BOUNCER_SHOWN(" + AUTHENTICATE_REASON_ALTERNATE_BIOMETRIC_BOUNCER_SHOWN + "), " 462 + "AUTHENTICATE_REASON_NOTIFICATION_PANEL_CLICKED(" + AUTHENTICATE_REASON_NOTIFICATION_PANEL_CLICKED + "), " 463 + "AUTHENTICATE_REASON_OCCLUDING_APP_REQUESTED(" + AUTHENTICATE_REASON_OCCLUDING_APP_REQUESTED + "), " 464 + "AUTHENTICATE_REASON_PICK_UP_GESTURE_TRIGGERED(" + AUTHENTICATE_REASON_PICK_UP_GESTURE_TRIGGERED + "), " 465 + "AUTHENTICATE_REASON_QS_EXPANDED(" + AUTHENTICATE_REASON_QS_EXPANDED + "), " 466 + "AUTHENTICATE_REASON_SWIPE_UP_ON_BOUNCER(" + AUTHENTICATE_REASON_SWIPE_UP_ON_BOUNCER + "), " 467 + "AUTHENTICATE_REASON_UDFPS_POINTER_DOWN(" + AUTHENTICATE_REASON_UDFPS_POINTER_DOWN + ")"); 468 } 469 470 this.mWakeReason = wakeReason; 471 com.android.internal.util.AnnotationValidations.validate( 472 PowerManager.WakeReason.class, null, mWakeReason); 473 this.mOpPackageName = opPackageName; 474 com.android.internal.util.AnnotationValidations.validate( 475 NonNull.class, null, mOpPackageName); 476 this.mAttributionTag = attributionTag; 477 this.mIsMandatoryBiometrics = isMandatoryBiometrics; 478 479 // onConstructed(); // You can define this method to get a callback 480 } 481 482 @DataClass.Generated.Member 483 public static final @NonNull Parcelable.Creator<FaceAuthenticateOptions> CREATOR 484 = new Parcelable.Creator<FaceAuthenticateOptions>() { 485 @Override 486 public FaceAuthenticateOptions[] newArray(int size) { 487 return new FaceAuthenticateOptions[size]; 488 } 489 490 @Override 491 public FaceAuthenticateOptions createFromParcel(@NonNull android.os.Parcel in) { 492 return new FaceAuthenticateOptions(in); 493 } 494 }; 495 496 /** 497 * A builder for {@link FaceAuthenticateOptions} 498 */ 499 @SuppressWarnings("WeakerAccess") 500 @DataClass.Generated.Member 501 public static class Builder { 502 503 private int mUserId; 504 private int mSensorId; 505 private @AuthenticateOptions.DisplayState int mDisplayState; 506 private @AuthenticateReason int mAuthenticateReason; 507 private @PowerManager.WakeReason int mWakeReason; 508 private @NonNull String mOpPackageName; 509 private @Nullable String mAttributionTag; 510 private boolean mIsMandatoryBiometrics; 511 512 private long mBuilderFieldsSet = 0L; 513 Builder()514 public Builder() { 515 } 516 517 /** 518 * The user id for this operation. 519 */ 520 @DataClass.Generated.Member setUserId(int value)521 public @NonNull Builder setUserId(int value) { 522 checkNotUsed(); 523 mBuilderFieldsSet |= 0x1; 524 mUserId = value; 525 return this; 526 } 527 528 /** 529 * The sensor id for this operation. 530 */ 531 @DataClass.Generated.Member setSensorId(int value)532 public @NonNull Builder setSensorId(int value) { 533 checkNotUsed(); 534 mBuilderFieldsSet |= 0x2; 535 mSensorId = value; 536 return this; 537 } 538 539 /** 540 * The current doze state of the device. 541 */ 542 @DataClass.Generated.Member setDisplayState(@uthenticateOptions.DisplayState int value)543 public @NonNull Builder setDisplayState(@AuthenticateOptions.DisplayState int value) { 544 checkNotUsed(); 545 mBuilderFieldsSet |= 0x4; 546 mDisplayState = value; 547 return this; 548 } 549 550 /** 551 * The reason for this operation when requested by the system (sysui), 552 * otherwise AUTHENTICATE_REASON_UNKNOWN. 553 * 554 * See frameworks/base/packages/SystemUI/src/com/android/keyguard/FaceAuthReason.kt 555 * for more details about each reason. 556 */ 557 @DataClass.Generated.Member setAuthenticateReason(@uthenticateReason int value)558 public @NonNull Builder setAuthenticateReason(@AuthenticateReason int value) { 559 checkNotUsed(); 560 mBuilderFieldsSet |= 0x8; 561 mAuthenticateReason = value; 562 return this; 563 } 564 565 /** 566 * A reason if this request was triggered due to a power event or WAKE_REASON_UNKNOWN. 567 */ 568 @DataClass.Generated.Member setWakeReason(@owerManager.WakeReason int value)569 public @NonNull Builder setWakeReason(@PowerManager.WakeReason int value) { 570 checkNotUsed(); 571 mBuilderFieldsSet |= 0x10; 572 mWakeReason = value; 573 return this; 574 } 575 576 /** 577 * The package name for that operation that should be used for 578 * {@link android.app.AppOpsManager} verification. 579 * 580 * This option may be overridden by the FingerprintManager using the caller's context. 581 */ 582 @DataClass.Generated.Member setOpPackageName(@onNull String value)583 public @NonNull Builder setOpPackageName(@NonNull String value) { 584 checkNotUsed(); 585 mBuilderFieldsSet |= 0x20; 586 mOpPackageName = value; 587 return this; 588 } 589 590 /** 591 * The attribution tag, if any. 592 * 593 * This option may be overridden by the FingerprintManager using the caller's context. 594 */ 595 @DataClass.Generated.Member setAttributionTag(@onNull String value)596 public @NonNull Builder setAttributionTag(@NonNull String value) { 597 checkNotUsed(); 598 mBuilderFieldsSet |= 0x40; 599 mAttributionTag = value; 600 return this; 601 } 602 603 /** 604 * If the authentication is requested due to mandatory biometrics being active. 605 */ 606 @DataClass.Generated.Member setIsMandatoryBiometrics(boolean value)607 public @NonNull Builder setIsMandatoryBiometrics(boolean value) { 608 checkNotUsed(); 609 mBuilderFieldsSet |= 0x80; 610 mIsMandatoryBiometrics = value; 611 return this; 612 } 613 614 /** Builds the instance. This builder should not be touched after calling this! */ build()615 public @NonNull FaceAuthenticateOptions build() { 616 checkNotUsed(); 617 mBuilderFieldsSet |= 0x100; // Mark builder used 618 619 if ((mBuilderFieldsSet & 0x1) == 0) { 620 mUserId = defaultUserId(); 621 } 622 if ((mBuilderFieldsSet & 0x2) == 0) { 623 mSensorId = defaultSensorId(); 624 } 625 if ((mBuilderFieldsSet & 0x4) == 0) { 626 mDisplayState = defaultDisplayState(); 627 } 628 if ((mBuilderFieldsSet & 0x8) == 0) { 629 mAuthenticateReason = defaultAuthenticateReason(); 630 } 631 if ((mBuilderFieldsSet & 0x10) == 0) { 632 mWakeReason = defaultWakeReason(); 633 } 634 if ((mBuilderFieldsSet & 0x20) == 0) { 635 mOpPackageName = defaultOpPackageName(); 636 } 637 if ((mBuilderFieldsSet & 0x40) == 0) { 638 mAttributionTag = defaultAttributionTag(); 639 } 640 FaceAuthenticateOptions o = new FaceAuthenticateOptions( 641 mUserId, 642 mSensorId, 643 mDisplayState, 644 mAuthenticateReason, 645 mWakeReason, 646 mOpPackageName, 647 mAttributionTag, 648 mIsMandatoryBiometrics); 649 return o; 650 } 651 checkNotUsed()652 private void checkNotUsed() { 653 if ((mBuilderFieldsSet & 0x100) != 0) { 654 throw new IllegalStateException( 655 "This Builder should not be reused. Use a new Builder instance instead"); 656 } 657 } 658 } 659 660 @DataClass.Generated( 661 time = 1723436679828L, 662 codegenVersion = "1.0.23", 663 sourceFile = "frameworks/base/core/java/android/hardware/face/FaceAuthenticateOptions.java", 664 inputSignatures = "private final int mUserId\nprivate int mSensorId\nprivate final @android.hardware.biometrics.AuthenticateOptions.DisplayState int mDisplayState\npublic static final int AUTHENTICATE_REASON_UNKNOWN\npublic static final int AUTHENTICATE_REASON_STARTED_WAKING_UP\npublic static final int AUTHENTICATE_REASON_PRIMARY_BOUNCER_SHOWN\npublic static final int AUTHENTICATE_REASON_ASSISTANT_VISIBLE\npublic static final int AUTHENTICATE_REASON_ALTERNATE_BIOMETRIC_BOUNCER_SHOWN\npublic static final int AUTHENTICATE_REASON_NOTIFICATION_PANEL_CLICKED\npublic static final int AUTHENTICATE_REASON_OCCLUDING_APP_REQUESTED\npublic static final int AUTHENTICATE_REASON_PICK_UP_GESTURE_TRIGGERED\npublic static final int AUTHENTICATE_REASON_QS_EXPANDED\npublic static final int AUTHENTICATE_REASON_SWIPE_UP_ON_BOUNCER\npublic static final int AUTHENTICATE_REASON_UDFPS_POINTER_DOWN\nprivate final @android.hardware.face.FaceAuthenticateOptions.AuthenticateReason int mAuthenticateReason\nprivate final @android.os.PowerManager.WakeReason int mWakeReason\nprivate @android.annotation.NonNull java.lang.String mOpPackageName\nprivate @android.annotation.Nullable java.lang.String mAttributionTag\nprivate boolean mIsMandatoryBiometrics\nprivate static int defaultUserId()\nprivate static int defaultSensorId()\nprivate static int defaultDisplayState()\nprivate static int defaultAuthenticateReason()\nprivate static int defaultWakeReason()\nprivate static java.lang.String defaultOpPackageName()\nprivate static java.lang.String defaultAttributionTag()\nclass FaceAuthenticateOptions extends java.lang.Object implements [android.hardware.biometrics.AuthenticateOptions, android.os.Parcelable]\n@com.android.internal.util.DataClass(genParcelable=true, genAidl=true, genBuilder=true, genSetters=true, genEqualsHashCode=true)") 665 @Deprecated __metadata()666 private void __metadata() {} 667 668 669 //@formatter:on 670 // End of generated code 671 672 } 673