| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
package android.hardware.fingerprint; |
| 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 FingerprintSensorProperties extends SensorProperties { |
| 34 |
|
| 35 |
|
| 36 |
|
| 37 |
public static final int TYPE_UNKNOWN = 0; |
| 38 |
|
| 39 |
|
| 40 |
|
| 41 |
|
| 42 |
public static final int TYPE_REAR = 1; |
| 43 |
|
| 44 |
|
| 45 |
|
| 46 |
|
| 47 |
public static final int TYPE_UDFPS_ULTRASONIC = 2; |
| 48 |
|
| 49 |
|
| 50 |
|
| 51 |
|
| 52 |
public static final int TYPE_UDFPS_OPTICAL = 3; |
| 53 |
|
| 54 |
|
| 55 |
|
| 56 |
|
| 57 |
public static final int TYPE_POWER_BUTTON = 4; |
| 58 |
|
| 59 |
|
| 60 |
|
| 61 |
|
| 62 |
public static final int TYPE_HOME_BUTTON = 5; |
| 63 |
|
| 64 |
|
| 65 |
|
| 66 |
|
| 67 |
@IntDef({TYPE_UNKNOWN, |
| 68 |
TYPE_REAR, |
| 69 |
TYPE_UDFPS_ULTRASONIC, |
| 70 |
TYPE_UDFPS_OPTICAL, |
| 71 |
TYPE_POWER_BUTTON, |
| 72 |
TYPE_HOME_BUTTON}) |
| 73 |
@Retention(RetentionPolicy.SOURCE) |
| 74 |
public @interface SensorType {} |
| 75 |
|
| 76 |
@SensorType final int mSensorType; |
| 77 |
|
| 78 |
|
| 79 |
|
| 80 |
|
| 81 |
|
| 82 |
public static FingerprintSensorProperties from( |
| 83 |
FingerprintSensorPropertiesInternal internalProp) { |
| 84 |
final List<ComponentInfo> componentInfo = new ArrayList<>(); |
| 85 |
for (ComponentInfoInternal internalComp : internalProp.componentInfo) { |
| 86 |
componentInfo.add(ComponentInfo.from(internalComp)); |
| 87 |
} |
| 88 |
return new FingerprintSensorProperties(internalProp.sensorId, |
| 89 |
internalProp.sensorStrength, |
| 90 |
componentInfo, |
| 91 |
internalProp.sensorType); |
| 92 |
} |
| 93 |
|
| 94 |
|
| 95 |
|
| 96 |
|
| 97 |
public FingerprintSensorProperties(int sensorId, int sensorStrength, |
| 98 |
@NonNull List<ComponentInfo> componentInfo, @SensorType int sensorType) { |
| 99 |
super(sensorId, sensorStrength, componentInfo); |
| 100 |
mSensorType = sensorType; |
| 101 |
} |
| 102 |
|
| 103 |
|
| 104 |
|
| 105 |
|
| 106 |
|
| 107 |
@SensorType |
| 108 |
public int getSensorType() { |
| 109 |
return mSensorType; |
| 110 |
} |
| 111 |
} |