Fix app crash if the selection is from reverse direction.
When user types some text and then long presses on end of empty area to open context menu, if user opens Gboard and selects text from the reverse direction, SelectionEnd will be less than SelectionStart. The IllegalArgumentException occurred because TextClassification does not allow SelectionEnd is less than SelectionStart. We swap the start and end index if end index is less than start index. Bug: 150916165 Bug: 157452302 Test: Manual. No crash occurs. Test: atest FrameworksCoreTests:android.widget.TextViewActivityTest (cherry picked from commit cb3c97db) Merged-In: I8dbc92f0f31e64b7e3a45ae91762e1b741629a8e Change-Id: Ie0e2b5840e147f98174cae4521eb777e1a080706
Loading
Please register or sign in to comment