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

Commit ff42b1b6 authored by Yohei Yukawa's avatar Yohei Yukawa
Browse files

Deprecate InputMethodManager#setCurrentInputMethodSubtype()

InputMethodManager#setCurrentInputMethodSubtype(), which was
introduced in Android 4.0 ICS [1], was probably mistakenly exposed as
a public API, because it has required WRITE_SECURE_SETTINGS that
typical applications cannot have.

This CL marks InputMethodManager#setCurrentInputMethodSubtype()
deprecated.  There is no actual implementation change at this moment,
but developers should avoid relying on this API in general not only on
futuer versions of Android but also on existing devices.

 [1]: I55daa19ba924999def544bf841f00bf54852f3e1
      b66d287e

Fix: 123249820
Test: make -j checkbuild
Change-Id: Ia31df87ad2182484d7335503c5d87cb93540fd17
parent 62ab6f0a
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -52992,7 +52992,7 @@ package android.view.inputmethod {
    method public void restartInput(android.view.View);
    method public void sendAppPrivateCommand(android.view.View, String, android.os.Bundle);
    method @Deprecated public void setAdditionalInputMethodSubtypes(String, android.view.inputmethod.InputMethodSubtype[]);
    method @RequiresPermission(android.Manifest.permission.WRITE_SECURE_SETTINGS) public boolean setCurrentInputMethodSubtype(android.view.inputmethod.InputMethodSubtype);
    method @Deprecated @RequiresPermission(android.Manifest.permission.WRITE_SECURE_SETTINGS) public boolean setCurrentInputMethodSubtype(android.view.inputmethod.InputMethodSubtype);
    method @Deprecated public void setInputMethod(android.os.IBinder, String);
    method @Deprecated public void setInputMethodAndSubtype(@NonNull android.os.IBinder, String, android.view.inputmethod.InputMethodSubtype);
    method @Deprecated public boolean shouldOfferSwitchingToNextInputMethod(android.os.IBinder);
+7 −0
Original line number Diff line number Diff line
@@ -2490,7 +2490,14 @@ public final class InputMethodManager {
     * @param subtype A new input method subtype to switch.
     * @return true if the current subtype was successfully switched. When the specified subtype is
     * null, this method returns false.
     * @deprecated If the calling process is an IME, use
     *             {@link InputMethodService#switchInputMethod(String, InputMethodSubtype)}, which
     *             does not require any permission as long as the caller is the current IME.
     *             If the calling process is some privileged app that already has
     *             {@link android.Manifest.permission#WRITE_SECURE_SETTINGS} permission, just
     *             directly update {@link Settings.Secure#SELECTED_INPUT_METHOD_SUBTYPE}.
     */
    @Deprecated
    @RequiresPermission(WRITE_SECURE_SETTINGS)
    public boolean setCurrentInputMethodSubtype(InputMethodSubtype subtype) {
        if (Process.myUid() == Process.SYSTEM_UID) {