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

Commit d82d6e0a authored by Riddle Hsu's avatar Riddle Hsu
Browse files

Fix NPE in InputManagerCallback#notifyFocusChanged

The newToken may be null from InputDispatcher before the
next focused window is ready.

Bug: 134365580
Test: Launch any activity and no error log of InputManager-JNI.
Test: atest PointerCaptureTest WindowFocusTests
Change-Id: Ifbb08a551a1ab1d3db536f4708164dbe965ac43b
parent 166b7cbb
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -266,7 +266,8 @@ final class InputManagerCallback implements InputManagerService.WindowManagerCal

        final IWindow focusedWindow = mFocusedWindow.get();
        if (focusedWindow != null) {
            if (focusedWindow.asBinder() == newFocusedWindow.asBinder()) {
            if (newFocusedWindow != null
                    && newFocusedWindow.asBinder() == focusedWindow.asBinder()) {
                Slog.w(TAG, "notifyFocusChanged called with unchanged mFocusedWindow="
                        + focusedWindow);
                return false;