Merge "fix an NPE in SyncManager's dump where it can get a null AuthorityInfo; instead create one if one doesn't exist yet"
This commit is contained in:
committed by
Android (Google) Code Review
commit
caa6f3860f
@@ -1041,7 +1041,7 @@ public class SyncManager implements OnAccountsUpdateListener {
|
||||
continue;
|
||||
}
|
||||
|
||||
SyncStorageEngine.AuthorityInfo settings = mSyncStorageEngine.getAuthority(
|
||||
SyncStorageEngine.AuthorityInfo settings = mSyncStorageEngine.getOrCreateAuthority(
|
||||
account, syncAdapterType.type.authority);
|
||||
SyncStatusInfo status = mSyncStorageEngine.getOrCreateSyncStatus(settings);
|
||||
pw.print(" "); pw.print(settings.authority);
|
||||
|
||||
@@ -632,9 +632,11 @@ public class SyncStorageEngine extends Handler {
|
||||
}
|
||||
}
|
||||
|
||||
public AuthorityInfo getAuthority(Account account, String authority) {
|
||||
public AuthorityInfo getOrCreateAuthority(Account account, String authority) {
|
||||
synchronized (mAuthorities) {
|
||||
return getAuthorityLocked(account, authority, null);
|
||||
return getOrCreateAuthorityLocked(account, authority,
|
||||
-1 /* assign a new identifier if creating a new authority */,
|
||||
true /* write to storage if this results in a change */);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user