Search in sources :

Example 6 with InputMethodSubtypeHandle

use of com.android.internal.inputmethod.InputMethodSubtypeHandle in project android_frameworks_base by DirtyUnicorns.

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);
    }
}
Also used : InputMethodSubtypeHandle(com.android.internal.inputmethod.InputMethodSubtypeHandle)

Example 7 with InputMethodSubtypeHandle

use of com.android.internal.inputmethod.InputMethodSubtypeHandle in project android_frameworks_base by DirtyUnicorns.

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);
}
Also used : InputMethodSubtypeHandle(com.android.internal.inputmethod.InputMethodSubtypeHandle)

Example 8 with InputMethodSubtypeHandle

use of com.android.internal.inputmethod.InputMethodSubtypeHandle in project android_frameworks_base by AOSPA.

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;
}
Also used : InputMethodSubtypeHandle(com.android.internal.inputmethod.InputMethodSubtypeHandle) InputDeviceIdentifier(android.hardware.input.InputDeviceIdentifier)

Example 9 with InputMethodSubtypeHandle

use of com.android.internal.inputmethod.InputMethodSubtypeHandle in project android_frameworks_base by AOSPA.

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);
    }
}
Also used : InputMethodSubtypeHandle(com.android.internal.inputmethod.InputMethodSubtypeHandle)

Example 10 with InputMethodSubtypeHandle

use of com.android.internal.inputmethod.InputMethodSubtypeHandle in project android_frameworks_base by AOSPA.

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);
}
Also used : InputMethodSubtypeHandle(com.android.internal.inputmethod.InputMethodSubtypeHandle)

Aggregations

InputMethodSubtypeHandle (com.android.internal.inputmethod.InputMethodSubtypeHandle)20 Nullable (android.annotation.Nullable)5 Resources (android.content.res.Resources)5 InputDeviceIdentifier (android.hardware.input.InputDeviceIdentifier)5 KeyboardLayout (android.hardware.input.KeyboardLayout)5