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

Commit 75c5501f authored by Jorim Jaggi's avatar Jorim Jaggi
Browse files

Add ability to post a message at the front of the queue

Used for remote animations to minimize latency.

Test: Boots
Bug: 64674361
Change-Id: Id07295a852edf4fbc308a4e4616077275f35f0f7
parent 2776b068
Loading
Loading
Loading
Loading
+10 −0
Original line number Diff line number Diff line
@@ -28,6 +28,8 @@ import android.graphics.Color;
import android.graphics.Rect;
import android.graphics.RectF;
import android.graphics.drawable.Drawable;
import android.os.Handler;
import android.os.Message;
import android.os.Trace;
import android.util.ArraySet;
import android.util.IntProperty;
@@ -314,4 +316,12 @@ public class Utilities {
        }
        return r.left + "," + r.top + "-" + r.right + "," + r.bottom;
    }

    /**
     * Posts a runnable on a handler at the front of the queue ignoring any sync barriers.
     */
    public static void postAtFrontOfQueueAsynchronously(Handler h, Runnable r) {
        Message msg = h.obtainMessage().setCallback(r);
        h.sendMessageAtFrontOfQueue(msg);
    }
}