1 /* 2 * Copyright (C) 2019 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 17 package android.hardware.biometrics; 18 19 import android.os.Bundle; 20 import android.hardware.biometrics.IBiometricEnabledOnKeyguardCallback; 21 import android.hardware.biometrics.IBiometricServiceReceiver; 22 23 /** 24 * Communication channel from BiometricPrompt and BiometricManager to AuthService. The 25 * interface does not expose specific biometric modalities. The system will use the default 26 * biometric for apps. On devices with more than one, the choice is dictated by user preference in 27 * Settings. 28 * @hide 29 */ 30 interface IAuthService { 31 // Requests authentication. The service choose the appropriate biometric to use, and show 32 // the corresponding BiometricDialog. authenticate(IBinder token, long sessionId, int userId, IBiometricServiceReceiver receiver, String opPackageName, in Bundle bundle)33 void authenticate(IBinder token, long sessionId, int userId, 34 IBiometricServiceReceiver receiver, String opPackageName, in Bundle bundle); 35 36 // Cancel authentication for the given sessionId cancelAuthentication(IBinder token, String opPackageName)37 void cancelAuthentication(IBinder token, String opPackageName); 38 39 // TODO(b/141025588): Make userId the first arg to be consistent with hasEnrolledBiometrics. 40 // Checks if biometrics can be used. canAuthenticate(String opPackageName, int userId, int authenticators)41 int canAuthenticate(String opPackageName, int userId, int authenticators); 42 43 // Checks if any biometrics are enrolled. hasEnrolledBiometrics(int userId, String opPackageName)44 boolean hasEnrolledBiometrics(int userId, String opPackageName); 45 46 // Register callback for when keyguard biometric eligibility changes. registerEnabledOnKeyguardCallback(IBiometricEnabledOnKeyguardCallback callback)47 void registerEnabledOnKeyguardCallback(IBiometricEnabledOnKeyguardCallback callback); 48 49 // Explicitly set the active user. setActiveUser(int userId)50 void setActiveUser(int userId); 51 52 // Reset the lockout when user authenticates with strong auth (e.g. PIN, pattern or password) resetLockout(in byte [] token)53 void resetLockout(in byte [] token); 54 55 // Get a list of AuthenticatorIDs for authenticators which have enrolled templates and meet 56 // the requirements for integrating with Keystore. The AuthenticatorID are known in Keystore 57 // land as SIDs, and are used during key generation. getAuthenticatorIds()58 long[] getAuthenticatorIds(); 59 } 60