1 /* 2 * Copyright (C) 2015 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 package android.hardware.fingerprint; 17 18 import android.hardware.biometrics.BiometricAuthenticator; 19 import android.os.Parcel; 20 import android.os.Parcelable; 21 22 /** 23 * Container for fingerprint metadata. 24 * @hide 25 */ 26 public final class Fingerprint extends BiometricAuthenticator.BiometricIdentifier { 27 private CharSequence mName; 28 private int mGroupId; 29 private int mFingerId; 30 private long mDeviceId; // physical device this is associated with 31 32 public Fingerprint(CharSequence name, int groupId, int fingerId, long deviceId) { 33 mName = name; 34 mGroupId = groupId; 35 mFingerId = fingerId; 36 mDeviceId = deviceId; 37 } 38 39 private Fingerprint(Parcel in) { 40 mName = in.readString(); 41 mGroupId = in.readInt(); 42 mFingerId = in.readInt(); 43 mDeviceId = in.readLong(); 44 } 45 46 /** 47 * Gets the human-readable name for the given fingerprint. 48 * @return name given to finger 49 */ 50 public CharSequence getName() { return mName; } 51 52 /** 53 * Gets the device-specific finger id. Used by Settings to map a name to a specific 54 * fingerprint template. 55 * @return device-specific id for this finger 56 * @hide 57 */ 58 public int getFingerId() { return mFingerId; } 59 60 /** 61 * Gets the group id specified when the fingerprint was enrolled. 62 * @return group id for the set of fingerprints this one belongs to. 63 * @hide 64 */ 65 public int getGroupId() { return mGroupId; } 66 67 /** 68 * Device this fingerprint belongs to. 69 * @hide 70 */ 71 public long getDeviceId() { return mDeviceId; } 72 73 public int describeContents() { 74 return 0; 75 } 76 77 public void writeToParcel(Parcel out, int flags) { 78 out.writeString(mName.toString()); 79 out.writeInt(mGroupId); 80 out.writeInt(mFingerId); 81 out.writeLong(mDeviceId); 82 } 83 84 public static final Parcelable.Creator<Fingerprint> CREATOR 85 = new Parcelable.Creator<Fingerprint>() { 86 public Fingerprint createFromParcel(Parcel in) { 87 return new Fingerprint(in); 88 } 89 90 public Fingerprint[] newArray(int size) { 91 return new Fingerprint[size]; 92 } 93 }; 94 };