Skip to content

Commit 14124c6

Browse files
satok16Android (Google) Code Review
authored andcommitted
Merge "Fix the issue that the insets linger after closing the voice input" into jb-dev
2 parents 956f9bd + e0a9941 commit 14124c6

File tree

2 files changed

+13
-3
lines changed

2 files changed

+13
-3
lines changed

services/java/com/android/server/InputMethodManagerService.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1142,6 +1142,10 @@ void unbindCurrentMethodLocked(boolean reportToClient) {
11421142
if (mCurToken != null) {
11431143
try {
11441144
if (DEBUG) Slog.v(TAG, "Removing window token: " + mCurToken);
1145+
if ((mImeWindowVis & InputMethodService.IME_ACTIVE) != 0) {
1146+
// The current IME is shown. Hence an IME switch (transition) is happening.
1147+
mWindowManagerService.saveLastInputMethodWindowForTransition();
1148+
}
11451149
mIWindowManager.removeWindowToken(mCurToken);
11461150
} catch (RemoteException e) {
11471151
}

services/java/com/android/server/wm/WindowManagerService.java

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3430,9 +3430,6 @@ public void removeWindowToken(IBinder token) {
34303430
synchronized(mWindowMap) {
34313431
WindowToken wtoken = mTokenMap.remove(token);
34323432
if (wtoken != null) {
3433-
if (wtoken.windowType == TYPE_INPUT_METHOD && mInputMethodWindow != null) {
3434-
mPolicy.setLastInputMethodWindowLw(mInputMethodWindow, mInputMethodTarget);
3435-
}
34363433
boolean delayed = false;
34373434
if (!wtoken.hidden) {
34383435
wtoken.hidden = true;
@@ -9269,6 +9266,15 @@ boolean removeFakeWindowLocked(FakeWindow window) {
92699266
}
92709267
}
92719268

9269+
// It is assumed that this method is called only by InputMethodManagerService.
9270+
public void saveLastInputMethodWindowForTransition() {
9271+
synchronized (mWindowMap) {
9272+
if (mInputMethodWindow != null) {
9273+
mPolicy.setLastInputMethodWindowLw(mInputMethodWindow, mInputMethodTarget);
9274+
}
9275+
}
9276+
}
9277+
92729278
@Override
92739279
public boolean hasNavigationBar() {
92749280
return mPolicy.hasNavigationBar();

0 commit comments

Comments
 (0)