am d869e1fd: am f603fa1f: Merge "[DO NOT MERGE] Add a sequence number to SuggestedWords." into klp-dev

* commit 'd869e1fdbbf753f0c944a85e27fd8e260e0562b5':
  [DO NOT MERGE] Add a sequence number to SuggestedWords.
This commit is contained in:
Jean Chalard 2013-10-21 23:39:41 -07:00 committed by Android Git Automerger
commit 74f2e69b94
3 changed files with 100 additions and 57 deletions

View File

@ -1835,12 +1835,15 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
@Override @Override
public boolean handleMessage(final Message msg) { public boolean handleMessage(final Message msg) {
// TODO: straighten message passing - we don't need two kinds of messages calling
// each other.
switch (msg.what) { switch (msg.what) {
case MSG_UPDATE_GESTURE_PREVIEW_AND_SUGGESTION_STRIP: case MSG_UPDATE_GESTURE_PREVIEW_AND_SUGGESTION_STRIP:
updateBatchInput((InputPointers)msg.obj); updateBatchInput((InputPointers)msg.obj, msg.arg2 /* sequenceNumber */);
break; break;
case MSG_GET_SUGGESTED_WORDS: case MSG_GET_SUGGESTED_WORDS:
mLatinIme.getSuggestedWords(msg.arg1, (OnGetSuggestedWordsCallback) msg.obj); mLatinIme.getSuggestedWords(msg.arg1 /* sessionId */,
msg.arg2 /* sequenceNumber */, (OnGetSuggestedWordsCallback) msg.obj);
break; break;
} }
return true; return true;
@ -1857,14 +1860,15 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
} }
// Run in the Handler thread. // Run in the Handler thread.
private void updateBatchInput(final InputPointers batchPointers) { private void updateBatchInput(final InputPointers batchPointers, final int sequenceNumber) {
synchronized (mLock) { synchronized (mLock) {
if (!mInBatchInput) { if (!mInBatchInput) {
// Batch input has ended or canceled while the message was being delivered. // Batch input has ended or canceled while the message was being delivered.
return; return;