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

Commit c5e16433 authored by Cosmin Băieș's avatar Cosmin Băieș Committed by Android (Google) Code Review
Browse files

Merge "Check if current profile is being removed in IMMS" into main

parents 8a49f5df 53fafb04
Loading
Loading
Loading
Loading
+14 −1
Original line number Diff line number Diff line
@@ -1082,6 +1082,19 @@ public final class InputMethodManagerService implements IInputMethodManagerImpl.
            AdditionalSubtypeMapRepository.remove(userId);
            InputMethodSettingsRepository.remove(userId);
            mService.mUserDataRepository.remove(userId);
            synchronized (ImfLock.class) {
                final int nextOrCurrentUser = mService.mUserSwitchHandlerTask != null
                        ? mService.mUserSwitchHandlerTask.mToUserId : mService.mCurrentImeUserId;
                if (!mService.mConcurrentMultiUserModeEnabled && userId == nextOrCurrentUser) {
                    // The current user was removed without an ongoing switch, or the user targeted
                    // by the ongoing switch was removed. Switch to the current non-profile user
                    // to allow starting input on it or one of its profile users later.
                    // Note: non-profile users cannot be removed while they are the current user.
                    final int currentUserId = mService.mActivityManagerInternal.getCurrentUserId();
                    mService.scheduleSwitchUserTaskLocked(currentUserId,
                            null /* clientToBeReset */);
                }
            }
        }

        @Override
@@ -1332,7 +1345,7 @@ public final class InputMethodManagerService implements IInputMethodManagerImpl.
                    + " prevUserId=" + prevUserId);
        }

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

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