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

Commit 2bd50fa5 authored by Yohei Yukawa's avatar Yohei Yukawa
Browse files

Introduce IMMI#getEnabledInputMethodListAsUser()

This is a preparation before fixing Bug 354333072.

Apparently

  InputMethodManagerInternal#getEnabledInputMethodListAsUser()

should have been there for

  KeyboardLayoutManager#getImeInfoListForLayoutMapping(),

which needs to query each user's IME information from the
system_server [1].

This is an internal refactoring. There must be no behavior change
until the above new internal method starts being used.

 [1]: I9057e793641950e2ad903404d591b4e517e91e38
      c2e31eb4

Bug: 354333072
Test: presubmit
Flag: EXEMPT refactor
Change-Id: I78292896d75e5e54e76ed5595f79d917e0a3818a
parent df401875
Loading
Loading
Loading
Loading
+20 −0
Original line number Diff line number Diff line
@@ -27,6 +27,7 @@ import android.inputmethodservice.InputMethodService;
import android.os.IBinder;
import android.view.inputmethod.InlineSuggestionsRequest;
import android.view.inputmethod.InputMethodInfo;
import android.view.inputmethod.InputMethodSubtype;

import com.android.internal.inputmethod.IAccessibilityInputMethodSession;
import com.android.internal.inputmethod.InlineSuggestionsRequestCallback;
@@ -99,6 +100,18 @@ public abstract class InputMethodManagerInternal {
     */
    public abstract List<InputMethodInfo> getEnabledInputMethodListAsUser(@UserIdInt int userId);

    /**
     * Returns the list of installed input methods that are enabled for the specified user.
     *
     * @param imiId                           IME ID to be queried about
     * @param allowsImplicitlyEnabledSubtypes {@code true} to return the implicitly enabled subtypes
     * @param userId                          the user ID to be queried about
     * @return a list of {@link InputMethodSubtype} that are enabled for {@code userId}
     */
    @NonNull
    public abstract List<InputMethodSubtype> getEnabledInputMethodSubtypeListAsUser(
            String imiId, boolean allowsImplicitlyEnabledSubtypes, @UserIdInt int userId);

    /**
     * Called by the Autofill Frameworks to request an {@link InlineSuggestionsRequest} from
     * the input method.
@@ -312,6 +325,13 @@ public abstract class InputMethodManagerInternal {
                    return Collections.emptyList();
                }

                @NonNull
                @Override
                public List<InputMethodSubtype> getEnabledInputMethodSubtypeListAsUser(String imiId,
                        boolean allowsImplicitlyEnabledSubtypes, int userId) {
                    return Collections.emptyList();
                }

                @Override
                public void onCreateInlineSuggestionsRequest(@UserIdInt int userId,
                        InlineSuggestionsRequestInfo requestInfo,
+11 −0
Original line number Diff line number Diff line
@@ -5865,6 +5865,17 @@ public final class InputMethodManagerService implements IInputMethodManagerImpl.
            }
        }

        @NonNull
        @Override
        public List<InputMethodSubtype> getEnabledInputMethodSubtypeListAsUser(
                String imiId, boolean allowsImplicitlyEnabledSubtypes, @UserIdInt int userId) {
            synchronized (ImfLock.class) {
                return getEnabledInputMethodSubtypeListLocked(imiId,
                        allowsImplicitlyEnabledSubtypes,
                        userId, Process.SYSTEM_UID);
            }
        }

        @Override
        public void onCreateInlineSuggestionsRequest(@UserIdInt int userId,
                InlineSuggestionsRequestInfo requestInfo, InlineSuggestionsRequestCallback cb) {