Fix a warning from the binder, step 3.
This patch fixes the following warning:
W/Binder: The following Binder class should be static or
leaks might occur: com.android.server
.InputMethodManagerService.MethodCallback
...in hope of removing a possible memory leaks.
Bugs: 5481376, 5461066
Change-Id: I1764090a7059d9bf9e5d90683d7ac190c83415de
diff --git a/services/java/com/android/server/InputMethodManagerService.java b/services/java/com/android/server/InputMethodManagerService.java
index 6ddbf5a..03d6b41 100644
--- a/services/java/com/android/server/InputMethodManagerService.java
+++ b/services/java/com/android/server/InputMethodManagerService.java
@@ -493,11 +493,13 @@
}
}
- class MethodCallback extends IInputMethodCallback.Stub {
- final IInputMethod mMethod;
+ private static class MethodCallback extends IInputMethodCallback.Stub {
+ private final IInputMethod mMethod;
+ private final InputMethodManagerService mParentIMMS;
- MethodCallback(IInputMethod method) {
+ MethodCallback(final IInputMethod method, final InputMethodManagerService imms) {
mMethod = method;
+ mParentIMMS = imms;
}
@Override
@@ -506,7 +508,7 @@
@Override
public void sessionCreated(IInputMethodSession session) throws RemoteException {
- onSessionCreated(mMethod, session);
+ mParentIMMS.onSessionCreated(mMethod, session);
}
}
@@ -837,7 +839,7 @@
if (DEBUG) Slog.v(TAG, "Creating new session for client " + cs);
executeOrSendMessage(mCurMethod, mCaller.obtainMessageOO(
MSG_CREATE_SESSION, mCurMethod,
- new MethodCallback(mCurMethod)));
+ new MethodCallback(mCurMethod, this)));
}
// Return to client, and we will get back with it when
// we have had a session made for it.
@@ -943,7 +945,7 @@
+ mCurClient);
executeOrSendMessage(mCurMethod, mCaller.obtainMessageOO(
MSG_CREATE_SESSION, mCurMethod,
- new MethodCallback(mCurMethod)));
+ new MethodCallback(mCurMethod, this)));
}
}
}