Revised "immersive mode" API.

No longer a window bit, FLAG_IMMERSIVE is now set on
ActivityInfo.flags and in the Activity's manifest as
android:immersive="true" (ActivityInfo).

[An "immersive" activity is one that wishes to avoid being
paused by full-screen notifications (like an incoming call).
An activity that sets FLAG_IMMERSIVE/android:immersive 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.]

[Originally: change Ie290c2e.]

Change-Id: I967bb10b930b8f0772b10f81f2957a03fa3f1736
This commit is contained in:
Daniel Sandler
2010-06-21 13:46:39 -04:00
parent aaf39f8406
commit 613dde4aa6
5 changed files with 43 additions and 26 deletions

View File

@@ -45952,6 +45952,17 @@
visibility="public"
>
</field>
<field name="FLAG_IMMERSIVE"
type="int"
transient="false"
volatile="false"
value="512"
static="true"
final="true"
deprecated="not deprecated"
visibility="public"
>
</field>
<field name="FLAG_MULTIPROCESS"
type="int"
transient="false"
@@ -188188,17 +188199,6 @@
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"
transient="false"

View File

@@ -149,14 +149,33 @@ public class ActivityInfo extends ComponentInfo
* {@link android.R.attr#finishOnCloseSystemDialogs} attribute.
*/
public static final int FLAG_FINISH_ON_CLOSE_SYSTEM_DIALOGS = 0x0100;
/**
* Bit in {@link #flags} corresponding to an immersive activity
* that wishes not to be interrupted by notifications.
* Applications that hide the system notification bar with
* {@link android.view.WindowManager.LayoutParams#FLAG_FULLSCREEN}
* may still be interrupted by high-priority notifications; for example, an
* incoming phone call may use
* {@link * android.app.Notification#fullScreenIntent fullScreenIntent}
* to present a full-screen in-call activity to the user, pausing the
* current activity as a side-effect. An activity with
* {@link #FLAG_IMMERSIVE} set, however, will not be interrupted; the
* notification may be shown in some other way (such as a small floating
* "toast" window).
* {@see android.app.Notification#FLAG_HIGH_PRIORITY}
*/
public static final int FLAG_IMMERSIVE = 0x0200;
/**
* Options that have been set in the activity declaration in the
* manifest: {@link #FLAG_MULTIPROCESS},
* manifest.
* These include:
* {@link #FLAG_MULTIPROCESS},
* {@link #FLAG_FINISH_ON_TASK_LAUNCH}, {@link #FLAG_CLEAR_TASK_ON_LAUNCH},
* {@link #FLAG_ALWAYS_RETAIN_TASK_STATE},
* {@link #FLAG_STATE_NOT_NEEDED}, {@link #FLAG_EXCLUDE_FROM_RECENTS},
* {@link #FLAG_ALLOW_TASK_REPARENTING}, {@link #FLAG_NO_HISTORY},
* {@link #FLAG_FINISH_ON_CLOSE_SYSTEM_DIALOGS}.
* {@link #FLAG_FINISH_ON_CLOSE_SYSTEM_DIALOGS},
* {@link #FLAG_IMMERSIVE}
*/
public int flags;

View File

@@ -1881,6 +1881,12 @@ public class PackageParser {
a.info.flags |= ActivityInfo.FLAG_FINISH_ON_CLOSE_SYSTEM_DIALOGS;
}
if (sa.getBoolean(
com.android.internal.R.styleable.AndroidManifestActivity_immersive,
false)) {
a.info.flags |= ActivityInfo.FLAG_IMMERSIVE;
}
if (!receiver) {
a.info.launchMode = sa.getInt(
com.android.internal.R.styleable.AndroidManifestActivity_launchMode,

View File

@@ -584,19 +584,6 @@ public interface WindowManager extends ViewManager {
*/
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 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 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.

View File

@@ -398,6 +398,10 @@
participate in data synchronization. -->
<attr name="syncable" format="boolean" />
<!-- Flag declaring this activity to be 'immersive'; immersive activities
should not be interrupted with other activities or notifications. -->
<attr name="immersive" format="boolean" />
<!-- Specify the order in which content providers hosted by a process
are instantiated when that process is created. Not needed unless
you have providers with dependencies between each other, to make
@@ -1200,6 +1204,7 @@
this activity. A value besides "unspecified" here overrides
any value in the theme. -->
<attr name="windowSoftInputMode" />
<attr name="immersive" />
</declare-styleable>
<!-- The <code>activity-alias</code> tag declares a new