Fix handling of base64 consent data and never die when it's broken

This commit is contained in:
mar-v-in 2015-04-12 21:33:29 +02:00
parent 124ec3ac1c
commit bd1be63f6b
2 changed files with 12 additions and 4 deletions

View File

@ -85,8 +85,12 @@ public class AuthManagerServiceImpl extends IAuthManagerService.Stub {
i.putExtra(KEY_ACCOUNT_TYPE, authManager.getAccountType());
i.putExtra(KEY_ACCOUNT_NAME, accountName);
i.putExtra(KEY_AUTHTOKEN, scope);
if (res.consentDataBase64 != null)
i.putExtra(EXTRA_CONSENT_DATA, Base64.decode(res.consentDataBase64, Base64.URL_SAFE));
try {
if (res.consentDataBase64 != null)
i.putExtra(EXTRA_CONSENT_DATA, Base64.decode(res.consentDataBase64, Base64.URL_SAFE));
} catch (Exception e) {
Log.w(TAG, "Can't decode consent data: ", e);
}
result.putParcelable(KEY_USER_RECOVERY_INTENT, i);
return result;
}

View File

@ -109,8 +109,12 @@ class AccountAuthenticator extends AbstractAccountAuthenticator {
i.putExtra(KEY_ACCOUNT_TYPE, account.type);
i.putExtra(KEY_ACCOUNT_NAME, account.name);
i.putExtra(KEY_AUTHTOKEN, authTokenType);
if (res.consentDataBase64 != null)
i.putExtra(AskPermissionActivity.EXTRA_CONSENT_DATA, Base64.decode(res.consentDataBase64, Base64.DEFAULT));
try {
if (res.consentDataBase64 != null)
i.putExtra(AskPermissionActivity.EXTRA_CONSENT_DATA, Base64.decode(res.consentDataBase64, Base64.URL_SAFE));
} catch (Exception e) {
Log.w(TAG, "Can't decode consent data: ", e);
}
result.putParcelable(KEY_INTENT, i);
return result;
}