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