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

This commit is contained in:
Jorim Jaggi
2018-01-18 00:19:20 +00:00
committed by Android (Google) Code Review

View File

@@ -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);
}
}