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

Commit 1c1954f6 authored by Yohei Yukawa's avatar Yohei Yukawa
Browse files

Run IMMS#onUnlockUser() also for background users

As part of our on-going effort to address the remaining dependency on

  InputMethodManagerService#mCurrentUserId,

this CL updates the behavior of

  InputMethodManagerService#onUnlockUser()

so that it calls

  * IMMS#postInputMethodSettingUpdatedLocked()
  * IMMS#updateInputMethodsFromSettingsLocked()

not only for the current user but also for background users, even for
phones/tablets/TVs/wearables. This was not possible until when we
update the above two methods to take userId [1].

With this CL, we would start initializing IME-related settings
(e.g. secure settings) more eagerly for background users. But other
than that, user observable behavior should remain unchanged.

 [1]: I9d4615e6da979204c21555e040a687163c1460ab
      e08e5c4a

Bug: 350386877
Test: presubmit
Flag: android.view.inputmethod.concurrent_input_methods
Change-Id: Iecbca2696d4e2fd56a434f2e3a95d14976978e06
parent 81c8ae9d
Loading
Loading
Loading
Loading
+3 −2
Original line number Original line Diff line number Diff line
@@ -1114,11 +1114,12 @@ public final class InputMethodManagerService implements IInputMethodManagerImpl.
            final InputMethodSettings newSettings = queryInputMethodServicesInternal(mContext,
            final InputMethodSettings newSettings = queryInputMethodServicesInternal(mContext,
                    userId, AdditionalSubtypeMapRepository.get(userId), DirectBootAwareness.AUTO);
                    userId, AdditionalSubtypeMapRepository.get(userId), DirectBootAwareness.AUTO);
            InputMethodSettingsRepository.put(userId, newSettings);
            InputMethodSettingsRepository.put(userId, newSettings);
            if (mCurrentUserId == userId) {
            if (!mConcurrentMultiUserModeEnabled) {
                // We need to rebuild IMEs.
                // We need to rebuild IMEs.
                postInputMethodSettingUpdatedLocked(false /* resetDefaultEnabledIme */, userId);
                postInputMethodSettingUpdatedLocked(false /* resetDefaultEnabledIme */, userId);
                updateInputMethodsFromSettingsLocked(true /* enabledChanged */, userId);
                updateInputMethodsFromSettingsLocked(true /* enabledChanged */, userId);
            } else if (mConcurrentMultiUserModeEnabled) {
            } else {
                // TODO(b/352758479): Stop relying on initializeVisibleBackgroundUserLocked()
                initializeVisibleBackgroundUserLocked(userId);
                initializeVisibleBackgroundUserLocked(userId);
            }
            }
        }
        }