Merge "Remove unnecessary arguments from disableHbm" into sc-dev

This commit is contained in:
Ilya Matyukhin
2021-06-05 00:43:01 +00:00
committed by Android (Google) Code Review
2 changed files with 12 additions and 9 deletions

View File

@@ -31,8 +31,10 @@ public interface UdfpsHbmProvider {
/** /**
* UdfpsView will call this to enable the HBM when the fingerprint illumination is needed. * UdfpsView will call this to enable the HBM when the fingerprint illumination is needed.
* *
* The call must be made from the UI thread. The callback, if provided, will also be invoked * This method is a no-op when some type of HBM is already enabled.
* from the UI thread. *
* This method must be called from the UI thread. The callback, if provided, will also be
* invoked from the UI thread.
* *
* @param hbmType The type of HBM that should be enabled. See {@link UdfpsHbmTypes}. * @param hbmType The type of HBM that should be enabled. See {@link UdfpsHbmTypes}.
* @param surface The surface for which the HBM is requested, in case the HBM implementation * @param surface The surface for which the HBM is requested, in case the HBM implementation
@@ -45,14 +47,14 @@ public interface UdfpsHbmProvider {
/** /**
* UdfpsView will call this to disable the HBM when the illumination is not longer needed. * UdfpsView will call this to disable the HBM when the illumination is not longer needed.
* *
* This method is a no-op when HBM is already disabled. If HBM is enabled, this method will
* disable HBM for the {@code hbmType} and {@code surface} that were provided to the
* corresponding {@link #enableHbm(int, Surface, Runnable)}.
*
* The call must be made from the UI thread. The callback, if provided, will also be invoked * The call must be made from the UI thread. The callback, if provided, will also be invoked
* from the UI thread. * from the UI thread.
* *
* @param hbmType The type of HBM that should be disabled. See {@link UdfpsHbmTypes}.
* @param surface The surface for which the HBM is requested, in case the HBM implementation
* needs to unset special surface flags to disable the HBM. Can be null.
* @param onHbmDisabled A runnable that will be executed once HBM is disabled. * @param onHbmDisabled A runnable that will be executed once HBM is disabled.
*/ */
void disableHbm(@HbmType int hbmType, @Nullable Surface surface, void disableHbm(@Nullable Runnable onHbmDisabled);
@Nullable Runnable onHbmDisabled);
} }

View File

@@ -124,8 +124,9 @@ public class UdfpsSurfaceView extends SurfaceView implements UdfpsIlluminator {
@Override @Override
public void stopIllumination() { public void stopIllumination() {
if (mHbmProvider != null) { if (mHbmProvider != null) {
final Runnable onHbmDisabled = this::invalidate; final Runnable onHbmDisabled =
mHbmProvider.disableHbm(mHbmType, mHolder.getSurface(), onHbmDisabled); (mHbmType == UdfpsHbmTypes.GLOBAL_HBM) ? this::invalidate : null;
mHbmProvider.disableHbm(onHbmDisabled);
} else { } else {
Log.e(TAG, "stopIllumination | mHbmProvider is null"); Log.e(TAG, "stopIllumination | mHbmProvider is null");
} }