| 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.annotation.Nullable; |
| 21 |
import android.graphics.Rect; |
| 22 |
import android.os.Parcel; |
| 23 |
import android.os.Parcelable; |
| 24 |
|
| 25 |
|
| 26 |
|
| 27 |
|
| 28 |
|
| 29 |
|
| 30 |
|
| 31 |
|
| 32 |
public class SensorLocationInternal implements Parcelable { |
| 33 |
|
| 34 |
|
| 35 |
public static final SensorLocationInternal DEFAULT = new SensorLocationInternal("", 0, 0, 0); |
| 36 |
|
| 37 |
|
| 38 |
|
| 39 |
|
| 40 |
@NonNull |
| 41 |
public final String displayId; |
| 42 |
|
| 43 |
|
| 44 |
|
| 45 |
|
| 46 |
|
| 47 |
|
| 48 |
public final int sensorLocationX; |
| 49 |
|
| 50 |
|
| 51 |
|
| 52 |
|
| 53 |
|
| 54 |
|
| 55 |
|
| 56 |
public final int sensorLocationY; |
| 57 |
|
| 58 |
|
| 59 |
|
| 60 |
|
| 61 |
|
| 62 |
|
| 63 |
public final int sensorRadius; |
| 64 |
|
| 65 |
public SensorLocationInternal(@Nullable String displayId, |
| 66 |
int sensorLocationX, int sensorLocationY, int sensorRadius) { |
| 67 |
this.displayId = displayId != null ? displayId : ""; |
| 68 |
this.sensorLocationX = sensorLocationX; |
| 69 |
this.sensorLocationY = sensorLocationY; |
| 70 |
this.sensorRadius = sensorRadius; |
| 71 |
} |
| 72 |
|
| 73 |
protected SensorLocationInternal(Parcel in) { |
| 74 |
displayId = in.readString16NoHelper(); |
| 75 |
sensorLocationX = in.readInt(); |
| 76 |
sensorLocationY = in.readInt(); |
| 77 |
sensorRadius = in.readInt(); |
| 78 |
} |
| 79 |
|
| 80 |
@Override |
| 81 |
public void writeToParcel(Parcel dest, int flags) { |
| 82 |
dest.writeString(displayId); |
| 83 |
dest.writeInt(sensorLocationX); |
| 84 |
dest.writeInt(sensorLocationY); |
| 85 |
dest.writeInt(sensorRadius); |
| 86 |
} |
| 87 |
|
| 88 |
@Override |
| 89 |
public int describeContents() { |
| 90 |
return 0; |
| 91 |
} |
| 92 |
|
| 93 |
public static final Creator<SensorLocationInternal> CREATOR = |
| 94 |
new Creator<SensorLocationInternal>() { |
| 95 |
@Override |
| 96 |
public SensorLocationInternal createFromParcel(Parcel in) { |
| 97 |
return new SensorLocationInternal(in); |
| 98 |
} |
| 99 |
|
| 100 |
@Override |
| 101 |
public SensorLocationInternal[] newArray(int size) { |
| 102 |
return new SensorLocationInternal[size]; |
| 103 |
} |
| 104 |
}; |
| 105 |
|
| 106 |
@Override |
| 107 |
public String toString() { |
| 108 |
return "[id: " + displayId |
| 109 |
+ ", x: " + sensorLocationX |
| 110 |
+ ", y: " + sensorLocationY |
| 111 |
+ ", r: " + sensorRadius + "]"; |
| 112 |
} |
| 113 |
|
| 114 |
|
| 115 |
public Rect getRect() { |
| 116 |
return new Rect(sensorLocationX - sensorRadius, |
| 117 |
sensorLocationY - sensorRadius, |
| 118 |
sensorLocationX + sensorRadius, |
| 119 |
sensorLocationY + sensorRadius); |
| 120 |
} |
| 121 |
} |