Merge "Fix monkey crash on selecting account sync prefernece."

This commit is contained in:
Doris Ling
2018-06-06 18:44:56 +00:00
committed by Android (Google) Code Review
3 changed files with 72 additions and 3 deletions

View File

@@ -247,10 +247,13 @@ public class AccountSyncSettings extends AccountPreferenceBase {
}
if (preference instanceof SyncStateSwitchPreference) {
SyncStateSwitchPreference syncPref = (SyncStateSwitchPreference) preference;
String authority = syncPref.getAuthority();
Account account = syncPref.getAccount();
final String authority = syncPref.getAuthority();
if (TextUtils.isEmpty(authority)) {
return false;
}
final Account account = syncPref.getAccount();
final int userId = mUserHandle.getIdentifier();
String packageName = syncPref.getPackageName();
final String packageName = syncPref.getPackageName();
boolean syncAutomatically = ContentResolver.getSyncAutomaticallyAsUser(account,
authority, userId);