Sort tasks by Z-order instead of lastActiveTime

lastActiveTime is not a reliable way to determine the Z order of
freeform tasks because it misses Z order changes of already
visible tasks (e.g. when bringing a semi occluded task to the top).
This change keeps track of the freeform task's Z-order by observing
TaskListener's appear/vanish and focus changes.

Bug: 258056163
Test: atest DesktopModeControllerTest DesktopModeTaskRepositoryTest
Test: manual:
 1. Clear all open tasks and enable desktop mode
 2. Launch YT from taskbar
 3. Launch Gmail from taskbar
 4. Tap on YT to bring to front
 5. Launch Photos from taskbar
Top->bottom order is Photos, YT, Gmail

Change-Id: I6f2751b32f43d7b8ac2f97ce4c06be7ffa4dec11
5 files changed