| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 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 |
|
| 28 |
|
| 29 |
|
| 30 |
|
| 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 |
} |