Skip to content
Commit 1e72ef28 authored by Lan Wei's avatar Lan Wei
Browse files

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
parent 64cd208b
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment