Fix issue #6968859: home not exiting an ANR'd dream

Add a new call to the activity manager for the input dispatcher
to report about any pid having an ANR.  This has a new feature
where it can also tell the activity manager that it is above the
system alert layer, so the activity manager can pop its ANR dialog
on top of everything if it needs to.  (Normally we don't want
these dialogs appearing on top of the lock screen.)

Also fixed some debugging stuff here and there that was useful
as I was working on this -- windows now very clearly include
their uid, various system dialogs now have titles so you know
what they are in the window manager, etc.

Change-Id: Ib8f5d29a5572542cc506e6d338599ab64088ce4e
diff --git a/services/java/com/android/server/am/AppNotRespondingDialog.java b/services/java/com/android/server/am/AppNotRespondingDialog.java
index b546ae7..58e533b 100644
--- a/services/java/com/android/server/am/AppNotRespondingDialog.java
+++ b/services/java/com/android/server/am/AppNotRespondingDialog.java
@@ -25,8 +25,8 @@
 import android.content.res.Resources;
 import android.os.Handler;
 import android.os.Message;
-import android.os.Process;
 import android.util.Slog;
+import android.view.WindowManager;
 
 class AppNotRespondingDialog extends BaseErrorDialog {
     private static final String TAG = "AppNotRespondingDialog";
@@ -40,7 +40,7 @@
     private final ProcessRecord mProc;
     
     public AppNotRespondingDialog(ActivityManagerService service, Context context,
-            ProcessRecord app, ActivityRecord activity) {
+            ProcessRecord app, ActivityRecord activity, boolean aboveSystem) {
         super(context);
         
         mService = service;
@@ -91,8 +91,13 @@
         }
 
         setTitle(res.getText(com.android.internal.R.string.anr_title));
+        if (aboveSystem) {
+            getWindow().setType(WindowManager.LayoutParams.TYPE_SYSTEM_ERROR);
+        }
         getWindow().addFlags(FLAG_SYSTEM_ERROR);
-        getWindow().setTitle("Application Not Responding: " + app.info.processName);
+        WindowManager.LayoutParams attrs = getWindow().getAttributes();
+        attrs.setTitle("Application Not Responding: " + app.info.processName);
+        getWindow().setAttributes(attrs);
     }
 
     public void onStop() {