Merge "Small optimization to eliminate a >0 check in RichInputConnection." into jb-ub-latinimegoogle
commit
c32389ce11
|
@ -132,7 +132,7 @@ public final class RichInputConnection implements PrivateCommandPerformer {
|
||||||
/**
|
/**
|
||||||
* The timestamp of the last slow InputConnection operation
|
* The timestamp of the last slow InputConnection operation
|
||||||
*/
|
*/
|
||||||
private long mLastSlowInputConnectionTime = 0;
|
private long mLastSlowInputConnectionTime = -SLOW_INPUTCONNECTION_PERSIST_MS;
|
||||||
|
|
||||||
public RichInputConnection(final InputMethodService parent) {
|
public RichInputConnection(final InputMethodService parent) {
|
||||||
mParent = parent;
|
mParent = parent;
|
||||||
|
@ -149,13 +149,12 @@ public final class RichInputConnection implements PrivateCommandPerformer {
|
||||||
* calling InputConnection methods that trigger an IPC round-trip (e.g., getTextAfterCursor).
|
* calling InputConnection methods that trigger an IPC round-trip (e.g., getTextAfterCursor).
|
||||||
*/
|
*/
|
||||||
public boolean hasSlowInputConnection() {
|
public boolean hasSlowInputConnection() {
|
||||||
return mLastSlowInputConnectionTime > 0 &&
|
return (SystemClock.uptimeMillis() - mLastSlowInputConnectionTime)
|
||||||
(SystemClock.uptimeMillis() - mLastSlowInputConnectionTime)
|
|
||||||
<= SLOW_INPUTCONNECTION_PERSIST_MS;
|
<= SLOW_INPUTCONNECTION_PERSIST_MS;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void onStartInput() {
|
public void onStartInput() {
|
||||||
mLastSlowInputConnectionTime = 0;
|
mLastSlowInputConnectionTime = -SLOW_INPUTCONNECTION_PERSIST_MS;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void checkConsistencyForDebug() {
|
private void checkConsistencyForDebug() {
|
||||||
|
|
Loading…
Reference in New Issue