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

Commit 60eb2b73 authored by mingwax's avatar mingwax Committed by Linux Build Service Account
Browse files

DocumentsUI: Fix monkey crash

RootCause: In RecyclerView source code,
The start method which is called by
smoothScrollToPosition method check whether
mTargetPosition value equal -1 or not, if equal
throw IllegalArgumentException, in stop method
mTargetPosition is assigned to -1. Under normal
circumestances, smoothScrollToPosition methed should
call setTargetPosition method, mTargetPosition is
assigned to normal value, but when the setTargetPosition
method is called after stop method, mTargetPosition is
assigned to -1. In monkey test, start the smoothScroll
and stop the smoothScroll faster could cause this issue.
The general operation of people will not be the case.

Solution: Use try/catch IllegalArgumentException to
avoid this case.

CRs-Fixed: 1055242
Change-Id: I9a2300240670bebe5d4b47570e62f31674fe26b8
parent 76cafe6c
Loading
Loading
Loading
Loading
+5 −1
Original line number Diff line number Diff line
@@ -307,7 +307,11 @@ class FocusManager implements View.OnFocusChangeListener {
                            }
                        }
                    });
            try {
                mView.smoothScrollToPosition(pos);
            } catch(IllegalArgumentException e) {
                Log.w(TAG, "Invalid target position :" + pos, e);
            }
        }
    }