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 authenticate(IBinder token, long sessionId, int userId, IFingerprintServiceReceiver receiver, int flags, String opPackageName)31 void authenticate(IBinder token, long sessionId, int userId, 32 IFingerprintServiceReceiver receiver, int flags, String opPackageName); 33 34 // Cancel authentication for the given sessionId cancelAuthentication(IBinder token, String opPackageName)35 void cancelAuthentication(IBinder token, String opPackageName); 36 37 // Start fingerprint enrollment enroll(IBinder token, in byte [] cryptoToken, int groupId, IFingerprintServiceReceiver receiver, int flags, String opPackageName)38 void enroll(IBinder token, in byte [] cryptoToken, int groupId, IFingerprintServiceReceiver receiver, 39 int flags, String opPackageName); 40 41 // Cancel enrollment in progress cancelEnrollment(IBinder token)42 void cancelEnrollment(IBinder token); 43 44 // Any errors resulting from this call will be returned to the listener remove(IBinder token, int fingerId, int groupId, int userId, IFingerprintServiceReceiver receiver)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 rename(int fingerId, int groupId, String name)49 void rename(int fingerId, int groupId, String name); 50 51 // Get a list of enrolled fingerprints in the given group. getEnrolledFingerprints(int groupId, String opPackageName)52 List<Fingerprint> getEnrolledFingerprints(int groupId, String opPackageName); 53 54 // Determine if HAL is loaded and ready isHardwareDetected(long deviceId, String opPackageName)55 boolean isHardwareDetected(long deviceId, String opPackageName); 56 57 // Get a pre-enrollment authentication token preEnroll(IBinder token)58 long preEnroll(IBinder token); 59 60 // Finish an enrollment sequence and invalidate the authentication token postEnroll(IBinder token)61 int postEnroll(IBinder token); 62 63 // Determine if a user has at least one enrolled fingerprint hasEnrolledFingerprints(int groupId, String opPackageName)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 getAuthenticatorId(String opPackageName)73 long getAuthenticatorId(String opPackageName); 74 75 // Reset the timeout when user authenticates with strong auth (e.g. PIN, pattern or password) resetTimeout(in byte [] cryptoToken)76 void resetTimeout(in byte [] cryptoToken); 77 78 // Add a callback which gets notified when the fingerprint lockout period expired. addLockoutResetCallback(IFingerprintServiceLockoutResetCallback callback)79 void addLockoutResetCallback(IFingerprintServiceLockoutResetCallback callback); 80 81 // Explicitly set the active user (for enrolling work profile) setActiveUser(int uid)82 void setActiveUser(int uid); 83 84 // Enumerate all fingerprints enumerate(IBinder token, int userId, IFingerprintServiceReceiver receiver)85 void enumerate(IBinder token, int userId, IFingerprintServiceReceiver receiver); 86 87 // Check if a client request is currently being handled isClientActive()88 boolean isClientActive(); 89 90 // Add a callback which gets notified when the service starts and stops handling client requests addClientActiveCallback(IFingerprintClientActiveCallback callback)91 void addClientActiveCallback(IFingerprintClientActiveCallback callback); 92 93 // Removes a callback set by addClientActiveCallback removeClientActiveCallback(IFingerprintClientActiveCallback callback)94 void removeClientActiveCallback(IFingerprintClientActiveCallback callback); 95 } 96