Fix bug that apps are not unminimizing if recent tasks are empty

If an activity was launched in the docked stack and we weren't able
to retrace the launch back to an activity launch from the homescreen
in activity manager, nothing happened.

Now we try to do a better job by also checking some conditions when
the app transition is starting. Note that this might still be racy,
but in practice all activities are usually launched from the same
process so the app is done starting/finishing any activities when
the first frame is drawn, so we are able to catch the correct state
when we figure out that the app transition is starting.

In addition to that, we also need to not hide the docked stack while
lockscreen is showing. This doesn't make any sense anymore as we are
dismissing the docked stack when we show something above the lockscreen,
and this only lead to issues that triggered app visibility events
which triggered this special unnecessarily. This also fixes some flicker/
race-condition in the normal unlocking process I noticed a long time ago
but couldn't really reproduce.

Change-Id: I42683520ba9ee9fbd0c9920501387a573ac94655
Fixes: 30439313
4 files changed