Merge "Simplify the consume before traversal heuristic." into jb-dev
This commit is contained in:
@@ -947,6 +947,7 @@ public final class ViewRootImpl implements ViewParent,
|
|||||||
mTraversalBarrier = mHandler.getLooper().postSyncBarrier();
|
mTraversalBarrier = mHandler.getLooper().postSyncBarrier();
|
||||||
mChoreographer.postCallback(
|
mChoreographer.postCallback(
|
||||||
Choreographer.CALLBACK_TRAVERSAL, mTraversalRunnable, null);
|
Choreographer.CALLBACK_TRAVERSAL, mTraversalRunnable, null);
|
||||||
|
scheduleConsumeBatchedInput();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -964,9 +965,6 @@ public final class ViewRootImpl implements ViewParent,
|
|||||||
mTraversalScheduled = false;
|
mTraversalScheduled = false;
|
||||||
mHandler.getLooper().removeSyncBarrier(mTraversalBarrier);
|
mHandler.getLooper().removeSyncBarrier(mTraversalBarrier);
|
||||||
|
|
||||||
doConsumeBatchedInput(false);
|
|
||||||
doProcessInputEvents();
|
|
||||||
|
|
||||||
if (mProfile) {
|
if (mProfile) {
|
||||||
Debug.startMethodTracing("ViewAncestor");
|
Debug.startMethodTracing("ViewAncestor");
|
||||||
}
|
}
|
||||||
@@ -4206,20 +4204,13 @@ public final class ViewRootImpl implements ViewParent,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void doConsumeBatchedInput(boolean callback) {
|
void doConsumeBatchedInput() {
|
||||||
if (mConsumeBatchedInputScheduled) {
|
if (mConsumeBatchedInputScheduled) {
|
||||||
mConsumeBatchedInputScheduled = false;
|
mConsumeBatchedInputScheduled = false;
|
||||||
if (!callback) {
|
if (mInputEventReceiver != null) {
|
||||||
mChoreographer.removeCallbacks(Choreographer.CALLBACK_INPUT,
|
mInputEventReceiver.consumeBatchedInputEvents();
|
||||||
mConsumedBatchedInputRunnable, null);
|
|
||||||
}
|
}
|
||||||
}
|
doProcessInputEvents();
|
||||||
|
|
||||||
// Always consume batched input events even if not scheduled, because there
|
|
||||||
// might be new input there waiting for us that we have no noticed yet because
|
|
||||||
// the Looper has not had a chance to run again.
|
|
||||||
if (mInputEventReceiver != null) {
|
|
||||||
mInputEventReceiver.consumeBatchedInputEvents();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -4257,8 +4248,7 @@ public final class ViewRootImpl implements ViewParent,
|
|||||||
final class ConsumeBatchedInputRunnable implements Runnable {
|
final class ConsumeBatchedInputRunnable implements Runnable {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
doConsumeBatchedInput(true);
|
doConsumeBatchedInput();
|
||||||
doProcessInputEvents();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
final ConsumeBatchedInputRunnable mConsumedBatchedInputRunnable =
|
final ConsumeBatchedInputRunnable mConsumedBatchedInputRunnable =
|
||||||
|
|||||||
Reference in New Issue
Block a user