Add InputMethodEnabler for enabling input methods and subtypes
- Copyed functionarity from LanguageSettings.java TODO: Save enabled InputMethodSubtypes Change-Id: I7b4fb1a79cb8b3229f88773d261430e23ba7aae2
This commit is contained in:
@@ -25,6 +25,7 @@ import com.android.internal.view.IInputMethodClient;
|
||||
import com.android.internal.view.IInputMethodManager;
|
||||
import com.android.internal.view.IInputMethodSession;
|
||||
import com.android.internal.view.InputBindResult;
|
||||
import com.android.internal.view.InputMethodAndSubtypeEnabler;
|
||||
|
||||
import com.android.server.StatusBarManagerService;
|
||||
|
||||
@@ -97,6 +98,7 @@ public class InputMethodManagerService extends IInputMethodManager.Stub
|
||||
|
||||
static final int MSG_SHOW_IM_PICKER = 1;
|
||||
static final int MSG_SHOW_IM_SUBTYPE_PICKER = 2;
|
||||
static final int MSG_SHOW_IM_SUBTYPE_ENABLER = 3;
|
||||
|
||||
static final int MSG_UNBIND_INPUT = 1000;
|
||||
static final int MSG_BIND_INPUT = 1010;
|
||||
@@ -1225,7 +1227,7 @@ public class InputMethodManagerService extends IInputMethodManager.Stub
|
||||
synchronized (mMethodMap) {
|
||||
if (mCurClient == null || client == null
|
||||
|| mCurClient.client.asBinder() != client.asBinder()) {
|
||||
Slog.w(TAG, "Ignoring showInputMethodDialogFromClient of uid "
|
||||
Slog.w(TAG, "Ignoring showInputMethodPickerFromClient of uid "
|
||||
+ Binder.getCallingUid() + ": " + client);
|
||||
}
|
||||
|
||||
@@ -1237,13 +1239,26 @@ public class InputMethodManagerService extends IInputMethodManager.Stub
|
||||
synchronized (mMethodMap) {
|
||||
if (mCurClient == null || client == null
|
||||
|| mCurClient.client.asBinder() != client.asBinder()) {
|
||||
Slog.w(TAG, "Ignoring showInputSubtypeMethodDialogFromClient of: " + client);
|
||||
Slog.w(TAG, "Ignoring showInputMethodSubtypePickerFromClient of: " + client);
|
||||
}
|
||||
|
||||
mHandler.sendEmptyMessage(MSG_SHOW_IM_SUBTYPE_PICKER);
|
||||
}
|
||||
}
|
||||
|
||||
public void showInputMethodAndSubtypeEnablerFromClient(
|
||||
IInputMethodClient client, String topId) {
|
||||
// TODO: Handle topId for setting the top position of the list activity
|
||||
synchronized (mMethodMap) {
|
||||
if (mCurClient == null || client == null
|
||||
|| mCurClient.client.asBinder() != client.asBinder()) {
|
||||
Slog.w(TAG, "Ignoring showInputMethodAndSubtypeEnablerFromClient of: " + client);
|
||||
}
|
||||
|
||||
mHandler.sendEmptyMessage(MSG_SHOW_IM_SUBTYPE_ENABLER);
|
||||
}
|
||||
}
|
||||
|
||||
public void setInputMethod(IBinder token, String id) {
|
||||
setInputMethodWithSubtype(token, id, NOT_A_SUBTYPE_ID);
|
||||
}
|
||||
@@ -1336,6 +1351,10 @@ public class InputMethodManagerService extends IInputMethodManager.Stub
|
||||
showInputMethodSubtypeMenu();
|
||||
return true;
|
||||
|
||||
case MSG_SHOW_IM_SUBTYPE_ENABLER:
|
||||
showInputMethodAndSubtypeEnabler();
|
||||
return true;
|
||||
|
||||
// ---------------------------------------------------------
|
||||
|
||||
case MSG_UNBIND_INPUT:
|
||||
@@ -1528,6 +1547,14 @@ public class InputMethodManagerService extends IInputMethodManager.Stub
|
||||
showInputMethodMenuInternal(true);
|
||||
}
|
||||
|
||||
private void showInputMethodAndSubtypeEnabler() {
|
||||
Intent intent = new Intent();
|
||||
intent.setClassName("android", InputMethodAndSubtypeEnabler.class.getCanonicalName());
|
||||
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK
|
||||
| Intent.FLAG_ACTIVITY_RESET_TASK_IF_NEEDED);
|
||||
mContext.startActivity(intent);
|
||||
}
|
||||
|
||||
private void showInputMethodMenuInternal(boolean showSubtypes) {
|
||||
if (DEBUG) Slog.v(TAG, "Show switching menu");
|
||||
|
||||
|
||||
Reference in New Issue
Block a user