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
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 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