New API for "immersive" activity windows.

An "immersive" activity (as indicated by the new
FLAG_IMMERSIVE) is one that wishes to avoid being paused by
full-screen notifications (like an incoming call).
An activity that sets FLAG_IMMERSIVE on its window is
sending a signal to the notification manager, status bar,
etc. that they should try to find some other way to get the
user's attention in high-priority situations.

FLAG_IMMERSIVE should be used exclusively in conjunction
with FLAG_FULL_SCREEN (that is, only activities that hide
the status bar should consider themselves immersive).

Change-Id: Ie290c2e92fc391bcf55edfdb1fbd626cd284e3e2
diff --git a/api/current.xml b/api/current.xml
index 9a15cfb..0db40ce 100644
--- a/api/current.xml
+++ b/api/current.xml
@@ -188146,6 +188146,16 @@
  visibility="public"
 >
 </field>
+<field name="FLAG_IMMERSIVE"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="8388608"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
 </field>
 <field name="FLAG_KEEP_SCREEN_ON"
  type="int"
diff --git a/core/java/android/view/WindowManager.java b/core/java/android/view/WindowManager.java
index adceeb2..2534de7 100644
--- a/core/java/android/view/WindowManager.java
+++ b/core/java/android/view/WindowManager.java
@@ -582,7 +582,20 @@
          * seeing this window, unless {@link #FLAG_SHOW_WHEN_LOCKED} has
          * also been set. */
         public static final int FLAG_DISMISS_KEYGUARD = 0x00400000;
-        
+
+        /** Window flag: This window corresponds to an immersive activity
+         * that wishes not to be interrupted with notifications.  In general,
+         * applications may simply hide the status bar with {@link
+         * FLAG_FULLSCREEN} to suppress most notifications, but will still be
+         * interrupted by those with
+         * {@link android.app.Notification.fullScreenIntent} set (example: an
+         * incoming call).  Setting {@link FLAG_IMMERSIVE} will suppress the
+         * full-screen intent and show the status bar briefly for those
+         * important notifications instead.  See also
+         * {@link android.app.Notification.FLAG_HIGH_PRIORITY}.
+         */
+        public static final int FLAG_IMMERSIVE = 0x00800000;
+
         /** Window flag: *sigh* The lock screen wants to continue running its
          * animation while it is fading.  A kind-of hack to allow this.  Maybe
          * in the future we just make this the default behavior.