1 /* 2 * Copyright (C) 2014 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.os.Bundle; 19 import android.hardware.fingerprint.IFingerprintServiceReceiver; 20 import android.hardware.fingerprint.IFingerprintServiceLockoutResetCallback; 21 import android.hardware.fingerprint.Fingerprint; 22 import java.util.List; 23 24 /** 25 * Communication channel from client to the fingerprint service. 26 * @hide 27 */ 28 interface IFingerprintService { 29 // Authenticate the given sessionId with a fingerprint 30 void authenticate(IBinder token, long sessionId, int userId, 31 IFingerprintServiceReceiver receiver, int flags, String opPackageName); 32 33 // Cancel authentication for the given sessionId 34 void cancelAuthentication(IBinder token, String opPackageName); 35 36 // Start fingerprint enrollment 37 void enroll(IBinder token, in byte [] cryptoToken, int groupId, IFingerprintServiceReceiver receiver, 38 int flags, String opPackageName); 39 40 // Cancel enrollment in progress 41 void cancelEnrollment(IBinder token); 42 43 // Any errors resulting from this call will be returned to the listener 44 void remove(IBinder token, int fingerId, int groupId, int userId, 45 IFingerprintServiceReceiver receiver); 46 47 // Rename the fingerprint specified by fingerId and groupId to the given name 48 void rename(int fingerId, int groupId, String name); 49 50 // Get a list of enrolled fingerprints in the given group. 51 List<Fingerprint> getEnrolledFingerprints(int groupId, String opPackageName); 52 53 // Determine if HAL is loaded and ready 54 boolean isHardwareDetected(long deviceId, String opPackageName); 55 56 // Get a pre-enrollment authentication token 57 long preEnroll(IBinder token); 58 59 // Finish an enrollment sequence and invalidate the authentication token 60 int postEnroll(IBinder token); 61 62 // Determine if a user has at least one enrolled fingerprint 63 boolean hasEnrolledFingerprints(int groupId, String opPackageName); 64 65 // Gets the number of hardware devices 66 // int getHardwareDeviceCount(); 67 68 // Gets the unique device id for hardware enumerated at i 69 // long getHardwareDevice(int i); 70 71 // Gets the authenticator ID for fingerprint 72 long getAuthenticatorId(String opPackageName); 73 74 // Reset the timeout when user authenticates with strong auth (e.g. PIN, pattern or password) 75 void resetTimeout(in byte [] cryptoToken); 76 77 // Add a callback which gets notified when the fingerprint lockout period expired. 78 void addLockoutResetCallback(IFingerprintServiceLockoutResetCallback callback); 79 80 // Explicitly set the active user (for enrolling work profile) 81 void setActiveUser(int uid); 82 } 83