Android Fido2PendingIntentlaunchPendingIntent首次失败,并且连续运行

问题描述

为什么Google的Fido2PendingIntent().launchPendingIntent方法首次尝试上失败,并显示错误代码

Security_ERR - The operation is insecure. The incoming request cannot be validated.

而且,成功尝试通常会导致上述呼叫正常工作(提示显示指纹/密码),并且不再出现此错误

这些是代码的主要摘要

ListenerRegistration.java:

    try {
        // Get intent for FIDO2 operation.
        Fido2apiclient fido2apiclient = Fido.getFido2apiclient( this.activity );
        Task<Fido2PendingIntent> task = fido2apiclient.getRegisterIntent( pkcco );

        // Send intent back to UI through callback.
        Log.d( TAG,"LISTENERREGISTRATION.java IS Now ATTEMPTING TO OPEN FINGERPRINT/SECRUITY PROMPT" );
        this.fidoDelegate.launchFidoPrompt( Tasks.await( task ),FidoPromptCallback.FIDO2_REGISTRATION );

        // Wait for authenticator to complete.
        this.fidoAuthenticatorLock.acquire();
    } catch( ExecutionException e ) {
        // Threw exception while waiting for authenticator.
        // Pass Fido2AuthenticatorException back to calling class so it can handle error appropriately.
        throw new Fido2AuthenticatorException( this.sFido2AuthenticatorErrorMessage,this.fido2ErrorCode );
    } catch( InterruptedException e ) {
        // Threw exception while waiting for authenticator.
        // Pass Fido2AuthenticatorException back to calling class so it can handle error appropriately.
        throw new Fido2AuthenticatorException( this.sFido2AuthenticatorErrorMessage,this.fido2ErrorCode );
    }

MainActivity.java:

       // Instantiate class to handle VC functionality called by listener.
       this.lo = new ListenerOperations(MainActivity.this,new FidoPromptCallback() {
        @Override
        public void launchFidoPrompt(Fido2PendingIntent fido2Intent,int iOperation) {
            // Determine how to handle authenticator result.
            int iCode;
            if (iOperation == FidoPromptCallback.FIDO2_REGISTRATION) {
                iCode = MainActivity.REQUEST_FIDO2_REGISTER;
            } else if (iOperation == FidoPromptCallback.FIDO2_ASSERTION) {
                iCode = MainActivity.REQUEST_FIDO2_ASSERTION;
            } else {
                // Invalid operation.
                iCode = -1;
            }

            try {
                // Launch the fingerprint dialog by launching the intent from FIDO2 API.
                Log.d( TAG,"MAINACTIVITY.java IS Now ATTEMPTING TO OPEN FINGERPRINT/SECRUITY PROMPT" );
                fido2Intent.launchPendingIntent( MainActivity.this,iCode );
                Log.d( TAG,"MAINACTIVITY.java HAS OPENNED FINGERPRINT/SECRUITY PROMPT WITH NO ERRORS" );

            } catch( IntentSender.SendIntentException e ) {
                // Error launching pending intent for register request.
                Log.d(TAG,"SADFACE - Failed TO OPEN FINGERPRINT FIDO DIALOG");
            } catch (Exception e) {
                Log.d( TAG,"GENERAL EXCEPTION OCCURRED WHEN CALLING fido2Intent.launchPendingIntent" );
                e.printstacktrace();
            }
            Log.d( TAG,"MAINACTIVITY.java END OF launchFidoPrompt()" );
        }

关于失败(和成功)的日志如下所示(因为即使收到Security_ERR错误之后,也不会抛出任何异常)

other logs
...
10-01 10:31:36.289 14272 15728 D MainActivity.java: LISTENERREGISTRATION.java IS Now ATTEMPTING TO OPEN FINGERPRINT/SECRUITY PROMPT
...
10-01 10:31:37.589 14974 15728 D MainActivity.java: MAINACTIVITY.java IS Now ATTEMPTING TO OPEN FINGERPRINT/SECRUITY PROMPT
10-01 10:31:37.602  4053  4953 I ActivityManager: START u0 {act=null typ=null flg=0x0 cmp=ComponentInfo{com.google.android.gms/com.google.android.gms.fido.fido2.ui.Fido2FullScreenActivity}} from uid 10031
10-01 10:31:37.623  4053  4953 D CustomFrequencyManagerService: acquireDVFSLockLocked : type : DVFS_MIN_LIMIT  frequency : 1560000  uid : 1000  pid : 4053  pkgName : AMS_APP_SWITCH@cpu_MIN@47
10-01 10:31:37.625  4053  4953 D ActivityManagerPerformance: AMP_acquire() APP_SWITCH
10-01 10:31:37.628  3633  3633 I SurfaceFlinger: id=56380 createSurf (3040x3040),2 flag=4,AppWindowToken{2800ead token=Token{77b3fc4 ActivityRecord{44bad7 u0 com.google.android.gms/.fido.fido2.ui.Fido2FullScreenActivity t7062}}}#0
10-01 10:31:37.636  4053  4953 D ActivityManager: Received ACTIVITY intent in key u0 {bcd25e2 act=nullstartActivity cmp=ComponentInfo{com.google.android.gms/com.google.android.gms.fido.fido2.ui.Fido2FullScreenActivity} res=0} from uid 10218
10-01 10:31:37.637 14974 15728 D MainActivity.java: MAINACTIVITY.java HAS OPENNED FINGERPRINT/SECRUITY PROMPT WITH NO ERRORS
10-01 10:31:37.637 14974 15728 D MainActivity.java: MAINACTIVITY.java END OF launchFidoPrompt()

我的代码没有得到任何异常通知的事实,使我相信问题出在对Fido2PendingIntent().launchPendingIntent调用之内。

请注意,此代码现在例外:

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)