Avoid bad InputConnection call crashing the app
Update InputConnection#getTextBeforeCursor(int, int) and
InputConnection#getTextAfterCursor(int, int) API to
specify that the paramter {@code n} must be non-negative.
If the IME using the API incorrectly, throw
IllegalArgumentException.
Also update these two APIs that return nullable result (no
behaivor change). For editor App, return null for bad case.
Test: atest BaseInputConnectionTest#testInvalidGetTextBeforeOrAfterCursorRequest
Test: atest InputConnectionWrapperTest#testInvalidGetTextBeforeOrAfterCursorRequest
BUG: 169114026
Change-Id: I95169735198f8363c981a61e20234dfebfd645b1
6 files changed