diff options
author | Daniel Sandler <dsandler@android.com> | 2010-06-23 16:29:36 -0400 |
---|---|---|
committer | Daniel Sandler <dsandler@android.com> | 2010-06-23 16:29:36 -0400 |
commit | 69a4817e3e1e368e758ff8c238deb5ee26963c04 (patch) | |
tree | 3eaed1f053b09daabf84854acb3155216543a102 /core/java/android/app/Activity.java | |
parent | efbe2d78ee5e26b6606c8552a5c1ac70749a5013 (diff) | |
download | frameworks_base-69a4817e3e1e368e758ff8c238deb5ee26963c04.zip frameworks_base-69a4817e3e1e368e758ff8c238deb5ee26963c04.tar.gz frameworks_base-69a4817e3e1e368e758ff8c238deb5ee26963c04.tar.bz2 |
Immersive activity API.
An Activity can declare itself to be "immersive" either by
setting android:immersive="true" in AndroidManifest or by
calling setImmersive(true).
Immersive activities "should" not be interrupted, for
example by Notifications with an associated
fullScreenIntent. (In the future we may even prevent any
non-system application from successfully calling
startActivity() if the foreground activity is immersive.)
Notifications with FLAG_HIGH_PRIORITY set will be shown to
the user in some less-obtrusive way if the frontmost
activity is immersive.
Change-Id: I8d0c25cc4e22371c27cbf2bb6372d2c95d57b2d7
Diffstat (limited to 'core/java/android/app/Activity.java')
-rw-r--r-- | core/java/android/app/Activity.java | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/core/java/android/app/Activity.java b/core/java/android/app/Activity.java index a962391..9b9ae52 100644 --- a/core/java/android/app/Activity.java +++ b/core/java/android/app/Activity.java @@ -3720,6 +3720,46 @@ public class Activity extends ContextThemeWrapper return null; } + /** + * Bit indicating that this activity is "immersive" and should not be + * interrupted by notifications if possible. + * + * This value is initially set by the manifest property + * <code>android:immersive</code> but may be changed at runtime by + * {@link #setImmersive}. + * + * @see android.content.pm.ActivityInfo#FLAG_IMMERSIVE + */ + public boolean isImmersive() { + try { + return ActivityManagerNative.getDefault().isImmersive(mToken); + } catch (RemoteException e) { + return false; + } + } + + /** + * Adjust the current immersive mode setting. + * + * Note that changing this value will have no effect on the activity's + * {@link android.content.pm.ActivityInfo} structure; that is, if + * <code>android:immersive</code> is set to <code>true</code> + * in the application's manifest entry for this activity, the {@link + * android.content.pm.ActivityInfo#flags ActivityInfo.flags} member will + * always have its {@link android.content.pm.ActivityInfo#FLAG_IMMERSIVE + * FLAG_IMMERSIVE} bit set. + * + * @see #isImmersive + * @see android.content.pm.ActivityInfo#FLAG_IMMERSIVE + */ + public void setImmersive(boolean i) { + try { + ActivityManagerNative.getDefault().setImmersive(mToken, i); + } catch (RemoteException e) { + // pass + } + } + // ------------------ Internal API ------------------ final void setParent(Activity parent) { |