Update visibility when finishing activity

Consider the situation where there is a translucent or non-fullscreen
activity in foreground and a middle activity that is going to be
finished. The black background will show below the foreground activity
if the middle activity is in STARTED state because the activity in
STARTED state was not treated as visible.

Another case is that the task of non-fullscreen activity is different to
the middle activity. We can't find any resumed activity from the task of
the middle activity.

This CL treat both PAUSED and STARTED activities as visible and update
the visibility if current activity is opaque.

Also clean up some dead code in Task and ActivityRecord.

Bug: 172837736
Test: atest WmTests:ActivityRecordTests RootTaskTests
Test: atest ActivityVisibilityTests
Test: atest ActivityLifecycleTopResumedStateTests
Test: atest CtsWindowManagerDeviceTestCases:ActivityLifecycleTests
Test: atest MultiDisplayPolicyTests
Change-Id: I43618e34383409b4805942b1923f1281f4226b1c
4 files changed