Loading packages/SystemUI/src/com/android/systemui/biometrics/AuthContainerView.java +3 −3 Original line number Diff line number Diff line Loading @@ -552,8 +552,6 @@ public class AuthContainerView extends LinearLayout } mWakefulnessLifecycle.addObserver(this); mPanelInteractionDetector.enable( () -> animateAway(AuthDialogCallback.DISMISSED_USER_CANCELED)); if (constraintBp()) { // Do nothing on attachment with constraintLayout } else if (mPromptViewModel.getPromptKind().getValue().isBiometric()) { Loading @@ -566,6 +564,8 @@ public class AuthContainerView extends LinearLayout } if (!constraintBp()) { mPanelInteractionDetector.enable( () -> animateAway(AuthDialogCallback.DISMISSED_USER_CANCELED)); updatePositionByCapability(false /* invalidate */); } Loading Loading @@ -977,7 +977,7 @@ public class AuthContainerView extends LinearLayout final WindowManager.LayoutParams lp = new WindowManager.LayoutParams( ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT, WindowManager.LayoutParams.TYPE_KEYGUARD_DIALOG, WindowManager.LayoutParams.TYPE_APPLICATION_OVERLAY, windowFlags, PixelFormat.TRANSLUCENT); lp.privateFlags |= WindowManager.LayoutParams.SYSTEM_FLAG_SHOW_FOR_ALL_USERS; Loading packages/SystemUI/src/com/android/systemui/biometrics/UdfpsController.java +23 −0 Original line number Diff line number Diff line Loading @@ -34,6 +34,7 @@ import android.content.Intent; import android.content.IntentFilter; import android.graphics.Rect; import android.hardware.biometrics.BiometricFingerprintConstants; import android.hardware.biometrics.BiometricPrompt; import android.hardware.biometrics.SensorProperties; import android.hardware.display.DisplayManager; import android.hardware.fingerprint.FingerprintManager; Loading @@ -43,7 +44,9 @@ import android.hardware.fingerprint.IUdfpsOverlayController; import android.hardware.fingerprint.IUdfpsOverlayControllerCallback; import android.hardware.input.InputManager; import android.os.Build; import android.os.CancellationSignal; import android.os.Handler; import android.os.Looper; import android.os.PowerManager; import android.os.Trace; import android.os.VibrationAttributes; Loading Loading @@ -382,6 +385,26 @@ public class UdfpsController implements DozeReceiver, Dumpable { UdfpsController.this.mFingerprintManager.onUdfpsUiEvent( FingerprintManager.UDFPS_UI_READY, requestId, sensorId); } /** * Debug to show biometric prompt */ public void debugBiometricPrompt() { final BiometricPrompt.AuthenticationCallback authenticationCallback = new BiometricPrompt.AuthenticationCallback() { }; final BiometricPrompt biometricPrompt = new BiometricPrompt.Builder(mContext) .setTitle("Test") .setDeviceCredentialAllowed(true) .setAllowBackgroundAuthentication(true) .build(); final Handler handler = new Handler(Looper.getMainLooper()); biometricPrompt.authenticate( new CancellationSignal(), handler::post, authenticationCallback); } } /** Loading packages/SystemUI/src/com/android/systemui/biometrics/UdfpsShell.kt +66 −28 Original line number Diff line number Diff line Loading @@ -45,16 +45,13 @@ private const val SENSOR_ID = 0 private const val MINOR = 10F private const val MAJOR = 10F /** * Used to show and hide the UDFPS overlay with statusbar commands. */ /** Used to show and hide the UDFPS overlay with statusbar commands. */ @SysUISingleton class UdfpsShell @Inject constructor( commandRegistry: CommandRegistry ) : Command { class UdfpsShell @Inject constructor(commandRegistry: CommandRegistry) : Command { /** * Set in [UdfpsController.java] constructor, used to show and hide the UDFPS overlay. * * TODO: inject after b/229290039 is resolved */ var udfpsOverlayController: UdfpsController.UdfpsOverlayController? = null Loading @@ -76,6 +73,8 @@ class UdfpsShell @Inject constructor( simFingerDown() } else if (args.size == 1 && args[0] == "simFingerUp") { simFingerUp() } else if (args.size == 1 && args[0] == "biometricPrompt") { launchBiometricPrompt() } else { invalidCommand(pw) } Loading @@ -85,8 +84,10 @@ class UdfpsShell @Inject constructor( pw.println("Usage: adb shell cmd statusbar udfps <cmd>") pw.println("Supported commands:") pw.println(" - show <reason>") pw.println(" -> supported reasons: [enroll-find-sensor, enroll-enrolling, auth-bp, " + "auth-keyguard, auth-other, auth-settings]") pw.println( " -> supported reasons: [enroll-find-sensor, enroll-enrolling, auth-bp, " + "auth-keyguard, auth-other, auth-settings]" ) pw.println(" -> reason otherwise defaults to unknown") pw.println(" - hide") pw.println(" - onUiReady") Loading @@ -94,6 +95,8 @@ class UdfpsShell @Inject constructor( pw.println(" -> Simulates onFingerDown on sensor") pw.println(" - simFingerUp") pw.println(" -> Simulates onFingerUp on sensor") pw.println(" - biometricPrompt") pw.println(" -> Shows Biometric Prompt") } private fun invalidCommand(pw: PrintWriter) { Loading Loading @@ -130,6 +133,9 @@ class UdfpsShell @Inject constructor( udfpsOverlayController?.hideUdfpsOverlay(SENSOR_ID) } private fun launchBiometricPrompt() { udfpsOverlayController?.debugBiometricPrompt() } @VisibleForTesting fun onUiReady() { Loading @@ -140,12 +146,24 @@ class UdfpsShell @Inject constructor( fun simFingerDown() { val sensorBounds: Rect = udfpsOverlayController!!.sensorBounds val downEvent: MotionEvent? = obtainMotionEvent(ACTION_DOWN, sensorBounds.exactCenterX(), sensorBounds.exactCenterY(), MINOR, MAJOR) val downEvent: MotionEvent? = obtainMotionEvent( ACTION_DOWN, sensorBounds.exactCenterX(), sensorBounds.exactCenterY(), MINOR, MAJOR ) udfpsOverlayController?.debugOnTouch(downEvent) val moveEvent: MotionEvent? = obtainMotionEvent(ACTION_MOVE, sensorBounds.exactCenterX(), sensorBounds.exactCenterY(), MINOR, MAJOR) val moveEvent: MotionEvent? = obtainMotionEvent( ACTION_MOVE, sensorBounds.exactCenterX(), sensorBounds.exactCenterY(), MINOR, MAJOR ) udfpsOverlayController?.debugOnTouch(moveEvent) downEvent?.recycle() Loading @@ -156,8 +174,14 @@ class UdfpsShell @Inject constructor( fun simFingerUp() { val sensorBounds: Rect = udfpsOverlayController!!.sensorBounds val upEvent: MotionEvent? = obtainMotionEvent(ACTION_UP, sensorBounds.exactCenterX(), sensorBounds.exactCenterY(), MINOR, MAJOR) val upEvent: MotionEvent? = obtainMotionEvent( ACTION_UP, sensorBounds.exactCenterX(), sensorBounds.exactCenterY(), MINOR, MAJOR ) udfpsOverlayController?.debugOnTouch(upEvent) upEvent?.recycle() } Loading @@ -176,7 +200,21 @@ class UdfpsShell @Inject constructor( pc.y = y pc.touchMinor = minor pc.touchMajor = major return MotionEvent.obtain(0, 0, action, 1, arrayOf(pp), arrayOf(pc), 0, 0, 1f, 1f, 0, 0, 0, 0) return MotionEvent.obtain( 0, 0, action, 1, arrayOf(pp), arrayOf(pc), 0, 0, 1f, 1f, 0, 0, 0, 0 ) } } Loading
packages/SystemUI/src/com/android/systemui/biometrics/AuthContainerView.java +3 −3 Original line number Diff line number Diff line Loading @@ -552,8 +552,6 @@ public class AuthContainerView extends LinearLayout } mWakefulnessLifecycle.addObserver(this); mPanelInteractionDetector.enable( () -> animateAway(AuthDialogCallback.DISMISSED_USER_CANCELED)); if (constraintBp()) { // Do nothing on attachment with constraintLayout } else if (mPromptViewModel.getPromptKind().getValue().isBiometric()) { Loading @@ -566,6 +564,8 @@ public class AuthContainerView extends LinearLayout } if (!constraintBp()) { mPanelInteractionDetector.enable( () -> animateAway(AuthDialogCallback.DISMISSED_USER_CANCELED)); updatePositionByCapability(false /* invalidate */); } Loading Loading @@ -977,7 +977,7 @@ public class AuthContainerView extends LinearLayout final WindowManager.LayoutParams lp = new WindowManager.LayoutParams( ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT, WindowManager.LayoutParams.TYPE_KEYGUARD_DIALOG, WindowManager.LayoutParams.TYPE_APPLICATION_OVERLAY, windowFlags, PixelFormat.TRANSLUCENT); lp.privateFlags |= WindowManager.LayoutParams.SYSTEM_FLAG_SHOW_FOR_ALL_USERS; Loading
packages/SystemUI/src/com/android/systemui/biometrics/UdfpsController.java +23 −0 Original line number Diff line number Diff line Loading @@ -34,6 +34,7 @@ import android.content.Intent; import android.content.IntentFilter; import android.graphics.Rect; import android.hardware.biometrics.BiometricFingerprintConstants; import android.hardware.biometrics.BiometricPrompt; import android.hardware.biometrics.SensorProperties; import android.hardware.display.DisplayManager; import android.hardware.fingerprint.FingerprintManager; Loading @@ -43,7 +44,9 @@ import android.hardware.fingerprint.IUdfpsOverlayController; import android.hardware.fingerprint.IUdfpsOverlayControllerCallback; import android.hardware.input.InputManager; import android.os.Build; import android.os.CancellationSignal; import android.os.Handler; import android.os.Looper; import android.os.PowerManager; import android.os.Trace; import android.os.VibrationAttributes; Loading Loading @@ -382,6 +385,26 @@ public class UdfpsController implements DozeReceiver, Dumpable { UdfpsController.this.mFingerprintManager.onUdfpsUiEvent( FingerprintManager.UDFPS_UI_READY, requestId, sensorId); } /** * Debug to show biometric prompt */ public void debugBiometricPrompt() { final BiometricPrompt.AuthenticationCallback authenticationCallback = new BiometricPrompt.AuthenticationCallback() { }; final BiometricPrompt biometricPrompt = new BiometricPrompt.Builder(mContext) .setTitle("Test") .setDeviceCredentialAllowed(true) .setAllowBackgroundAuthentication(true) .build(); final Handler handler = new Handler(Looper.getMainLooper()); biometricPrompt.authenticate( new CancellationSignal(), handler::post, authenticationCallback); } } /** Loading
packages/SystemUI/src/com/android/systemui/biometrics/UdfpsShell.kt +66 −28 Original line number Diff line number Diff line Loading @@ -45,16 +45,13 @@ private const val SENSOR_ID = 0 private const val MINOR = 10F private const val MAJOR = 10F /** * Used to show and hide the UDFPS overlay with statusbar commands. */ /** Used to show and hide the UDFPS overlay with statusbar commands. */ @SysUISingleton class UdfpsShell @Inject constructor( commandRegistry: CommandRegistry ) : Command { class UdfpsShell @Inject constructor(commandRegistry: CommandRegistry) : Command { /** * Set in [UdfpsController.java] constructor, used to show and hide the UDFPS overlay. * * TODO: inject after b/229290039 is resolved */ var udfpsOverlayController: UdfpsController.UdfpsOverlayController? = null Loading @@ -76,6 +73,8 @@ class UdfpsShell @Inject constructor( simFingerDown() } else if (args.size == 1 && args[0] == "simFingerUp") { simFingerUp() } else if (args.size == 1 && args[0] == "biometricPrompt") { launchBiometricPrompt() } else { invalidCommand(pw) } Loading @@ -85,8 +84,10 @@ class UdfpsShell @Inject constructor( pw.println("Usage: adb shell cmd statusbar udfps <cmd>") pw.println("Supported commands:") pw.println(" - show <reason>") pw.println(" -> supported reasons: [enroll-find-sensor, enroll-enrolling, auth-bp, " + "auth-keyguard, auth-other, auth-settings]") pw.println( " -> supported reasons: [enroll-find-sensor, enroll-enrolling, auth-bp, " + "auth-keyguard, auth-other, auth-settings]" ) pw.println(" -> reason otherwise defaults to unknown") pw.println(" - hide") pw.println(" - onUiReady") Loading @@ -94,6 +95,8 @@ class UdfpsShell @Inject constructor( pw.println(" -> Simulates onFingerDown on sensor") pw.println(" - simFingerUp") pw.println(" -> Simulates onFingerUp on sensor") pw.println(" - biometricPrompt") pw.println(" -> Shows Biometric Prompt") } private fun invalidCommand(pw: PrintWriter) { Loading Loading @@ -130,6 +133,9 @@ class UdfpsShell @Inject constructor( udfpsOverlayController?.hideUdfpsOverlay(SENSOR_ID) } private fun launchBiometricPrompt() { udfpsOverlayController?.debugBiometricPrompt() } @VisibleForTesting fun onUiReady() { Loading @@ -140,12 +146,24 @@ class UdfpsShell @Inject constructor( fun simFingerDown() { val sensorBounds: Rect = udfpsOverlayController!!.sensorBounds val downEvent: MotionEvent? = obtainMotionEvent(ACTION_DOWN, sensorBounds.exactCenterX(), sensorBounds.exactCenterY(), MINOR, MAJOR) val downEvent: MotionEvent? = obtainMotionEvent( ACTION_DOWN, sensorBounds.exactCenterX(), sensorBounds.exactCenterY(), MINOR, MAJOR ) udfpsOverlayController?.debugOnTouch(downEvent) val moveEvent: MotionEvent? = obtainMotionEvent(ACTION_MOVE, sensorBounds.exactCenterX(), sensorBounds.exactCenterY(), MINOR, MAJOR) val moveEvent: MotionEvent? = obtainMotionEvent( ACTION_MOVE, sensorBounds.exactCenterX(), sensorBounds.exactCenterY(), MINOR, MAJOR ) udfpsOverlayController?.debugOnTouch(moveEvent) downEvent?.recycle() Loading @@ -156,8 +174,14 @@ class UdfpsShell @Inject constructor( fun simFingerUp() { val sensorBounds: Rect = udfpsOverlayController!!.sensorBounds val upEvent: MotionEvent? = obtainMotionEvent(ACTION_UP, sensorBounds.exactCenterX(), sensorBounds.exactCenterY(), MINOR, MAJOR) val upEvent: MotionEvent? = obtainMotionEvent( ACTION_UP, sensorBounds.exactCenterX(), sensorBounds.exactCenterY(), MINOR, MAJOR ) udfpsOverlayController?.debugOnTouch(upEvent) upEvent?.recycle() } Loading @@ -176,7 +200,21 @@ class UdfpsShell @Inject constructor( pc.y = y pc.touchMinor = minor pc.touchMajor = major return MotionEvent.obtain(0, 0, action, 1, arrayOf(pp), arrayOf(pc), 0, 0, 1f, 1f, 0, 0, 0, 0) return MotionEvent.obtain( 0, 0, action, 1, arrayOf(pp), arrayOf(pc), 0, 0, 1f, 1f, 0, 0, 0, 0 ) } }