Dispatch task change notifications to local callbacks in same thread

Currently, task change notifications are dispatched to the
listeners on a separate thread even if the callback lives in
the system process. As a result, they happen too late to
respond to certain key events in a task's state change.

This CL fixes this issue by tracking local and remote listeners
separately, and notifying local listeners directly instead of
on the handler thread.

Test: Manual - verify that local callbacks delivered to the
TaskWindowPlacer are called in the same thread as the main
ActivityManager thread.
Test: run TaskStackChangedListenerTest
Bug: 33664258

Change-Id: I92f20d539558054368acfa836bd2476e9ae81b33
1 file changed