Avoid making post state to RESUMED for a PAUSING activity

Make sure the client post execution lifecycle state to RESUMED
only if the activity was RESUMED while delivering new intent.

Bug: 135715788
Test: making skype calls
Test: atest ActivityThreadTest

Change-Id: I1e3054e1d1611aecf6ddf6d482abf2cb3ebdf9a4
diff --git a/services/core/java/com/android/server/wm/ActivityStack.java b/services/core/java/com/android/server/wm/ActivityStack.java
index 30e866b..6bed462 100644
--- a/services/core/java/com/android/server/wm/ActivityStack.java
+++ b/services/core/java/com/android/server/wm/ActivityStack.java
@@ -2964,7 +2964,8 @@
                 }
 
                 if (next.newIntents != null) {
-                    transaction.addCallback(NewIntentItem.obtain(next.newIntents));
+                    transaction.addCallback(
+                            NewIntentItem.obtain(next.newIntents, true /* resume */));
                 }
 
                 // Well the app will no longer be stopped.