AM: make LockTask truly multi-task-aware.

LockTask was first designed to be single-task only. It was later
expanded to multi-task use cases in a rather flawed manner. Many aspects
of the implementation overlook the implications of more than one locked
tasks, and sometimes completely ignore the LockTask-unaware apps.

For example, LockTask-unaware apps are not registered in
LockTaskController's list of locked tasks, although they can be launched
in LockTask mode as long as they are whitelisted. As a consequence,
these unregistered tasks are not finished when their whitelist
authorization is removed.

In this patch, we make sure LockTask-unaware apps are also registered,
and introduce the notion of a root task, thus providing a genuine
multi-task experience with LockTask.

Bug: 66130096
Bug: 66132035
Test: bit FrameworksServicesTests:com.android.server.am.LockTaskControllerTest
Test: cts-tradefed run cts-dev -m DevicePolicyManager --test com.android.cts.devicepolicy.DeviceOwnerTest#testLockTask_deviceOwnerUser
Test: manual, by using TestDPC > Start kiosk mode
Change-Id: I68a26d2198fa3991f85ae1e7a6acae5981c34db5
10 files changed