Debian Codegraph @

core/java/android/hardware/face/FaceSensorPropertiesInternal.java

raw symbols SCIP
1 /*
2 * Copyright (C) 2020 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 import android.annotation.NonNull;
20 import android.hardware.biometrics.ComponentInfoInternal;
21 import android.hardware.biometrics.SensorProperties;
22 import android.hardware.biometrics.SensorPropertiesInternal;
23 import android.os.Parcel;
24
25 import java.util.List;
26
27 /**
28 * Container for face sensor properties.
29 * @hide
30 */
31 public class FaceSensorPropertiesInternal extends SensorPropertiesInternal {
32 /**
33 * See {@link FaceSensorProperties.SensorType}.
34 */
35 public final @FaceSensorProperties.SensorType int sensorType;
36
37 /**
38 * True if the sensor is able to perform generic face detection, without running the
39 * matching algorithm, and without affecting the lockout counter.
40 */
41 public final boolean supportsFaceDetection;
42 /**
43 * True if the sensor is able to provide self illumination in dark scenarios, without support
44 * from above the HAL.
45 */
46 public final boolean supportsSelfIllumination;
47
48 /**
49 * Initializes SensorProperties with specified values
50 */
51 public FaceSensorPropertiesInternal(int sensorId, @SensorProperties.Strength int strength,
52 int maxEnrollmentsPerUser, @NonNull List<ComponentInfoInternal> componentInfo,
53 @FaceSensorProperties.SensorType int sensorType, boolean supportsFaceDetection,
54 boolean supportsSelfIllumination, boolean resetLockoutRequiresChallenge) {
55 // resetLockout is managed by the HAL and requires a HardwareAuthToken for all face
56 // HAL interfaces ([email protected] HIDL and [email protected] AIDL).
57 super(sensorId, strength, maxEnrollmentsPerUser, componentInfo,
58 true /* resetLockoutRequiresHardwareAuthToken */, resetLockoutRequiresChallenge);
59 this.sensorType = sensorType;
60 this.supportsFaceDetection = supportsFaceDetection;
61 this.supportsSelfIllumination = supportsSelfIllumination;
62 }
63
64 protected FaceSensorPropertiesInternal(Parcel in) {
65 super(in);
66 sensorType = in.readInt();
67 supportsFaceDetection = in.readBoolean();
68 supportsSelfIllumination = in.readBoolean();
69 }
70
71 public static final Creator<FaceSensorPropertiesInternal> CREATOR =
72 new Creator<FaceSensorPropertiesInternal>() {
73 @Override
74 public FaceSensorPropertiesInternal createFromParcel(Parcel in) {
75 return new FaceSensorPropertiesInternal(in);
76 }
77
78 @Override
79 public FaceSensorPropertiesInternal[] newArray(int size) {
80 return new FaceSensorPropertiesInternal[size];
81 }
82 };
83
84 @Override
85 public int describeContents() {
86 return 0;
87 }
88
89 @Override
90 public void writeToParcel(Parcel dest, int flags) {
91 super.writeToParcel(dest, flags);
92 dest.writeInt(sensorType);
93 dest.writeBoolean(supportsFaceDetection);
94 dest.writeBoolean(supportsSelfIllumination);
95 }
96
97 @Override
98 public String toString() {
99 return "ID: " + sensorId + ", Strength: " + sensorStrength + ", Type: " + sensorType
100 + ", SupportsFaceDetection: " + supportsFaceDetection;
101 }
102 }