Fix issue #3274841: Orientation change problem with a paused activity

Plus a bunch of debug output improvements.

And some new Intent helpers for dealing with restarting an app.

Change-Id: I50ec56bca6a86c562156b13fe8a6fdf68038a12e
diff --git a/core/java/android/app/ActivityThread.java b/core/java/android/app/ActivityThread.java
index 449992e..43f9d52 100644
--- a/core/java/android/app/ActivityThread.java
+++ b/core/java/android/app/ActivityThread.java
@@ -361,6 +361,7 @@
     private static final class DumpComponentInfo {
         FileDescriptor fd;
         IBinder token;
+        String prefix;
         String[] args;
         boolean dumped;
     }
@@ -680,10 +681,12 @@
             queueOrSendMessage(H.SCHEDULE_CRASH, msg);
         }
 
-        public void dumpActivity(FileDescriptor fd, IBinder activitytoken, String[] args) {
+        public void dumpActivity(FileDescriptor fd, IBinder activitytoken,
+                String prefix, String[] args) {
             DumpComponentInfo data = new DumpComponentInfo();
             data.fd = fd;
             data.token = activitytoken;
+            data.prefix = prefix;
             data.args = args;
             data.dumped = false;
             queueOrSendMessage(H.DUMP_ACTIVITY, data);
@@ -2076,7 +2079,7 @@
             ActivityClientRecord r = mActivities.get(info.token);
             if (r != null && r.activity != null) {
                 PrintWriter pw = new PrintWriter(new FileOutputStream(info.fd));
-                r.activity.dump(info.fd, pw, info.args);
+                r.activity.dump(info.prefix, info.fd, pw, info.args);
                 pw.close();
             }
         } finally {