Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 36abd8a6 authored by Yohei Yukawa's avatar Yohei Yukawa
Browse files

Revert "Accept null subtype in InputMethodSubtypeHandle."

This reverts commit 46ac35d0 [1].

Reason for revert:
This is the part 1 of a series of reverts to unlaunch Bug 25752812,
which aimed to improve UX but did not work well.

See I7a2ed6dd39dcd8207d3d94e12cd01d5d67ba4bb5 for the detailed reason
of revert.

 [1]: Ia013784a594ad3beaf30976d047f5ac0fa8185be

Bug: 66498367
Test: Manually done
Change-Id: Ifd17b53704b3dff75b6ef3be6835f51271859933
parent 09ed26a0
Loading
Loading
Loading
Loading
+4 −7
Original line number Diff line number Diff line
@@ -17,7 +17,6 @@
package android.hardware.input;

import android.annotation.IntDef;
import android.annotation.Nullable;
import android.annotation.SdkConstant;
import android.annotation.SdkConstant.SdkConstantType;
import android.annotation.SystemService;
@@ -709,16 +708,14 @@ public final class InputManager {
     *
     * @param identifier The identifier for the input device.
     * @param inputMethodInfo The input method.
     * @param inputMethodSubtype The input method subtype. {@code null} if this input method does
     * not support any subtype.
     * @param inputMethodSubtype The input method subtype.
     *
     * @return The associated {@link KeyboardLayout}, or null if one has not been set.
     *
     * @hide
     */
    @Nullable
    public KeyboardLayout getKeyboardLayoutForInputDevice(InputDeviceIdentifier identifier,
            InputMethodInfo inputMethodInfo, @Nullable InputMethodSubtype inputMethodSubtype) {
            InputMethodInfo inputMethodInfo, InputMethodSubtype inputMethodSubtype) {
        try {
            return mIm.getKeyboardLayoutForInputDevice(
                    identifier, inputMethodInfo, inputMethodSubtype);
@@ -733,13 +730,13 @@ public final class InputManager {
     * @param identifier The identifier for the input device.
     * @param inputMethodInfo The input method with which to associate the keyboard layout.
     * @param inputMethodSubtype The input method subtype which which to associate the keyboard
     * layout. {@code null} if this input method does not support any subtype.
     *                           layout.
     * @param keyboardLayoutDescriptor The descriptor of the keyboard layout to set
     *
     * @hide
     */
    public void setKeyboardLayoutForInputDevice(InputDeviceIdentifier identifier,
            InputMethodInfo inputMethodInfo, @Nullable InputMethodSubtype inputMethodSubtype,
            InputMethodInfo inputMethodInfo, InputMethodSubtype inputMethodSubtype,
            String keyboardLayoutDescriptor) {
        try {
            mIm.setKeyboardLayoutForInputDevice(identifier, inputMethodInfo,
+2 −3
Original line number Diff line number Diff line
@@ -16,7 +16,6 @@

package com.android.internal.inputmethod;

import android.annotation.Nullable;
import android.text.TextUtils;
import android.view.inputmethod.InputMethodInfo;
import android.view.inputmethod.InputMethodSubtype;
@@ -27,12 +26,12 @@ public class InputMethodSubtypeHandle {
    private final String mInputMethodId;
    private final int mSubtypeId;

    public InputMethodSubtypeHandle(InputMethodInfo info, @Nullable InputMethodSubtype subtype) {
    public InputMethodSubtypeHandle(InputMethodInfo info, InputMethodSubtype subtype) {
        mInputMethodId = info.getId();
        if (subtype != null) {
            mSubtypeId = subtype.hashCode();
        } else {
            mSubtypeId = InputMethodUtils.NOT_A_SUBTYPE_ID;
            mSubtypeId = 0;
        }
    }

+2 −2
Original line number Diff line number Diff line
@@ -1408,8 +1408,8 @@ public class InputManagerService extends IInputManager.Stub
        if (keyboardLayoutDescriptor == null) {
            throw new IllegalArgumentException("keyboardLayoutDescriptor must not be null");
        }
        if (imeInfo == null) {
            throw new IllegalArgumentException("imeInfo must not be null");
        if (imeInfo == null || imeSubtype == null) {
            throw new IllegalArgumentException("imeInfo and imeSubtype must not be null");
        }
        InputMethodSubtypeHandle handle = new InputMethodSubtypeHandle(imeInfo, imeSubtype);
        setKeyboardLayoutForInputDeviceInner(identifier, handle, keyboardLayoutDescriptor);