Debian Codegraph @

core/java/android/hardware/face/FaceSensorProperties.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.IntDef;
20 import android.annotation.NonNull;
21 import android.hardware.biometrics.ComponentInfoInternal;
22 import android.hardware.biometrics.SensorProperties;
23
24 import java.lang.annotation.Retention;
25 import java.lang.annotation.RetentionPolicy;
26 import java.util.ArrayList;
27 import java.util.List;
28
29 /**
30 * Container for face sensor properties.
31 * @hide
32 */
33 public class FaceSensorProperties extends SensorProperties {
34 /**
35 * @hide
36 */
37 public static final int TYPE_UNKNOWN = 0;
38
39 /**
40 * @hide
41 */
42 public static final int TYPE_RGB = 1;
43
44 /**
45 * @hide
46 */
47 public static final int TYPE_IR = 2;
48
49 /**
50 * @hide
51 */
52 @IntDef({TYPE_UNKNOWN,
53 TYPE_RGB,
54 TYPE_IR})
55 @Retention(RetentionPolicy.SOURCE)
56 public @interface SensorType {}
57
58 @FaceSensorProperties.SensorType
59 final int mSensorType;
60
61 /**
62 * @hide
63 */
64 public static FaceSensorProperties from(FaceSensorPropertiesInternal internalProp) {
65 final List<ComponentInfo> componentInfo = new ArrayList<>();
66 for (ComponentInfoInternal internalComp : internalProp.componentInfo) {
67 componentInfo.add(ComponentInfo.from(internalComp));
68 }
69 return new FaceSensorProperties(internalProp.sensorId,
70 internalProp.sensorStrength,
71 componentInfo,
72 internalProp.sensorType);
73 }
74 /**
75 * @hide
76 */
77 public FaceSensorProperties(int sensorId, int sensorStrength,
78 @NonNull List<ComponentInfo> componentInfo,
79 @FaceSensorProperties.SensorType int sensorType) {
80 super(sensorId, sensorStrength, componentInfo);
81 mSensorType = sensorType;
82 }
83
84 /**
85 * @hide
86 * @return The sensor's type.
87 */
88 @FaceSensorProperties.SensorType
89 public int getSensorType() {
90 return mSensorType;
91 }
92 }