diff --git a/api/current.xml b/api/current.xml
index 86ed7b8a92484..1ca51c2ba41d9 100644
--- a/api/current.xml
+++ b/api/current.xml
@@ -218267,6 +218267,17 @@
+
+
imis = mImm.getEnabledInputMethodList();
+ if (curInputMethodId != null) {
+ for (InputMethodInfo imi: imis) {
+ if (imi.getId().equals(curInputMethodId)) {
+ return imi;
+ }
+ }
+ }
+ return null;
+ }
+
+ private Drawable getCurrentSubtypeIcon() {
+ final PackageManager pm = getContext().getPackageManager();
+ InputMethodInfo imi = getCurrentInputMethodInfo();
+ InputMethodSubtype subtype = mImm.getCurrentInputMethodSubtype();
+ Drawable icon = null;
+ if (imi != null) {
+ if (subtype != null) {
+ return pm.getDrawable(imi.getPackageName(), subtype.getIconResId(),
+ imi.getServiceInfo().applicationInfo);
+ } else if (imi.getSubtypes().size() > 0) {
+ return pm.getDrawable(imi.getPackageName(),
+ imi.getSubtypes().get(0).getIconResId(),
+ imi.getServiceInfo().applicationInfo);
+ } else {
+ try {
+ return pm.getApplicationInfo(imi.getPackageName(), 0).loadIcon(pm);
+ } catch (PackageManager.NameNotFoundException e) {
+ Log.w(TAG, "Current IME cann't be found: " + imi.getPackageName());
+ }
+ }
+ }
+ return null;
+ }
+
+ private void refreshStatusIcon(boolean keyboardShown) {
+ if (!keyboardShown) {
+ setVisibility(View.INVISIBLE);
+ return;
+ } else {
+ setVisibility(View.VISIBLE);
+ }
+ Drawable icon = getCurrentSubtypeIcon();
+ if (icon == null) {
+ mIcon.setImageResource(R.drawable.ic_sysbar_ime_default);
+ } else {
+ mIcon.setImageDrawable(icon);
+ }
+ }
+
+ private void postRefreshStatusIcon() {
+ getHandler().post(new Runnable() {
+ public void run() {
+ refreshStatusIcon(mKeyboardShown);
+ }
+ });
+ }
+
+ public void showSoftInput() {
+ mKeyboardShown = true;
+ postRefreshStatusIcon();
+ }
+
+ public void hideSoftInput() {
+ mKeyboardShown = false;
+ postRefreshStatusIcon();
+ }
+}