Fixed issue with turn-screen-on activities

Regression introduced by ag/2147938 where we set the visibility of an
app to false after pausing because it might have been previously
defered. However, the change did it for all activities regardless of if
it was previously deferred or not. We now only do the visibility change
to false if we previouly deferred.

Change-Id: Ifde46587e1ddf38304b73cec45c56f0acd955f37
Fixes: 37657105
Test: cts.ActivityManagerActivityVisibilityTests#testTurnScreenOnActivity
2 files changed