Debian Codegraph @

core/java/android/hardware/biometrics/SensorPropertiesInternal.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.biometrics;
18
19 import android.annotation.NonNull;
20 import android.os.Parcel;
21 import android.os.Parcelable;
22
23 import java.util.ArrayList;
24 import java.util.List;
25
26 /**
27 * The base class containing all modality-agnostic information. This is a superset of the
28 * {@link android.hardware.biometrics.common.CommonProps}, and provides backwards-compatible
29 * behavior with the older generation of HIDL (non-AIDL) interfaces.
30 * @hide
31 */
32 public class SensorPropertiesInternal implements Parcelable {
33
34 public final int sensorId;
35 @SensorProperties.Strength public final int sensorStrength;
36 public final int maxEnrollmentsPerUser;
37 @NonNull public final List<ComponentInfoInternal> componentInfo;
38 public final boolean resetLockoutRequiresHardwareAuthToken;
39 public final boolean resetLockoutRequiresChallenge;
40
41 public static SensorPropertiesInternal from(@NonNull SensorPropertiesInternal prop) {
42 return new SensorPropertiesInternal(prop.sensorId, prop.sensorStrength,
43 prop.maxEnrollmentsPerUser, prop.componentInfo,
44 prop.resetLockoutRequiresHardwareAuthToken, prop.resetLockoutRequiresChallenge);
45 }
46
47 public SensorPropertiesInternal(int sensorId, @SensorProperties.Strength int sensorStrength,
48 int maxEnrollmentsPerUser, @NonNull List<ComponentInfoInternal> componentInfo,
49 boolean resetLockoutRequiresHardwareAuthToken, boolean resetLockoutRequiresChallenge) {
50 this.sensorId = sensorId;
51 this.sensorStrength = sensorStrength;
52 this.maxEnrollmentsPerUser = maxEnrollmentsPerUser;
53 this.componentInfo = componentInfo;
54 this.resetLockoutRequiresHardwareAuthToken = resetLockoutRequiresHardwareAuthToken;
55 this.resetLockoutRequiresChallenge = resetLockoutRequiresChallenge;
56 }
57
58 protected SensorPropertiesInternal(Parcel in) {
59 sensorId = in.readInt();
60 sensorStrength = in.readInt();
61 maxEnrollmentsPerUser = in.readInt();
62 componentInfo = new ArrayList<>();
63 in.readList(componentInfo, ComponentInfoInternal.class.getClassLoader(), android.hardware.biometrics.ComponentInfoInternal.class);
64 resetLockoutRequiresHardwareAuthToken = in.readBoolean();
65 resetLockoutRequiresChallenge = in.readBoolean();
66 }
67
68 public static final Creator<SensorPropertiesInternal> CREATOR =
69 new Creator<SensorPropertiesInternal>() {
70 @Override
71 public SensorPropertiesInternal createFromParcel(Parcel in) {
72 return new SensorPropertiesInternal(in);
73 }
74
75 @Override
76 public SensorPropertiesInternal[] newArray(int size) {
77 return new SensorPropertiesInternal[size];
78 }
79 };
80
81 @Override
82 public int describeContents() {
83 return 0;
84 }
85
86 @Override
87 public void writeToParcel(Parcel dest, int flags) {
88 dest.writeInt(sensorId);
89 dest.writeInt(sensorStrength);
90 dest.writeInt(maxEnrollmentsPerUser);
91 dest.writeList(componentInfo);
92 dest.writeBoolean(resetLockoutRequiresHardwareAuthToken);
93 dest.writeBoolean(resetLockoutRequiresChallenge);
94 }
95
96 @Override
97 public String toString() {
98 final StringBuilder sb = new StringBuilder();
99 sb.append("[ ");
100 for (ComponentInfoInternal info : componentInfo) {
101 sb.append("[").append(info.toString());
102 sb.append("] ");
103 }
104 sb.append("]");
105
106 return "ID: " + sensorId + ", Strength: " + sensorStrength
107 + ", MaxEnrollmentsPerUser: " + maxEnrollmentsPerUser
108 + ", ComponentInfo: " + sb.toString();
109 }
110 }