Loading services/core/java/com/android/server/inputmethod/AutofillSuggestionsController.java +2 −4 Original line number Diff line number Diff line Loading @@ -21,7 +21,6 @@ import android.annotation.Nullable; import android.annotation.UserIdInt; import android.os.IBinder; import android.os.RemoteException; import android.util.ArrayMap; import android.util.Slog; import android.view.autofill.AutofillId; import android.view.inputmethod.InlineSuggestionsRequest; Loading @@ -40,7 +39,6 @@ final class AutofillSuggestionsController { private static final String TAG = AutofillSuggestionsController.class.getSimpleName(); @NonNull private final InputMethodManagerService mService; @NonNull private final ArrayMap<String, InputMethodInfo> mMethodMap; @NonNull private final InputMethodUtils.InputMethodSettings mSettings; private static final class CreateInlineSuggestionsRequest { Loading Loading @@ -78,7 +76,6 @@ final class AutofillSuggestionsController { AutofillSuggestionsController(@NonNull InputMethodManagerService service) { mService = service; mMethodMap = mService.mMethodMap; mSettings = mService.mSettings; } Loading @@ -88,7 +85,8 @@ final class AutofillSuggestionsController { boolean touchExplorationEnabled) { clearPendingInlineSuggestionsRequest(); mInlineSuggestionsRequestCallback = callback; final InputMethodInfo imi = mMethodMap.get(mService.getSelectedMethodIdLocked()); final InputMethodInfo imi = mService.queryInputMethodForCurrentUserLocked( mService.getSelectedMethodIdLocked()); try { if (userId == mSettings.getCurrentUserId() && imi != null && isInlineSuggestionsEnabled(imi, touchExplorationEnabled)) { Loading services/core/java/com/android/server/inputmethod/InputMethodBindingController.java +3 −5 Original line number Diff line number Diff line Loading @@ -34,7 +34,6 @@ import android.os.SystemClock; import android.os.Trace; import android.os.UserHandle; import android.provider.Settings; import android.util.ArrayMap; import android.util.EventLog; import android.util.Slog; import android.view.WindowManager; Loading Loading @@ -64,7 +63,6 @@ final class InputMethodBindingController { @NonNull private final InputMethodManagerService mService; @NonNull private final Context mContext; @NonNull private final ArrayMap<String, InputMethodInfo> mMethodMap; @NonNull private final InputMethodUtils.InputMethodSettings mSettings; @NonNull private final PackageManagerInternal mPackageManagerInternal; @NonNull private final WindowManagerInternal mWindowManagerInternal; Loading Loading @@ -115,7 +113,6 @@ final class InputMethodBindingController { int imeConnectionBindFlags, CountDownLatch latchForTesting) { mService = service; mContext = mService.mContext; mMethodMap = mService.mMethodMap; mSettings = mService.mSettings; mPackageManagerInternal = mService.mPackageManagerInternal; mWindowManagerInternal = mService.mWindowManagerInternal; Loading Loading @@ -295,7 +292,8 @@ final class InputMethodBindingController { return; } if (DEBUG) Slog.v(TAG, "Initiating attach with token: " + mCurToken); final InputMethodInfo info = mMethodMap.get(mSelectedMethodId); final InputMethodInfo info = mService.queryInputMethodForCurrentUserLocked(mSelectedMethodId); boolean supportsStylusHwChanged = mSupportsStylusHw != info.supportsStylusHandwriting(); mSupportsStylusHw = info.supportsStylusHandwriting(); Loading Loading @@ -410,7 +408,7 @@ final class InputMethodBindingController { return InputBindResult.NO_IME; } InputMethodInfo info = mMethodMap.get(mSelectedMethodId); InputMethodInfo info = mService.queryInputMethodForCurrentUserLocked(mSelectedMethodId); if (info == null) { throw new IllegalArgumentException("Unknown id: " + mSelectedMethodId); } Loading services/core/java/com/android/server/inputmethod/InputMethodManagerService.java +7 −1 Original line number Diff line number Diff line Loading @@ -310,7 +310,7 @@ public final class InputMethodManagerService extends IInputMethodManager.Stub // All known input methods. final ArrayList<InputMethodInfo> mMethodList = new ArrayList<>(); final ArrayMap<String, InputMethodInfo> mMethodMap = new ArrayMap<>(); private final ArrayMap<String, InputMethodInfo> mMethodMap = new ArrayMap<>(); final InputMethodSubtypeSwitchingController mSwitchingController; final HardwareKeyboardShortcutController mHardwareKeyboardShortcutController = new HardwareKeyboardShortcutController(); Loading Loading @@ -500,6 +500,12 @@ public final class InputMethodManagerService extends IInputMethodManager.Stub mBindingController.advanceSequenceNumber(); } @GuardedBy("ImfLock.class") @Nullable InputMethodInfo queryInputMethodForCurrentUserLocked(@NonNull String imeId) { return mMethodMap.get(imeId); } /** * The client that is currently bound to an input method. */ Loading services/core/java/com/android/server/inputmethod/InputMethodMenuController.java +2 −4 Original line number Diff line number Diff line Loading @@ -26,7 +26,6 @@ import android.content.DialogInterface; import android.content.res.TypedArray; import android.graphics.drawable.Drawable; import android.text.TextUtils; import android.util.ArrayMap; import android.util.Slog; import android.view.LayoutInflater; import android.view.View; Loading Loading @@ -54,7 +53,6 @@ final class InputMethodMenuController { private final InputMethodManagerService mService; private final InputMethodUtils.InputMethodSettings mSettings; private final InputMethodSubtypeSwitchingController mSwitchingController; private final ArrayMap<String, InputMethodInfo> mMethodMap; private final WindowManagerInternal mWindowManagerInternal; private AlertDialog.Builder mDialogBuilder; Loading @@ -73,7 +71,6 @@ final class InputMethodMenuController { mService = service; mSettings = mService.mSettings; mSwitchingController = mService.mSwitchingController; mMethodMap = mService.mMethodMap; mWindowManagerInternal = LocalServices.getService(WindowManagerInternal.class); } Loading Loading @@ -101,7 +98,8 @@ final class InputMethodMenuController { mService.getCurrentInputMethodSubtypeLocked(); if (currentSubtype != null) { final String curMethodId = mService.getSelectedMethodIdLocked(); final InputMethodInfo currentImi = mMethodMap.get(curMethodId); final InputMethodInfo currentImi = mService.queryInputMethodForCurrentUserLocked(curMethodId); lastInputMethodSubtypeId = SubtypeUtils.getSubtypeIdFromHashCode( currentImi, currentSubtype.hashCode()); } Loading services/tests/InputMethodSystemServerTests/src/com/android/server/inputmethod/InputMethodBindingControllerTest.java +2 −1 Original line number Diff line number Diff line Loading @@ -133,10 +133,11 @@ public class InputMethodBindingControllerTest extends InputMethodManagerServiceT } private void testBindCurrentMethodWithMainConnection() throws Exception { final InputMethodInfo info; synchronized (ImfLock.class) { mBindingController.setSelectedMethodId(TEST_IME_ID); info = mInputMethodManagerService.queryInputMethodForCurrentUserLocked(TEST_IME_ID); } InputMethodInfo info = mInputMethodManagerService.mMethodMap.get(TEST_IME_ID); assertThat(info).isNotNull(); assertThat(info.getId()).isEqualTo(TEST_IME_ID); assertThat(info.getServiceName()).isEqualTo(TEST_SERVICE_NAME); Loading Loading
services/core/java/com/android/server/inputmethod/AutofillSuggestionsController.java +2 −4 Original line number Diff line number Diff line Loading @@ -21,7 +21,6 @@ import android.annotation.Nullable; import android.annotation.UserIdInt; import android.os.IBinder; import android.os.RemoteException; import android.util.ArrayMap; import android.util.Slog; import android.view.autofill.AutofillId; import android.view.inputmethod.InlineSuggestionsRequest; Loading @@ -40,7 +39,6 @@ final class AutofillSuggestionsController { private static final String TAG = AutofillSuggestionsController.class.getSimpleName(); @NonNull private final InputMethodManagerService mService; @NonNull private final ArrayMap<String, InputMethodInfo> mMethodMap; @NonNull private final InputMethodUtils.InputMethodSettings mSettings; private static final class CreateInlineSuggestionsRequest { Loading Loading @@ -78,7 +76,6 @@ final class AutofillSuggestionsController { AutofillSuggestionsController(@NonNull InputMethodManagerService service) { mService = service; mMethodMap = mService.mMethodMap; mSettings = mService.mSettings; } Loading @@ -88,7 +85,8 @@ final class AutofillSuggestionsController { boolean touchExplorationEnabled) { clearPendingInlineSuggestionsRequest(); mInlineSuggestionsRequestCallback = callback; final InputMethodInfo imi = mMethodMap.get(mService.getSelectedMethodIdLocked()); final InputMethodInfo imi = mService.queryInputMethodForCurrentUserLocked( mService.getSelectedMethodIdLocked()); try { if (userId == mSettings.getCurrentUserId() && imi != null && isInlineSuggestionsEnabled(imi, touchExplorationEnabled)) { Loading
services/core/java/com/android/server/inputmethod/InputMethodBindingController.java +3 −5 Original line number Diff line number Diff line Loading @@ -34,7 +34,6 @@ import android.os.SystemClock; import android.os.Trace; import android.os.UserHandle; import android.provider.Settings; import android.util.ArrayMap; import android.util.EventLog; import android.util.Slog; import android.view.WindowManager; Loading Loading @@ -64,7 +63,6 @@ final class InputMethodBindingController { @NonNull private final InputMethodManagerService mService; @NonNull private final Context mContext; @NonNull private final ArrayMap<String, InputMethodInfo> mMethodMap; @NonNull private final InputMethodUtils.InputMethodSettings mSettings; @NonNull private final PackageManagerInternal mPackageManagerInternal; @NonNull private final WindowManagerInternal mWindowManagerInternal; Loading Loading @@ -115,7 +113,6 @@ final class InputMethodBindingController { int imeConnectionBindFlags, CountDownLatch latchForTesting) { mService = service; mContext = mService.mContext; mMethodMap = mService.mMethodMap; mSettings = mService.mSettings; mPackageManagerInternal = mService.mPackageManagerInternal; mWindowManagerInternal = mService.mWindowManagerInternal; Loading Loading @@ -295,7 +292,8 @@ final class InputMethodBindingController { return; } if (DEBUG) Slog.v(TAG, "Initiating attach with token: " + mCurToken); final InputMethodInfo info = mMethodMap.get(mSelectedMethodId); final InputMethodInfo info = mService.queryInputMethodForCurrentUserLocked(mSelectedMethodId); boolean supportsStylusHwChanged = mSupportsStylusHw != info.supportsStylusHandwriting(); mSupportsStylusHw = info.supportsStylusHandwriting(); Loading Loading @@ -410,7 +408,7 @@ final class InputMethodBindingController { return InputBindResult.NO_IME; } InputMethodInfo info = mMethodMap.get(mSelectedMethodId); InputMethodInfo info = mService.queryInputMethodForCurrentUserLocked(mSelectedMethodId); if (info == null) { throw new IllegalArgumentException("Unknown id: " + mSelectedMethodId); } Loading
services/core/java/com/android/server/inputmethod/InputMethodManagerService.java +7 −1 Original line number Diff line number Diff line Loading @@ -310,7 +310,7 @@ public final class InputMethodManagerService extends IInputMethodManager.Stub // All known input methods. final ArrayList<InputMethodInfo> mMethodList = new ArrayList<>(); final ArrayMap<String, InputMethodInfo> mMethodMap = new ArrayMap<>(); private final ArrayMap<String, InputMethodInfo> mMethodMap = new ArrayMap<>(); final InputMethodSubtypeSwitchingController mSwitchingController; final HardwareKeyboardShortcutController mHardwareKeyboardShortcutController = new HardwareKeyboardShortcutController(); Loading Loading @@ -500,6 +500,12 @@ public final class InputMethodManagerService extends IInputMethodManager.Stub mBindingController.advanceSequenceNumber(); } @GuardedBy("ImfLock.class") @Nullable InputMethodInfo queryInputMethodForCurrentUserLocked(@NonNull String imeId) { return mMethodMap.get(imeId); } /** * The client that is currently bound to an input method. */ Loading
services/core/java/com/android/server/inputmethod/InputMethodMenuController.java +2 −4 Original line number Diff line number Diff line Loading @@ -26,7 +26,6 @@ import android.content.DialogInterface; import android.content.res.TypedArray; import android.graphics.drawable.Drawable; import android.text.TextUtils; import android.util.ArrayMap; import android.util.Slog; import android.view.LayoutInflater; import android.view.View; Loading Loading @@ -54,7 +53,6 @@ final class InputMethodMenuController { private final InputMethodManagerService mService; private final InputMethodUtils.InputMethodSettings mSettings; private final InputMethodSubtypeSwitchingController mSwitchingController; private final ArrayMap<String, InputMethodInfo> mMethodMap; private final WindowManagerInternal mWindowManagerInternal; private AlertDialog.Builder mDialogBuilder; Loading @@ -73,7 +71,6 @@ final class InputMethodMenuController { mService = service; mSettings = mService.mSettings; mSwitchingController = mService.mSwitchingController; mMethodMap = mService.mMethodMap; mWindowManagerInternal = LocalServices.getService(WindowManagerInternal.class); } Loading Loading @@ -101,7 +98,8 @@ final class InputMethodMenuController { mService.getCurrentInputMethodSubtypeLocked(); if (currentSubtype != null) { final String curMethodId = mService.getSelectedMethodIdLocked(); final InputMethodInfo currentImi = mMethodMap.get(curMethodId); final InputMethodInfo currentImi = mService.queryInputMethodForCurrentUserLocked(curMethodId); lastInputMethodSubtypeId = SubtypeUtils.getSubtypeIdFromHashCode( currentImi, currentSubtype.hashCode()); } Loading
services/tests/InputMethodSystemServerTests/src/com/android/server/inputmethod/InputMethodBindingControllerTest.java +2 −1 Original line number Diff line number Diff line Loading @@ -133,10 +133,11 @@ public class InputMethodBindingControllerTest extends InputMethodManagerServiceT } private void testBindCurrentMethodWithMainConnection() throws Exception { final InputMethodInfo info; synchronized (ImfLock.class) { mBindingController.setSelectedMethodId(TEST_IME_ID); info = mInputMethodManagerService.queryInputMethodForCurrentUserLocked(TEST_IME_ID); } InputMethodInfo info = mInputMethodManagerService.mMethodMap.get(TEST_IME_ID); assertThat(info).isNotNull(); assertThat(info.getId()).isEqualTo(TEST_IME_ID); assertThat(info.getServiceName()).isEqualTo(TEST_SERVICE_NAME); Loading