Buggy code:
public abstract class BaseLayoutManager extends TwoWayLayoutManager { private static final String LOGTAG = "BaseLayoutManager" ; protected static class ItemEntry implements Parcelable { public int startLane ; public int anchorLane ; private int [ ] spanMargins ; public ItemEntry ( int startLane , int anchorLane ) { } public ItemEntry ( Parcel in ) { } @ Override public int describeContents ( ) { } @ Override public void writeToParcel ( Parcel out , int flags ) { } void setLane ( LaneInfo laneInfo ) { } void invalidateLane ( ) { } private boolean hasSpanMargins ( ) { } private int getSpanMargin ( int index ) { } private void setSpanMargin ( int index , int margin , int span ) { } public static final Creator < BaseLayoutManager . ItemEntry > CREATOR = new Creator < BaseLayoutManager . ItemEntry > ( ) { @ Override public BaseLayoutManager . ItemEntry createFromParcel ( Parcel in ) { } @ Override public BaseLayoutManager . ItemEntry [ ] newArray ( int size ) { } } ; } private enum UpdateOp { ADD , REMOVE , UPDATE , MOVE ; } private Lanes mLanes ; private Lanes mLanesToRestore ; private ItemEntries mItemEntries ; private ItemEntries mItemEntriesToRestore ; protected final Rect mChildFrame = new Rect ( ) ; protected final Rect mTempRect = new Rect ( ) ; protected final LaneInfo mTempLaneInfo = new LaneInfo ( ) ; public BaseLayoutManager ( Context context , AttributeSet attrs ) { } public BaseLayoutManager ( Context context , AttributeSet attrs , int defStyle ) { } public BaseLayoutManager ( Orientation orientation ) { } protected void pushChildFrame ( BaseLayoutManager . ItemEntry entry , Rect childFrame , int lane , int laneSpan , Direction direction ) { } private void popChildFrame ( BaseLayoutManager . ItemEntry entry , Rect childFrame , int lane , int laneSpan , Direction direction ) { } void getDecoratedChildFrame ( View child , Rect childFrame ) { } @ Override public void setScreenOrientation ( int orientation ) { } boolean isVertical ( ) { } Lanes getLanes ( ) { } void setItemEntryForPosition ( int position , BaseLayoutManager . ItemEntry entry ) { } BaseLayoutManager . ItemEntry getItemEntryForPosition ( int position ) { } void clearItemEntries ( ) { } void invalidateItemLanesAfter ( int position ) { } void offsetForAddition ( int positionStart , int itemCount ) { } void offsetForRemoval ( int positionStart , int itemCount ) { } private void requestMoveLayout ( ) { } private boolean canUseLanes ( Lanes lanes ) { } private boolean ensureLayoutState ( ) { } private void handleUpdate ( int positionStart , int itemCountOrToPosition , BaseLayoutManager . UpdateOp cmd ) { } @ Override public void offsetChildrenHorizontal ( int offset ) { } @ Override public void offsetChildrenVertical ( int offset ) { } @ Override public void onLayoutChildren ( Recycler recycler , State state ) { final boolean restoringLanes = ( mLanesToRestore ) != null ; if ( restoringLanes ) { mLanes = mLanesToRestore ; mItemEntries = mItemEntriesToRestore ; mLanesToRestore = null ; mItemEntriesToRestore = null ; } final boolean refreshingLanes = ensureLayoutState ( ) ; if ( ( mLanes ) == null ) { return ; } final int itemCount = state . getItemCount ( ) ; final int anchorItemPosition = getAnchorItemPosition ( state ) ; <START_BUG> if ( ( anchorItemPosition > 0 ) && ( refreshingLanes || ( ! restoringLanes ) ) ) { <END_BUG> moveLayoutToPosition ( anchorItemPosition , getPendingScrollOffset ( ) , recycler , state ) ; } mLanes . reset ( START ) ; super . onLayoutChildren ( recycler , state ) ; } @ Override protected void onLayoutScrapList ( Recycler recycler , State state ) { } @ Override public void onItemsAdded ( RecyclerView recyclerView , int positionStart , int itemCount ) { } @ Override public void onItemsRemoved ( RecyclerView recyclerView , int positionStart , int itemCount ) { } @ Override public void onItemsUpdated ( RecyclerView recyclerView , int positionStart , int itemCount ) { } @ Override public void onItemsMoved ( RecyclerView recyclerView , int from , int to , int itemCount ) { } @ Override public void onItemsChanged ( RecyclerView recyclerView ) { } @ Override public Parcelable onSaveInstanceState ( ) { } @ Override public void onRestoreInstanceState ( Parcelable state ) { } @ Override protected boolean canAddMoreViews ( Direction direction , int limit ) { } private int getWidthUsed ( View child ) { } private int getHeightUsed ( View child ) { } void measureChildWithMargins ( View child ) { } @ Override protected void measureChild ( View child , Direction direction ) { } @ Override protected void layoutChild ( View child , Direction direction ) { } @ Override protected void detachChild ( View child , Direction direction ) { } void getLaneForChild ( LaneInfo outInfo , View child , Direction direction ) { } int getLaneSpanForChild ( View child ) { } int getLaneSpanForPosition ( int position ) { } BaseLayoutManager . ItemEntry cacheChildLaneAndSpan ( View child , Direction direction ) { } BaseLayoutManager . ItemEntry cacheChildFrame ( View child , Rect childFrame ) { } @ Override public boolean checkLayoutParams ( LayoutParams lp ) { } @ Override public LayoutParams generateDefaultLayoutParams ( ) { } @ Override public LayoutParams generateLayoutParams ( ViewGroup . LayoutParams lp ) { } @ Override public LayoutParams generateLayoutParams ( Context c , AttributeSet attrs ) { } abstract int getLaneCount ( ) { } abstract void getLaneForPosition ( LaneInfo outInfo , int position , Direction direction ) { } abstract void moveLayoutToPosition ( int position , int offset , Recycler recycler , State state ) { } protected static class LanedSavedState extends SavedState { private int screenOrientation ; private Orientation orientation ; private Rect [ ] lanes ; private int laneSize ; private ItemEntries itemEntries ; protected LanedSavedState ( Parcelable superState ) { } private LanedSavedState ( Parcel in ) { }

Fix:
if ( ( ( anchorItemPosition > 0 ) && refreshingLanes ) && ( ! restoringLanes ) ) {