summaryrefslogtreecommitdiffstats
path: root/services
diff options
context:
space:
mode:
authorDevin Taylor <devin.taylor@garmin.com>2010-02-23 13:26:46 -0600
committerGarmin Android technology group <android@garmin.com>2010-02-24 09:17:04 -0600
commit0c33ed2992b2eb484c229fd3322df14d97c10caa (patch)
tree6090e0c936ab4441c3306ed29bb42ec380684642 /services
parent27f3de6bac93140452ce131cbbd8c6df33e25a94 (diff)
downloadframeworks_base-0c33ed2992b2eb484c229fd3322df14d97c10caa.zip
frameworks_base-0c33ed2992b2eb484c229fd3322df14d97c10caa.tar.gz
frameworks_base-0c33ed2992b2eb484c229fd3322df14d97c10caa.tar.bz2
Fix Memory Leak When Switching Input Methods
Fixes a memory leak when input methods are switched. Uses a variety of methods to avoid holding a reference to the InputMethodService which created the binders, which was leaking those InputMethodServices. See http://code.google.com/p/android/issues/detail?id=6661 for reproduction steps.
Diffstat (limited to 'services')
-rw-r--r--services/java/com/android/server/InputMethodManagerService.java14
1 files changed, 14 insertions, 0 deletions
diff --git a/services/java/com/android/server/InputMethodManagerService.java b/services/java/com/android/server/InputMethodManagerService.java
index e2e0ba9..afcba47 100644
--- a/services/java/com/android/server/InputMethodManagerService.java
+++ b/services/java/com/android/server/InputMethodManagerService.java
@@ -855,12 +855,26 @@ public class InputMethodManagerService extends IInputMethodManager.Stub
}
}
+ private void finishSession(SessionState sessionState) {
+ if (sessionState != null && sessionState.session != null) {
+ try {
+ sessionState.session.finishSession();
+ } catch (RemoteException e) {
+ Log.w(TAG, "Session failed to close due to remote exception", e);
+ }
+ }
+ }
+
void clearCurMethodLocked() {
if (mCurMethod != null) {
for (ClientState cs : mClients.values()) {
cs.sessionRequested = false;
+ finishSession(cs.curSession);
cs.curSession = null;
}
+
+ finishSession(mEnabledSession);
+ mEnabledSession = null;
mCurMethod = null;
}
mStatusBar.setIconVisibility(mInputMethodIcon, false);