ASM - Bug fixes for clearTopIfNeeded
This includes the following changes:
1. activity starts with UID 0 could fail - they do not have a
corresponding packageName, resulting in a NPE in the feature flag
allowlist. We now both explicitely allow UID 0, and check for nulls.
2. We no longer exclude finishing activities in the check. While this is
generally a no-op, it resulted in noisy logs/toasts. E.G, an activity
finishes itself and launches a new one with NEW_TASK at the same time
would result in clearTop being called, even though there is nothing
to clear.
This is net-neutral for security - the finishing activity could have
already morphed itself rather than finishing.
3. We move the home task to front of the finishing tas in
checkActivitySecurityForTaskClear, rather than to front of display
area. For multi-window scenarios, this could result in one app
forcing a home switch for the other.
4. Allow launches from top of stack, even if finishing or alwaysOnTop.
This supports tasks which are always set to alwaysOnTop, if they try
to start or finish activities
Bug: 271417931
Test: ABTD with all WM tests and InputMethod tests
Change-Id: I966319723b17f1affd92e141791596e5da644050
3 files changed