1 /* 2 * Copyright (C) 2020 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.biometrics; 17 18 import android.hardware.biometrics.SensorPropertiesInternal; 19 20 /** 21 * A test service for FingerprintManager and BiometricManager. 22 * @hide 23 */ 24 interface ITestSession { 25 // Switches the specified sensor to use a test HAL. In this mode, the framework will not invoke 26 // any methods on the real HAL implementation. This allows the framework to test a substantial 27 // portion of the framework code that would otherwise require human interaction. Note that 28 // secure pathways such as HAT/Keystore are not testable, since they depend on the TEE or its 29 // equivalent for the secret key. setTestHalEnabled(boolean enableTestHal)30 void setTestHalEnabled(boolean enableTestHal); 31 32 // Starts the enrollment process. This should generally be used when the test HAL is enabled. startEnroll(int userId)33 void startEnroll(int userId); 34 35 // Finishes the enrollment process. Simulates the HAL's callback. finishEnroll(int userId)36 void finishEnroll(int userId); 37 38 // Simulates a successful authentication, but does not provide a valid HAT. acceptAuthentication(int userId)39 void acceptAuthentication(int userId); 40 41 // Simulates a rejected attempt. rejectAuthentication(int userId)42 void rejectAuthentication(int userId); 43 44 // Simulates an acquired message from the HAL. notifyAcquired(int userId, int acquireInfo)45 void notifyAcquired(int userId, int acquireInfo); 46 47 // Simulates an error message from the HAL. notifyError(int userId, int errorCode)48 void notifyError(int userId, int errorCode); 49 50 // Matches the framework's cached enrollments against the HAL's enrollments. Any enrollment 51 // that isn't known by both sides are deleted. This should generally be used when the test 52 // HAL is disabled (e.g. to clean up after a test). cleanupInternalState(int userId)53 void cleanupInternalState(int userId); 54 } 55