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

Commit d1cd540b authored by Ming-Shin Lu's avatar Ming-Shin Lu
Browse files

Add Null check for mView.findFocus() in ViewRootImpl

Some apps like Netflix crashed while handleWindowFocusChanged but mView
somehow has became null.

It's fair to check null for mView.findFocus() since other places
in ViewRootImpl that calling this method also add null check.

Fix: 153862451
Test: atest CtsInputMethodTestCases

Change-Id: I86bd5f3193deabe28bb425a8564017f7b32b90f3
(cherry picked from commit bdaa14bf)
parent b72c8a09
Loading
Loading
Loading
Loading
+2 −2
Original line number Original line Diff line number Diff line
@@ -3268,8 +3268,8 @@ public final class ViewRootImpl implements ViewParent,


            // Note: must be done after the focus change callbacks,
            // Note: must be done after the focus change callbacks,
            // so all of the view state is set up correctly.
            // so all of the view state is set up correctly.
            mImeFocusController.onPostWindowFocus(mView.findFocus(), hasWindowFocus,
            mImeFocusController.onPostWindowFocus(mView != null ? mView.findFocus() : null,
                    mWindowAttributes);
                    hasWindowFocus, mWindowAttributes);


            if (hasWindowFocus) {
            if (hasWindowFocus) {
                // Clear the forward bit.  We can just do this directly, since
                // Clear the forward bit.  We can just do this directly, since