New API for high-priority Notifications and full-screen alerts.

* fullScreenIntent: a PendingIntent pointing to a
  full-screen activity or other modal alert experience to be
  shown to the user instead of (or in addition to) a
  traditional status bar notification icon. Example: An
  incoming call should pop up a full-screen activity
  allowing the user to accept or decline the call.

  The old way to accomplish this is to simply fire off the
  full-screen intent directly from the Phone app. By routing
  through the Notification system, we make way for the
  FLAG_IMMERSIVE bit (forthcoming API) which would allow the
  frontmost opaque window to suppress full-screen alerts.

* FLAG_HIGH_PRIORITY: This bit allows a notification to be
  shown in windows that have the FLAG_IMMERSIVE bit set. For
  example, a Notification corresponding to an incoming call
  would be marked HIGH_PRIORITY so that even in an immersive
  activity (i.e. a networked game) the Notification could be
  shown to the user.

Change-Id: I4943e53f425800a6e152bc4992dd41586b43aff8
diff --git a/api/current.xml b/api/current.xml
index 3acd21f..9a15cfb 100644
--- a/api/current.xml
+++ b/api/current.xml
@@ -26547,6 +26547,17 @@
  visibility="public"
 >
 </field>
+<field name="FLAG_HIGH_PRIORITY"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="128"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
 <field name="FLAG_INSISTENT"
  type="int"
  transient="false"
@@ -26673,6 +26684,16 @@
  visibility="public"
 >
 </field>
+<field name="fullScreenIntent"
+ type="android.app.PendingIntent"
+ transient="false"
+ volatile="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
 <field name="icon"
  type="int"
  transient="false"
@@ -188125,6 +188146,7 @@
  visibility="public"
 >
 </field>
+</field>
 <field name="FLAG_KEEP_SCREEN_ON"
  type="int"
  transient="false"
diff --git a/core/java/android/app/Notification.java b/core/java/android/app/Notification.java
index 739aca3..83a2024 100644
--- a/core/java/android/app/Notification.java
+++ b/core/java/android/app/Notification.java
@@ -83,10 +83,10 @@
     public int icon;
 
     /**
-     * The number of events that this notification represents.  For example, if this is the
-     * new mail notification, this would be the number of unread messages.  This number is
-     * be superimposed over the icon in the status bar.  If the number is 0 or negative, it
-     * is not shown in the status bar.
+     * The number of events that this notification represents.  For example, in a new mail
+     * notification, this could be the number of unread messages.  This number is superimposed over
+     * the icon in the status bar.  If the number is 0 or negative, it is not shown in the status
+     * bar.
      */
     public int number;
 
@@ -109,13 +109,22 @@
     public PendingIntent deleteIntent;
 
     /**
+     * An intent to launch instead of posting the notification to the status bar. Only for use with
+     * extremely high-priority notifications demanding the user's attention, such as an incoming
+     * call (handled in the core Android Phone app with a full-screen Activity).
+     * Use with {@link #FLAG_HIGH_PRIORITY} to ensure that this notification will reach the user
+     * even when other notifications are suppressed.
+     */
+    public PendingIntent fullScreenIntent;
+
+    /**
      * Text to scroll across the screen when this item is added to
      * the status bar.
      */
     public CharSequence tickerText;
 
     /**
-     * The view that shows when this notification is shown in the expanded status bar.
+     * The view that will represent this notification in the expanded status bar.
      */
     public RemoteViews contentView;
 
@@ -264,6 +273,14 @@
      */
     public static final int FLAG_FOREGROUND_SERVICE = 0x00000040;
 
+    /**
+     * Bit to be bitwise-ored into the {@link #flags} field that should be set if this notification
+     * represents a high-priority event that may be shown to the user even if notifications are
+     * otherwise unavailable (that is, when the status bar is hidden). This flag is ideally used
+     * in conjunction with {@link #fullScreenIntent}.
+     */
+    public static final int FLAG_HIGH_PRIORITY = 0x00000080;
+
     public int flags;
 
     /**
@@ -339,6 +356,10 @@
         ledOnMS = parcel.readInt();
         ledOffMS = parcel.readInt();
         iconLevel = parcel.readInt();
+
+        if (parcel.readInt() != 0) {
+            fullScreenIntent = PendingIntent.CREATOR.createFromParcel(parcel);
+        }
     }
 
     public Notification clone() {
@@ -351,6 +372,7 @@
         // PendingIntents are global, so there's no reason (or way) to clone them.
         that.contentIntent = this.contentIntent;
         that.deleteIntent = this.deleteIntent;
+        that.fullScreenIntent = this.fullScreenIntent;
 
         if (this.tickerText != null) {
             that.tickerText = this.tickerText.toString();
@@ -433,6 +455,13 @@
         parcel.writeInt(ledOnMS);
         parcel.writeInt(ledOffMS);
         parcel.writeInt(iconLevel);
+
+        if (fullScreenIntent != null) {
+            parcel.writeInt(1);
+            fullScreenIntent.writeToParcel(parcel, 0);
+        } else {
+            parcel.writeInt(0);
+        }
     }
 
     /**
@@ -518,6 +547,11 @@
         }
         sb.append(",defaults=0x");
         sb.append(Integer.toHexString(this.defaults));
+        sb.append(",flags=0x");
+        sb.append(Integer.toHexString(this.flags));
+        if ((this.flags & FLAG_HIGH_PRIORITY) != 0) {
+            sb.append("!!!1!one!");
+        }
         sb.append(")");
         return sb.toString();
     }