diff options
author | Fred Quintana <fredq@google.com> | 2010-02-10 10:04:33 -0800 |
---|---|---|
committer | Fred Quintana <fredq@google.com> | 2010-02-10 11:44:23 -0800 |
commit | 1bbcd105a164ebbd69ee3fd1fe8fb75cd8a8c0cb (patch) | |
tree | 1ff4dd1ca0e9e00ed9c55d0f93a5fc2ccbbea17c | |
parent | 751fdc09bb7ab0ce6feac7b7a823e38ed858feb0 (diff) | |
download | frameworks_base-1bbcd105a164ebbd69ee3fd1fe8fb75cd8a8c0cb.zip frameworks_base-1bbcd105a164ebbd69ee3fd1fe8fb75cd8a8c0cb.tar.gz frameworks_base-1bbcd105a164ebbd69ee3fd1fe8fb75cd8a8c0cb.tar.bz2 |
fix an NPE in SyncManager's dump where it can get a null AuthorityInfo; instead create one if one doesn't exist yet
-rw-r--r-- | core/java/android/content/SyncManager.java | 2 | ||||
-rw-r--r-- | core/java/android/content/SyncStorageEngine.java | 6 |
2 files changed, 5 insertions, 3 deletions
diff --git a/core/java/android/content/SyncManager.java b/core/java/android/content/SyncManager.java index ebb95e8..9ff2e25 100644 --- a/core/java/android/content/SyncManager.java +++ b/core/java/android/content/SyncManager.java @@ -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); diff --git a/core/java/android/content/SyncStorageEngine.java b/core/java/android/content/SyncStorageEngine.java index 07a1f46..fcb910d 100644 --- a/core/java/android/content/SyncStorageEngine.java +++ b/core/java/android/content/SyncStorageEngine.java @@ -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 */); } } |