Skip to content

Commit f17db9f

Browse files
committed
Call onFinishInputView in onDestroy
onFinishInputView is called in InputMethodService#hideWindow but not in onDestroy. For closing IMS safely, onFinishInputView should be called in onDestroy. Bug: 5265534 Bug: 4697071 Change-Id: I2947b62326e3e0644f1c079eafc839a9981e902b
1 parent aab55bf commit f17db9f

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

core/java/android/inputmethodservice/InputMethodService.java

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -687,6 +687,7 @@ void initViews() {
687687
super.onDestroy();
688688
mRootView.getViewTreeObserver().removeOnComputeInternalInsetsListener(
689689
mInsetsComputer);
690+
finishViews();
690691
if (mWindowAdded) {
691692
// Disable exit animation for the current IME window
692693
// to avoid the race condition between the exit and enter animations
@@ -695,7 +696,7 @@ void initViews() {
695696
mWindow.dismiss();
696697
}
697698
}
698-
699+
699700
/**
700701
* Take care of handling configuration changes. Subclasses of
701702
* InputMethodService generally don't need to deal directly with
@@ -1436,7 +1437,7 @@ void showWindowInner(boolean showInput) {
14361437
}
14371438
}
14381439

1439-
public void hideWindow() {
1440+
private void finishViews() {
14401441
if (mInputViewStarted) {
14411442
if (DEBUG) Log.v(TAG, "CALL: onFinishInputView");
14421443
onFinishInputView(false);
@@ -1446,6 +1447,10 @@ public void hideWindow() {
14461447
}
14471448
mInputViewStarted = false;
14481449
mCandidatesViewStarted = false;
1450+
}
1451+
1452+
public void hideWindow() {
1453+
finishViews();
14491454
mImm.setImeWindowStatus(mToken, 0, mBackDisposition);
14501455
if (mWindowVisible) {
14511456
mWindow.hide();

0 commit comments

Comments
 (0)