summaryrefslogtreecommitdiff
path: root/core/java/android/inputmethodservice/IInputMethodSessionWrapper.java
diff options
context:
space:
mode:
authorTarandeep Singh <tarandeep@google.com>2020-02-03 14:55:30 -0800
committerTaran Singh <tarandeep@google.com>2020-02-26 18:58:33 +0000
commit94c9a8328e4dc9f8942ffc0d02784700ee77880b (patch)
tree2e7d5daf28d3c55cb88f28f5e699ccc74994c499 /core/java/android/inputmethodservice/IInputMethodSessionWrapper.java
parentd506a78e94594be701b2a061cb48b5e2f5cf3908 (diff)
Remove IME surface when hidden
When IME is no longer shown, notify IMS to hide the window surface. This reclaims the memory allocated to IME window surface. Fix: 150163310 Test: atest CtsInputMethodTests Manually: 1. Open any app that has editor and run adb shell dumpsys SurfaceFlinger | grep Total 2. Note down total memory 3. Tap on editor and IME shows. Note down memory using command in #1. It should go up by ~27MB 4. Hide IME and note down memory again. It should revert to original value in #1. Change-Id: I6c2a13dd40b22d3fd62b4763ba369992e5ff1138
Diffstat (limited to 'core/java/android/inputmethodservice/IInputMethodSessionWrapper.java')
-rw-r--r--core/java/android/inputmethodservice/IInputMethodSessionWrapper.java10
1 files changed, 10 insertions, 0 deletions
diff --git a/core/java/android/inputmethodservice/IInputMethodSessionWrapper.java b/core/java/android/inputmethodservice/IInputMethodSessionWrapper.java
index 9327b241c6c5..e9de27456f97 100644
--- a/core/java/android/inputmethodservice/IInputMethodSessionWrapper.java
+++ b/core/java/android/inputmethodservice/IInputMethodSessionWrapper.java
@@ -53,6 +53,7 @@ class IInputMethodSessionWrapper extends IInputMethodSession.Stub
private static final int DO_FINISH_SESSION = 110;
private static final int DO_VIEW_CLICKED = 115;
private static final int DO_NOTIFY_IME_HIDDEN = 120;
+ private static final int DO_REMOVE_IME_SURFACE = 130;
@UnsupportedAppUsage
HandlerCaller mCaller;
@@ -136,6 +137,10 @@ class IInputMethodSessionWrapper extends IInputMethodSession.Stub
mInputMethodSession.notifyImeHidden();
return;
}
+ case DO_REMOVE_IME_SURFACE: {
+ mInputMethodSession.removeImeSurface();
+ return;
+ }
}
Log.w(TAG, "Unhandled message code: " + msg.what);
}
@@ -184,6 +189,11 @@ class IInputMethodSessionWrapper extends IInputMethodSession.Stub
}
@Override
+ public void removeImeSurface() {
+ mCaller.executeOrSendMessage(mCaller.obtainMessage(DO_REMOVE_IME_SURFACE));
+ }
+
+ @Override
public void updateCursor(Rect newCursor) {
mCaller.executeOrSendMessage(
mCaller.obtainMessageO(DO_UPDATE_CURSOR, newCursor));