Do not pause initializing activities when becoming visible.

makeVisibleIfNeeded was recently modified to ensure activities
becoming visible were not left in the stopped state. However, the
condition was based on simply not being in the paused state, rather
than requiring it be in the stopped/stopping state. This can lead
to lifecycle issues for moving an initializing activity into the
paused state.

This changelist ensures that only stopped/stopping activities are
considered.

Change-Id: I17fc6310db6ee111d1db8f69599090becd1e1760
Fixes: 72028454
Test: atest FrameworksServicesTests:com.android.server.am.ActivityRecordTests
diff --git a/services/core/java/com/android/server/am/ActivityRecord.java b/services/core/java/com/android/server/am/ActivityRecord.java
index b74c8da..b5fbee6 100644
--- a/services/core/java/com/android/server/am/ActivityRecord.java
+++ b/services/core/java/com/android/server/am/ActivityRecord.java
@@ -1609,9 +1609,8 @@
             mStackSupervisor.mStoppingActivities.remove(this);
             mStackSupervisor.mGoingToSleepActivities.remove(this);
 
-            // If an activity is not in the paused state when becoming visible, cycle to the paused
-            // state.
-            if (state != PAUSED) {
+            // If the activity is stopped or stopping, cycle to the paused state.
+            if (state == STOPPED || state == STOPPING) {
                 // An activity must be in the {@link PAUSING} state for the system to validate
                 // the move to {@link PAUSED}.
                 state = PAUSING;