Fix that the top process is not cleared after device sleeps

Commit 8f7dd59 makes getTopApp lock-free by the field mTopApp.
And it is updated when the top activity is changed. When making
device sleep, the given top resumed activity is null and the
pausing activity is chosen. But there won't be next top activity
change to replace the mTopApp of previous pausing activity.
That causes the process stays on top state.

This change clears mTopApp when pausing the top activity for
sleeping. This also aligns the condition in OomAdjuster that if
the current top state is not PROCESS_STATE_TOP, there won't be
a top process.

Fixes: 171060345
Test: atest ActivityTaskManagerServiceTests#testUpdateSleep
      CtsStatsdAtomHostTestCases:ProcStateAtomTests#testTopSleeping
Change-Id: Ie96113ab4002a559a5af974f83b36f56f28ff438
2 files changed