Loading services/core/java/com/android/server/inputmethod/HardwareKeyboardShortcutController.java +3 −15 Original line number Diff line number Diff line Loading @@ -19,7 +19,6 @@ package com.android.server.inputmethod; import android.annotation.AnyThread; import android.annotation.NonNull; import android.annotation.Nullable; import android.annotation.UserIdInt; import android.view.inputmethod.InputMethodInfo; import android.view.inputmethod.InputMethodSubtype; Loading @@ -34,24 +33,13 @@ final class HardwareKeyboardShortcutController { @GuardedBy("ImfLock.class") private final ArrayList<InputMethodSubtypeHandle> mSubtypeHandles = new ArrayList<>(); @UserIdInt private final int mUserId; @AnyThread @UserIdInt int getUserId() { return mUserId; } HardwareKeyboardShortcutController(@NonNull InputMethodMap methodMap, @UserIdInt int userId) { mUserId = userId; reset(methodMap); HardwareKeyboardShortcutController(@NonNull InputMethodSettings settings) { update(settings); } @GuardedBy("ImfLock.class") void reset(@NonNull InputMethodMap methodMap) { void update(@NonNull InputMethodSettings settings) { mSubtypeHandles.clear(); final InputMethodSettings settings = InputMethodSettings.create(methodMap, mUserId); final List<InputMethodInfo> inputMethods = settings.getEnabledInputMethodList(); for (int i = 0; i < inputMethods.size(); ++i) { final InputMethodInfo imi = inputMethods.get(i); Loading services/core/java/com/android/server/inputmethod/InputMethodManagerService.java +8 −24 Original line number Diff line number Diff line Loading @@ -381,10 +381,6 @@ public final class InputMethodManagerService implements IInputMethodManagerImpl. @NonNull @MultiUserUnawareField private InputMethodSubtypeSwitchingController mSwitchingController; // TODO: Instantiate mHardwareKeyboardShortcutController for each user. @NonNull @MultiUserUnawareField private HardwareKeyboardShortcutController mHardwareKeyboardShortcutController; @Nullable private StatusBarManagerInternal mStatusBarManagerInternal; Loading Loading @@ -1302,9 +1298,7 @@ public final class InputMethodManagerService implements IInputMethodManagerImpl. mSwitchingController = new InputMethodSubtypeSwitchingController(context, settings.getMethodMap(), settings.getUserId()); mHardwareKeyboardShortcutController = new HardwareKeyboardShortcutController(settings.getMethodMap(), settings.getUserId()); getUserData(mCurrentUserId).mHardwareKeyboardShortcutController.update(settings); mMenuController = new InputMethodMenuController(this); mVisibilityStateComputer = new ImeVisibilityStateComputer(this); mVisibilityApplier = new DefaultImeVisibilityApplier(this); Loading Loading @@ -2936,7 +2930,6 @@ public final class InputMethodManagerService implements IInputMethodManagerImpl. * </li> * <li>{@link InputMethodBindingController#getDeviceIdToShowIme()} is ignored.</li> * <li>{@link #mSwitchingController} is ignored.</li> * <li>{@link #mHardwareKeyboardShortcutController} is ignored.</li> * <li>{@link #mPreventImeStartupUnlessTextEditor} is ignored.</li> * <li>and so on.</li> * </ul> Loading Loading @@ -2969,6 +2962,9 @@ public final class InputMethodManagerService implements IInputMethodManagerImpl. id = imi.getId(); settings.putSelectedInputMethod(id); } final var userData = getUserData(userId); userData.mHardwareKeyboardShortcutController.update(settings); } @GuardedBy("ImfLock.class") Loading Loading @@ -3051,13 +3047,7 @@ public final class InputMethodManagerService implements IInputMethodManagerImpl. mSwitchingController = new InputMethodSubtypeSwitchingController(mContext, settings.getMethodMap(), userId); } // TODO: Instantiate mHardwareKeyboardShortcutController for each user. if (userId == mHardwareKeyboardShortcutController.getUserId()) { mHardwareKeyboardShortcutController.reset(settings.getMethodMap()); } else { mHardwareKeyboardShortcutController = new HardwareKeyboardShortcutController( settings.getMethodMap(), userId); } getUserData(userId).mHardwareKeyboardShortcutController.update(settings); sendOnNavButtonFlagsChangedLocked(); } Loading Loading @@ -5322,13 +5312,7 @@ public final class InputMethodManagerService implements IInputMethodManagerImpl. mSwitchingController = new InputMethodSubtypeSwitchingController(mContext, settings.getMethodMap(), mCurrentUserId); } // TODO: Instantiate mHardwareKeyboardShortcutController for each user. if (userId == mHardwareKeyboardShortcutController.getUserId()) { mHardwareKeyboardShortcutController.reset(settings.getMethodMap()); } else { mHardwareKeyboardShortcutController = new HardwareKeyboardShortcutController( settings.getMethodMap(), userId); } getUserData(userId).mHardwareKeyboardShortcutController.update(settings); sendOnNavButtonFlagsChangedLocked(); Loading Loading @@ -5639,8 +5623,8 @@ public final class InputMethodManagerService implements IInputMethodManagerImpl. final InputMethodSubtypeHandle currentSubtypeHandle = InputMethodSubtypeHandle.of(currentImi, bindingController.getCurrentSubtype()); final InputMethodSubtypeHandle nextSubtypeHandle = mHardwareKeyboardShortcutController.onSubtypeSwitch(currentSubtypeHandle, direction > 0); getUserData(userId).mHardwareKeyboardShortcutController.onSubtypeSwitch( currentSubtypeHandle, direction > 0); if (nextSubtypeHandle == null) { return; } Loading services/core/java/com/android/server/inputmethod/UserDataRepository.java +5 −0 Original line number Diff line number Diff line Loading @@ -88,6 +88,9 @@ final class UserDataRepository { @NonNull final InputMethodBindingController mBindingController; @NonNull final HardwareKeyboardShortcutController mHardwareKeyboardShortcutController; /** * Intended to be instantiated only from this file. */ Loading @@ -95,6 +98,8 @@ final class UserDataRepository { @NonNull InputMethodBindingController bindingController) { mUserId = userId; mBindingController = bindingController; mHardwareKeyboardShortcutController = new HardwareKeyboardShortcutController( InputMethodSettings.createEmptyMap(userId)); } @Override Loading Loading
services/core/java/com/android/server/inputmethod/HardwareKeyboardShortcutController.java +3 −15 Original line number Diff line number Diff line Loading @@ -19,7 +19,6 @@ package com.android.server.inputmethod; import android.annotation.AnyThread; import android.annotation.NonNull; import android.annotation.Nullable; import android.annotation.UserIdInt; import android.view.inputmethod.InputMethodInfo; import android.view.inputmethod.InputMethodSubtype; Loading @@ -34,24 +33,13 @@ final class HardwareKeyboardShortcutController { @GuardedBy("ImfLock.class") private final ArrayList<InputMethodSubtypeHandle> mSubtypeHandles = new ArrayList<>(); @UserIdInt private final int mUserId; @AnyThread @UserIdInt int getUserId() { return mUserId; } HardwareKeyboardShortcutController(@NonNull InputMethodMap methodMap, @UserIdInt int userId) { mUserId = userId; reset(methodMap); HardwareKeyboardShortcutController(@NonNull InputMethodSettings settings) { update(settings); } @GuardedBy("ImfLock.class") void reset(@NonNull InputMethodMap methodMap) { void update(@NonNull InputMethodSettings settings) { mSubtypeHandles.clear(); final InputMethodSettings settings = InputMethodSettings.create(methodMap, mUserId); final List<InputMethodInfo> inputMethods = settings.getEnabledInputMethodList(); for (int i = 0; i < inputMethods.size(); ++i) { final InputMethodInfo imi = inputMethods.get(i); Loading
services/core/java/com/android/server/inputmethod/InputMethodManagerService.java +8 −24 Original line number Diff line number Diff line Loading @@ -381,10 +381,6 @@ public final class InputMethodManagerService implements IInputMethodManagerImpl. @NonNull @MultiUserUnawareField private InputMethodSubtypeSwitchingController mSwitchingController; // TODO: Instantiate mHardwareKeyboardShortcutController for each user. @NonNull @MultiUserUnawareField private HardwareKeyboardShortcutController mHardwareKeyboardShortcutController; @Nullable private StatusBarManagerInternal mStatusBarManagerInternal; Loading Loading @@ -1302,9 +1298,7 @@ public final class InputMethodManagerService implements IInputMethodManagerImpl. mSwitchingController = new InputMethodSubtypeSwitchingController(context, settings.getMethodMap(), settings.getUserId()); mHardwareKeyboardShortcutController = new HardwareKeyboardShortcutController(settings.getMethodMap(), settings.getUserId()); getUserData(mCurrentUserId).mHardwareKeyboardShortcutController.update(settings); mMenuController = new InputMethodMenuController(this); mVisibilityStateComputer = new ImeVisibilityStateComputer(this); mVisibilityApplier = new DefaultImeVisibilityApplier(this); Loading Loading @@ -2936,7 +2930,6 @@ public final class InputMethodManagerService implements IInputMethodManagerImpl. * </li> * <li>{@link InputMethodBindingController#getDeviceIdToShowIme()} is ignored.</li> * <li>{@link #mSwitchingController} is ignored.</li> * <li>{@link #mHardwareKeyboardShortcutController} is ignored.</li> * <li>{@link #mPreventImeStartupUnlessTextEditor} is ignored.</li> * <li>and so on.</li> * </ul> Loading Loading @@ -2969,6 +2962,9 @@ public final class InputMethodManagerService implements IInputMethodManagerImpl. id = imi.getId(); settings.putSelectedInputMethod(id); } final var userData = getUserData(userId); userData.mHardwareKeyboardShortcutController.update(settings); } @GuardedBy("ImfLock.class") Loading Loading @@ -3051,13 +3047,7 @@ public final class InputMethodManagerService implements IInputMethodManagerImpl. mSwitchingController = new InputMethodSubtypeSwitchingController(mContext, settings.getMethodMap(), userId); } // TODO: Instantiate mHardwareKeyboardShortcutController for each user. if (userId == mHardwareKeyboardShortcutController.getUserId()) { mHardwareKeyboardShortcutController.reset(settings.getMethodMap()); } else { mHardwareKeyboardShortcutController = new HardwareKeyboardShortcutController( settings.getMethodMap(), userId); } getUserData(userId).mHardwareKeyboardShortcutController.update(settings); sendOnNavButtonFlagsChangedLocked(); } Loading Loading @@ -5322,13 +5312,7 @@ public final class InputMethodManagerService implements IInputMethodManagerImpl. mSwitchingController = new InputMethodSubtypeSwitchingController(mContext, settings.getMethodMap(), mCurrentUserId); } // TODO: Instantiate mHardwareKeyboardShortcutController for each user. if (userId == mHardwareKeyboardShortcutController.getUserId()) { mHardwareKeyboardShortcutController.reset(settings.getMethodMap()); } else { mHardwareKeyboardShortcutController = new HardwareKeyboardShortcutController( settings.getMethodMap(), userId); } getUserData(userId).mHardwareKeyboardShortcutController.update(settings); sendOnNavButtonFlagsChangedLocked(); Loading Loading @@ -5639,8 +5623,8 @@ public final class InputMethodManagerService implements IInputMethodManagerImpl. final InputMethodSubtypeHandle currentSubtypeHandle = InputMethodSubtypeHandle.of(currentImi, bindingController.getCurrentSubtype()); final InputMethodSubtypeHandle nextSubtypeHandle = mHardwareKeyboardShortcutController.onSubtypeSwitch(currentSubtypeHandle, direction > 0); getUserData(userId).mHardwareKeyboardShortcutController.onSubtypeSwitch( currentSubtypeHandle, direction > 0); if (nextSubtypeHandle == null) { return; } Loading
services/core/java/com/android/server/inputmethod/UserDataRepository.java +5 −0 Original line number Diff line number Diff line Loading @@ -88,6 +88,9 @@ final class UserDataRepository { @NonNull final InputMethodBindingController mBindingController; @NonNull final HardwareKeyboardShortcutController mHardwareKeyboardShortcutController; /** * Intended to be instantiated only from this file. */ Loading @@ -95,6 +98,8 @@ final class UserDataRepository { @NonNull InputMethodBindingController bindingController) { mUserId = userId; mBindingController = bindingController; mHardwareKeyboardShortcutController = new HardwareKeyboardShortcutController( InputMethodSettings.createEmptyMap(userId)); } @Override Loading