diff options
author | Dianne Hackborn <hackbod@google.com> | 2014-10-03 21:02:42 +0000 |
---|---|---|
committer | Android Git Automerger <android-git-automerger@android.com> | 2014-10-03 21:02:42 +0000 |
commit | 02d758a9e83eb1da236f34a2a6b70af89941be43 (patch) | |
tree | af283a27597813bd1719c00561a51c3e46a864d2 /packages/SettingsProvider | |
parent | 2d553e95c9e16fd37a676acaf1960e9d919c3caf (diff) | |
parent | 7caa51e6ec6443d5c1fdb96f7e42508b074b4278 (diff) | |
download | frameworks_base-02d758a9e83eb1da236f34a2a6b70af89941be43.zip frameworks_base-02d758a9e83eb1da236f34a2a6b70af89941be43.tar.gz frameworks_base-02d758a9e83eb1da236f34a2a6b70af89941be43.tar.bz2 |
am 7caa51e6: Merge "Fix issue #17811029: Settings provider race when removing users" into lmp-dev
* commit '7caa51e6ec6443d5c1fdb96f7e42508b074b4278':
Fix issue #17811029: Settings provider race when removing users
Diffstat (limited to 'packages/SettingsProvider')
-rw-r--r-- | packages/SettingsProvider/src/com/android/providers/settings/SettingsProvider.java | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/packages/SettingsProvider/src/com/android/providers/settings/SettingsProvider.java b/packages/SettingsProvider/src/com/android/providers/settings/SettingsProvider.java index 3453a67..34e57bc 100644 --- a/packages/SettingsProvider/src/com/android/providers/settings/SettingsProvider.java +++ b/packages/SettingsProvider/src/com/android/providers/settings/SettingsProvider.java @@ -506,7 +506,14 @@ public class SettingsProvider extends ContentProvider { } private void fullyPopulateCaches(final int userHandle) { - DatabaseHelper dbHelper = mOpenHelpers.get(userHandle); + DatabaseHelper dbHelper; + synchronized (this) { + dbHelper = mOpenHelpers.get(userHandle); + } + if (dbHelper == null) { + // User is gone. + return; + } // Only populate the globals cache once, for the owning user if (userHandle == UserHandle.USER_OWNER) { fullyPopulateCache(dbHelper, TABLE_GLOBAL, sGlobalCache); @@ -611,10 +618,15 @@ public class SettingsProvider extends ContentProvider { long oldId = Binder.clearCallingIdentity(); try { - DatabaseHelper dbHelper = mOpenHelpers.get(callingUser); + DatabaseHelper dbHelper; + synchronized (this) { + dbHelper = mOpenHelpers.get(callingUser); + } if (null == dbHelper) { establishDbTracking(callingUser); - dbHelper = mOpenHelpers.get(callingUser); + synchronized (this) { + dbHelper = mOpenHelpers.get(callingUser); + } } return dbHelper; } finally { |