use of com.android.internal.inputmethod.InputMethodSubtypeHandle in project android_frameworks_base by crdroidandroid.
the class InputManagerService method setKeyboardLayoutForInputDevice.
@Override
public void setKeyboardLayoutForInputDevice(InputDeviceIdentifier identifier, InputMethodInfo imeInfo, InputMethodSubtype imeSubtype, String keyboardLayoutDescriptor) {
if (!checkCallingPermission(android.Manifest.permission.SET_KEYBOARD_LAYOUT, "setKeyboardLayoutForInputDevice()")) {
throw new SecurityException("Requires SET_KEYBOARD_LAYOUT permission");
}
if (keyboardLayoutDescriptor == null) {
throw new IllegalArgumentException("keyboardLayoutDescriptor must not be null");
}
if (imeInfo == null) {
throw new IllegalArgumentException("imeInfo must not be null");
}
InputMethodSubtypeHandle handle = new InputMethodSubtypeHandle(imeInfo, imeSubtype);
setKeyboardLayoutForInputDeviceInner(identifier, handle, keyboardLayoutDescriptor);
}
use of com.android.internal.inputmethod.InputMethodSubtypeHandle in project android_frameworks_base by crdroidandroid.
the class InputManagerService method handleSwitchInputMethodSubtype.
// Must be called on handler.
private void handleSwitchInputMethodSubtype(int userId, @Nullable InputMethodInfo inputMethodInfo, @Nullable InputMethodSubtype subtype) {
if (DEBUG) {
Slog.i(TAG, "InputMethodSubtype changed: userId=" + userId + " ime=" + inputMethodInfo + " subtype=" + subtype);
}
if (inputMethodInfo == null) {
Slog.d(TAG, "No InputMethod is running, ignoring change");
return;
}
if (subtype != null && !"keyboard".equals(subtype.getMode())) {
Slog.d(TAG, "InputMethodSubtype changed to non-keyboard subtype, ignoring change");
return;
}
InputMethodSubtypeHandle handle = new InputMethodSubtypeHandle(inputMethodInfo, subtype);
if (!handle.equals(mCurrentImeHandle)) {
mCurrentImeHandle = handle;
handleSwitchKeyboardLayout(null, handle);
}
}
use of com.android.internal.inputmethod.InputMethodSubtypeHandle in project android_frameworks_base by DirtyUnicorns.
the class InputManagerService method getKeyboardLayoutForInputDevice.
// Binder call
@Override
@Nullable
public KeyboardLayout getKeyboardLayoutForInputDevice(InputDeviceIdentifier identifier, InputMethodInfo imeInfo, InputMethodSubtype imeSubtype) {
InputMethodSubtypeHandle handle = new InputMethodSubtypeHandle(imeInfo, imeSubtype);
String key = getLayoutDescriptor(identifier);
final String keyboardLayoutDescriptor;
synchronized (mDataStore) {
keyboardLayoutDescriptor = mDataStore.getKeyboardLayout(key, handle);
}
if (keyboardLayoutDescriptor == null) {
return null;
}
final KeyboardLayout[] result = new KeyboardLayout[1];
visitKeyboardLayout(keyboardLayoutDescriptor, new KeyboardLayoutVisitor() {
@Override
public void visitKeyboardLayout(Resources resources, int keyboardLayoutResId, KeyboardLayout layout) {
result[0] = layout;
}
});
if (result[0] == null) {
Slog.w(TAG, "Could not get keyboard layout with descriptor '" + keyboardLayoutDescriptor + "'.");
}
return result[0];
}
use of com.android.internal.inputmethod.InputMethodSubtypeHandle in project android_frameworks_base by ResurrectionRemix.
the class InputManagerService method handleSwitchInputMethodSubtype.
// Must be called on handler.
private void handleSwitchInputMethodSubtype(int userId, @Nullable InputMethodInfo inputMethodInfo, @Nullable InputMethodSubtype subtype) {
if (DEBUG) {
Slog.i(TAG, "InputMethodSubtype changed: userId=" + userId + " ime=" + inputMethodInfo + " subtype=" + subtype);
}
if (inputMethodInfo == null) {
Slog.d(TAG, "No InputMethod is running, ignoring change");
return;
}
if (subtype != null && !"keyboard".equals(subtype.getMode())) {
Slog.d(TAG, "InputMethodSubtype changed to non-keyboard subtype, ignoring change");
return;
}
InputMethodSubtypeHandle handle = new InputMethodSubtypeHandle(inputMethodInfo, subtype);
if (!handle.equals(mCurrentImeHandle)) {
mCurrentImeHandle = handle;
handleSwitchKeyboardLayout(null, handle);
}
}
use of com.android.internal.inputmethod.InputMethodSubtypeHandle in project android_frameworks_base by ResurrectionRemix.
the class InputManagerService method onShellCommand.
public int onShellCommand(Shell shell, String cmd) {
if (TextUtils.isEmpty(cmd)) {
shell.onHelp();
return 1;
}
if (cmd.equals("setlayout")) {
if (!checkCallingPermission(android.Manifest.permission.SET_KEYBOARD_LAYOUT, "onShellCommand()")) {
throw new SecurityException("Requires SET_KEYBOARD_LAYOUT permission");
}
InputMethodSubtypeHandle handle = new InputMethodSubtypeHandle(shell.getNextArgRequired(), Integer.parseInt(shell.getNextArgRequired()));
String descriptor = shell.getNextArgRequired();
int vid = Integer.decode(shell.getNextArgRequired());
int pid = Integer.decode(shell.getNextArgRequired());
InputDeviceIdentifier id = new InputDeviceIdentifier(descriptor, vid, pid);
setKeyboardLayoutForInputDeviceInner(id, handle, shell.getNextArgRequired());
}
return 0;
}
Aggregations