Scheduling Tasks by Priority

Juggling work at different priorities using scheduler.postTask().

How to test:

  1. Click Schedule Batch (Mixed) to add tasks of different priorities to the queue.
  2. Observe the log: Tasks should execute in order of priority (Blocking > Visible > Background), regardless of the order they were added.
  3. Try clicking individual buttons to see how they behave.