Fix showSoftInput crashing when no IME is enabled
This CL adds a shortcut for bindCurrentMethod in InputMethodBindingController to return NO_IME instead of crashing in the rare case when no IME is enabled in the system. Bug: 220125769 Test: atest InputMethodServiceTest#testShowSoftInput_whenAllImesDisabled Change-Id: I7da6ed7f2b80331c469751b7091c340422df40a8
This commit is contained in:
@@ -408,6 +408,11 @@ final class InputMethodBindingController {
|
|||||||
@GuardedBy("ImfLock.class")
|
@GuardedBy("ImfLock.class")
|
||||||
@NonNull
|
@NonNull
|
||||||
InputBindResult bindCurrentMethod() {
|
InputBindResult bindCurrentMethod() {
|
||||||
|
if (mSelectedMethodId == null) {
|
||||||
|
Slog.e(TAG, "mSelectedMethodId is null!");
|
||||||
|
return InputBindResult.NO_IME;
|
||||||
|
}
|
||||||
|
|
||||||
InputMethodInfo info = mMethodMap.get(mSelectedMethodId);
|
InputMethodInfo info = mMethodMap.get(mSelectedMethodId);
|
||||||
if (info == null) {
|
if (info == null) {
|
||||||
throw new IllegalArgumentException("Unknown id: " + mSelectedMethodId);
|
throw new IllegalArgumentException("Unknown id: " + mSelectedMethodId);
|
||||||
|
|||||||
Reference in New Issue
Block a user