diff options
author | Yohei Yukawa <yukawa@google.com> | 2014-05-22 12:49:00 +0900 |
---|---|---|
committer | Yohei Yukawa <yukawa@google.com> | 2014-05-22 18:18:02 +0900 |
commit | 5a647b69be8ac8d40c33ed9abe63e41514699e5b (patch) | |
tree | ced03f8b88fb4d59d2a176f859cea1cb53f9e95b /core/tests | |
parent | 69b43b496472132c4eaee0f9007d453c6f6a49b2 (diff) | |
download | frameworks_base-5a647b69be8ac8d40c33ed9abe63e41514699e5b.zip frameworks_base-5a647b69be8ac8d40c33ed9abe63e41514699e5b.tar.gz frameworks_base-5a647b69be8ac8d40c33ed9abe63e41514699e5b.tar.bz2 |
Remove unnecessary internal lock
Previously, InputMethodSubtypeSwitchingController has relied on
its own internal lock for #getNextInputMethod and
class has to be invalidated whenever
InputMethodManagerService#mMethodMap is updated, any method of
InputMethodSubtypeSwitchingController should be called under
the global lock of InputMethodManagerService#mMethodMap.
As a consequence, we can conclude that
InputMethodSubtypeSwitchingController does not need its own
internal lock.
This CL also adds additional synchronization blocks into
the constructor of InputMethodManagerService to address the
existing inconsistency that methods with *Locked suffix are
called without the lock actually.
BUG: 7043015
Change-Id: I9d4d3d7232c984432185c10c13fb726a6158cac8
Diffstat (limited to 'core/tests')
-rw-r--r-- | core/tests/inputmethodtests/src/android/os/InputMethodSubtypeSwitchingControllerTest.java | 28 |
1 files changed, 14 insertions, 14 deletions
diff --git a/core/tests/inputmethodtests/src/android/os/InputMethodSubtypeSwitchingControllerTest.java b/core/tests/inputmethodtests/src/android/os/InputMethodSubtypeSwitchingControllerTest.java index 2a4d921..0f343b1 100644 --- a/core/tests/inputmethodtests/src/android/os/InputMethodSubtypeSwitchingControllerTest.java +++ b/core/tests/inputmethodtests/src/android/os/InputMethodSubtypeSwitchingControllerTest.java @@ -105,44 +105,44 @@ public class InputMethodSubtypeSwitchingControllerTest extends InstrumentationTe // "switchAwareLatinIme/en_US" -> "switchAwareLatinIme/es_US" currentIme = imList.get(0); - nextIme = InputMethodSubtypeSwitchingController.getNextInputMethodImpl( + nextIme = InputMethodSubtypeSwitchingController.getNextInputMethodLockedImpl( imList, ONLY_CURRENT_IME, currentIme.mImi, createDummySubtype( currentIme.mSubtypeName.toString())); assertEquals(imList.get(1), nextIme); // "switchAwareLatinIme/es_US" -> "switchAwareLatinIme/fr" currentIme = imList.get(1); - nextIme = InputMethodSubtypeSwitchingController.getNextInputMethodImpl( + nextIme = InputMethodSubtypeSwitchingController.getNextInputMethodLockedImpl( imList, ONLY_CURRENT_IME, currentIme.mImi, createDummySubtype( currentIme.mSubtypeName.toString())); assertEquals(imList.get(2), nextIme); // "switchAwareLatinIme/fr" -> "switchAwareJapaneseIme/ja_JP" currentIme = imList.get(2); - nextIme = InputMethodSubtypeSwitchingController.getNextInputMethodImpl( + nextIme = InputMethodSubtypeSwitchingController.getNextInputMethodLockedImpl( imList, ONLY_CURRENT_IME, currentIme.mImi, createDummySubtype( currentIme.mSubtypeName.toString())); assertEquals(imList.get(5), nextIme); // "switchAwareJapaneseIme/ja_JP" -> "switchAwareLatinIme/en_US" currentIme = imList.get(5); - nextIme = InputMethodSubtypeSwitchingController.getNextInputMethodImpl( + nextIme = InputMethodSubtypeSwitchingController.getNextInputMethodLockedImpl( imList, ONLY_CURRENT_IME, currentIme.mImi, createDummySubtype( currentIme.mSubtypeName.toString())); assertEquals(imList.get(0), nextIme); // "nonSwitchAwareLatinIme/en_UK" -> "nonSwitchAwareLatinIme/hi" currentIme = imList.get(3); - nextIme = InputMethodSubtypeSwitchingController.getNextInputMethodImpl( + nextIme = InputMethodSubtypeSwitchingController.getNextInputMethodLockedImpl( imList, ONLY_CURRENT_IME, currentIme.mImi, createDummySubtype( currentIme.mSubtypeName.toString())); assertEquals(imList.get(4), nextIme); // "nonSwitchAwareLatinIme/hi" -> "nonSwitchAwareJapaneseIme/ja_JP" currentIme = imList.get(4); - nextIme = InputMethodSubtypeSwitchingController.getNextInputMethodImpl( + nextIme = InputMethodSubtypeSwitchingController.getNextInputMethodLockedImpl( imList, ONLY_CURRENT_IME, currentIme.mImi, createDummySubtype( currentIme.mSubtypeName.toString())); assertEquals(imList.get(6), nextIme); // "nonSwitchAwareJapaneseIme/ja_JP" -> "nonSwitchAwareLatinIme/en_UK" currentIme = imList.get(6); - nextIme = InputMethodSubtypeSwitchingController.getNextInputMethodImpl( + nextIme = InputMethodSubtypeSwitchingController.getNextInputMethodLockedImpl( imList, ONLY_CURRENT_IME, currentIme.mImi, createDummySubtype( currentIme.mSubtypeName.toString())); assertEquals(imList.get(3), nextIme); @@ -158,46 +158,46 @@ public class InputMethodSubtypeSwitchingControllerTest extends InstrumentationTe // "switchAwareLatinIme/en_US" -> "switchAwareLatinIme/es_US" currentIme = imList.get(0); - nextIme = InputMethodSubtypeSwitchingController.getNextInputMethodImpl( + nextIme = InputMethodSubtypeSwitchingController.getNextInputMethodLockedImpl( imList, ONLY_CURRENT_IME, currentIme.mImi, createDummySubtype( currentIme.mSubtypeName.toString())); assertEquals(imList.get(1), nextIme); // "switchAwareLatinIme/es_US" -> "switchAwareLatinIme/fr" currentIme = imList.get(1); - nextIme = InputMethodSubtypeSwitchingController.getNextInputMethodImpl( + nextIme = InputMethodSubtypeSwitchingController.getNextInputMethodLockedImpl( imList, ONLY_CURRENT_IME, currentIme.mImi, createDummySubtype( currentIme.mSubtypeName.toString())); assertEquals(imList.get(2), nextIme); // "switchAwareLatinIme/fr" -> "switchAwareLatinIme/en_US" currentIme = imList.get(2); - nextIme = InputMethodSubtypeSwitchingController.getNextInputMethodImpl( + nextIme = InputMethodSubtypeSwitchingController.getNextInputMethodLockedImpl( imList, ONLY_CURRENT_IME, currentIme.mImi, createDummySubtype( currentIme.mSubtypeName.toString())); assertEquals(imList.get(0), nextIme); // "nonSwitchAwareLatinIme/en_UK" -> "nonSwitchAwareLatinIme/hi" currentIme = imList.get(3); - nextIme = InputMethodSubtypeSwitchingController.getNextInputMethodImpl( + nextIme = InputMethodSubtypeSwitchingController.getNextInputMethodLockedImpl( imList, ONLY_CURRENT_IME, currentIme.mImi, createDummySubtype( currentIme.mSubtypeName.toString())); assertEquals(imList.get(4), nextIme); // "nonSwitchAwareLatinIme/hi" -> "switchAwareLatinIme/en_UK" currentIme = imList.get(4); - nextIme = InputMethodSubtypeSwitchingController.getNextInputMethodImpl( + nextIme = InputMethodSubtypeSwitchingController.getNextInputMethodLockedImpl( imList, ONLY_CURRENT_IME, currentIme.mImi, createDummySubtype( currentIme.mSubtypeName.toString())); assertEquals(imList.get(3), nextIme); // "switchAwareJapaneseIme/ja_JP" -> null currentIme = imList.get(5); - nextIme = InputMethodSubtypeSwitchingController.getNextInputMethodImpl( + nextIme = InputMethodSubtypeSwitchingController.getNextInputMethodLockedImpl( imList, ONLY_CURRENT_IME, currentIme.mImi, createDummySubtype( currentIme.mSubtypeName.toString())); assertNull(nextIme); // "nonSwitchAwareJapaneseIme/ja_JP" -> null currentIme = imList.get(6); - nextIme = InputMethodSubtypeSwitchingController.getNextInputMethodImpl( + nextIme = InputMethodSubtypeSwitchingController.getNextInputMethodLockedImpl( imList, ONLY_CURRENT_IME, currentIme.mImi, createDummySubtype( currentIme.mSubtypeName.toString())); assertNull(nextIme); |