Loading core/java/android/hardware/fingerprint/ISidefpsController.aidl +3 −3 Original line number Diff line number Diff line Loading @@ -21,9 +21,9 @@ package android.hardware.fingerprint; */ oneway interface ISidefpsController { // Shows the overlay. void show(); // Shows the overlay for the given sensor with a reason from BiometricOverlayConstants. void show(int sensorId, int reason); // Hides the overlay. void hide(); void hide(int sensorId); } core/java/android/hardware/fingerprint/IUdfpsOverlayController.aidl +1 −1 Original line number Diff line number Diff line Loading @@ -22,7 +22,7 @@ import android.hardware.fingerprint.IUdfpsOverlayControllerCallback; * @hide */ oneway interface IUdfpsOverlayController { // Shows the overlay. // Shows the overlay for the given sensor with a reason from BiometricOverlayConstants. void showUdfpsOverlay(int sensorId, int reason, IUdfpsOverlayControllerCallback callback); // Hides the overlay. Loading packages/SystemUI/src/com/android/systemui/biometrics/SidefpsController.kt +16 −2 Original line number Diff line number Diff line Loading @@ -18,6 +18,8 @@ package com.android.systemui.biometrics import android.content.Context import android.graphics.PixelFormat import android.graphics.Rect import android.hardware.biometrics.BiometricOverlayConstants import android.hardware.biometrics.BiometricOverlayConstants.REASON_AUTH_KEYGUARD import android.hardware.display.DisplayManager import android.hardware.fingerprint.FingerprintManager import android.hardware.fingerprint.FingerprintSensorPropertiesInternal Loading Loading @@ -100,14 +102,20 @@ class SidefpsController @Inject constructor( init { fingerprintManager?.setSidefpsController(object : ISidefpsController.Stub() { override fun show() = mainExecutor.execute { override fun show( sensorId: Int, @BiometricOverlayConstants.ShowReason reason: Int ) = if (reason.isReasonToShow()) doShow() else hide(sensorId) private fun doShow() = mainExecutor.execute { if (overlayView == null) { overlayView = createOverlayForDisplay() } else { Log.v(TAG, "overlay already shown") } } override fun hide() = mainExecutor.execute { overlayView = null } override fun hide(sensorId: Int) = mainExecutor.execute { overlayView = null } }) } Loading Loading @@ -165,6 +173,12 @@ class SidefpsController @Inject constructor( } } @BiometricOverlayConstants.ShowReason private fun Int.isReasonToShow(): Boolean = when (this) { REASON_AUTH_KEYGUARD -> false else -> true } @RawRes private fun Display.asSideFpsAnimation(): Int = when (rotation) { Surface.ROTATION_0 -> R.raw.sfps_pulse Loading packages/SystemUI/tests/src/com/android/systemui/biometrics/SidefpsControllerTest.kt +17 −7 Original line number Diff line number Diff line Loading @@ -17,6 +17,8 @@ package com.android.systemui.biometrics import android.graphics.Rect import android.hardware.biometrics.BiometricOverlayConstants.REASON_AUTH_KEYGUARD import android.hardware.biometrics.BiometricOverlayConstants.REASON_UNKNOWN import android.hardware.biometrics.SensorProperties import android.hardware.display.DisplayManager import android.hardware.display.DisplayManagerGlobal Loading Loading @@ -128,25 +130,25 @@ class SidefpsControllerTest : SysuiTestCase() { @Test fun testSubscribesToOrientationChangesWhenShowingOverlay() { overlayController.show() overlayController.show(SENSOR_ID, REASON_UNKNOWN) executor.runAllReady() verify(displayManager).registerDisplayListener(any(), eq(handler)) overlayController.hide() overlayController.hide(SENSOR_ID) executor.runAllReady() verify(displayManager).unregisterDisplayListener(any()) } @Test fun testShowsAndHides() { overlayController.show() overlayController.show(SENSOR_ID, REASON_UNKNOWN) executor.runAllReady() verify(windowManager).addView(overlayCaptor.capture(), any()) reset(windowManager) overlayController.hide() overlayController.hide(SENSOR_ID) executor.runAllReady() verify(windowManager, never()).addView(any(), any()) Loading @@ -156,7 +158,7 @@ class SidefpsControllerTest : SysuiTestCase() { @Test fun testShowsOnce() { repeat(5) { overlayController.show() overlayController.show(SENSOR_ID, REASON_UNKNOWN) executor.runAllReady() } Loading @@ -166,15 +168,23 @@ class SidefpsControllerTest : SysuiTestCase() { @Test fun testHidesOnce() { overlayController.show() overlayController.show(SENSOR_ID, REASON_UNKNOWN) executor.runAllReady() repeat(5) { overlayController.hide() overlayController.hide(SENSOR_ID) executor.runAllReady() } verify(windowManager).addView(any(), any()) verify(windowManager).removeView(any()) } @Test fun testIgnoredForKeyguard() { overlayController.show(SENSOR_ID, REASON_AUTH_KEYGUARD) executor.runAllReady() verify(windowManager, never()).addView(any(), any()) } } services/core/java/com/android/server/biometrics/sensors/SensorOverlays.java +2 −2 Original line number Diff line number Diff line Loading @@ -68,7 +68,7 @@ public final class SensorOverlays { @NonNull AcquisitionClient<?> client) { if (mSidefpsController.isPresent()) { try { mSidefpsController.get().show(); mSidefpsController.get().show(sensorId, reason); } catch (RemoteException e) { Slog.e(TAG, "Remote exception when showing the side-fps overlay", e); } Loading Loading @@ -99,7 +99,7 @@ public final class SensorOverlays { public void hide(int sensorId) { if (mSidefpsController.isPresent()) { try { mSidefpsController.get().hide(); mSidefpsController.get().hide(sensorId); } catch (RemoteException e) { Slog.e(TAG, "Remote exception when hiding the side-fps overlay", e); } Loading Loading
core/java/android/hardware/fingerprint/ISidefpsController.aidl +3 −3 Original line number Diff line number Diff line Loading @@ -21,9 +21,9 @@ package android.hardware.fingerprint; */ oneway interface ISidefpsController { // Shows the overlay. void show(); // Shows the overlay for the given sensor with a reason from BiometricOverlayConstants. void show(int sensorId, int reason); // Hides the overlay. void hide(); void hide(int sensorId); }
core/java/android/hardware/fingerprint/IUdfpsOverlayController.aidl +1 −1 Original line number Diff line number Diff line Loading @@ -22,7 +22,7 @@ import android.hardware.fingerprint.IUdfpsOverlayControllerCallback; * @hide */ oneway interface IUdfpsOverlayController { // Shows the overlay. // Shows the overlay for the given sensor with a reason from BiometricOverlayConstants. void showUdfpsOverlay(int sensorId, int reason, IUdfpsOverlayControllerCallback callback); // Hides the overlay. Loading
packages/SystemUI/src/com/android/systemui/biometrics/SidefpsController.kt +16 −2 Original line number Diff line number Diff line Loading @@ -18,6 +18,8 @@ package com.android.systemui.biometrics import android.content.Context import android.graphics.PixelFormat import android.graphics.Rect import android.hardware.biometrics.BiometricOverlayConstants import android.hardware.biometrics.BiometricOverlayConstants.REASON_AUTH_KEYGUARD import android.hardware.display.DisplayManager import android.hardware.fingerprint.FingerprintManager import android.hardware.fingerprint.FingerprintSensorPropertiesInternal Loading Loading @@ -100,14 +102,20 @@ class SidefpsController @Inject constructor( init { fingerprintManager?.setSidefpsController(object : ISidefpsController.Stub() { override fun show() = mainExecutor.execute { override fun show( sensorId: Int, @BiometricOverlayConstants.ShowReason reason: Int ) = if (reason.isReasonToShow()) doShow() else hide(sensorId) private fun doShow() = mainExecutor.execute { if (overlayView == null) { overlayView = createOverlayForDisplay() } else { Log.v(TAG, "overlay already shown") } } override fun hide() = mainExecutor.execute { overlayView = null } override fun hide(sensorId: Int) = mainExecutor.execute { overlayView = null } }) } Loading Loading @@ -165,6 +173,12 @@ class SidefpsController @Inject constructor( } } @BiometricOverlayConstants.ShowReason private fun Int.isReasonToShow(): Boolean = when (this) { REASON_AUTH_KEYGUARD -> false else -> true } @RawRes private fun Display.asSideFpsAnimation(): Int = when (rotation) { Surface.ROTATION_0 -> R.raw.sfps_pulse Loading
packages/SystemUI/tests/src/com/android/systemui/biometrics/SidefpsControllerTest.kt +17 −7 Original line number Diff line number Diff line Loading @@ -17,6 +17,8 @@ package com.android.systemui.biometrics import android.graphics.Rect import android.hardware.biometrics.BiometricOverlayConstants.REASON_AUTH_KEYGUARD import android.hardware.biometrics.BiometricOverlayConstants.REASON_UNKNOWN import android.hardware.biometrics.SensorProperties import android.hardware.display.DisplayManager import android.hardware.display.DisplayManagerGlobal Loading Loading @@ -128,25 +130,25 @@ class SidefpsControllerTest : SysuiTestCase() { @Test fun testSubscribesToOrientationChangesWhenShowingOverlay() { overlayController.show() overlayController.show(SENSOR_ID, REASON_UNKNOWN) executor.runAllReady() verify(displayManager).registerDisplayListener(any(), eq(handler)) overlayController.hide() overlayController.hide(SENSOR_ID) executor.runAllReady() verify(displayManager).unregisterDisplayListener(any()) } @Test fun testShowsAndHides() { overlayController.show() overlayController.show(SENSOR_ID, REASON_UNKNOWN) executor.runAllReady() verify(windowManager).addView(overlayCaptor.capture(), any()) reset(windowManager) overlayController.hide() overlayController.hide(SENSOR_ID) executor.runAllReady() verify(windowManager, never()).addView(any(), any()) Loading @@ -156,7 +158,7 @@ class SidefpsControllerTest : SysuiTestCase() { @Test fun testShowsOnce() { repeat(5) { overlayController.show() overlayController.show(SENSOR_ID, REASON_UNKNOWN) executor.runAllReady() } Loading @@ -166,15 +168,23 @@ class SidefpsControllerTest : SysuiTestCase() { @Test fun testHidesOnce() { overlayController.show() overlayController.show(SENSOR_ID, REASON_UNKNOWN) executor.runAllReady() repeat(5) { overlayController.hide() overlayController.hide(SENSOR_ID) executor.runAllReady() } verify(windowManager).addView(any(), any()) verify(windowManager).removeView(any()) } @Test fun testIgnoredForKeyguard() { overlayController.show(SENSOR_ID, REASON_AUTH_KEYGUARD) executor.runAllReady() verify(windowManager, never()).addView(any(), any()) } }
services/core/java/com/android/server/biometrics/sensors/SensorOverlays.java +2 −2 Original line number Diff line number Diff line Loading @@ -68,7 +68,7 @@ public final class SensorOverlays { @NonNull AcquisitionClient<?> client) { if (mSidefpsController.isPresent()) { try { mSidefpsController.get().show(); mSidefpsController.get().show(sensorId, reason); } catch (RemoteException e) { Slog.e(TAG, "Remote exception when showing the side-fps overlay", e); } Loading Loading @@ -99,7 +99,7 @@ public final class SensorOverlays { public void hide(int sensorId) { if (mSidefpsController.isPresent()) { try { mSidefpsController.get().hide(); mSidefpsController.get().hide(sensorId); } catch (RemoteException e) { Slog.e(TAG, "Remote exception when hiding the side-fps overlay", e); } Loading