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

Commit ab751aa0 authored by satok's avatar satok
Browse files

Add methods for managing subtypes

- added showInputMethodSubtypePicker to public API
-- show the selector dialog for subtypes
- added getter, setter and event handler to InputMethodManagerService
- extract InputMethodSubtype to the top level class for using it in aidl
- TODO: make an enabler for input method subtypes
- TODO: handle the event of changing an input method subtype in LatinIME

Change-Id: I49f8c6675ac4b06511635d14a37bd398738eff33
parent 6b762aaa
Loading
Loading
Loading
Loading
+164 −103
Original line number Diff line number Diff line
@@ -89810,6 +89810,19 @@
 visibility="public"
>
</method>
<method name="onCurrentInputMethodSubtypeChanged"
 return="void"
 abstract="false"
 native="false"
 synchronized="false"
 static="false"
 final="false"
 deprecated="not deprecated"
 visibility="protected"
>
<parameter name="newSubtype" type="android.view.inputmethod.InputMethodSubtype">
</parameter>
</method>
<method name="onDisplayCompletions"
 return="void"
 abstract="false"
@@ -90413,6 +90426,19 @@
<parameter name="binding" type="android.view.inputmethod.InputBinding">
</parameter>
</method>
<method name="changeInputMethodSubtype"
 return="void"
 abstract="false"
 native="false"
 synchronized="false"
 static="false"
 final="false"
 deprecated="not deprecated"
 visibility="public"
>
<parameter name="subtype" type="android.view.inputmethod.InputMethodSubtype">
</parameter>
</method>
<method name="hideSoftInput"
 return="void"
 abstract="false"
@@ -156779,6 +156805,17 @@
 visibility="public"
>
</field>
<field name="SELECTED_INPUT_METHOD_SUBTYPE"
 type="java.lang.String"
 transient="false"
 volatile="false"
 value="&quot;selected_input_method_subtype&quot;"
 static="true"
 final="true"
 deprecated="not deprecated"
 visibility="public"
>
</field>
<field name="SETTINGS_CLASSNAME"
 type="java.lang.String"
 transient="false"
@@ -213754,6 +213791,19 @@
<parameter name="binding" type="android.view.inputmethod.InputBinding">
</parameter>
</method>
<method name="changeInputMethodSubtype"
 return="void"
 abstract="true"
 native="false"
 synchronized="false"
 static="false"
 final="false"
 deprecated="not deprecated"
 visibility="public"
>
<parameter name="subtype" type="android.view.inputmethod.InputMethodSubtype">
</parameter>
</method>
<method name="createSession"
 return="void"
 abstract="true"
@@ -214078,7 +214128,7 @@
>
</method>
<method name="getSubtypes"
 return="java.util.ArrayList&lt;android.view.inputmethod.InputMethodInfo.InputMethodSubtype&gt;"
 return="java.util.ArrayList&lt;android.view.inputmethod.InputMethodSubtype&gt;"
 abstract="false"
 native="false"
 synchronized="false"
@@ -214140,108 +214190,6 @@
>
</field>
</class>
<class name="InputMethodInfo.InputMethodSubtype"
 extends="java.lang.Object"
 abstract="false"
 static="true"
 final="false"
 deprecated="not deprecated"
 visibility="public"
>
<implements name="android.os.Parcelable">
</implements>
<method name="describeContents"
 return="int"
 abstract="false"
 native="false"
 synchronized="false"
 static="false"
 final="false"
 deprecated="not deprecated"
 visibility="public"
>
</method>
<method name="getExtraValue"
 return="java.lang.String"
 abstract="false"
 native="false"
 synchronized="false"
 static="false"
 final="false"
 deprecated="not deprecated"
 visibility="public"
>
</method>
<method name="getIconId"
 return="int"
 abstract="false"
 native="false"
 synchronized="false"
 static="false"
 final="false"
 deprecated="not deprecated"
 visibility="public"
>
</method>
<method name="getLocale"
 return="java.lang.String"
 abstract="false"
 native="false"
 synchronized="false"
 static="false"
 final="false"
 deprecated="not deprecated"
 visibility="public"
>
</method>
<method name="getMode"
 return="java.lang.String"
 abstract="false"
 native="false"
 synchronized="false"
 static="false"
 final="false"
 deprecated="not deprecated"
 visibility="public"
>
</method>
<method name="getName"
 return="java.lang.String"
 abstract="false"
 native="false"
 synchronized="false"
 static="false"
 final="false"
 deprecated="not deprecated"
 visibility="public"
>
</method>
<method name="writeToParcel"
 return="void"
 abstract="false"
 native="false"
 synchronized="false"
 static="false"
 final="false"
 deprecated="not deprecated"
 visibility="public"
>
<parameter name="dest" type="android.os.Parcel">
</parameter>
<parameter name="parcelableFlags" type="int">
</parameter>
</method>
<field name="CREATOR"
 type="android.os.Parcelable.Creator"
 transient="false"
 volatile="false"
 static="true"
 final="true"
 deprecated="not deprecated"
 visibility="public"
>
</field>
</class>
<class name="InputMethodManager"
 extends="java.lang.Object"
 abstract="false"
@@ -214462,6 +214410,17 @@
 visibility="public"
>
</method>
<method name="showInputMethodSubtypePicker"
 return="void"
 abstract="false"
 native="false"
 synchronized="false"
 static="false"
 final="false"
 deprecated="not deprecated"
 visibility="public"
>
</method>
<method name="showSoftInput"
 return="boolean"
 abstract="false"
@@ -214876,6 +214835,108 @@
</parameter>
</method>
</interface>
<class name="InputMethodSubtype"
 extends="java.lang.Object"
 abstract="false"
 static="false"
 final="true"
 deprecated="not deprecated"
 visibility="public"
>
<implements name="android.os.Parcelable">
</implements>
<method name="describeContents"
 return="int"
 abstract="false"
 native="false"
 synchronized="false"
 static="false"
 final="false"
 deprecated="not deprecated"
 visibility="public"
>
</method>
<method name="getExtraValue"
 return="java.lang.String"
 abstract="false"
 native="false"
 synchronized="false"
 static="false"
 final="false"
 deprecated="not deprecated"
 visibility="public"
>
</method>
<method name="getIconResId"
 return="int"
 abstract="false"
 native="false"
 synchronized="false"
 static="false"
 final="false"
 deprecated="not deprecated"
 visibility="public"
>
</method>
<method name="getLocale"
 return="java.lang.String"
 abstract="false"
 native="false"
 synchronized="false"
 static="false"
 final="false"
 deprecated="not deprecated"
 visibility="public"
>
</method>
<method name="getModeResId"
 return="int"
 abstract="false"
 native="false"
 synchronized="false"
 static="false"
 final="false"
 deprecated="not deprecated"
 visibility="public"
>
</method>
<method name="getNameResId"
 return="int"
 abstract="false"
 native="false"
 synchronized="false"
 static="false"
 final="false"
 deprecated="not deprecated"
 visibility="public"
>
</method>
<method name="writeToParcel"
 return="void"
 abstract="false"
 native="false"
 synchronized="false"
 static="false"
 final="false"
 deprecated="not deprecated"
 visibility="public"
>
<parameter name="dest" type="android.os.Parcel">
</parameter>
<parameter name="parcelableFlags" type="int">
</parameter>
</method>
<field name="CREATOR"
 type="android.os.Parcelable.Creator"
 transient="false"
 volatile="false"
 static="true"
 final="true"
 deprecated="not deprecated"
 visibility="public"
>
</field>
</class>
</package>
<package name="android.webkit"
>
+1 −0
Original line number Diff line number Diff line
@@ -177,6 +177,7 @@ public abstract class AbstractInputMethodService extends Service
     * Implement this to handle {@link android.os.Binder#dump Binder.dump()}
     * calls on your input method.
     */
    @Override
    protected void dump(FileDescriptor fd, PrintWriter fout, String[] args) {
    }

+10 −0
Original line number Diff line number Diff line
@@ -36,6 +36,7 @@ import android.view.inputmethod.InputBinding;
import android.view.inputmethod.InputConnection;
import android.view.inputmethod.InputMethod;
import android.view.inputmethod.InputMethodSession;
import android.view.inputmethod.InputMethodSubtype;

import java.io.FileDescriptor;
import java.io.PrintWriter;
@@ -64,6 +65,7 @@ class IInputMethodWrapper extends IInputMethod.Stub
    private static final int DO_REVOKE_SESSION = 50;
    private static final int DO_SHOW_SOFT_INPUT = 60;
    private static final int DO_HIDE_SOFT_INPUT = 70;
    private static final int DO_CHANGE_INPUTMETHOD_SUBTYPE = 80;
   
    final WeakReference<AbstractInputMethodService> mTarget;
    final HandlerCaller mCaller;
@@ -178,6 +180,9 @@ class IInputMethodWrapper extends IInputMethod.Stub
            case DO_HIDE_SOFT_INPUT:
                inputMethod.hideSoftInput(msg.arg1, (ResultReceiver)msg.obj);
                return;
            case DO_CHANGE_INPUTMETHOD_SUBTYPE:
                inputMethod.changeInputMethodSubtype((InputMethodSubtype)msg.obj);
                return;
        }
        Log.w(TAG, "Unhandled message code: " + msg.what);
    }
@@ -267,4 +272,9 @@ class IInputMethodWrapper extends IInputMethod.Stub
        mCaller.executeOrSendMessage(mCaller.obtainMessageIO(DO_HIDE_SOFT_INPUT,
                flags, resultReceiver));
    }

    public void changeInputMethodSubtype(InputMethodSubtype subtype) {
        mCaller.executeOrSendMessage(mCaller.obtainMessageO(DO_CHANGE_INPUTMETHOD_SUBTYPE,
                subtype));
    }
}
+34 −8
Original line number Diff line number Diff line
@@ -52,6 +52,7 @@ import android.view.inputmethod.InputBinding;
import android.view.inputmethod.InputConnection;
import android.view.inputmethod.InputMethod;
import android.view.inputmethod.InputMethodManager;
import android.view.inputmethod.InputMethodSubtype;
import android.view.inputmethod.EditorInfo;
import android.widget.Button;
import android.widget.FrameLayout;
@@ -394,6 +395,10 @@ public class InputMethodService extends AbstractInputMethodService {
                                : InputMethodManager.RESULT_UNCHANGED_HIDDEN), null);
            }
        }

        public void changeInputMethodSubtype(InputMethodSubtype subtype) {
            onCurrentInputMethodSubtypeChanged(subtype);
        }
    }

    /**
@@ -541,6 +546,7 @@ public class InputMethodService extends AbstractInputMethodService {
     * will typically call it in your constructor with the resource ID
     * of your custom theme.
     */
    @Override
    public void setTheme(int theme) {
        if (mWindow != null) {
            throw new IllegalStateException("Must be called before onCreate()");
@@ -677,6 +683,7 @@ public class InputMethodService extends AbstractInputMethodService {
     * Implement to return our standard {@link InputMethodImpl}.  Subclasses
     * can override to provide their own customized version.
     */
    @Override
    public AbstractInputMethodImpl onCreateInputMethodInterface() {
        return new InputMethodImpl();
    }
@@ -685,6 +692,7 @@ public class InputMethodService extends AbstractInputMethodService {
     * Implement to return our standard {@link InputMethodSessionImpl}.  Subclasses
     * can override to provide their own customized version.
     */
    @Override
    public AbstractInputMethodSessionImpl onCreateInputMethodSessionInterface() {
        return new InputMethodSessionImpl();
    }
@@ -1656,6 +1664,7 @@ public class InputMethodService extends AbstractInputMethodService {
        return doMovementKey(keyCode, event, MOVEMENT_UP);
    }

    @Override
    public boolean onTrackballEvent(MotionEvent event) {
        return false;
    }
@@ -2065,6 +2074,23 @@ public class InputMethodService extends AbstractInputMethodService {
        }
    }

    // TODO: Handle the subtype change event
    /**
     * Called when the subtype was changed.
     * @param newSubtype the subtype which is being changed to.
     */
    protected void onCurrentInputMethodSubtypeChanged(InputMethodSubtype newSubtype) {
        if (DEBUG) {
            int nameResId = newSubtype.getNameResId();
            int modeResId = newSubtype.getModeResId();
            String output = "changeInputMethodSubtype:"
                + (nameResId == 0 ? "<none>" : getString(nameResId)) + ","
                + (modeResId == 0 ? "<none>" : getString(modeResId)) + ","
                + newSubtype.getLocale() + "," + newSubtype.getExtraValue();
            Log.v(TAG, "--- " + output);
        }
    }

    /**
     * Performs a dump of the InputMethodService's internal state.  Override
     * to add your own information to the dump.
+7 −0
Original line number Diff line number Diff line
@@ -2355,6 +2355,13 @@ public final class Settings {
         */
        public static final String DEFAULT_INPUT_METHOD = "default_input_method";

        /**
         * Setting to record the input method subtype used by default, holding the ID
         * of the desired method.
         */
        public static final String SELECTED_INPUT_METHOD_SUBTYPE =
                "selected_input_method_subtype";

        /**
         * Whether the device has been provisioned (0 = false, 1 = true)
         */
Loading