am dbadee96: Do not create a handler thread for each session

* commit 'dbadee96b6bc385b18377bd8b943e79097853849':
  Do not create a handler thread for each session
main
Jean Chalard 2014-03-31 06:51:54 +00:00 committed by Android Git Automerger
commit e2537ed58c
2 changed files with 9 additions and 7 deletions

View File

@ -130,8 +130,11 @@ public final class InputLogic {
// so we try using some heuristics to find out about these and fix them.
mConnection.tryFixLyingCursorPosition();
cancelDoubleSpacePeriodCountdown();
mInputLogicHandler.destroy();
mInputLogicHandler = new InputLogicHandler(mLatinIME, this);
if (InputLogicHandler.NULL_HANDLER == mInputLogicHandler) {
mInputLogicHandler = new InputLogicHandler(mLatinIME, this);
} else {
mInputLogicHandler.reset();
}
}
/**
@ -142,8 +145,7 @@ public final class InputLogic {
mConnection.finishComposingText();
}
resetComposingState(true /* alsoResetLastComposedWord */);
mInputLogicHandler.destroy();
mInputLogicHandler = InputLogicHandler.NULL_HANDLER;
mInputLogicHandler.reset();
}
/**

View File

@ -43,7 +43,7 @@ class InputLogicHandler implements Handler.Callback {
// is initialized, though probably only the monkey can actually do this.
public static final InputLogicHandler NULL_HANDLER = new InputLogicHandler() {
@Override
public void destroy() {}
public void reset() {}
@Override
public boolean handleMessage(final Message msg) { return true; }
@Override
@ -75,8 +75,8 @@ class InputLogicHandler implements Handler.Callback {
mInputLogic = inputLogic;
}
public void destroy() {
mNonUIThreadHandler.getLooper().quit();
public void reset() {
mNonUIThreadHandler.removeCallbacksAndMessages(null);
}
/**