| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 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 |
|
| 31 |
|
| 32 |
|
| 33 |
public class FaceSensorProperties extends SensorProperties { |
| 34 |
|
| 35 |
|
| 36 |
|
| 37 |
public static final int TYPE_UNKNOWN = 0; |
| 38 |
|
| 39 |
|
| 40 |
|
| 41 |
|
| 42 |
public static final int TYPE_RGB = 1; |
| 43 |
|
| 44 |
|
| 45 |
|
| 46 |
|
| 47 |
public static final int TYPE_IR = 2; |
| 48 |
|
| 49 |
|
| 50 |
|
| 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 |
|
| 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 |
|
| 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 |
|
| 86 |
|
| 87 |
|
| 88 |
@FaceSensorProperties.SensorType |
| 89 |
public int getSensorType() { |
| 90 |
return mSensorType; |
| 91 |
} |
| 92 |
} |