Fix issue #10387684: ArrayIndexOutOfBoundsException in ArrayMap.put

Locking of sSharedPrefs was bad -- it was using a per-context lock
instead of a static lock.

Change-Id: Ib7a929f9fd93f22cc817d32b53ac56523cdad75f
This commit is contained in:
Dianne Hackborn
2013-09-05 13:21:24 -07:00
parent 0851945a72
commit eb5b70b85c

View File

@@ -710,7 +710,7 @@ class ContextImpl extends Context {
@Override
public SharedPreferences getSharedPreferences(String name, int mode) {
SharedPreferencesImpl sp;
synchronized (mSync) {
synchronized (ContextImpl.class) {
if (sSharedPrefs == null) {
sSharedPrefs = new ArrayMap<String, ArrayMap<String, SharedPreferencesImpl>>();
}