leanback/src/androidTest/java/androidx/leanback/widget/GridWidgetTest.java
protected void waitForLayout(boolean force) {
        if (mWaitLayoutListener == null) {
            throw new IllegalStateException("startWaitLayout() not called");
        }
        if (mWaitLayoutListener != mLayoutManager.mLayoutCompleteListener) {
            throw new IllegalStateException("layout listener inconistent");
        }
        try {
            if (force || mGridView.isLayoutRequested()) {
                verify(mWaitLayoutListener, timeout(WAIT_FOR_LAYOUT_PASS_TIMEOUT_MS).atLeastOnce())
                        .onLayoutCompleted(any(RecyclerView.State.class));
            }
        } finally {
            mWaitLayoutListener = null;
            mLayoutManager.mLayoutCompleteListener = null;
        }
    }
/**
     * wait layout to be called and remove the listener.
     * @param force True if always wait regardless if layout requested
     */
wait layout to be called and remove the listener.
@param force True if always wait regardless if layout requested
wait layout to be called and remove the listener . @param force True if always wait regardless if layout requested
protected void waitForLayout(boolean force) {
        if (mWaitLayoutListener == null) {
            throw new IllegalStateException("startWaitLayout() not called");
        }
        if (mWaitLayoutListener != mLayoutManager.mLayoutCompleteListener) {
            throw new IllegalStateException("layout listener inconistent");
        }
        try {
            if (force || mGridView.isLayoutRequested()) {
                verify(mWaitLayoutListener, timeout(WAIT_FOR_LAYOUT_PASS_TIMEOUT_MS).atLeastOnce())
                        .onLayoutCompleted(any(RecyclerView.State.class));
            }
        } finally {
            mWaitLayoutListener = null;
            mLayoutManager.mLayoutCompleteListener = null;
        }
    }
protected void waitForLayout ( boolean force ) { if ( mWaitLayoutListener == null ) { throw new IllegalStateException ( "startWaitLayout() not called" ) ; } if ( mWaitLayoutListener != mLayoutManager . mLayoutCompleteListener ) { throw new IllegalStateException ( "layout listener inconistent" ) ; } try { if ( force || mGridView . isLayoutRequested ( ) ) { verify ( mWaitLayoutListener , timeout ( WAIT_FOR_LAYOUT_PASS_TIMEOUT_MS ) . atLeastOnce ( ) ) . onLayoutCompleted ( any ( RecyclerView . State . class ) ) ; } } finally { mWaitLayoutListener = null ; mLayoutManager . mLayoutCompleteListener = null ; } }
wait layout to be called and remove the listener.
wait layout to be called and remove the listener .