Merge "[IL46] Remove a useless message passing."
This commit is contained in:
commit
51e79fb4b2
1 changed files with 2 additions and 20 deletions
|
@ -1302,19 +1302,12 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
|
||||||
mLatinIme = latinIme;
|
mLatinIme = latinIme;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static final int MSG_UPDATE_GESTURE_PREVIEW_AND_SUGGESTION_STRIP = 1;
|
private static final int MSG_GET_SUGGESTED_WORDS = 1;
|
||||||
private static final int MSG_GET_SUGGESTED_WORDS = 2;
|
|
||||||
|
|
||||||
// Called on the InputUpdater thread by the Handler code.
|
// Called on the InputUpdater thread by the Handler code.
|
||||||
@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:
|
|
||||||
updateBatchInput((InputPointers)msg.obj, msg.arg2 /* sequenceNumber */,
|
|
||||||
false /* forEnd */);
|
|
||||||
break;
|
|
||||||
case MSG_GET_SUGGESTED_WORDS:
|
case MSG_GET_SUGGESTED_WORDS:
|
||||||
mLatinIme.getSuggestedWords(msg.arg1 /* sessionId */,
|
mLatinIme.getSuggestedWords(msg.arg1 /* sessionId */,
|
||||||
msg.arg2 /* sequenceNumber */, (OnGetSuggestedWordsCallback) msg.obj);
|
msg.arg2 /* sequenceNumber */, (OnGetSuggestedWordsCallback) msg.obj);
|
||||||
|
@ -1326,7 +1319,6 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
|
||||||
// Called on the UI thread by LatinIME.
|
// Called on the UI thread by LatinIME.
|
||||||
public void onStartBatchInput() {
|
public void onStartBatchInput() {
|
||||||
synchronized (mLock) {
|
synchronized (mLock) {
|
||||||
mHandler.removeMessages(MSG_UPDATE_GESTURE_PREVIEW_AND_SUGGESTION_STRIP);
|
|
||||||
mInBatchInput = true;
|
mInBatchInput = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1345,7 +1337,6 @@ 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;
|
||||||
|
@ -1382,14 +1373,7 @@ 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) {
|
||||||
synchronized (mLock) {
|
updateBatchInput(batchPointers, sequenceNumber, false /* forEnd */);
|
||||||
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();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1402,7 +1386,6 @@ 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;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1450,7 +1433,6 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
|
||||||
|
|
||||||
void quitLooper() {
|
void quitLooper() {
|
||||||
mHandler.removeMessages(MSG_GET_SUGGESTED_WORDS);
|
mHandler.removeMessages(MSG_GET_SUGGESTED_WORDS);
|
||||||
mHandler.removeMessages(MSG_UPDATE_GESTURE_PREVIEW_AND_SUGGESTION_STRIP);
|
|
||||||
mHandler.getLooper().quit();
|
mHandler.getLooper().quit();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue