Pause activity when making visible from stopped state.

It is possible for an activity to become visible without gaining
focus. For example, if a paused activity in split-screen finishes
itself, the activity below will become visible. Currently this
activity will not exit the stopped state. This changelist
addresses this inconsistency by cycling the activity to paused if
it becomes visible in the stopped state.

Change-Id: I170d586793dadb0d6ff59d1ad68f2d94699f9ca6
Bug: 71582913
Test: atest ActivityRecordTests#testPausingWhenVisibleFromStopped
diff --git a/services/tests/servicestests/src/com/android/server/am/ActivityTestsBase.java b/services/tests/servicestests/src/com/android/server/am/ActivityTestsBase.java
index d74d994..96bf49b 100644
--- a/services/tests/servicestests/src/com/android/server/am/ActivityTestsBase.java
+++ b/services/tests/servicestests/src/com/android/server/am/ActivityTestsBase.java
@@ -32,6 +32,7 @@
 
 import org.mockito.invocation.InvocationOnMock;
 
+import android.app.IApplicationThread;
 import android.content.ComponentName;
 import android.content.Context;
 import android.content.Intent;
@@ -177,6 +178,10 @@
                 mTaskRecord.addActivityToTop(activity);
             }
 
+            activity.setProcess(new ProcessRecord(null, mService.mContext.getApplicationInfo(),
+                    "name", 12345));
+            activity.app.thread = mock(IApplicationThread.class);
+
             return activity;
         }
     }