diff options
| author | satok <satok@google.com> | 2010-11-10 01:04:04 +0900 |
|---|---|---|
| committer | satok <satok@google.com> | 2010-11-13 09:49:59 +0900 |
| commit | b66d287e3003a0934d5714fbf15e554b3c814906 (patch) | |
| tree | 0cc8bc71a4e44295e5ca6f290177a74d786e05eb /services/java | |
| parent | 03eb319a3a7fe6fe9ab9eba6fc1f727285850906 (diff) | |
| download | frameworks_base-b66d287e3003a0934d5714fbf15e554b3c814906.zip frameworks_base-b66d287e3003a0934d5714fbf15e554b3c814906.tar.gz frameworks_base-b66d287e3003a0934d5714fbf15e554b3c814906.tar.bz2 | |
Add a setter of InputMethodSubtype to InputMethodManager
- Public API: void setCurrentInputMethodSubtype(int pos)
Change-Id: I55daa19ba924999def544bf841f00bf54852f3e1
Diffstat (limited to 'services/java')
| -rw-r--r-- | services/java/com/android/server/InputMethodManagerService.java | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/services/java/com/android/server/InputMethodManagerService.java b/services/java/com/android/server/InputMethodManagerService.java index 7c1c992..4f8862c 100644 --- a/services/java/com/android/server/InputMethodManagerService.java +++ b/services/java/com/android/server/InputMethodManagerService.java @@ -988,8 +988,9 @@ public class InputMethodManagerService extends IInputMethodManager.Stub } if (id.equals(mCurMethodId)) { - if (subtypeId != NOT_A_SUBTYPE_ID) { - InputMethodSubtype subtype = info.getSubtypes().get(subtypeId); + ArrayList<InputMethodSubtype> subtypes = info.getSubtypes(); + if (subtypeId >= 0 && subtypeId < subtypes.size()) { + InputMethodSubtype subtype = subtypes.get(subtypeId); if (subtype != mCurrentSubtype) { synchronized (mMethodMap) { if (mCurMethod != null) { @@ -1964,6 +1965,20 @@ public class InputMethodManagerService extends IInputMethodManager.Stub return mCurrentSubtype; } + public boolean setCurrentInputMethodSubtype(InputMethodSubtype subtype) { + synchronized (mMethodMap) { + if (subtype != null && mCurMethodId != null) { + InputMethodInfo imi = mMethodMap.get(mCurMethodId); + int subtypeId = getSubtypeIdFromHashCode(imi, subtype.hashCode()); + if (subtypeId != NOT_A_SUBTYPE_ID) { + setInputMethodLocked(mCurMethodId, subtypeId); + return true; + } + } + return false; + } + } + /** * Utility class for putting and getting settings for InputMethod * TODO: Move all putters and getters of settings to this class. |
