diff --git a/api/current.txt b/api/current.txt index 7fe87e4365f01..1146e42abc57c 100644 --- a/api/current.txt +++ b/api/current.txt @@ -21226,15 +21226,14 @@ package android.inputmethodservice { method public void setCandidatesViewShown(boolean); method public void setExtractView(android.view.View); method public void setExtractViewShown(boolean); - method public void setInputMethod(java.lang.String); - method public void setInputMethodAndSubtype(java.lang.String, android.view.inputmethod.InputMethodSubtype); method public void setInputView(android.view.View); method public boolean shouldOfferSwitchingToNextInputMethod(); method public void showStatusIcon(int); method public void showWindow(boolean); method public void switchInputMethod(java.lang.String); - method public boolean switchToLastInputMethod(); + method public void switchInputMethod(java.lang.String, android.view.inputmethod.InputMethodSubtype); method public boolean switchToNextInputMethod(boolean); + method public boolean switchToPreviousInputMethod(); method public void updateFullscreenMode(); method public void updateInputViewShown(); field public static final int BACK_DISPOSITION_DEFAULT = 0; // 0x0 diff --git a/core/java/android/inputmethodservice/InputMethodService.java b/core/java/android/inputmethodservice/InputMethodService.java index 017674f5ea8ab..f38c37a2fb70a 100644 --- a/core/java/android/inputmethodservice/InputMethodService.java +++ b/core/java/android/inputmethodservice/InputMethodService.java @@ -1074,25 +1074,6 @@ public class InputMethodService extends AbstractInputMethodService { return mInputConnection; } - /** - * Force switch to a new input method component. This can only be called - * from an application or a service which has a token of the currently active input method. - * @param id The unique identifier for the new input method to be switched to. - */ - public void setInputMethod(String id) { - mImm.setInputMethodInternal(mToken, id); - } - - /** - * Force switch to a new input method and subtype. This can only be called - * from an application or a service which has a token of the currently active input method. - * @param id The unique identifier for the new input method to be switched to. - * @param subtype The new subtype of the new input method to be switched to. - */ - public void setInputMethodAndSubtype(String id, InputMethodSubtype subtype) { - mImm.setInputMethodAndSubtypeInternal(mToken, id, subtype); - } - /** * Force switch to the last used input method and subtype. If the last input method didn't have * any subtypes, the framework will simply switch to the last input method with no subtype @@ -1100,8 +1081,8 @@ public class InputMethodService extends AbstractInputMethodService { * @return true if the current input method and subtype was successfully switched to the last * used input method and subtype. */ - public boolean switchToLastInputMethod() { - return mImm.switchToLastInputMethodInternal(mToken); + public boolean switchToPreviousInputMethod() { + return mImm.switchToPreviousInputMethodInternal(mToken); } /** @@ -1455,12 +1436,24 @@ public class InputMethodService extends AbstractInputMethodService { * input method will be destroyed, and the requested one started on the * current input field. * - * @param id Unique identifier of the new input method ot start. + * @param id Unique identifier of the new input method to start. */ public void switchInputMethod(String id) { mImm.setInputMethodInternal(mToken, id); } + /** + * Force switch to a new input method, as identified by {@code id}. This + * input method will be destroyed, and the requested one started on the + * current input field. + * + * @param id Unique identifier of the new input method to start. + * @param subtype The new subtype of the new input method to be switched to. + */ + public void switchInputMethod(String id, InputMethodSubtype subtype) { + mImm.setInputMethodAndSubtypeInternal(mToken, id, subtype); + } + public void setExtractView(View view) { mExtractFrame.removeAllViews(); mExtractFrame.addView(view, new FrameLayout.LayoutParams( diff --git a/core/java/android/view/inputmethod/InputMethodManager.java b/core/java/android/view/inputmethod/InputMethodManager.java index a2280a4acd11c..4104728149704 100644 --- a/core/java/android/view/inputmethod/InputMethodManager.java +++ b/core/java/android/view/inputmethod/InputMethodManager.java @@ -1812,9 +1812,9 @@ public final class InputMethodManager { * when it was started, which allows it to perform this operation on * itself. * @param id The unique identifier for the new input method to be switched to. - * @deprecated Use {@link InputMethodService#setInputMethod(String)} instead. This method - * was intended for IME developers who should be accessing APIs through the service. APIs in - * this class are intended for app developers interacting with the IME. + * @deprecated Use {@link InputMethodService#switchInputMethod(String)} + * instead. This method was intended for IME developers who should be accessing APIs through + * the service. APIs in this class are intended for app developers interacting with the IME. */ @Deprecated public void setInputMethod(IBinder token, String id) { @@ -1841,7 +1841,7 @@ public final class InputMethodManager { * @param id The unique identifier for the new input method to be switched to. * @param subtype The new subtype of the new input method to be switched to. * @deprecated Use - * {@link InputMethodService#setInputMethodAndSubtype(String, InputMethodSubtype)} + * {@link InputMethodService#switchInputMethod(String, InputMethodSubtype)} * instead. This method was intended for IME developers who should be accessing APIs through * the service. APIs in this class are intended for app developers interacting with the IME. */ @@ -2317,22 +2317,22 @@ public final class InputMethodManager { * which allows it to perform this operation on itself. * @return true if the current input method and subtype was successfully switched to the last * used input method and subtype. - * @deprecated Use {@link InputMethodService#switchToLastInputMethod()} instead. This method + * @deprecated Use {@link InputMethodService#switchToPreviousInputMethod()} instead. This method * was intended for IME developers who should be accessing APIs through the service. APIs in * this class are intended for app developers interacting with the IME. */ @Deprecated public boolean switchToLastInputMethod(IBinder imeToken) { - return switchToLastInputMethodInternal(imeToken); + return switchToPreviousInputMethodInternal(imeToken); } /** * @hide */ - public boolean switchToLastInputMethodInternal(IBinder imeToken) { + public boolean switchToPreviousInputMethodInternal(IBinder imeToken) { synchronized (mH) { try { - return mService.switchToLastInputMethod(imeToken); + return mService.switchToPreviousInputMethod(imeToken); } catch (RemoteException e) { throw e.rethrowFromSystemServer(); } diff --git a/core/java/com/android/internal/view/IInputMethodManager.aidl b/core/java/com/android/internal/view/IInputMethodManager.aidl index 02822869f4212..9ed1ffba68972 100644 --- a/core/java/com/android/internal/view/IInputMethodManager.aidl +++ b/core/java/com/android/internal/view/IInputMethodManager.aidl @@ -80,7 +80,7 @@ interface IInputMethodManager { boolean notifySuggestionPicked(in SuggestionSpan span, String originalString, int index); InputMethodSubtype getCurrentInputMethodSubtype(); boolean setCurrentInputMethodSubtype(in InputMethodSubtype subtype); - boolean switchToLastInputMethod(in IBinder token); + boolean switchToPreviousInputMethod(in IBinder token); boolean switchToNextInputMethod(in IBinder token, boolean onlyCurrentIme); boolean shouldOfferSwitchingToNextInputMethod(in IBinder token); void setAdditionalInputMethodSubtypes(String id, in InputMethodSubtype[] subtypes); diff --git a/services/core/java/com/android/server/InputMethodManagerService.java b/services/core/java/com/android/server/InputMethodManagerService.java index c570005348d78..70ca161167406 100644 --- a/services/core/java/com/android/server/InputMethodManagerService.java +++ b/services/core/java/com/android/server/InputMethodManagerService.java @@ -3042,7 +3042,7 @@ public class InputMethodManagerService extends IInputMethodManager.Stub } @Override - public boolean switchToLastInputMethod(IBinder token) { + public boolean switchToPreviousInputMethod(IBinder token) { if (!calledFromValidUser()) { return false; }