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

Commit cd0b2fde authored by Treehugger Robot's avatar Treehugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Cache and fetch ViewRootImpl Looper and MessageQueue" into main

parents cf3ce3b9 c047cbf2
Loading
Loading
Loading
Loading
+9 −6
Original line number Diff line number Diff line
@@ -201,6 +201,7 @@ import android.os.Handler;
import android.os.IBinder;
import android.os.Looper;
import android.os.Message;
import android.os.MessageQueue;
import android.os.ParcelFileDescriptor;
import android.os.Process;
import android.os.RemoteException;
@@ -3015,7 +3016,7 @@ public final class ViewRootImpl implements ViewParent,
    void scheduleTraversals() {
        if (!mTraversalScheduled) {
            mTraversalScheduled = true;
            mTraversalBarrier = mHandler.getLooper().getQueue().postSyncBarrier();
            mTraversalBarrier = mQueue.postSyncBarrier();
            mChoreographer.postCallback(
                    Choreographer.CALLBACK_TRAVERSAL, mTraversalRunnable, null);
            notifyRendererOfFramePending();
@@ -3026,7 +3027,7 @@ public final class ViewRootImpl implements ViewParent,
    void unscheduleTraversals() {
        if (mTraversalScheduled) {
            mTraversalScheduled = false;
            mHandler.getLooper().getQueue().removeSyncBarrier(mTraversalBarrier);
            mQueue.removeSyncBarrier(mTraversalBarrier);
            mChoreographer.removeCallbacks(
                    Choreographer.CALLBACK_TRAVERSAL, mTraversalRunnable, null);
        }
@@ -3035,7 +3036,7 @@ public final class ViewRootImpl implements ViewParent,
    void doTraversal() {
        if (mTraversalScheduled) {
            mTraversalScheduled = false;
            mHandler.getLooper().getQueue().removeSyncBarrier(mTraversalBarrier);
            mQueue.removeSyncBarrier(mTraversalBarrier);
            performTraversals();
        }
    }
@@ -7177,6 +7178,8 @@ public final class ViewRootImpl implements ViewParent,
    final Executor mExecutor = (Runnable r) -> {
        mHandler.post(r);
    };
    final Looper mLooper = mHandler.getLooper();
    final MessageQueue mQueue = mLooper.getQueue();
    /**
     * Something in the current window tells us we need to change the touch mode.  For
@@ -11703,7 +11706,7 @@ public final class ViewRootImpl implements ViewParent,
            }
            // If the UI thread is the same as the current thread that is dispatching
            // WindowStateResizeItem, then it can run directly.
            if (isFromResizeItem && viewAncestor.mHandler.getLooper()
            if (isFromResizeItem && viewAncestor.mLooper
                    == ActivityThread.currentActivityThread().getLooper()) {
                viewAncestor.handleResized(layout.frames, reportDraw, layout.mergedConfiguration,
                        layout.insetsState, forceLayout, displayId, layout.syncSeqId,
@@ -11741,7 +11744,7 @@ public final class ViewRootImpl implements ViewParent,
            }
            // If the UI thread is the same as the current thread that is dispatching
            // WindowStateInsetsControlChangeItem, then it can run directly.
            if (isFromInsetsControlChangeItem && viewAncestor.mHandler.getLooper()
            if (isFromInsetsControlChangeItem && viewAncestor.mLooper
                    == ActivityThread.currentActivityThread().getLooper()) {
                viewAncestor.handleInsetsControlChanged(insetsState, activeControls);
                return;
@@ -12408,7 +12411,7 @@ public final class ViewRootImpl implements ViewParent,
        }
        public void runOrPost(View source, int changeType) {
            if (mHandler.getLooper() != Looper.myLooper()) {
            if (mLooper != Looper.myLooper()) {
                CalledFromWrongThreadException e = new CalledFromWrongThreadException("Only the "
                        + "original thread that created a view hierarchy can touch its views.");
                // TODO: Throw the exception