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