0

I am trying to launch a biometric prompt from the background. Basically I added a piece of code to the SystemUi of AOSP and any app can make a request to the SystemUi to have this biometric overlay show up. But now I am migrating from the FingerprintManager to the androidx.biometrics package and I have the issue that it doesn't want to make a Biometric Prompt from the systemUi. This is the output of the logs:

05-14 21:40:12.166  1722  1722 W AuthController: Task stack changed, current client: com.android.systemui
05-14 21:40:12.171  1722  1722 E AuthController: Evicting client due to: org.example.app

Basically it is checking if the clientPackage is equal to the topPackage and then it auto-cancels the prompt.

This is the offending method:

    private void cancelIfOwnerIsNotInForeground() {
        mExecution.assertIsMainThread();
        if (mCurrentDialog != null) {
            try {
                final String clientPackage = mCurrentDialog.getOpPackageName();
                Log.w(TAG, "Task stack changed, current client: " + clientPackage);
                final List<ActivityManager.RunningTaskInfo> runningTasks =
                        mActivityTaskManager.getTasks(1);
                if (!runningTasks.isEmpty()) {
                    final String topPackage = runningTasks.get(0).topActivity.getPackageName();
                    if (!topPackage.contentEquals(clientPackage)
                            && !Utils.isSystem(mContext, clientPackage)) {
                        Log.e(TAG, "Evicting client due to: " + topPackage);
                        mCurrentDialog.dismissWithoutCallback(true /* animate */);
                        mCurrentDialog = null;

                        for (Callback cb : mCallbacks) {
                            cb.onBiometricPromptDismissed();
                        }

                        if (mReceiver != null) {
                            mReceiver.onDialogDismissed(
                                    BiometricPrompt.DISMISSED_REASON_USER_CANCEL,
                                    null /* credentialAttestation */);
                            mReceiver = null;
                        }
                    }
                }
            } catch (RemoteException e) {
                Log.e(TAG, "Remote exception", e);
            }
        }
    }

How can I make it so that the function does not auto-cancel if the systemUi is calling it, and so that the fingerprint still works? Because I tried to just add an if currentClient is "com.android.systemui" then return. It then doesn't auto-cancel anymore, but I cannot use the bio prompt, as it does nothing when I touch the in-screen sensor.

Thanks in advance!

Markusbug
  • 31
  • 6

0 Answers0