DO NOT MERGE. Backport master InputMethodManagerService.java to gingerbread
Change-Id: Ied15b4f2f447ee3e3b858d4ca65c21c30dfa4eba
This commit is contained in:
@ -77,9 +77,12 @@ import android.view.inputmethod.EditorInfo;
|
|||||||
import java.io.FileDescriptor;
|
import java.io.FileDescriptor;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.PrintWriter;
|
import java.io.PrintWriter;
|
||||||
|
import java.text.Collator;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.TreeMap;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This class provides a system service that manages input methods.
|
* This class provides a system service that manages input methods.
|
||||||
@ -463,14 +466,19 @@ public class InputMethodManagerService extends IInputMethodManager.Stub
|
|||||||
screenOnOffFilt.addAction(Intent.ACTION_CLOSE_SYSTEM_DIALOGS);
|
screenOnOffFilt.addAction(Intent.ACTION_CLOSE_SYSTEM_DIALOGS);
|
||||||
mContext.registerReceiver(new ScreenOnOffReceiver(), screenOnOffFilt);
|
mContext.registerReceiver(new ScreenOnOffReceiver(), screenOnOffFilt);
|
||||||
|
|
||||||
|
mStatusBar = statusBar;
|
||||||
|
statusBar.setIconVisibility("ime", false);
|
||||||
|
|
||||||
buildInputMethodListLocked(mMethodList, mMethodMap);
|
buildInputMethodListLocked(mMethodList, mMethodMap);
|
||||||
|
|
||||||
final String enabledStr = Settings.Secure.getString(
|
final String enabledStr = Settings.Secure.getString(
|
||||||
mContext.getContentResolver(),
|
mContext.getContentResolver(),
|
||||||
Settings.Secure.ENABLED_INPUT_METHODS);
|
Settings.Secure.ENABLED_INPUT_METHODS);
|
||||||
Slog.i(TAG, "Enabled input methods: " + enabledStr);
|
Slog.i(TAG, "Enabled input methods: " + enabledStr);
|
||||||
if (enabledStr == null) {
|
final String defaultIme = Settings.Secure.getString(mContext
|
||||||
Slog.i(TAG, "Enabled input methods has not been set, enabling all");
|
.getContentResolver(), Settings.Secure.DEFAULT_INPUT_METHOD);
|
||||||
|
if (enabledStr == null || TextUtils.isEmpty(defaultIme)) {
|
||||||
|
Slog.i(TAG, "Enabled input methods or default IME has not been set, enabling all");
|
||||||
InputMethodInfo defIm = null;
|
InputMethodInfo defIm = null;
|
||||||
StringBuilder sb = new StringBuilder(256);
|
StringBuilder sb = new StringBuilder(256);
|
||||||
final int N = mMethodList.size();
|
final int N = mMethodList.size();
|
||||||
@ -504,9 +512,6 @@ public class InputMethodManagerService extends IInputMethodManager.Stub
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
mStatusBar = statusBar;
|
|
||||||
statusBar.setIconVisibility("ime", false);
|
|
||||||
|
|
||||||
mSettingsObserver = new SettingsObserver(mHandler);
|
mSettingsObserver = new SettingsObserver(mHandler);
|
||||||
updateFromSettingsLocked();
|
updateFromSettingsLocked();
|
||||||
}
|
}
|
||||||
@ -978,7 +983,7 @@ public class InputMethodManagerService extends IInputMethodManager.Stub
|
|||||||
void setInputMethodLocked(String id) {
|
void setInputMethodLocked(String id) {
|
||||||
InputMethodInfo info = mMethodMap.get(id);
|
InputMethodInfo info = mMethodMap.get(id);
|
||||||
if (info == null) {
|
if (info == null) {
|
||||||
throw new IllegalArgumentException("Unknown id: " + mCurMethodId);
|
throw new IllegalArgumentException("Unknown id: " + id);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (id.equals(mCurMethodId)) {
|
if (id.equals(mCurMethodId)) {
|
||||||
@ -1476,7 +1481,7 @@ public class InputMethodManagerService extends IInputMethodManager.Stub
|
|||||||
|
|
||||||
String defaultIme = Settings.Secure.getString(mContext
|
String defaultIme = Settings.Secure.getString(mContext
|
||||||
.getContentResolver(), Settings.Secure.DEFAULT_INPUT_METHOD);
|
.getContentResolver(), Settings.Secure.DEFAULT_INPUT_METHOD);
|
||||||
if (!map.containsKey(defaultIme)) {
|
if (!TextUtils.isEmpty(defaultIme) && !map.containsKey(defaultIme)) {
|
||||||
if (chooseNewDefaultIMELocked()) {
|
if (chooseNewDefaultIMELocked()) {
|
||||||
updateFromSettingsLocked();
|
updateFromSettingsLocked();
|
||||||
}
|
}
|
||||||
@ -1507,20 +1512,21 @@ public class InputMethodManagerService extends IInputMethodManager.Stub
|
|||||||
|
|
||||||
int N = immis.size();
|
int N = immis.size();
|
||||||
|
|
||||||
mItems = new CharSequence[N];
|
final Map<CharSequence, InputMethodInfo> imMap =
|
||||||
mIms = new InputMethodInfo[N];
|
new TreeMap<CharSequence, InputMethodInfo>(Collator.getInstance());
|
||||||
|
|
||||||
int j = 0;
|
|
||||||
for (int i = 0; i < N; ++i) {
|
for (int i = 0; i < N; ++i) {
|
||||||
InputMethodInfo property = immis.get(i);
|
InputMethodInfo property = immis.get(i);
|
||||||
if (property == null) {
|
if (property == null) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
mItems[j] = property.loadLabel(pm);
|
imMap.put(property.loadLabel(pm), property);
|
||||||
mIms[j] = property;
|
|
||||||
j++;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
N = imMap.size();
|
||||||
|
mItems = imMap.keySet().toArray(new CharSequence[N]);
|
||||||
|
mIms = imMap.values().toArray(new InputMethodInfo[N]);
|
||||||
|
|
||||||
int checkedItem = 0;
|
int checkedItem = 0;
|
||||||
for (int i = 0; i < N; ++i) {
|
for (int i = 0; i < N; ++i) {
|
||||||
if (mIms[i].getId().equals(lastInputMethodId)) {
|
if (mIms[i].getId().equals(lastInputMethodId)) {
|
||||||
|
Reference in New Issue
Block a user