diff options
| author | 2022-09-28 23:08:47 +0000 | |
|---|---|---|
| committer | 2022-10-27 00:49:19 +0000 | |
| commit | 957309aee1a16b8dcd9e72fd072ff05bcd24f28c (patch) | |
| tree | c321d050bdbd5b4104d8a421a12fce1621aeafee | |
| parent | 3c84cadaf928eeda4fa43280b078021cd9245cfd (diff) | |
Add new UdfpsOverlay to SensorOverlays
Test: N/A
Bug: 252897742
Change-Id: I8b652b4f28cf5e5802a3251e85a979472162d227
23 files changed, 307 insertions, 103 deletions
diff --git a/core/java/android/hardware/fingerprint/FingerprintManager.java b/core/java/android/hardware/fingerprint/FingerprintManager.java index 5403f089b308..3c73eb697a69 100644 --- a/core/java/android/hardware/fingerprint/FingerprintManager.java +++ b/core/java/android/hardware/fingerprint/FingerprintManager.java @@ -918,6 +918,22 @@ public class FingerprintManager implements BiometricAuthenticator, BiometricFing } } + /** + * @hide + */ + @RequiresPermission(USE_BIOMETRIC_INTERNAL) + public void setUdfpsOverlay(@NonNull IUdfpsOverlay controller) { + if (mService == null) { + Slog.w(TAG, "setUdfpsOverlay: no fingerprint service"); + return; + } + + try { + mService.setUdfpsOverlay(controller); + } catch (RemoteException e) { + throw e.rethrowFromSystemServer(); + } + } /** * Forwards BiometricStateListener to FingerprintService diff --git a/core/java/android/hardware/fingerprint/IFingerprintService.aidl b/core/java/android/hardware/fingerprint/IFingerprintService.aidl index 051e3a4caa4e..365a6b3e06e5 100644 --- a/core/java/android/hardware/fingerprint/IFingerprintService.aidl +++ b/core/java/android/hardware/fingerprint/IFingerprintService.aidl @@ -26,6 +26,7 @@ import android.hardware.fingerprint.IFingerprintAuthenticatorsRegisteredCallback import android.hardware.fingerprint.IFingerprintServiceReceiver; import android.hardware.fingerprint.IUdfpsOverlayController; import android.hardware.fingerprint.ISidefpsController; +import android.hardware.fingerprint.IUdfpsOverlay; import android.hardware.fingerprint.Fingerprint; import android.hardware.fingerprint.FingerprintSensorPropertiesInternal; import java.util.List; @@ -201,6 +202,10 @@ interface IFingerprintService { @EnforcePermission("USE_BIOMETRIC_INTERNAL") void setSidefpsController(in ISidefpsController controller); + // Sets the controller for managing the UDFPS overlay. + @EnforcePermission("USE_BIOMETRIC_INTERNAL") + void setUdfpsOverlay(in IUdfpsOverlay controller); + // Registers BiometricStateListener. @EnforcePermission("USE_BIOMETRIC_INTERNAL") void registerBiometricStateListener(IBiometricStateListener listener); diff --git a/core/java/android/hardware/fingerprint/IUdfpsOverlay.aidl b/core/java/android/hardware/fingerprint/IUdfpsOverlay.aidl new file mode 100644 index 000000000000..c99fcccc68ea --- /dev/null +++ b/core/java/android/hardware/fingerprint/IUdfpsOverlay.aidl @@ -0,0 +1,29 @@ +/* + * Copyright (C) 2022 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package android.hardware.fingerprint; + +/** + * Interface for interacting with the under-display fingerprint sensor (UDFPS) overlay. + * @hide + */ +oneway interface IUdfpsOverlay { + // Shows the overlay. + void show(long requestId, int sensorId, int reason); + + // Hides the overlay. + void hide(int sensorId); +} diff --git a/packages/SystemUI/src/com/android/systemui/biometrics/UdfpsController.java b/packages/SystemUI/src/com/android/systemui/biometrics/UdfpsController.java index 3273d7429d49..b0e612530fb3 100644 --- a/packages/SystemUI/src/com/android/systemui/biometrics/UdfpsController.java +++ b/packages/SystemUI/src/com/android/systemui/biometrics/UdfpsController.java @@ -60,6 +60,8 @@ import com.android.systemui.dagger.SysUISingleton; import com.android.systemui.dagger.qualifiers.Main; import com.android.systemui.doze.DozeReceiver; import com.android.systemui.dump.DumpManager; +import com.android.systemui.flags.FeatureFlags; +import com.android.systemui.flags.Flags; import com.android.systemui.keyguard.ScreenLifecycle; import com.android.systemui.plugins.FalsingManager; import com.android.systemui.plugins.statusbar.StatusBarStateController; @@ -119,6 +121,7 @@ public class UdfpsController implements DozeReceiver { @NonNull private final SystemUIDialogManager mDialogManager; @NonNull private final KeyguardUpdateMonitor mKeyguardUpdateMonitor; @NonNull private final VibratorHelper mVibrator; + @NonNull private final FeatureFlags mFeatureFlags; @NonNull private final FalsingManager mFalsingManager; @NonNull private final PowerManager mPowerManager; @NonNull private final AccessibilityManager mAccessibilityManager; @@ -202,6 +205,10 @@ public class UdfpsController implements DozeReceiver { @Override public void showUdfpsOverlay(long requestId, int sensorId, int reason, @NonNull IUdfpsOverlayControllerCallback callback) { + if (mFeatureFlags.isEnabled(Flags.NEW_UDFPS_OVERLAY)) { + return; + } + mFgExecutor.execute(() -> UdfpsController.this.showUdfpsOverlay( new UdfpsControllerOverlay(mContext, mFingerprintManager, mInflater, mWindowManager, mAccessibilityManager, mStatusBarStateController, @@ -217,6 +224,10 @@ public class UdfpsController implements DozeReceiver { @Override public void hideUdfpsOverlay(int sensorId) { + if (mFeatureFlags.isEnabled(Flags.NEW_UDFPS_OVERLAY)) { + return; + } + mFgExecutor.execute(() -> { if (mKeyguardUpdateMonitor.isFingerprintDetectionRunning()) { // if we get here, we expect keyguardUpdateMonitor's fingerprintRunningState @@ -590,6 +601,7 @@ public class UdfpsController implements DozeReceiver { @NonNull StatusBarKeyguardViewManager statusBarKeyguardViewManager, @NonNull DumpManager dumpManager, @NonNull KeyguardUpdateMonitor keyguardUpdateMonitor, + @NonNull FeatureFlags featureFlags, @NonNull FalsingManager falsingManager, @NonNull PowerManager powerManager, @NonNull AccessibilityManager accessibilityManager, @@ -625,6 +637,7 @@ public class UdfpsController implements DozeReceiver { mDumpManager = dumpManager; mDialogManager = dialogManager; mKeyguardUpdateMonitor = keyguardUpdateMonitor; + mFeatureFlags = featureFlags; mFalsingManager = falsingManager; mPowerManager = powerManager; mAccessibilityManager = accessibilityManager; diff --git a/packages/SystemUI/src/com/android/systemui/biometrics/UdfpsOverlay.kt b/packages/SystemUI/src/com/android/systemui/biometrics/UdfpsOverlay.kt index 57652dc44aa6..142642a2411f 100644 --- a/packages/SystemUI/src/com/android/systemui/biometrics/UdfpsOverlay.kt +++ b/packages/SystemUI/src/com/android/systemui/biometrics/UdfpsOverlay.kt @@ -21,22 +21,25 @@ import android.content.Context import android.graphics.PixelFormat import android.graphics.Point import android.graphics.Rect +import android.hardware.biometrics.BiometricOverlayConstants import android.hardware.fingerprint.FingerprintManager import android.hardware.fingerprint.FingerprintSensorPropertiesInternal import android.hardware.fingerprint.IFingerprintAuthenticatorsRegisteredCallback +import android.hardware.fingerprint.IUdfpsOverlay import android.os.Handler +import android.provider.Settings import android.view.MotionEvent -import android.view.View import android.view.WindowManager import android.view.WindowManager.LayoutParams.INPUT_FEATURE_SPY import com.android.keyguard.KeyguardUpdateMonitor import com.android.systemui.CoreStartable import com.android.systemui.dagger.SysUISingleton +import com.android.systemui.dagger.qualifiers.Main import com.android.systemui.flags.FeatureFlags import com.android.systemui.flags.Flags import com.android.systemui.util.concurrency.DelayableExecutor import com.android.systemui.util.concurrency.Execution -import java.util.* +import java.util.Optional import java.util.concurrent.Executor import javax.inject.Inject import kotlin.math.cos @@ -45,8 +48,10 @@ import kotlin.math.sin private const val TAG = "UdfpsOverlay" +const val SETTING_OVERLAY_DEBUG = "udfps_overlay_debug" + // Number of sensor points needed inside ellipse for good overlap -private const val NEEDED_POINTS = 3 +private const val NEEDED_POINTS = 2 @SuppressLint("ClickableViewAccessibility") @SysUISingleton @@ -60,7 +65,7 @@ constructor( private val handler: Handler, private val biometricExecutor: Executor, private val alternateTouchProvider: Optional<AlternateUdfpsTouchProvider>, - private val fgExecutor: DelayableExecutor, + @Main private val fgExecutor: DelayableExecutor, private val keyguardUpdateMonitor: KeyguardUpdateMonitor, private val authController: AuthController, private val udfpsLogger: UdfpsLogger, @@ -74,9 +79,11 @@ constructor( private var requestId: Long = 0 private var onFingerDown = false val size = windowManager.maximumWindowMetrics.bounds + val udfpsProps: MutableList<FingerprintSensorPropertiesInternal> = mutableListOf() var points: Array<Point> = emptyArray() var processedMotionEvent = false + var isShowing = false private var params: UdfpsOverlayParams = UdfpsOverlayParams() @@ -99,8 +106,8 @@ constructor( inputFeatures = INPUT_FEATURE_SPY } - fun onTouch(v: View, event: MotionEvent): Boolean { - val view = v as UdfpsOverlayView + fun onTouch(event: MotionEvent): Boolean { + val view = overlayView!! return when (event.action) { MotionEvent.ACTION_DOWN, @@ -132,17 +139,19 @@ constructor( if (keyguardUpdateMonitor.isFingerprintDetectionRunning) { keyguardUpdateMonitor.onUdfpsPointerDown(requestId.toInt()) } - } - view.configureDisplay { - biometricExecutor.execute { alternateTouchProvider.get().onUiReady() } - } + view.configureDisplay { + biometricExecutor.execute { + alternateTouchProvider.get().onUiReady() + } + } - processedMotionEvent = true + processedMotionEvent = true + } } - } - view.invalidate() + view.invalidate() + } true } MotionEvent.ACTION_UP, @@ -181,7 +190,7 @@ constructor( fun checkPoint(event: MotionEvent, point: Point): Boolean { // Calculate if sensor point is within ellipse - // Formula: ((cos(o)(xE - xS) + sin(o)(yE - yS))^2 / a^2) + ((sin(o)(xE - xS) + cos(0)(yE - + // Formula: ((cos(o)(xE - xS) + sin(o)(yE - yS))^2 / a^2) + ((sin(o)(xE - xS) + cos(o)(yE - // yS))^2 / b^2) <= 1 val a: Float = cos(event.orientation) * (point.x - event.rawX) val b: Float = sin(event.orientation) * (point.y - event.rawY) @@ -194,32 +203,67 @@ constructor( return result <= 1 } - fun show(requestId: Long): Boolean { + fun show(requestId: Long) { + if (!featureFlags.isEnabled(Flags.NEW_UDFPS_OVERLAY)) { + return + } + this.requestId = requestId - if (overlayView == null && alternateTouchProvider.isPresent) { - UdfpsOverlayView(context, null).let { - it.overlayParams = params - it.setUdfpsDisplayMode( - UdfpsDisplayMode(context, execution, authController, udfpsLogger) - ) - it.setOnTouchListener { v, event -> onTouch(v, event) } - it.sensorPoints = points - overlayView = it + fgExecutor.execute { + if (overlayView == null && alternateTouchProvider.isPresent) { + UdfpsOverlayView(context, null).let { + it.overlayParams = params + it.setUdfpsDisplayMode( + UdfpsDisplayMode(context, execution, authController, udfpsLogger) + ) + it.setOnTouchListener { _, event -> onTouch(event) } + it.sensorPoints = points + it.debugOverlay = + Settings.Global.getInt( + context.contentResolver, + SETTING_OVERLAY_DEBUG, + 0 /* def */ + ) != 0 + overlayView = it + } + windowManager.addView(overlayView, coreLayoutParams) + isShowing = true } - windowManager.addView(overlayView, coreLayoutParams) - return true } - - return false } fun hide() { - overlayView?.apply { - windowManager.removeView(this) - setOnTouchListener(null) + if (!featureFlags.isEnabled(Flags.NEW_UDFPS_OVERLAY)) { + return } - overlayView = null + fgExecutor.execute { + if (overlayView != null && isShowing && alternateTouchProvider.isPresent) { + if (processedMotionEvent) { + biometricExecutor.execute { + alternateTouchProvider.get().onPointerUp(requestId) + } + fgExecutor.execute { + if (keyguardUpdateMonitor.isFingerprintDetectionRunning) { + keyguardUpdateMonitor.onUdfpsPointerUp(requestId.toInt()) + } + } + } + + if (overlayView!!.isDisplayConfigured) { + overlayView!!.unconfigureDisplay() + } + + overlayView?.apply { + windowManager.removeView(this) + setOnTouchListener(null) + } + + isShowing = false + overlayView = null + processedMotionEvent = false + } + } } @Override @@ -233,6 +277,18 @@ constructor( } } ) + + fingerprintManager?.setUdfpsOverlay( + object : IUdfpsOverlay.Stub() { + override fun show( + requestId: Long, + sensorId: Int, + @BiometricOverlayConstants.ShowReason reason: Int + ) = show(requestId) + + override fun hide(sensorId: Int) = hide() + } + ) } private fun handleAllFingerprintAuthenticatorsRegistered( @@ -257,19 +313,20 @@ constructor( val sensorX = params.sensorBounds.centerX() val sensorY = params.sensorBounds.centerY() - val gridOffset: Int = params.sensorBounds.width() / 3 + val cornerOffset: Int = params.sensorBounds.width() / 4 + val sideOffset: Int = params.sensorBounds.width() / 3 points = arrayOf( - Point(sensorX - gridOffset, sensorY - gridOffset), - Point(sensorX, sensorY - gridOffset), - Point(sensorX + gridOffset, sensorY - gridOffset), - Point(sensorX - gridOffset, sensorY), + Point(sensorX - cornerOffset, sensorY - cornerOffset), + Point(sensorX, sensorY - sideOffset), + Point(sensorX + cornerOffset, sensorY - cornerOffset), + Point(sensorX - sideOffset, sensorY), Point(sensorX, sensorY), - Point(sensorX + gridOffset, sensorY), - Point(sensorX - gridOffset, sensorY + gridOffset), - Point(sensorX, sensorY + gridOffset), - Point(sensorX + gridOffset, sensorY + gridOffset) + Point(sensorX + sideOffset, sensorY), + Point(sensorX - cornerOffset, sensorY + cornerOffset), + Point(sensorX, sensorY + sideOffset), + Point(sensorX + cornerOffset, sensorY + cornerOffset) ) } } diff --git a/packages/SystemUI/src/com/android/systemui/biometrics/UdfpsOverlayView.kt b/packages/SystemUI/src/com/android/systemui/biometrics/UdfpsOverlayView.kt index 25e08d705736..4e6a06b1c44b 100644 --- a/packages/SystemUI/src/com/android/systemui/biometrics/UdfpsOverlayView.kt +++ b/packages/SystemUI/src/com/android/systemui/biometrics/UdfpsOverlayView.kt @@ -33,6 +33,8 @@ class UdfpsOverlayView(context: Context, attrs: AttributeSet?) : FrameLayout(con var overlayParams = UdfpsOverlayParams() private var mUdfpsDisplayMode: UdfpsDisplayMode? = null + var debugOverlay = false + var overlayPaint = Paint() var sensorPaint = Paint() var touchPaint = Paint() @@ -76,9 +78,13 @@ class UdfpsOverlayView(context: Context, attrs: AttributeSet?) : FrameLayout(con override fun onDraw(canvas: Canvas) { super.onDraw(canvas) - // Draw overlay and sensor - canvas.drawRect(overlayParams.overlayBounds, overlayPaint) - canvas.drawRect(overlayParams.sensorBounds, sensorPaint) + if (debugOverlay) { + // Draw overlay and sensor bounds + canvas.drawRect(overlayParams.overlayBounds, overlayPaint) + canvas.drawRect(overlayParams.sensorBounds, sensorPaint) + } + + // Draw sensor circle canvas.drawCircle( overlayParams.sensorBounds.exactCenterX(), overlayParams.sensorBounds.exactCenterY(), @@ -86,28 +92,30 @@ class UdfpsOverlayView(context: Context, attrs: AttributeSet?) : FrameLayout(con centerPaint ) - // Draw Points - sensorPoints?.forEach { - canvas.drawCircle(it.x.toFloat(), it.y.toFloat(), POINT_SIZE, pointPaint) + if (debugOverlay) { + // Draw Points + sensorPoints?.forEach { + canvas.drawCircle(it.x.toFloat(), it.y.toFloat(), POINT_SIZE, pointPaint) + } + + // Draw touch oval + canvas.save() + canvas.rotate(Math.toDegrees(touchOrientation).toFloat(), touchX, touchY) + + oval.setEmpty() + oval.set( + touchX - touchMinor / 2, + touchY + touchMajor / 2, + touchX + touchMinor / 2, + touchY - touchMajor / 2 + ) + + canvas.drawOval(oval, touchPaint) + + // Draw center point + canvas.drawCircle(touchX, touchY, POINT_SIZE, centerPaint) + canvas.restore() } - - // Draw touch oval - canvas.save() - canvas.rotate(Math.toDegrees(touchOrientation).toFloat(), touchX, touchY) - - oval.setEmpty() - oval.set( - touchX - touchMinor / 2, - touchY + touchMajor / 2, - touchX + touchMinor / 2, - touchY - touchMajor / 2 - ) - - canvas.drawOval(oval, touchPaint) - - // Draw center point - canvas.drawCircle(touchX, touchY, POINT_SIZE, centerPaint) - canvas.restore() } fun setUdfpsDisplayMode(udfpsDisplayMode: UdfpsDisplayMode?) { diff --git a/packages/SystemUI/src/com/android/systemui/biometrics/UdfpsShell.kt b/packages/SystemUI/src/com/android/systemui/biometrics/UdfpsShell.kt index 75640b787a62..da50f1c94f29 100644 --- a/packages/SystemUI/src/com/android/systemui/biometrics/UdfpsShell.kt +++ b/packages/SystemUI/src/com/android/systemui/biometrics/UdfpsShell.kt @@ -62,7 +62,6 @@ class UdfpsShell @Inject constructor( if (args.size == 1 && args[0] == "hide") { hideOverlay() } else if (args.size == 2 && args[0] == "udfpsOverlay" && args[1] == "show") { - hideOverlay() showUdfpsOverlay() } else if (args.size == 2 && args[0] == "udfpsOverlay" && args[1] == "hide") { hideUdfpsOverlay() diff --git a/packages/SystemUI/tests/src/com/android/systemui/biometrics/UdfpsControllerTest.java b/packages/SystemUI/tests/src/com/android/systemui/biometrics/UdfpsControllerTest.java index 49c6fd14997e..ed957db2852b 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/biometrics/UdfpsControllerTest.java +++ b/packages/SystemUI/tests/src/com/android/systemui/biometrics/UdfpsControllerTest.java @@ -69,6 +69,7 @@ import com.android.systemui.R; import com.android.systemui.SysuiTestCase; import com.android.systemui.animation.ActivityLaunchAnimator; import com.android.systemui.dump.DumpManager; +import com.android.systemui.flags.FeatureFlags; import com.android.systemui.keyguard.ScreenLifecycle; import com.android.systemui.plugins.FalsingManager; import com.android.systemui.plugins.statusbar.StatusBarStateController; @@ -169,6 +170,8 @@ public class UdfpsControllerTest extends SysuiTestCase { private FakeExecutor mFgExecutor; @Mock private UdfpsDisplayMode mUdfpsDisplayMode; + @Mock + private FeatureFlags mFeatureFlags; // Stuff for configuring mocks @Mock @@ -250,6 +253,7 @@ public class UdfpsControllerTest extends SysuiTestCase { mStatusBarKeyguardViewManager, mDumpManager, mKeyguardUpdateMonitor, + mFeatureFlags, mFalsingManager, mPowerManager, mAccessibilityManager, diff --git a/services/core/java/com/android/server/biometrics/sensors/SensorOverlays.java b/services/core/java/com/android/server/biometrics/sensors/SensorOverlays.java index aeb6b6e2a907..969a174f49c7 100644 --- a/services/core/java/com/android/server/biometrics/sensors/SensorOverlays.java +++ b/services/core/java/com/android/server/biometrics/sensors/SensorOverlays.java @@ -20,6 +20,7 @@ import android.annotation.NonNull; import android.annotation.Nullable; import android.hardware.biometrics.BiometricOverlayConstants; import android.hardware.fingerprint.ISidefpsController; +import android.hardware.fingerprint.IUdfpsOverlay; import android.hardware.fingerprint.IUdfpsOverlayController; import android.hardware.fingerprint.IUdfpsOverlayControllerCallback; import android.os.RemoteException; @@ -43,6 +44,7 @@ public final class SensorOverlays { @NonNull private final Optional<IUdfpsOverlayController> mUdfpsOverlayController; @NonNull private final Optional<ISidefpsController> mSidefpsController; + @NonNull private final Optional<IUdfpsOverlay> mUdfpsOverlay; /** * Create an overlay controller for each modality. @@ -52,9 +54,11 @@ public final class SensorOverlays { */ public SensorOverlays( @Nullable IUdfpsOverlayController udfpsOverlayController, - @Nullable ISidefpsController sidefpsController) { + @Nullable ISidefpsController sidefpsController, + @Nullable IUdfpsOverlay udfpsOverlay) { mUdfpsOverlayController = Optional.ofNullable(udfpsOverlayController); mSidefpsController = Optional.ofNullable(sidefpsController); + mUdfpsOverlay = Optional.ofNullable(udfpsOverlay); } /** @@ -90,6 +94,14 @@ public final class SensorOverlays { Slog.e(TAG, "Remote exception when showing the UDFPS overlay", e); } } + + if (mUdfpsOverlay.isPresent()) { + try { + mUdfpsOverlay.get().show(client.getRequestId(), sensorId, reason); + } catch (RemoteException e) { + Slog.e(TAG, "Remote exception when showing the new UDFPS overlay", e); + } + } } /** @@ -113,6 +125,14 @@ public final class SensorOverlays { Slog.e(TAG, "Remote exception when hiding the UDFPS overlay", e); } } + + if (mUdfpsOverlay.isPresent()) { + try { + mUdfpsOverlay.get().hide(sensorId); + } catch (RemoteException e) { + Slog.e(TAG, "Remote exception when hiding the new udfps overlay", e); + } + } } /** diff --git a/services/core/java/com/android/server/biometrics/sensors/fingerprint/FingerprintService.java b/services/core/java/com/android/server/biometrics/sensors/fingerprint/FingerprintService.java index b0dc28ddce96..156e6bb503ec 100644 --- a/services/core/java/com/android/server/biometrics/sensors/fingerprint/FingerprintService.java +++ b/services/core/java/com/android/server/biometrics/sensors/fingerprint/FingerprintService.java @@ -52,6 +52,7 @@ import android.hardware.fingerprint.IFingerprintClientActiveCallback; import android.hardware.fingerprint.IFingerprintService; import android.hardware.fingerprint.IFingerprintServiceReceiver; import android.hardware.fingerprint.ISidefpsController; +import android.hardware.fingerprint.IUdfpsOverlay; import android.hardware.fingerprint.IUdfpsOverlayController; import android.os.Binder; import android.os.Build; @@ -874,6 +875,14 @@ public class FingerprintService extends SystemService { @android.annotation.EnforcePermission(android.Manifest.permission.USE_BIOMETRIC_INTERNAL) @Override + public void setUdfpsOverlay(@NonNull IUdfpsOverlay controller) { + for (ServiceProvider provider : mRegistry.getProviders()) { + provider.setUdfpsOverlay(controller); + } + } + + @android.annotation.EnforcePermission(android.Manifest.permission.USE_BIOMETRIC_INTERNAL) + @Override public void onPowerPressed() { for (ServiceProvider provider : mRegistry.getProviders()) { provider.onPowerPressed(); diff --git a/services/core/java/com/android/server/biometrics/sensors/fingerprint/ServiceProvider.java b/services/core/java/com/android/server/biometrics/sensors/fingerprint/ServiceProvider.java index 0c29f5615b4c..05c2e2919a11 100644 --- a/services/core/java/com/android/server/biometrics/sensors/fingerprint/ServiceProvider.java +++ b/services/core/java/com/android/server/biometrics/sensors/fingerprint/ServiceProvider.java @@ -26,6 +26,7 @@ import android.hardware.fingerprint.FingerprintManager; import android.hardware.fingerprint.FingerprintSensorPropertiesInternal; import android.hardware.fingerprint.IFingerprintServiceReceiver; import android.hardware.fingerprint.ISidefpsController; +import android.hardware.fingerprint.IUdfpsOverlay; import android.hardware.fingerprint.IUdfpsOverlayController; import android.os.IBinder; @@ -129,6 +130,12 @@ public interface ServiceProvider extends void setUdfpsOverlayController(@NonNull IUdfpsOverlayController controller); + /** + * Sets udfps overlay + * @param controller udfps overlay + */ + void setUdfpsOverlay(@NonNull IUdfpsOverlay controller); + void onPowerPressed(); /** diff --git a/services/core/java/com/android/server/biometrics/sensors/fingerprint/aidl/FingerprintAuthenticationClient.java b/services/core/java/com/android/server/biometrics/sensors/fingerprint/aidl/FingerprintAuthenticationClient.java index 2e5663db57b5..7f1fb1cfc4bd 100644 --- a/services/core/java/com/android/server/biometrics/sensors/fingerprint/aidl/FingerprintAuthenticationClient.java +++ b/services/core/java/com/android/server/biometrics/sensors/fingerprint/aidl/FingerprintAuthenticationClient.java @@ -33,6 +33,7 @@ import android.hardware.biometrics.common.OperationContext; import android.hardware.biometrics.fingerprint.PointerContext; import android.hardware.fingerprint.FingerprintSensorPropertiesInternal; import android.hardware.fingerprint.ISidefpsController; +import android.hardware.fingerprint.IUdfpsOverlay; import android.hardware.fingerprint.IUdfpsOverlayController; import android.os.Build; import android.os.Handler; @@ -118,6 +119,7 @@ class FingerprintAuthenticationClient extends AuthenticationClient<AidlSession> @NonNull LockoutCache lockoutCache, @Nullable IUdfpsOverlayController udfpsOverlayController, @Nullable ISidefpsController sidefpsController, + @Nullable IUdfpsOverlay udfpsOverlay, boolean allowBackgroundAuthentication, @NonNull FingerprintSensorPropertiesInternal sensorProps, @NonNull Handler handler, @@ -145,7 +147,8 @@ class FingerprintAuthenticationClient extends AuthenticationClient<AidlSession> false /* isKeyguardBypassEnabled */); setRequestId(requestId); mLockoutCache = lockoutCache; - mSensorOverlays = new SensorOverlays(udfpsOverlayController, sidefpsController); + mSensorOverlays = new SensorOverlays(udfpsOverlayController, + sidefpsController, udfpsOverlay); mSensorProps = sensorProps; mALSProbeCallback = getLogger().getAmbientLightProbe(false /* startWithClient */); mHandler = handler; @@ -248,8 +251,8 @@ class FingerprintAuthenticationClient extends AuthenticationClient<AidlSession> if (authenticated && mSensorProps.isAnySidefpsType()) { if (mHandler.hasMessages(MESSAGE_IGNORE_AUTH)) { Slog.i(TAG, "(sideFPS) Ignoring auth due to recent power press"); - onErrorInternal(BiometricConstants.BIOMETRIC_ERROR_POWER_PRESSED, 0, - true); + onErrorInternal(BiometricConstants.BIOMETRIC_ERROR_POWER_PRESSED, + 0, true); return; } delay = isKeyguard() ? mWaitForAuthKeyguard : mWaitForAuthBp; diff --git a/services/core/java/com/android/server/biometrics/sensors/fingerprint/aidl/FingerprintDetectClient.java b/services/core/java/com/android/server/biometrics/sensors/fingerprint/aidl/FingerprintDetectClient.java index 0e89814c6ad2..52822347e96f 100644 --- a/services/core/java/com/android/server/biometrics/sensors/fingerprint/aidl/FingerprintDetectClient.java +++ b/services/core/java/com/android/server/biometrics/sensors/fingerprint/aidl/FingerprintDetectClient.java @@ -21,6 +21,7 @@ import android.annotation.Nullable; import android.content.Context; import android.hardware.biometrics.BiometricOverlayConstants; import android.hardware.biometrics.common.ICancellationSignal; +import android.hardware.fingerprint.IUdfpsOverlay; import android.hardware.fingerprint.IUdfpsOverlayController; import android.os.IBinder; import android.os.RemoteException; @@ -54,12 +55,15 @@ class FingerprintDetectClient extends AcquisitionClient<AidlSession> implements @NonNull ClientMonitorCallbackConverter listener, int userId, @NonNull String owner, int sensorId, @NonNull BiometricLogger biometricLogger, @NonNull BiometricContext biometricContext, - @Nullable IUdfpsOverlayController udfpsOverlayController, boolean isStrongBiometric) { + @Nullable IUdfpsOverlayController udfpsOverlayController, + @Nullable IUdfpsOverlay udfpsOverlay, + boolean isStrongBiometric) { super(context, lazyDaemon, token, listener, userId, owner, 0 /* cookie */, sensorId, true /* shouldVibrate */, biometricLogger, biometricContext); setRequestId(requestId); mIsStrongBiometric = isStrongBiometric; - mSensorOverlays = new SensorOverlays(udfpsOverlayController, null /* sideFpsController*/); + mSensorOverlays = new SensorOverlays(udfpsOverlayController, + null /* sideFpsController*/, udfpsOverlay); } @Override @@ -82,7 +86,8 @@ class FingerprintDetectClient extends AcquisitionClient<AidlSession> implements @Override protected void startHalOperation() { - mSensorOverlays.show(getSensorId(), BiometricOverlayConstants.REASON_AUTH_KEYGUARD, this); + mSensorOverlays.show(getSensorId(), BiometricOverlayConstants.REASON_AUTH_KEYGUARD, + this); try { mCancellationSignal = doDetectInteraction(); diff --git a/services/core/java/com/android/server/biometrics/sensors/fingerprint/aidl/FingerprintEnrollClient.java b/services/core/java/com/android/server/biometrics/sensors/fingerprint/aidl/FingerprintEnrollClient.java index 612d90670888..7e5d39fdef1a 100644 --- a/services/core/java/com/android/server/biometrics/sensors/fingerprint/aidl/FingerprintEnrollClient.java +++ b/services/core/java/com/android/server/biometrics/sensors/fingerprint/aidl/FingerprintEnrollClient.java @@ -30,6 +30,7 @@ import android.hardware.fingerprint.Fingerprint; import android.hardware.fingerprint.FingerprintManager; import android.hardware.fingerprint.FingerprintSensorPropertiesInternal; import android.hardware.fingerprint.ISidefpsController; +import android.hardware.fingerprint.IUdfpsOverlay; import android.hardware.fingerprint.IUdfpsOverlayController; import android.hardware.keymaster.HardwareAuthToken; import android.os.IBinder; @@ -86,6 +87,7 @@ class FingerprintEnrollClient extends EnrollClient<AidlSession> implements Udfps @NonNull FingerprintSensorPropertiesInternal sensorProps, @Nullable IUdfpsOverlayController udfpsOverlayController, @Nullable ISidefpsController sidefpsController, + @Nullable IUdfpsOverlay udfpsOverlay, int maxTemplatesPerUser, @FingerprintManager.EnrollReason int enrollReason) { // UDFPS haptics occur when an image is acquired (instead of when the result is known) super(context, lazyDaemon, token, listener, userId, hardwareAuthToken, owner, utils, @@ -93,7 +95,8 @@ class FingerprintEnrollClient extends EnrollClient<AidlSession> implements Udfps biometricContext); setRequestId(requestId); mSensorProps = sensorProps; - mSensorOverlays = new SensorOverlays(udfpsOverlayController, sidefpsController); + mSensorOverlays = new SensorOverlays(udfpsOverlayController, + sidefpsController, udfpsOverlay); mMaxTemplatesPerUser = maxTemplatesPerUser; mALSProbeCallback = getLogger().getAmbientLightProbe(true /* startWithClient */); @@ -162,7 +165,8 @@ class FingerprintEnrollClient extends EnrollClient<AidlSession> implements Udfps @Override protected void startHalOperation() { - mSensorOverlays.show(getSensorId(), getOverlayReasonFromEnrollReason(mEnrollReason), this); + mSensorOverlays.show(getSensorId(), getOverlayReasonFromEnrollReason(mEnrollReason), + this); BiometricNotificationUtils.cancelBadCalibrationNotification(getContext()); try { diff --git a/services/core/java/com/android/server/biometrics/sensors/fingerprint/aidl/FingerprintProvider.java b/services/core/java/com/android/server/biometrics/sensors/fingerprint/aidl/FingerprintProvider.java index 628c16afed5c..a42ff9a8a2ba 100644 --- a/services/core/java/com/android/server/biometrics/sensors/fingerprint/aidl/FingerprintProvider.java +++ b/services/core/java/com/android/server/biometrics/sensors/fingerprint/aidl/FingerprintProvider.java @@ -40,6 +40,7 @@ import android.hardware.fingerprint.FingerprintManager; import android.hardware.fingerprint.FingerprintSensorPropertiesInternal; import android.hardware.fingerprint.IFingerprintServiceReceiver; import android.hardware.fingerprint.ISidefpsController; +import android.hardware.fingerprint.IUdfpsOverlay; import android.hardware.fingerprint.IUdfpsOverlayController; import android.os.Binder; import android.os.Handler; @@ -108,6 +109,7 @@ public class FingerprintProvider implements IBinder.DeathRecipient, ServiceProvi @Nullable private IFingerprint mDaemon; @Nullable private IUdfpsOverlayController mUdfpsOverlayController; @Nullable private ISidefpsController mSidefpsController; + @Nullable private IUdfpsOverlay mUdfpsOverlay; private final class BiometricTaskStackListener extends TaskStackListener { @Override @@ -383,7 +385,8 @@ public class FingerprintProvider implements IBinder.DeathRecipient, ServiceProvi BiometricsProtoEnums.CLIENT_UNKNOWN), mBiometricContext, mSensors.get(sensorId).getSensorProperties(), - mUdfpsOverlayController, mSidefpsController, maxTemplatesPerUser, enrollReason); + mUdfpsOverlayController, mSidefpsController, mUdfpsOverlay, + maxTemplatesPerUser, enrollReason); scheduleForSensor(sensorId, client, new ClientMonitorCompositeCallback( mBiometricStateCallback, new ClientMonitorCallback() { @Override @@ -418,7 +421,7 @@ public class FingerprintProvider implements IBinder.DeathRecipient, ServiceProvi opPackageName, sensorId, createLogger(BiometricsProtoEnums.ACTION_AUTHENTICATE, statsClient), mBiometricContext, - mUdfpsOverlayController, isStrongBiometric); + mUdfpsOverlayController, mUdfpsOverlay, isStrongBiometric); scheduleForSensor(sensorId, client, mBiometricStateCallback); }); @@ -439,10 +442,10 @@ public class FingerprintProvider implements IBinder.DeathRecipient, ServiceProvi createLogger(BiometricsProtoEnums.ACTION_AUTHENTICATE, statsClient), mBiometricContext, isStrongBiometric, mTaskStackListener, mSensors.get(sensorId).getLockoutCache(), - mUdfpsOverlayController, mSidefpsController, allowBackgroundAuthentication, + mUdfpsOverlayController, mSidefpsController, mUdfpsOverlay, + allowBackgroundAuthentication, mSensors.get(sensorId).getSensorProperties(), mHandler, - Utils.getCurrentStrength(sensorId), - SystemClock.elapsedRealtimeClock()); + Utils.getCurrentStrength(sensorId), SystemClock.elapsedRealtimeClock()); scheduleForSensor(sensorId, client, mBiometricStateCallback); }); } @@ -649,6 +652,11 @@ public class FingerprintProvider implements IBinder.DeathRecipient, ServiceProvi } @Override + public void setUdfpsOverlay(@NonNull IUdfpsOverlay controller) { + mUdfpsOverlay = controller; + } + + @Override public void dumpProtoState(int sensorId, @NonNull ProtoOutputStream proto, boolean clearSchedulerBuffer) { if (mSensors.contains(sensorId)) { diff --git a/services/core/java/com/android/server/biometrics/sensors/fingerprint/hidl/Fingerprint21.java b/services/core/java/com/android/server/biometrics/sensors/fingerprint/hidl/Fingerprint21.java index 0e6df8e0df77..dbc96df9c458 100644 --- a/services/core/java/com/android/server/biometrics/sensors/fingerprint/hidl/Fingerprint21.java +++ b/services/core/java/com/android/server/biometrics/sensors/fingerprint/hidl/Fingerprint21.java @@ -38,6 +38,7 @@ import android.hardware.fingerprint.FingerprintSensorProperties; import android.hardware.fingerprint.FingerprintSensorPropertiesInternal; import android.hardware.fingerprint.IFingerprintServiceReceiver; import android.hardware.fingerprint.ISidefpsController; +import android.hardware.fingerprint.IUdfpsOverlay; import android.hardware.fingerprint.IUdfpsOverlayController; import android.os.Handler; import android.os.IBinder; @@ -120,6 +121,7 @@ public class Fingerprint21 implements IHwBinder.DeathRecipient, ServiceProvider @NonNull private final HalResultController mHalResultController; @Nullable private IUdfpsOverlayController mUdfpsOverlayController; @Nullable private ISidefpsController mSidefpsController; + @Nullable private IUdfpsOverlay mUdfpsOverlay; @NonNull private final BiometricContext mBiometricContext; // for requests that do not use biometric prompt @NonNull private final AtomicLong mRequestCounter = new AtomicLong(0); @@ -594,7 +596,7 @@ public class Fingerprint21 implements IHwBinder.DeathRecipient, ServiceProvider createLogger(BiometricsProtoEnums.ACTION_ENROLL, BiometricsProtoEnums.CLIENT_UNKNOWN), mBiometricContext, - mUdfpsOverlayController, mSidefpsController, + mUdfpsOverlayController, mSidefpsController, mUdfpsOverlay, enrollReason); mScheduler.scheduleClientMonitor(client, new ClientMonitorCallback() { @Override @@ -640,7 +642,7 @@ public class Fingerprint21 implements IHwBinder.DeathRecipient, ServiceProvider mLazyDaemon, token, id, listener, userId, opPackageName, mSensorProperties.sensorId, createLogger(BiometricsProtoEnums.ACTION_AUTHENTICATE, statsClient), - mBiometricContext, mUdfpsOverlayController, + mBiometricContext, mUdfpsOverlayController, mUdfpsOverlay, isStrongBiometric); mScheduler.scheduleClientMonitor(client, mBiometricStateCallback); }); @@ -664,7 +666,7 @@ public class Fingerprint21 implements IHwBinder.DeathRecipient, ServiceProvider createLogger(BiometricsProtoEnums.ACTION_AUTHENTICATE, statsClient), mBiometricContext, isStrongBiometric, mTaskStackListener, mLockoutTracker, - mUdfpsOverlayController, mSidefpsController, + mUdfpsOverlayController, mSidefpsController, mUdfpsOverlay, allowBackgroundAuthentication, mSensorProperties); mScheduler.scheduleClientMonitor(client, mBiometricStateCallback); }); @@ -853,6 +855,11 @@ public class Fingerprint21 implements IHwBinder.DeathRecipient, ServiceProvider } @Override + public void setUdfpsOverlay(@NonNull IUdfpsOverlay controller) { + mUdfpsOverlay = controller; + } + + @Override public void dumpProtoState(int sensorId, @NonNull ProtoOutputStream proto, boolean clearSchedulerBuffer) { final long sensorToken = proto.start(SensorServiceStateProto.SENSOR_STATES); diff --git a/services/core/java/com/android/server/biometrics/sensors/fingerprint/hidl/FingerprintAuthenticationClient.java b/services/core/java/com/android/server/biometrics/sensors/fingerprint/hidl/FingerprintAuthenticationClient.java index 0d620fd3a9e4..56fa36ec20e2 100644 --- a/services/core/java/com/android/server/biometrics/sensors/fingerprint/hidl/FingerprintAuthenticationClient.java +++ b/services/core/java/com/android/server/biometrics/sensors/fingerprint/hidl/FingerprintAuthenticationClient.java @@ -26,6 +26,7 @@ import android.hardware.biometrics.BiometricFingerprintConstants; import android.hardware.biometrics.fingerprint.V2_1.IBiometricsFingerprint; import android.hardware.fingerprint.FingerprintSensorPropertiesInternal; import android.hardware.fingerprint.ISidefpsController; +import android.hardware.fingerprint.IUdfpsOverlay; import android.hardware.fingerprint.IUdfpsOverlayController; import android.os.IBinder; import android.os.RemoteException; @@ -76,15 +77,18 @@ class FingerprintAuthenticationClient extends AuthenticationClient<IBiometricsFi @NonNull LockoutFrameworkImpl lockoutTracker, @Nullable IUdfpsOverlayController udfpsOverlayController, @Nullable ISidefpsController sidefpsController, + @Nullable IUdfpsOverlay udfpsOverlay, boolean allowBackgroundAuthentication, @NonNull FingerprintSensorPropertiesInternal sensorProps) { super(context, lazyDaemon, token, listener, targetUserId, operationId, restricted, owner, cookie, requireConfirmation, sensorId, logger, biometricContext, - isStrongBiometric, taskStackListener, lockoutTracker, allowBackgroundAuthentication, - false /* shouldVibrate */, false /* isKeyguardBypassEnabled */); + isStrongBiometric, taskStackListener, lockoutTracker, + allowBackgroundAuthentication, false /* shouldVibrate */, + false /* isKeyguardBypassEnabled */); setRequestId(requestId); mLockoutFrameworkImpl = lockoutTracker; - mSensorOverlays = new SensorOverlays(udfpsOverlayController, sidefpsController); + mSensorOverlays = new SensorOverlays(udfpsOverlayController, + sidefpsController, udfpsOverlay); mSensorProps = sensorProps; mALSProbeCallback = getLogger().getAmbientLightProbe(false /* startWithClient */); } diff --git a/services/core/java/com/android/server/biometrics/sensors/fingerprint/hidl/FingerprintDetectClient.java b/services/core/java/com/android/server/biometrics/sensors/fingerprint/hidl/FingerprintDetectClient.java index c2929d0f15b2..3e9b8ef7fab4 100644 --- a/services/core/java/com/android/server/biometrics/sensors/fingerprint/hidl/FingerprintDetectClient.java +++ b/services/core/java/com/android/server/biometrics/sensors/fingerprint/hidl/FingerprintDetectClient.java @@ -23,6 +23,7 @@ import android.hardware.biometrics.BiometricAuthenticator; import android.hardware.biometrics.BiometricFingerprintConstants; import android.hardware.biometrics.BiometricOverlayConstants; import android.hardware.biometrics.fingerprint.V2_1.IBiometricsFingerprint; +import android.hardware.fingerprint.IUdfpsOverlay; import android.hardware.fingerprint.IUdfpsOverlayController; import android.os.IBinder; import android.os.RemoteException; @@ -62,11 +63,13 @@ class FingerprintDetectClient extends AcquisitionClient<IBiometricsFingerprint> @NonNull ClientMonitorCallbackConverter listener, int userId, @NonNull String owner, int sensorId, @NonNull BiometricLogger biometricLogger, @NonNull BiometricContext biometricContext, - @Nullable IUdfpsOverlayController udfpsOverlayController, boolean isStrongBiometric) { + @Nullable IUdfpsOverlayController udfpsOverlayController, + @Nullable IUdfpsOverlay udfpsOverlay, boolean isStrongBiometric) { super(context, lazyDaemon, token, listener, userId, owner, 0 /* cookie */, sensorId, true /* shouldVibrate */, biometricLogger, biometricContext); setRequestId(requestId); - mSensorOverlays = new SensorOverlays(udfpsOverlayController, null /* sideFpsController */); + mSensorOverlays = new SensorOverlays(udfpsOverlayController, + null /* sideFpsController */, udfpsOverlay); mIsStrongBiometric = isStrongBiometric; } @@ -92,7 +95,8 @@ class FingerprintDetectClient extends AcquisitionClient<IBiometricsFingerprint> @Override protected void startHalOperation() { - mSensorOverlays.show(getSensorId(), BiometricOverlayConstants.REASON_AUTH_KEYGUARD, this); + mSensorOverlays.show(getSensorId(), BiometricOverlayConstants.REASON_AUTH_KEYGUARD, + this); try { getFreshDaemon().authenticate(0 /* operationId */, getTargetUserId()); @@ -128,8 +132,8 @@ class FingerprintDetectClient extends AcquisitionClient<IBiometricsFingerprint> } @Override - public void onAuthenticated(BiometricAuthenticator.Identifier identifier, boolean authenticated, - ArrayList<Byte> hardwareAuthToken) { + public void onAuthenticated(BiometricAuthenticator.Identifier identifier, + boolean authenticated, ArrayList<Byte> hardwareAuthToken) { getLogger().logOnAuthenticated(getContext(), getOperationContext(), authenticated, false /* requireConfirmation */, getTargetUserId(), false /* isBiometricPrompt */); diff --git a/services/core/java/com/android/server/biometrics/sensors/fingerprint/hidl/FingerprintEnrollClient.java b/services/core/java/com/android/server/biometrics/sensors/fingerprint/hidl/FingerprintEnrollClient.java index 5d9af5322c2e..3371cec32fde 100644 --- a/services/core/java/com/android/server/biometrics/sensors/fingerprint/hidl/FingerprintEnrollClient.java +++ b/services/core/java/com/android/server/biometrics/sensors/fingerprint/hidl/FingerprintEnrollClient.java @@ -26,6 +26,7 @@ import android.hardware.biometrics.fingerprint.V2_1.IBiometricsFingerprint; import android.hardware.fingerprint.Fingerprint; import android.hardware.fingerprint.FingerprintManager; import android.hardware.fingerprint.ISidefpsController; +import android.hardware.fingerprint.IUdfpsOverlay; import android.hardware.fingerprint.IUdfpsOverlayController; import android.os.IBinder; import android.os.RemoteException; @@ -67,12 +68,14 @@ public class FingerprintEnrollClient extends EnrollClient<IBiometricsFingerprint @NonNull BiometricLogger biometricLogger, @NonNull BiometricContext biometricContext, @Nullable IUdfpsOverlayController udfpsOverlayController, @Nullable ISidefpsController sidefpsController, + @Nullable IUdfpsOverlay udfpsOverlay, @FingerprintManager.EnrollReason int enrollReason) { super(context, lazyDaemon, token, listener, userId, hardwareAuthToken, owner, utils, timeoutSec, sensorId, true /* shouldVibrate */, biometricLogger, biometricContext); setRequestId(requestId); - mSensorOverlays = new SensorOverlays(udfpsOverlayController, sidefpsController); + mSensorOverlays = new SensorOverlays(udfpsOverlayController, + sidefpsController, udfpsOverlay); mEnrollReason = enrollReason; if (enrollReason == FingerprintManager.ENROLL_FIND_SENSOR) { @@ -102,7 +105,8 @@ public class FingerprintEnrollClient extends EnrollClient<IBiometricsFingerprint @Override protected void startHalOperation() { - mSensorOverlays.show(getSensorId(), getOverlayReasonFromEnrollReason(mEnrollReason), this); + mSensorOverlays.show(getSensorId(), getOverlayReasonFromEnrollReason(mEnrollReason), + this); BiometricNotificationUtils.cancelBadCalibrationNotification(getContext()); try { diff --git a/services/tests/servicestests/src/com/android/server/biometrics/sensors/SensorOverlaysTest.java b/services/tests/servicestests/src/com/android/server/biometrics/sensors/SensorOverlaysTest.java index 5012335b533f..21c9c753a062 100644 --- a/services/tests/servicestests/src/com/android/server/biometrics/sensors/SensorOverlaysTest.java +++ b/services/tests/servicestests/src/com/android/server/biometrics/sensors/SensorOverlaysTest.java @@ -61,7 +61,7 @@ public class SensorOverlaysTest { @Test public void noopWhenBothNull() { - final SensorOverlays useless = new SensorOverlays(null, null); + final SensorOverlays useless = new SensorOverlays(null, null, null); useless.show(SENSOR_ID, 2, null); useless.hide(SENSOR_ID); } @@ -69,12 +69,12 @@ public class SensorOverlaysTest { @Test public void testProvidesUdfps() { final List<IUdfpsOverlayController> udfps = new ArrayList<>(); - SensorOverlays sensorOverlays = new SensorOverlays(null, mSidefpsController); + SensorOverlays sensorOverlays = new SensorOverlays(null, mSidefpsController, null); sensorOverlays.ifUdfps(udfps::add); assertThat(udfps).isEmpty(); - sensorOverlays = new SensorOverlays(mUdfpsOverlayController, mSidefpsController); + sensorOverlays = new SensorOverlays(mUdfpsOverlayController, mSidefpsController, null); sensorOverlays.ifUdfps(udfps::add); assertThat(udfps).containsExactly(mUdfpsOverlayController); } @@ -96,7 +96,7 @@ public class SensorOverlaysTest { private void testShow(IUdfpsOverlayController udfps, ISidefpsController sidefps) throws Exception { - final SensorOverlays sensorOverlays = new SensorOverlays(udfps, sidefps); + final SensorOverlays sensorOverlays = new SensorOverlays(udfps, sidefps, null); final int reason = BiometricOverlayConstants.REASON_UNKNOWN; sensorOverlays.show(SENSOR_ID, reason, mAcquisitionClient); @@ -126,7 +126,7 @@ public class SensorOverlaysTest { private void testHide(IUdfpsOverlayController udfps, ISidefpsController sidefps) throws Exception { - final SensorOverlays sensorOverlays = new SensorOverlays(udfps, sidefps); + final SensorOverlays sensorOverlays = new SensorOverlays(udfps, sidefps, null); sensorOverlays.hide(SENSOR_ID); if (udfps != null) { diff --git a/services/tests/servicestests/src/com/android/server/biometrics/sensors/fingerprint/aidl/FingerprintAuthenticationClientTest.java b/services/tests/servicestests/src/com/android/server/biometrics/sensors/fingerprint/aidl/FingerprintAuthenticationClientTest.java index 1b5db0a35449..675f0e357aa8 100644 --- a/services/tests/servicestests/src/com/android/server/biometrics/sensors/fingerprint/aidl/FingerprintAuthenticationClientTest.java +++ b/services/tests/servicestests/src/com/android/server/biometrics/sensors/fingerprint/aidl/FingerprintAuthenticationClientTest.java @@ -645,7 +645,7 @@ public class FingerprintAuthenticationClientTest { 9 /* sensorId */, mBiometricLogger, mBiometricContext, true /* isStrongBiometric */, null /* taskStackListener */, mLockoutCache, - mUdfpsOverlayController, mSideFpsController, allowBackgroundAuthentication, + mUdfpsOverlayController, mSideFpsController, null, allowBackgroundAuthentication, mSensorProps, new Handler(mLooper.getLooper()), 0 /* biometricStrength */, mClock) { @Override diff --git a/services/tests/servicestests/src/com/android/server/biometrics/sensors/fingerprint/aidl/FingerprintDetectClientTest.java b/services/tests/servicestests/src/com/android/server/biometrics/sensors/fingerprint/aidl/FingerprintDetectClientTest.java index 93cbef19aca9..4579fc15f661 100644 --- a/services/tests/servicestests/src/com/android/server/biometrics/sensors/fingerprint/aidl/FingerprintDetectClientTest.java +++ b/services/tests/servicestests/src/com/android/server/biometrics/sensors/fingerprint/aidl/FingerprintDetectClientTest.java @@ -118,6 +118,6 @@ public class FingerprintDetectClientTest { return new FingerprintDetectClient(mContext, () -> aidl, mToken, 6 /* requestId */, mClientMonitorCallbackConverter, 2 /* userId */, "a-test", 1 /* sensorId */, mBiometricLogger, mBiometricContext, - mUdfpsOverlayController, true /* isStrongBiometric */); + mUdfpsOverlayController, null, true /* isStrongBiometric */); } } diff --git a/services/tests/servicestests/src/com/android/server/biometrics/sensors/fingerprint/aidl/FingerprintEnrollClientTest.java b/services/tests/servicestests/src/com/android/server/biometrics/sensors/fingerprint/aidl/FingerprintEnrollClientTest.java index 837b55397416..38b06c476174 100644 --- a/services/tests/servicestests/src/com/android/server/biometrics/sensors/fingerprint/aidl/FingerprintEnrollClientTest.java +++ b/services/tests/servicestests/src/com/android/server/biometrics/sensors/fingerprint/aidl/FingerprintEnrollClientTest.java @@ -28,7 +28,6 @@ import static org.mockito.Mockito.any; import static org.mockito.Mockito.inOrder; import static org.mockito.Mockito.never; import static org.mockito.Mockito.same; -import static org.mockito.Mockito.times; import static org.mockito.Mockito.verify; import static org.mockito.Mockito.when; @@ -66,7 +65,6 @@ import org.mockito.Mock; import org.mockito.junit.MockitoJUnit; import org.mockito.junit.MockitoRule; -import java.util.ArrayList; import java.util.function.Consumer; @Presubmit @@ -292,6 +290,6 @@ public class FingerprintEnrollClientTest { mClientMonitorCallbackConverter, 0 /* userId */, HAT, "owner", mBiometricUtils, 8 /* sensorId */, mBiometricLogger, mBiometricContext, mSensorProps, mUdfpsOverlayController, - mSideFpsController, 6 /* maxTemplatesPerUser */, FingerprintManager.ENROLL_ENROLL); + mSideFpsController, null, 6 /* maxTemplatesPerUser */, FingerprintManager.ENROLL_ENROLL); } } |