图案解锁失败后无法使用Google帐户解

来源:互联网 发布:英语书籍推荐知乎 编辑:程序博客网 时间:2024/05/05 23:19

图案解锁失败后无法使用Google帐户解

[DESCRIPTION]

手机已登入谷歌账户,设置屏幕图案解锁,每输入错误5次,系统会警示一次,在等待30秒后重新输入的时间里,解锁界面没有“忘记密码”选项可点击。

[SOLUTION]

该问题是早期KK GMS版本中GoogleLoginService的一个bug。使用KK mr1 r2以及之后的GMS版本,该问题已经被解决。
问题原因是由于,Keyguard會註冊一個 AccountManager callback function,並在callback function 內將 flag mEnableFallback 設成 true。只有當mEnableFallback 等於 true 時,才能在後續的動作裡將GOOGLE帐户解锁的BUTTON" 顯示出來。
但當 AccountManager callback 被呼叫時,在解析參數時 always 出現exception(見下圖 code & log)。
导致exception的原因是由于AccountManager bind到GoogleLoginService,并且调用其confimCredential方法时,返回了null。
查看Log发现,在执行confimCredential的时候,发生了NullPointerException:
04-23 06:20:58.238 3167 3180 W AccountAuthenticator:
confirmCredentials(Account
{name=qi.wang.mtk@gmail.com, type=com.google})
04-23 06:20:58.238 3167 3180 W AccountAuthenticator:
JAVA.lang.NullPointerException
04-23 06:20:58.238 3167 3180 W AccountAuthenticator: at
Android.os.Bundle.putAll(Bundle.java:331)
04-23 06:20:58.238 3167 3180 W AccountAuthenticator: at
android.content.Intent.putExtras(Intent.java:6376)
04-23 06:20:58.238 3167 3180 W AccountAuthenticator: at
com.google.android.gsf.loginservice.GoogleLoginService$AccountAuthenticato
rImpl.multiProcessHopFix(GoogleLoginService.java:541)
04-23 06:20:58.238 3167 3180 W AccountAuthenticator: at
com.google.android.gsf.loginservice.GoogleLoginService$AccountAuthenticato
rImpl.confirmCredentials(GoogleLoginService.java:383)
04-23 06:20:58.238 3167 3180 W AccountAuthenticator: at
android.accounts.AbstractAccountAuthenticator$Transport.confirmCredentials
(AbstractAccountAuthenticator.java:150)
04-23 06:20:58.238 3167 3180 W AccountAuthenticator: at
android.accounts.IAccountAuthenticator$Stub.onTransact(IAccountAuthenticat
or.java:89)
04-23 06:20:58.238 3167 3180 W AccountAuthenticator: at
android.os.Binder.execTransact(Binder.java:404)
04-23 06:20:58.238 3167 3180 W AccountAuthenticator: at
dalvik.system.NativeStart.run(Native Method)
反编译GLS发现,GLS没有判断传递的参数为null的情况:
public Bundle confirmCredentials(AccountAuthenticatorResponse
paramAccountAuthenticatorResponse, Account paramAccount, Bundle
paramBundle)
{
//......
if (paramBundle != null)
{
((GLSSession)localObject2).mAccountManagerOptions = paramBundle;
((GLSSession)localObject2).mPendingIntent =
((PendingIntent)paramBundle.getParcelable("pendingIntent"));
}
((GLSSession)localObject2).addSession((Intent)localObject1);
((GLSSession)localObject2).mCallingUID = Binder.getCallingUid();
((Intent)localObject1).putExtra("accountAuthenticatorResponse",
((GLSSession)localObject2).mAccountAuthenticatorResponse);
((Intent)localObject1).putExtra("authAccount", paramAccount.name);
((Intent)localObject1).putExtra(RequestKey.SERVICE.getWire(), "SID");
((Intent)localObject1).putExtra("pendingIntent",
((GLSSession)localObject2).mPendingIntent);
multiProcessHopFix((Intent)localObject1, paramBundle);
((GLSSession)localObject2).mError = Status.BAD_AUTHENTICATION;
//......
private void multiProcessHopFix(Intent paramIntent, Bundle paramBundle)
{
paramIntent.putExtra("hasAccountManagerOptions", true);
paramIntent.putExtras(paramBundle);
}
对比GMS r2版本的GLS,发现GLS中的这段逻辑已经被修改(没有呼叫multiProcessHopFix函数
)
if (paramBundle != null)
{
((GLSSession)localObject2).mAccountManagerOptions = paramBundle;
((GLSSession)localObject2).mPendingIntent =
((PendingIntent)paramBundle.getParcelable("pendingIntent"));
multiProcessHopFix((Intent)localObject1, paramBundle);
}
((GLSSession)localObject2).addSession((Intent)localObject1);
((GLSSession)localObject2).mCallingUID = Binder.getCallingUid();
((Intent)localObject1).putExtra("accountAuthenticatorResponse",
((GLSSession)localObject2).mAccountAuthenticatorResponse);
((Intent)localObject1).putExtra("authAccount", paramAccount.name);
((Intent)localObject1).putExtra(RequestKey.SERVICE.getWire(), "SID");
((Intent)localObject1).putExtra("pendingIntent",
((GLSSession)localObject2).mPendingIntent);
((GLSSession)localObject2).mError = Status.BAD_AUTHENTICATION;
StatusHelper.BAD_AUTHENTICATION.toIntent((Intent)localObject1);
((Intent)localObject1).putExtra("authFailedMessage",
this.mContext.getText(2131230965));
((Intent)localObject1).putExtra("confirmCredentials", true);
localObject2 = new Bundle();
((Bundle)localObject2).putParcelable("intent", (Parcelable)localObject1);
return localObject2;
综上,该问题属于Google issue,并且在KK GMS r2之后的版本已经被解决。


0 0
原创粉丝点击