Jim Miller | 9f0753f | 2015-03-23 23:59:22 -0700 | [diff] [blame] | 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 | */ |
Jim Miller | ebbf205 | 2015-03-31 17:24:34 -0700 | [diff] [blame] | 16 | package android.hardware.fingerprint; |
Jim Miller | 9f0753f | 2015-03-23 23:59:22 -0700 | [diff] [blame] | 17 | |
Kevin Chyn | 6668256 | 2018-01-25 18:26:46 -0800 | [diff] [blame] | 18 | import android.hardware.biometrics.BiometricAuthenticator; |
Jim Miller | 9f0753f | 2015-03-23 23:59:22 -0700 | [diff] [blame] | 19 | import android.os.Parcel; |
| 20 | import android.os.Parcelable; |
| 21 | |
| 22 | /** |
| 23 | * Container for fingerprint metadata. |
| 24 | * @hide |
| 25 | */ |
Kevin Chyn | a56dff7 | 2018-06-19 18:41:12 -0700 | [diff] [blame] | 26 | public final class Fingerprint extends BiometricAuthenticator.Identifier { |
Jim Miller | 9f0753f | 2015-03-23 23:59:22 -0700 | [diff] [blame] | 27 | private int mGroupId; |
Jim Miller | 9f0753f | 2015-03-23 23:59:22 -0700 | [diff] [blame] | 28 | |
| 29 | public Fingerprint(CharSequence name, int groupId, int fingerId, long deviceId) { |
Kevin Chyn | a56dff7 | 2018-06-19 18:41:12 -0700 | [diff] [blame] | 30 | super(name, fingerId, deviceId); |
Jim Miller | 9f0753f | 2015-03-23 23:59:22 -0700 | [diff] [blame] | 31 | mGroupId = groupId; |
Jim Miller | 9f0753f | 2015-03-23 23:59:22 -0700 | [diff] [blame] | 32 | } |
| 33 | |
| 34 | private Fingerprint(Parcel in) { |
Kevin Chyn | a56dff7 | 2018-06-19 18:41:12 -0700 | [diff] [blame] | 35 | super(in.readString(), in.readInt(), in.readLong()); |
Jim Miller | 9f0753f | 2015-03-23 23:59:22 -0700 | [diff] [blame] | 36 | mGroupId = in.readInt(); |
Jim Miller | 9f0753f | 2015-03-23 23:59:22 -0700 | [diff] [blame] | 37 | } |
| 38 | |
| 39 | /** |
Jim Miller | 9f0753f | 2015-03-23 23:59:22 -0700 | [diff] [blame] | 40 | * Gets the group id specified when the fingerprint was enrolled. |
| 41 | * @return group id for the set of fingerprints this one belongs to. |
Jim Miller | 9f0753f | 2015-03-23 23:59:22 -0700 | [diff] [blame] | 42 | */ |
Kevin Chyn | a56dff7 | 2018-06-19 18:41:12 -0700 | [diff] [blame] | 43 | public int getGroupId() { |
| 44 | return mGroupId; |
| 45 | } |
Jim Miller | 9f0753f | 2015-03-23 23:59:22 -0700 | [diff] [blame] | 46 | |
| 47 | public int describeContents() { |
| 48 | return 0; |
| 49 | } |
| 50 | |
| 51 | public void writeToParcel(Parcel out, int flags) { |
Kevin Chyn | a56dff7 | 2018-06-19 18:41:12 -0700 | [diff] [blame] | 52 | out.writeString(getName().toString()); |
| 53 | out.writeInt(getBiometricId()); |
| 54 | out.writeLong(getDeviceId()); |
Jim Miller | 9f0753f | 2015-03-23 23:59:22 -0700 | [diff] [blame] | 55 | out.writeInt(mGroupId); |
Jim Miller | 9f0753f | 2015-03-23 23:59:22 -0700 | [diff] [blame] | 56 | } |
| 57 | |
Jeff Sharkey | 9e8f83d | 2019-02-28 12:06:45 -0700 | [diff] [blame^] | 58 | public static final @android.annotation.NonNull Parcelable.Creator<Fingerprint> CREATOR |
Jim Miller | 9f0753f | 2015-03-23 23:59:22 -0700 | [diff] [blame] | 59 | = new Parcelable.Creator<Fingerprint>() { |
| 60 | public Fingerprint createFromParcel(Parcel in) { |
| 61 | return new Fingerprint(in); |
| 62 | } |
| 63 | |
| 64 | public Fingerprint[] newArray(int size) { |
| 65 | return new Fingerprint[size]; |
| 66 | } |
| 67 | }; |
| 68 | }; |