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

Commit ef670528 authored by Vaibhav Devmurari's avatar Vaibhav Devmurari
Browse files

Use SystemService lifecycle to keep track of current user

Bug: 362473586
Test: manual
Flag: com.android.hardware.input.input_manager_lifecycle_support
Change-Id: Id052e8193aacbb4090cb0dc53180bc58eb4fa108
parent 809571a3
Loading
Loading
Loading
Loading
+13 −0
Original line number Diff line number Diff line
@@ -3038,6 +3038,14 @@ public class InputManagerService extends IInputManager.Stub
        mNative.resetLockedModifierState();
    }

    private void onUserSwitching(@NonNull SystemService.TargetUser from,
            @NonNull SystemService.TargetUser to) {
        if (DEBUG) {
            Slog.d(TAG, "onUserSwitching from=" + from + " to=" + to);
        }
        mHandler.obtainMessage(MSG_CURRENT_USER_CHANGED, to.getUserIdentifier()).sendToTarget();
    }

    private void handleCurrentUserChanged(@UserIdInt int userId) {
        mCurrentUserId = userId;
        mKeyGestureController.setCurrentUserId(userId);
@@ -3424,6 +3432,11 @@ public class InputManagerService extends IInputManager.Stub
            }
        }

        @Override
        public void onUserSwitching(@Nullable TargetUser from, @NonNull TargetUser to) {
            mService.onUserSwitching(from, to);
        }

        public InputManagerService getService() {
            return mService;
        }
+4 −1
Original line number Diff line number Diff line
@@ -85,6 +85,7 @@ import static android.view.contentprotection.flags.Flags.createAccessibilityOver

import static com.android.hardware.input.Flags.enableNew25q2Keycodes;
import static com.android.hardware.input.Flags.enableTalkbackAndMagnifierKeyGestures;
import static com.android.hardware.input.Flags.inputManagerLifecycleSupport;
import static com.android.hardware.input.Flags.keyboardA11yShortcutControl;
import static com.android.hardware.input.Flags.modifierShortcutDump;
import static com.android.hardware.input.Flags.useKeyGestureEventHandler;
@@ -7106,8 +7107,10 @@ public class PhoneWindowManager implements WindowManagerPolicy {
        if (modifierShortcutManagerMultiuser()) {
            mModifierShortcutManager.setCurrentUser(UserHandle.of(newUserId));
        }
        if (!inputManagerLifecycleSupport()) {
            mInputManagerInternal.setCurrentUser(newUserId);
        }
    }

    @Override
    public void setSwitchingUser(boolean switching) {