Loading services/core/java/com/android/server/inputmethod/HardwareKeyboardShortcutController.java +20 −1 Original line number Original line Diff line number Diff line Loading @@ -19,6 +19,8 @@ package com.android.server.inputmethod; import android.annotation.AnyThread; import android.annotation.AnyThread; import android.annotation.NonNull; import android.annotation.NonNull; import android.annotation.Nullable; import android.annotation.Nullable; import android.annotation.UserIdInt; import android.util.ArrayMap; import android.view.inputmethod.InputMethodInfo; import android.view.inputmethod.InputMethodInfo; import android.view.inputmethod.InputMethodSubtype; import android.view.inputmethod.InputMethodSubtype; Loading @@ -33,9 +35,26 @@ final class HardwareKeyboardShortcutController { @GuardedBy("ImfLock.class") @GuardedBy("ImfLock.class") private final ArrayList<InputMethodSubtypeHandle> mSubtypeHandles = new ArrayList<>(); private final ArrayList<InputMethodSubtypeHandle> mSubtypeHandles = new ArrayList<>(); @UserIdInt private final int mUserId; @AnyThread @UserIdInt int getUserId() { return mUserId; } HardwareKeyboardShortcutController( @NonNull ArrayMap<String, InputMethodInfo> methodMap, @UserIdInt int userId) { mUserId = userId; reset(methodMap); } @GuardedBy("ImfLock.class") @GuardedBy("ImfLock.class") void reset(@NonNull InputMethodUtils.InputMethodSettings settings) { void reset(@NonNull ArrayMap<String, InputMethodInfo> methodMap) { mSubtypeHandles.clear(); mSubtypeHandles.clear(); final InputMethodUtils.InputMethodSettings settings = new InputMethodUtils.InputMethodSettings(methodMap, mUserId); for (final InputMethodInfo imi : settings.getEnabledInputMethodListLocked()) { for (final InputMethodInfo imi : settings.getEnabledInputMethodListLocked()) { if (!imi.shouldShowInInputMethodPicker()) { if (!imi.shouldShowInInputMethodPicker()) { continue; continue; Loading services/core/java/com/android/server/inputmethod/InputMethodManagerService.java +19 −6 Original line number Original line Diff line number Diff line Loading @@ -324,8 +324,9 @@ public final class InputMethodManagerService extends IInputMethodManager.Stub // TODO: Instantiate mSwitchingController for each user. // TODO: Instantiate mSwitchingController for each user. @NonNull @NonNull private InputMethodSubtypeSwitchingController mSwitchingController; private InputMethodSubtypeSwitchingController mSwitchingController; final HardwareKeyboardShortcutController mHardwareKeyboardShortcutController = // TODO: Instantiate mHardwareKeyboardShortcutController for each user. new HardwareKeyboardShortcutController(); @NonNull private HardwareKeyboardShortcutController mHardwareKeyboardShortcutController; /** /** * Tracks how many times {@link #mMethodMap} was updated. * Tracks how many times {@link #mMethodMap} was updated. Loading Loading @@ -1709,7 +1710,8 @@ public final class InputMethodManagerService extends IInputMethodManager.Stub mSwitchingController = mSwitchingController = InputMethodSubtypeSwitchingController.createInstanceLocked(context, mMethodMap, InputMethodSubtypeSwitchingController.createInstanceLocked(context, mMethodMap, userId); userId); mHardwareKeyboardShortcutController.reset(mSettings); mHardwareKeyboardShortcutController = new HardwareKeyboardShortcutController(mMethodMap, userId); mMenuController = new InputMethodMenuController(this); mMenuController = new InputMethodMenuController(this); mBindingController = mBindingController = bindingControllerForTesting != null bindingControllerForTesting != null Loading Loading @@ -3305,8 +3307,13 @@ public final class InputMethodManagerService extends IInputMethodManager.Stub mSwitchingController = InputMethodSubtypeSwitchingController.createInstanceLocked( mSwitchingController = InputMethodSubtypeSwitchingController.createInstanceLocked( mContext, mMethodMap, mSettings.getCurrentUserId()); mContext, mMethodMap, mSettings.getCurrentUserId()); } } // TODO: Instantiate mHardwareKeyboardShortcutController for each user. mHardwareKeyboardShortcutController.reset(mSettings); if (mSettings.getCurrentUserId() == mHardwareKeyboardShortcutController.getUserId()) { mHardwareKeyboardShortcutController.reset(mMethodMap); } else { mHardwareKeyboardShortcutController = new HardwareKeyboardShortcutController( mMethodMap, mSettings.getCurrentUserId()); } sendOnNavButtonFlagsChangedLocked(); sendOnNavButtonFlagsChangedLocked(); } } Loading Loading @@ -5328,7 +5335,13 @@ public final class InputMethodManagerService extends IInputMethodManager.Stub mSwitchingController = InputMethodSubtypeSwitchingController.createInstanceLocked( mSwitchingController = InputMethodSubtypeSwitchingController.createInstanceLocked( mContext, mMethodMap, mSettings.getCurrentUserId()); mContext, mMethodMap, mSettings.getCurrentUserId()); } } mHardwareKeyboardShortcutController.reset(mSettings); // TODO: Instantiate mHardwareKeyboardShortcutController for each user. if (mSettings.getCurrentUserId() == mHardwareKeyboardShortcutController.getUserId()) { mHardwareKeyboardShortcutController.reset(mMethodMap); } else { mHardwareKeyboardShortcutController = new HardwareKeyboardShortcutController( mMethodMap, mSettings.getCurrentUserId()); } sendOnNavButtonFlagsChangedLocked(); sendOnNavButtonFlagsChangedLocked(); Loading Loading
services/core/java/com/android/server/inputmethod/HardwareKeyboardShortcutController.java +20 −1 Original line number Original line Diff line number Diff line Loading @@ -19,6 +19,8 @@ package com.android.server.inputmethod; import android.annotation.AnyThread; import android.annotation.AnyThread; import android.annotation.NonNull; import android.annotation.NonNull; import android.annotation.Nullable; import android.annotation.Nullable; import android.annotation.UserIdInt; import android.util.ArrayMap; import android.view.inputmethod.InputMethodInfo; import android.view.inputmethod.InputMethodInfo; import android.view.inputmethod.InputMethodSubtype; import android.view.inputmethod.InputMethodSubtype; Loading @@ -33,9 +35,26 @@ final class HardwareKeyboardShortcutController { @GuardedBy("ImfLock.class") @GuardedBy("ImfLock.class") private final ArrayList<InputMethodSubtypeHandle> mSubtypeHandles = new ArrayList<>(); private final ArrayList<InputMethodSubtypeHandle> mSubtypeHandles = new ArrayList<>(); @UserIdInt private final int mUserId; @AnyThread @UserIdInt int getUserId() { return mUserId; } HardwareKeyboardShortcutController( @NonNull ArrayMap<String, InputMethodInfo> methodMap, @UserIdInt int userId) { mUserId = userId; reset(methodMap); } @GuardedBy("ImfLock.class") @GuardedBy("ImfLock.class") void reset(@NonNull InputMethodUtils.InputMethodSettings settings) { void reset(@NonNull ArrayMap<String, InputMethodInfo> methodMap) { mSubtypeHandles.clear(); mSubtypeHandles.clear(); final InputMethodUtils.InputMethodSettings settings = new InputMethodUtils.InputMethodSettings(methodMap, mUserId); for (final InputMethodInfo imi : settings.getEnabledInputMethodListLocked()) { for (final InputMethodInfo imi : settings.getEnabledInputMethodListLocked()) { if (!imi.shouldShowInInputMethodPicker()) { if (!imi.shouldShowInInputMethodPicker()) { continue; continue; Loading
services/core/java/com/android/server/inputmethod/InputMethodManagerService.java +19 −6 Original line number Original line Diff line number Diff line Loading @@ -324,8 +324,9 @@ public final class InputMethodManagerService extends IInputMethodManager.Stub // TODO: Instantiate mSwitchingController for each user. // TODO: Instantiate mSwitchingController for each user. @NonNull @NonNull private InputMethodSubtypeSwitchingController mSwitchingController; private InputMethodSubtypeSwitchingController mSwitchingController; final HardwareKeyboardShortcutController mHardwareKeyboardShortcutController = // TODO: Instantiate mHardwareKeyboardShortcutController for each user. new HardwareKeyboardShortcutController(); @NonNull private HardwareKeyboardShortcutController mHardwareKeyboardShortcutController; /** /** * Tracks how many times {@link #mMethodMap} was updated. * Tracks how many times {@link #mMethodMap} was updated. Loading Loading @@ -1709,7 +1710,8 @@ public final class InputMethodManagerService extends IInputMethodManager.Stub mSwitchingController = mSwitchingController = InputMethodSubtypeSwitchingController.createInstanceLocked(context, mMethodMap, InputMethodSubtypeSwitchingController.createInstanceLocked(context, mMethodMap, userId); userId); mHardwareKeyboardShortcutController.reset(mSettings); mHardwareKeyboardShortcutController = new HardwareKeyboardShortcutController(mMethodMap, userId); mMenuController = new InputMethodMenuController(this); mMenuController = new InputMethodMenuController(this); mBindingController = mBindingController = bindingControllerForTesting != null bindingControllerForTesting != null Loading Loading @@ -3305,8 +3307,13 @@ public final class InputMethodManagerService extends IInputMethodManager.Stub mSwitchingController = InputMethodSubtypeSwitchingController.createInstanceLocked( mSwitchingController = InputMethodSubtypeSwitchingController.createInstanceLocked( mContext, mMethodMap, mSettings.getCurrentUserId()); mContext, mMethodMap, mSettings.getCurrentUserId()); } } // TODO: Instantiate mHardwareKeyboardShortcutController for each user. mHardwareKeyboardShortcutController.reset(mSettings); if (mSettings.getCurrentUserId() == mHardwareKeyboardShortcutController.getUserId()) { mHardwareKeyboardShortcutController.reset(mMethodMap); } else { mHardwareKeyboardShortcutController = new HardwareKeyboardShortcutController( mMethodMap, mSettings.getCurrentUserId()); } sendOnNavButtonFlagsChangedLocked(); sendOnNavButtonFlagsChangedLocked(); } } Loading Loading @@ -5328,7 +5335,13 @@ public final class InputMethodManagerService extends IInputMethodManager.Stub mSwitchingController = InputMethodSubtypeSwitchingController.createInstanceLocked( mSwitchingController = InputMethodSubtypeSwitchingController.createInstanceLocked( mContext, mMethodMap, mSettings.getCurrentUserId()); mContext, mMethodMap, mSettings.getCurrentUserId()); } } mHardwareKeyboardShortcutController.reset(mSettings); // TODO: Instantiate mHardwareKeyboardShortcutController for each user. if (mSettings.getCurrentUserId() == mHardwareKeyboardShortcutController.getUserId()) { mHardwareKeyboardShortcutController.reset(mMethodMap); } else { mHardwareKeyboardShortcutController = new HardwareKeyboardShortcutController( mMethodMap, mSettings.getCurrentUserId()); } sendOnNavButtonFlagsChangedLocked(); sendOnNavButtonFlagsChangedLocked(); Loading