Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit be9a68c9 authored by Jeff Brown's avatar Jeff Brown Committed by Android Git Automerger
Browse files

am f613da0e: Merge "Simplify the consume before traversal heuristic." into jb-dev

* commit 'f613da0e':
  Simplify the consume before traversal heuristic.
parents 162b31b6 f613da0e
Loading
Loading
Loading
Loading
+6 −16
Original line number Diff line number Diff line
@@ -947,6 +947,7 @@ public final class ViewRootImpl implements ViewParent,
            mTraversalBarrier = mHandler.getLooper().postSyncBarrier();
            mChoreographer.postCallback(
                    Choreographer.CALLBACK_TRAVERSAL, mTraversalRunnable, null);
            scheduleConsumeBatchedInput();
        }
    }

@@ -964,9 +965,6 @@ public final class ViewRootImpl implements ViewParent,
            mTraversalScheduled = false;
            mHandler.getLooper().removeSyncBarrier(mTraversalBarrier);

            doConsumeBatchedInput(false);
            doProcessInputEvents();

            if (mProfile) {
                Debug.startMethodTracing("ViewAncestor");
            }
@@ -4206,21 +4204,14 @@ public final class ViewRootImpl implements ViewParent,
        }
    }

    void doConsumeBatchedInput(boolean callback) {
    void doConsumeBatchedInput() {
        if (mConsumeBatchedInputScheduled) {
            mConsumeBatchedInputScheduled = false;
            if (!callback) {
                mChoreographer.removeCallbacks(Choreographer.CALLBACK_INPUT,
                        mConsumedBatchedInputRunnable, null);
            }
        }

        // 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();
            }
            doProcessInputEvents();
        }
    }

    final class TraversalRunnable implements Runnable {
@@ -4257,8 +4248,7 @@ public final class ViewRootImpl implements ViewParent,
    final class ConsumeBatchedInputRunnable implements Runnable {
        @Override
        public void run() {
            doConsumeBatchedInput(true);
            doProcessInputEvents();
            doConsumeBatchedInput();
        }
    }
    final ConsumeBatchedInputRunnable mConsumedBatchedInputRunnable =