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

Commit d866f500 authored by Satoshi Kataoka's avatar Satoshi Kataoka Committed by Android (Google) Code Review
Browse files

Merge "Add new API shouldOfferSwitchingToNextInputMethod" into klp-dev

parents 5bc1ea4e 2b10b52f
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -29299,6 +29299,7 @@ package android.view.inputmethod {
    method public boolean setCurrentInputMethodSubtype(android.view.inputmethod.InputMethodSubtype);
    method public void setInputMethod(android.os.IBinder, java.lang.String);
    method public void setInputMethodAndSubtype(android.os.IBinder, java.lang.String, android.view.inputmethod.InputMethodSubtype);
    method public boolean shouldOfferSwitchingToNextInputMethod(android.os.IBinder);
    method public void showInputMethodAndSubtypeEnabler(java.lang.String);
    method public void showInputMethodPicker();
    method public boolean showSoftInput(android.view.View, int);
+18 −0
Original line number Diff line number Diff line
@@ -1875,6 +1875,24 @@ public final class InputMethodManager {
        }
    }

    /**
     * Returns true if the current IME needs to offer the users a way to switch to a next input
     * method. When the user triggers it, the IME has to call {@link #switchToNextInputMethod} to
     * switch to a next input method which is selected by the system.
     * @param imeToken Supplies the identifying token given to an input method when it was started,
     * which allows it to perform this operation on itself.
     */
    public boolean shouldOfferSwitchingToNextInputMethod(IBinder imeToken) {
        synchronized (mH) {
            try {
                return mService.shouldOfferSwitchingToNextInputMethod(imeToken);
            } catch (RemoteException e) {
                Log.w(TAG, "IME died: " + mCurId, e);
                return false;
            }
        }
    }

    /**
     * Set additional input method subtypes. Only a process which shares the same uid with the IME
     * can add additional input method subtypes to the IME.
+2 −1
Original line number Diff line number Diff line
@@ -71,6 +71,7 @@ interface IInputMethodManager {
    boolean setCurrentInputMethodSubtype(in InputMethodSubtype subtype);
    boolean switchToLastInputMethod(in IBinder token);
    boolean switchToNextInputMethod(in IBinder token, boolean onlyCurrentIme);
    boolean shouldOfferSwitchingToNextInputMethod(in IBinder token);
    boolean setInputMethodEnabled(String id, boolean enabled);
    oneway void setAdditionalInputMethodSubtypes(String id, in InputMethodSubtype[] subtypes);
}
+15 −0
Original line number Diff line number Diff line
@@ -2158,6 +2158,21 @@ public class InputMethodManagerService extends IInputMethodManager.Stub
        }
    }

    @Override
    public boolean shouldOfferSwitchingToNextInputMethod(IBinder token) {
        if (!calledFromValidUser()) {
            return false;
        }
        synchronized (mMethodMap) {
            final ImeSubtypeListItem nextSubtype = mImListManager.getNextInputMethod(
                    false /* onlyCurrentIme */, mMethodMap.get(mCurMethodId), mCurrentSubtype);
            if (nextSubtype == null) {
                return false;
            }
            return true;
        }
    }

    @Override
    public InputMethodSubtype getLastInputMethodSubtype() {
        if (!calledFromValidUser()) {