Fix no-op traversal requested in traversal before layout
Commit f64e1343 (2652da82) eliminates the unconditional resize from the first layout. But IME window may rely on the additional resize to trigger the 3rd layout pass to compute its final size, otherwise the height of navigation bar isn’t accounted for IME window. The layout steps of initializing IME window: a. Add root view (ViewRootImpl setView -> requestLayout). b. Layout pass 1: apply window insets (WindowInsetsListener of InputMethodService ~ DecorView#updateColorViews -> addView (navigation bar background) -> requestLayout). c. Layout pass 2: almost no-op because pass 1 cleared ViewRootImpl#mLayoutRequested (performLayout is called after dispatchApplyInsets). So if pass 2 performs measure and layout correctly, the 3rd layout pass is not needed. As the comment of the first place that clears mLayoutRequested (in ViewRootImpl#performTraversals), the layout request during traversal should be caught for performing next full layout pass. Fix: 147857963 Test: atest OnScreenPositionTest#testImeIsNotBehindNavBar Change-Id: Ib9c116fb81cd41c2df30ab81c0f0594c489cebf9
Loading
Please register or sign in to comment