diff options
author | Dianne Hackborn <hackbod@google.com> | 2014-10-03 12:29:43 -0700 |
---|---|---|
committer | Dianne Hackborn <hackbod@google.com> | 2014-10-03 12:29:43 -0700 |
commit | 67f175cf07ff52c5bee30536caad2e97800ab5b8 (patch) | |
tree | 5ded2644897aa50e60d73172b9dec619c919ba68 /packages/SettingsProvider | |
parent | 1e2e4307ff381e5cb9d8d19eb6a1aca763ba9415 (diff) | |
download | frameworks_base-67f175cf07ff52c5bee30536caad2e97800ab5b8.zip frameworks_base-67f175cf07ff52c5bee30536caad2e97800ab5b8.tar.gz frameworks_base-67f175cf07ff52c5bee30536caad2e97800ab5b8.tar.bz2 |
Fix issue #17811029: Settings provider race when removing users
Change-Id: Ia40d0a9c161b765d1340db5390d0acdbfc050b81
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 { |