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

Commit 1e4f3605 authored by Treehugger Robot's avatar Treehugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Replace questionable resetCurrentMethodAndClientLocked()" into main

parents 7194b2b2 61c23f8a
Loading
Loading
Loading
Loading
+15 −4
Original line number Diff line number Diff line
@@ -1527,6 +1527,20 @@ public final class InputMethodManagerService implements IInputMethodManagerImpl.
                    + " currentUserId=" + mCurrentUserId);
        }

        // Clean up stuff for mCurrentUserId, which soon becomes the previous user.

        // TODO(b/338461930): Check if this is still necessary or not.
        onUnbindCurrentMethodByReset();

        // Note that in b/197848765 we want to see if we can keep the binding alive for better
        // profile switching.
        mBindingController.unbindCurrentMethod();
        // TODO(b/325515685): No need to do this once BindingController becomes per-user.
        mBindingController.setSelectedMethodId(null);
        unbindCurrentClientLocked(UnbindReason.SWITCH_USER);

        // Hereafter we start initializing things for "newUserId".

        maybeInitImeNavbarConfigLocked(newUserId);

        // ContentObserver should be registered again when the user is changed
@@ -1548,10 +1562,6 @@ public final class InputMethodManagerService implements IInputMethodManagerImpl.
        // IME for that user.
        final boolean initialUserSwitch = TextUtils.isEmpty(defaultImiId);

        // The mSystemReady flag is set during boot phase,
        // and user switch would not happen at that time.
        resetCurrentMethodAndClientLocked(UnbindReason.SWITCH_USER);

        final InputMethodSettings newSettings = InputMethodSettingsRepository.get(newUserId);
        postInputMethodSettingUpdatedLocked(initialUserSwitch /* resetDefaultEnabledIme */);
        if (TextUtils.isEmpty(newSettings.getSelectedInputMethod())) {
@@ -2500,6 +2510,7 @@ public final class InputMethodManagerService implements IInputMethodManagerImpl.
    void resetCurrentMethodAndClientLocked(@UnbindReason int unbindClientReason) {
        mBindingController.setSelectedMethodId(null);
        // Callback before clean-up binding states.
        // TODO(b/338461930): Check if this is still necessary or not.
        onUnbindCurrentMethodByReset();
        mBindingController.unbindCurrentMethod();
        unbindCurrentClientLocked(unbindClientReason);