Merge "Fix double-checked locking in InputMethodSubtype" into oc-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
da93d0ea9b
@@ -520,27 +520,27 @@ public final class InputMethodSubtype implements Parcelable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private HashMap<String, String> getExtraValueHashMap() {
|
private HashMap<String, String> getExtraValueHashMap() {
|
||||||
if (mExtraValueHashMapCache == null) {
|
synchronized (this) {
|
||||||
synchronized(this) {
|
HashMap<String, String> extraValueMap = mExtraValueHashMapCache;
|
||||||
if (mExtraValueHashMapCache == null) {
|
if (extraValueMap != null) {
|
||||||
mExtraValueHashMapCache = new HashMap<String, String>();
|
return extraValueMap;
|
||||||
final String[] pairs = mSubtypeExtraValue.split(EXTRA_VALUE_PAIR_SEPARATOR);
|
}
|
||||||
final int N = pairs.length;
|
extraValueMap = new HashMap<>();
|
||||||
for (int i = 0; i < N; ++i) {
|
final String[] pairs = mSubtypeExtraValue.split(EXTRA_VALUE_PAIR_SEPARATOR);
|
||||||
final String[] pair = pairs[i].split(EXTRA_VALUE_KEY_VALUE_SEPARATOR);
|
for (int i = 0; i < pairs.length; ++i) {
|
||||||
if (pair.length == 1) {
|
final String[] pair = pairs[i].split(EXTRA_VALUE_KEY_VALUE_SEPARATOR);
|
||||||
mExtraValueHashMapCache.put(pair[0], null);
|
if (pair.length == 1) {
|
||||||
} else if (pair.length > 1) {
|
extraValueMap.put(pair[0], null);
|
||||||
if (pair.length > 2) {
|
} else if (pair.length > 1) {
|
||||||
Slog.w(TAG, "ExtraValue has two or more '='s");
|
if (pair.length > 2) {
|
||||||
}
|
Slog.w(TAG, "ExtraValue has two or more '='s");
|
||||||
mExtraValueHashMapCache.put(pair[0], pair[1]);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
extraValueMap.put(pair[0], pair[1]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
mExtraValueHashMapCache = extraValueMap;
|
||||||
|
return extraValueMap;
|
||||||
}
|
}
|
||||||
return mExtraValueHashMapCache;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user