Ensure next invisible activity can be resumed while finishing top

The top activity was added to finishing list and set the next top
activity to resume while the top activity finished itself during
screen off. However, the next top activity was not resumed since it
was on another task and it was the last paused activity of the task.

Clear the last paused activity while focused task changed during
sleeping.

Also fixes RWC#resumeFocusedStacksTopActivities() not returning true
while activities resumed.

Bug: 172189606
Test: atest ActivityRecordTests
Test: finish top activity while screen off
Change-Id: I14b6e48f6f1d8c30716f9838c8a19a11815f8975
4 files changed