Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 05f5236f authored by satok's avatar satok Committed by Android (Google) Code Review
Browse files

Merge "Make InputMethodSubtype thread safe" into jb-dev

parents faf5b16a e52eb4e2
Loading
Loading
Loading
Loading
+16 −12
Original line number Diff line number Diff line
@@ -58,7 +58,7 @@ public final class InputMethodSubtype implements Parcelable {
    private final String mSubtypeLocale;
    private final String mSubtypeMode;
    private final String mSubtypeExtraValue;
    private HashMap<String, String> mExtraValueHashMapCache;
    private volatile HashMap<String, String> mExtraValueHashMapCache;

    /**
     * Constructor.
@@ -236,6 +236,8 @@ public final class InputMethodSubtype implements Parcelable {
    }

    private HashMap<String, String> getExtraValueHashMap() {
        if (mExtraValueHashMapCache == null) {
            synchronized(this) {
                if (mExtraValueHashMapCache == null) {
                    mExtraValueHashMapCache = new HashMap<String, String>();
                    final String[] pairs = mSubtypeExtraValue.split(EXTRA_VALUE_PAIR_SEPARATOR);
@@ -252,6 +254,8 @@ public final class InputMethodSubtype implements Parcelable {
                        }
                    }
                }
            }
        }
        return mExtraValueHashMapCache;
    }