Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit de9dbb05 authored by Jean Chalard's avatar Jean Chalard
Browse files

Fix a warning from the binder, step 2.

This patch fixes the following warning:
W/Binder: The following Binder class should be static or
  leaks might occur: android.view.inputmethod
  .InputMethodManager.ControlledInputConnectionWrapper

...in hope of removing a possible memory leaks.

Change-Id: I081d10fd839f2985d7081492f4f5cf0b4da42fd2
Bugs: 5481376, 5461066
parent 149a1493
Loading
Loading
Loading
Loading
+9 −5
Original line number Diff line number Diff line
@@ -384,14 +384,18 @@ public final class InputMethodManager {
        }
    }
    
    class ControlledInputConnectionWrapper extends IInputConnectionWrapper {
        public ControlledInputConnectionWrapper(Looper mainLooper, InputConnection conn) {
    private static class ControlledInputConnectionWrapper extends IInputConnectionWrapper {
        private final InputMethodManager mParentInputMethodManager;

        public ControlledInputConnectionWrapper(final Looper mainLooper, final InputConnection conn,
                final InputMethodManager inputMethodManager) {
            super(mainLooper, conn);
            mParentInputMethodManager = inputMethodManager;
        }

        @Override
        public boolean isActive() {
            return mActive;
            return mParentInputMethodManager.mActive;
        }
    }
    
@@ -439,7 +443,7 @@ public final class InputMethodManager {
        mMainLooper = looper;
        mH = new H(looper);
        mIInputContext = new ControlledInputConnectionWrapper(looper,
                mDummyInputConnection);
                mDummyInputConnection, this);
        
        if (mInstance == null) {
            mInstance = this;
@@ -1016,7 +1020,7 @@ public final class InputMethodManager {
                mCursorCandStart = -1;
                mCursorCandEnd = -1;
                mCursorRect.setEmpty();
                servedContext = new ControlledInputConnectionWrapper(vh.getLooper(), ic);
                servedContext = new ControlledInputConnectionWrapper(vh.getLooper(), ic, this);
            } else {
                servedContext = null;
            }