1 /* 2 * Copyright (C) 2021 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 com.android.systemui.biometrics; 18 19 import android.annotation.Nullable; 20 import android.view.Surface; 21 22 import com.android.systemui.biometrics.UdfpsHbmTypes.HbmType; 23 24 /** 25 * Interface for controlling the high-brightness mode (HBM). UdfpsView can use this callback to 26 * enable the HBM while showing the fingerprint illumination, and to disable the HBM after the 27 * illumination is no longer necessary. 28 */ 29 public interface UdfpsHbmProvider { 30 31 /** 32 * UdfpsView will call this to enable the HBM when the fingerprint illumination is needed. 33 * 34 * This method is a no-op when some type of HBM is already enabled. 35 * 36 * This method must be called from the UI thread. The callback, if provided, will also be 37 * invoked from the UI thread. 38 * 39 * @param hbmType The type of HBM that should be enabled. See {@link UdfpsHbmTypes}. 40 * @param surface The surface for which the HBM is requested, in case the HBM implementation 41 * needs to set special surface flags to enable the HBM. Can be null. 42 * @param onHbmEnabled A runnable that will be executed once HBM is enabled. 43 */ enableHbm(@bmType int hbmType, @Nullable Surface surface, @Nullable Runnable onHbmEnabled)44 void enableHbm(@HbmType int hbmType, @Nullable Surface surface, 45 @Nullable Runnable onHbmEnabled); 46 47 /** 48 * UdfpsView will call this to disable the HBM when the illumination is not longer needed. 49 * 50 * This method is a no-op when HBM is already disabled. If HBM is enabled, this method will 51 * disable HBM for the {@code hbmType} and {@code surface} that were provided to the 52 * corresponding {@link #enableHbm(int, Surface, Runnable)}. 53 * 54 * The call must be made from the UI thread. The callback, if provided, will also be invoked 55 * from the UI thread. 56 * 57 * @param onHbmDisabled A runnable that will be executed once HBM is disabled. 58 */ disableHbm(@ullable Runnable onHbmDisabled)59 void disableHbm(@Nullable Runnable onHbmDisabled); 60 } 61