diff options
author | 2013-12-25 18:24:48 +0900 | |
---|---|---|
committer | 2013-12-27 16:50:06 +0900 | |
commit | 71a3e96382a0564e32b6679e23f82f2413031310 (patch) | |
tree | d3a014f9e6564f3f5f0466250796d936d41d8e61 /java/src | |
parent | 31ff2a4335d6cea0a5ebc11268833ceb99a4fa72 (diff) | |
download | latinime-71a3e96382a0564e32b6679e23f82f2413031310.tar.gz latinime-71a3e96382a0564e32b6679e23f82f2413031310.tar.xz latinime-71a3e96382a0564e32b6679e23f82f2413031310.zip |
[IL46] Remove a useless message passing.
The only point of this message is to send the processing on another
thread. However, this will be accomplished later.
Here is the exact call graph:
0. onUpdateBatchInput
1. -> MSG_UPDATE_GESTURE_PREVIEW_AND_SUGGESTION_STRIP
2. -> updateBatchInputSync
3. -> getSuggestedWordsGestureLocked
4. -> MSG_GET_SUGGESTED_WORDS
5. -> LatinIME#getSuggestedWords
The point of both step 1. and step 4. is to make sure the processing
is happening on the InputUpdater thread. Thus, it's useless to do
it twice.
Bug: 11326092
Bug: 8636060
Change-Id: Iceebb9e8879a8f15b73c987f5fd3489f27699be4
Diffstat (limited to 'java/src')
-rw-r--r-- | java/src/com/android/inputmethod/latin/LatinIME.java | 22 |
1 files changed, 2 insertions, 20 deletions
diff --git a/java/src/com/android/inputmethod/latin/LatinIME.java b/java/src/com/android/inputmethod/latin/LatinIME.java index 4679a93b7..d2d44cce6 100644 --- a/java/src/com/android/inputmethod/latin/LatinIME.java +++ b/java/src/com/android/inputmethod/latin/LatinIME.java @@ -1295,19 +1295,12 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen mLatinIme = latinIme; } - private static final int MSG_UPDATE_GESTURE_PREVIEW_AND_SUGGESTION_STRIP = 1; - private static final int MSG_GET_SUGGESTED_WORDS = 2; + private static final int MSG_GET_SUGGESTED_WORDS = 1; // Called on the InputUpdater thread by the Handler code. @Override public boolean handleMessage(final Message msg) { - // TODO: straighten message passing - we don't need two kinds of messages calling - // each other. switch (msg.what) { - case MSG_UPDATE_GESTURE_PREVIEW_AND_SUGGESTION_STRIP: - updateBatchInput((InputPointers)msg.obj, msg.arg2 /* sequenceNumber */, - false /* forEnd */); - break; case MSG_GET_SUGGESTED_WORDS: mLatinIme.getSuggestedWords(msg.arg1 /* sessionId */, msg.arg2 /* sequenceNumber */, (OnGetSuggestedWordsCallback) msg.obj); @@ -1319,7 +1312,6 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen // Called on the UI thread by LatinIME. public void onStartBatchInput() { synchronized (mLock) { - mHandler.removeMessages(MSG_UPDATE_GESTURE_PREVIEW_AND_SUGGESTION_STRIP); mInBatchInput = true; } } @@ -1338,7 +1330,6 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen private void updateBatchInput(final InputPointers batchPointers, final int sequenceNumber, final boolean forEnd) { synchronized (mLock) { - mHandler.removeMessages(MSG_UPDATE_GESTURE_PREVIEW_AND_SUGGESTION_STRIP); if (!mInBatchInput) { // Batch input has ended or canceled while the message was being delivered. return; @@ -1375,14 +1366,7 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen // Called on the UI thread by LatinIME. public void onUpdateBatchInput(final InputPointers batchPointers, final int sequenceNumber) { - synchronized (mLock) { - if (mHandler.hasMessages(MSG_UPDATE_GESTURE_PREVIEW_AND_SUGGESTION_STRIP)) { - return; - } - mHandler.obtainMessage(MSG_UPDATE_GESTURE_PREVIEW_AND_SUGGESTION_STRIP, - 0 /* arg1 */,sequenceNumber /* arg2 */, - batchPointers /* obj */).sendToTarget(); - } + updateBatchInput(batchPointers, sequenceNumber, false /* forEnd */); } /** @@ -1395,7 +1379,6 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen // Called on the UI thread by LatinIME. public void onCancelBatchInput() { synchronized (mLock) { - mHandler.removeMessages(MSG_UPDATE_GESTURE_PREVIEW_AND_SUGGESTION_STRIP); mInBatchInput = false; } } @@ -1443,7 +1426,6 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen void quitLooper() { mHandler.removeMessages(MSG_GET_SUGGESTED_WORDS); - mHandler.removeMessages(MSG_UPDATE_GESTURE_PREVIEW_AND_SUGGESTION_STRIP); mHandler.getLooper().quit(); } } |