[IL45] Remove lingering messages

Bug: 8636060
And possibly bug: 12085864

Change-Id: I867036bc3d8bd255dc8ceebdd30e28b4b3dc4b2d
main
Jean Chalard 2013-12-25 17:07:35 +09:00
parent 69e7a0d24d
commit 31ff2a4335
1 changed files with 9 additions and 4 deletions

View File

@ -1338,6 +1338,7 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
private void updateBatchInput(final InputPointers batchPointers, private void updateBatchInput(final InputPointers batchPointers,
final int sequenceNumber, final boolean forEnd) { final int sequenceNumber, final boolean forEnd) {
synchronized (mLock) { synchronized (mLock) {
mHandler.removeMessages(MSG_UPDATE_GESTURE_PREVIEW_AND_SUGGESTION_STRIP);
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;
@ -1374,11 +1375,14 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
// Called on the UI thread by LatinIME. // Called on the UI thread by LatinIME.
public void onUpdateBatchInput(final InputPointers batchPointers, public void onUpdateBatchInput(final InputPointers batchPointers,
final int sequenceNumber) { final int sequenceNumber) {
if (mHandler.hasMessages(MSG_UPDATE_GESTURE_PREVIEW_AND_SUGGESTION_STRIP)) { synchronized (mLock) {
return; 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();
} }
mHandler.obtainMessage(MSG_UPDATE_GESTURE_PREVIEW_AND_SUGGESTION_STRIP, 0 /* arg1 */,
sequenceNumber /* arg2 */, batchPointers /* obj */).sendToTarget();
} }
/** /**
@ -1391,6 +1395,7 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
// Called on the UI thread by LatinIME. // Called on the UI thread by LatinIME.
public void onCancelBatchInput() { public void onCancelBatchInput() {
synchronized (mLock) { synchronized (mLock) {
mHandler.removeMessages(MSG_UPDATE_GESTURE_PREVIEW_AND_SUGGESTION_STRIP);
mInBatchInput = false; mInBatchInput = false;
} }
} }