summaryrefslogtreecommitdiff
path: root/core/java/android/inputmethodservice/InputMethodService.java
diff options
context:
space:
mode:
authorShan Huang <shanh@google.com>2022-05-10 16:09:13 +0000
committerShan Huang <shanh@google.com>2022-05-12 14:19:05 +0000
commitc16b5740556d39e9cb2323ffdc164475bd757883 (patch)
tree7e49736e8243a8e5594924da089c6bd978eb6bb4 /core/java/android/inputmethodservice/InputMethodService.java
parent89c3325804e2cb0e8c590cfac417d4678cf704eb (diff)
Fix IME callback not being re-registered on screen off / on.
Bug:231917948 Bug:229355440 Test: atest InputMethodServiceLifecycleTest Test: atest CtsInputMethodTestCases:InputMethodServiceTest Test atest CtsInputMethodTestCases:KeyboardVisibilityControlTest Change-Id: I8dc1425aa9338b37128d308bf58fd15c39d04a88
Diffstat (limited to 'core/java/android/inputmethodservice/InputMethodService.java')
-rw-r--r--core/java/android/inputmethodservice/InputMethodService.java6
1 files changed, 5 insertions, 1 deletions
diff --git a/core/java/android/inputmethodservice/InputMethodService.java b/core/java/android/inputmethodservice/InputMethodService.java
index 25296bc0a8b9..200fe22edaad 100644
--- a/core/java/android/inputmethodservice/InputMethodService.java
+++ b/core/java/android/inputmethodservice/InputMethodService.java
@@ -1625,7 +1625,6 @@ public class InputMethodService extends AbstractInputMethodService {
// when IME developers are doing something unsupported.
InputMethodPrivilegedOperationsRegistry.remove(mToken);
}
- unregisterCompatOnBackInvokedCallback();
mImeDispatcher = null;
}
@@ -2788,6 +2787,11 @@ public class InputMethodService extends AbstractInputMethodService {
if (mInkWindow != null) {
finishStylusHandwriting();
}
+ // Back callback is typically unregistered in {@link #hideWindow()}, but it's possible
+ // for {@link #doFinishInput()} to be called without {@link #hideWindow()} so we also
+ // unregister here.
+ // TODO(b/232341407): Add CTS to verify back behavior after screen on / off.
+ unregisterCompatOnBackInvokedCallback();
}
void doStartInput(InputConnection ic, EditorInfo attribute, boolean restarting) {