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 /services | |
| 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 'services')
| -rw-r--r-- | services/java/com/android/server/am/ActivityManagerService.java | 29 | ||||
| -rw-r--r-- | services/java/com/android/server/am/HistoryRecord.java | 5 |
2 files changed, 34 insertions, 0 deletions
diff --git a/services/java/com/android/server/am/ActivityManagerService.java b/services/java/com/android/server/am/ActivityManagerService.java index 4d18191..d59ecdd 100644 --- a/services/java/com/android/server/am/ActivityManagerService.java +++ b/services/java/com/android/server/am/ActivityManagerService.java @@ -8725,6 +8725,35 @@ public final class ActivityManagerService extends ActivityManagerNative implemen } } + public void setImmersive(IBinder token, boolean immersive) { + synchronized(this) { + int index = (token != null) ? indexOfTokenLocked(token) : -1; + if (index < 0) { + throw new IllegalArgumentException(); + } + HistoryRecord r = (HistoryRecord)mHistory.get(index); + r.immersive = immersive; + } + } + + public boolean isImmersive(IBinder token) { + synchronized (this) { + int index = (token != null) ? indexOfTokenLocked(token) : -1; + if (index < 0) { + throw new IllegalArgumentException(); + } + HistoryRecord r = (HistoryRecord)mHistory.get(index); + return r.immersive; + } + } + + public boolean isTopActivityImmersive() { + synchronized (this) { + HistoryRecord r = topRunningActivityLocked(null); + return (r != null) ? r.immersive : false; + } + } + public final void enterSafeMode() { synchronized(this) { // It only makes sense to do this before the system is ready diff --git a/services/java/com/android/server/am/HistoryRecord.java b/services/java/com/android/server/am/HistoryRecord.java index dca7a99..fb5c8aa 100644 --- a/services/java/com/android/server/am/HistoryRecord.java +++ b/services/java/com/android/server/am/HistoryRecord.java @@ -101,6 +101,7 @@ class HistoryRecord extends IApplicationToken.Stub { boolean idle; // has the activity gone idle? boolean hasBeenLaunched;// has this activity ever been launched? boolean frozenBeforeDestroy;// has been frozen but not yet destroyed. + boolean immersive; // immersive mode (don't interrupt if possible) String stringName; // for caching of toString(). @@ -153,6 +154,7 @@ class HistoryRecord extends IApplicationToken.Stub { pw.print(prefix); pw.print("keysPaused="); pw.print(keysPaused); pw.print(" inHistory="); pw.print(inHistory); pw.print(" persistent="); pw.print(persistent); + pw.print(" immersive="); pw.print(immersive); pw.print(" launchMode="); pw.println(launchMode); pw.print(prefix); pw.print("fullscreen="); pw.print(fullscreen); pw.print(" visible="); pw.print(visible); @@ -278,6 +280,8 @@ class HistoryRecord extends IApplicationToken.Stub { } else { isHomeActivity = false; } + + immersive = (aInfo.flags & ActivityInfo.FLAG_IMMERSIVE) != 0; } else { realActivity = null; taskAffinity = null; @@ -289,6 +293,7 @@ class HistoryRecord extends IApplicationToken.Stub { packageName = null; fullscreen = true; isHomeActivity = false; + immersive = false; } } |
