Fix NPE in WindowState#needsRelativeLayeringToIme
CL[1] modified DC#computeImeTarget to keep the previous IME target window when the insets visiblity of the IME target window is visible in order to prevent flickering because IME hiding animation occurs on top of the overview screen. However, this caused below call stack in needsRelativeLayeringToIme() may hit NPE by invoking getParentWindow().isInputMethodTarget() on the null parent window because the window is the previous IME target which has been removed from the hierarchy: WindowState.needsRelativeLayeringToIme InsetsStateController.isAboveIme InsetsStateController.getInsetsForWindow InsetsPolicy.getInsetsForWindow WindowState.getInsetsState DisplayContent.computeImeTarget Make sure set DC#mInputMethodTarget as null when the IME target window is removed by WindowState#removeImmediately() for fixing NPE by accessing outdated object. [1]: Ib898bc2e3a5b063fe9eaf8b07d022231dd1326a3 Fix: 171818150 Bug: 166736352 Test: all WM tests passed Test: atest DisplayContentTests#\ testComputeImeTarget_shouldNotCheckOutdatedImeTargetLayerWhenRemoved Change-Id: I7ff42b0e6ef5b68f37f81fe9a396bdc7e045c6ea
Loading
Please register or sign in to comment