diff options
author | Craig Mautner <cmautner@google.com> | 2012-10-05 14:45:52 -0700 |
---|---|---|
committer | Craig Mautner <cmautner@google.com> | 2012-10-06 13:09:58 -0700 |
commit | 5962b12bedc4a1d0354816c1cd6b06ba04f6d807 (patch) | |
tree | b9918fad07cf0e0ff84d510b6e17b31cf48394f9 /services/java/com/android/server/am | |
parent | 88400d3a31139c40c4014faf86c243647087ef6c (diff) | |
download | frameworks_base-5962b12bedc4a1d0354816c1cd6b06ba04f6d807.zip frameworks_base-5962b12bedc4a1d0354816c1cd6b06ba04f6d807.tar.gz frameworks_base-5962b12bedc4a1d0354816c1cd6b06ba04f6d807.tar.bz2 |
Adds showWhenLocked attribute to Activities.
The new attribute allows an Activity such as the alarm to appear
on all users screens.
Bug: 7213805 fixed.
Change-Id: If7866b13d88c04af07debc69e0e875d0adc6050a
Diffstat (limited to 'services/java/com/android/server/am')
-rw-r--r-- | services/java/com/android/server/am/ActivityManagerService.java | 1 | ||||
-rwxr-xr-x | services/java/com/android/server/am/ActivityStack.java | 23 |
2 files changed, 16 insertions, 8 deletions
diff --git a/services/java/com/android/server/am/ActivityManagerService.java b/services/java/com/android/server/am/ActivityManagerService.java index 3ef6767..dcdde76 100644 --- a/services/java/com/android/server/am/ActivityManagerService.java +++ b/services/java/com/android/server/am/ActivityManagerService.java @@ -7453,6 +7453,7 @@ public final class ActivityManagerService extends ActivityManagerNative lp.format = v.getBackground().getOpacity(); lp.flags = WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE | WindowManager.LayoutParams.FLAG_NOT_TOUCHABLE; + lp.privateFlags |= WindowManager.LayoutParams.PRIVATE_FLAG_SHOW_FOR_ALL_USERS; ((WindowManager)mContext.getSystemService( Context.WINDOW_SERVICE)).addView(v, lp); } diff --git a/services/java/com/android/server/am/ActivityStack.java b/services/java/com/android/server/am/ActivityStack.java index a6dc867..4bcb339 100755 --- a/services/java/com/android/server/am/ActivityStack.java +++ b/services/java/com/android/server/am/ActivityStack.java @@ -420,12 +420,17 @@ final class ActivityStack { mLaunchingActivity = pm.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK, "ActivityManager-Launch"); mLaunchingActivity.setReferenceCounted(false); } - + + private boolean okToShow(ActivityRecord r) { + return r.userId == mCurrentUser + || (r.info.flags & ActivityInfo.FLAG_SHOW_ON_LOCK_SCREEN) != 0; + } + final ActivityRecord topRunningActivityLocked(ActivityRecord notTop) { int i = mHistory.size()-1; while (i >= 0) { ActivityRecord r = mHistory.get(i); - if (!r.finishing && r != notTop && r.userId == mCurrentUser) { + if (!r.finishing && r != notTop && okToShow(r)) { return r; } i--; @@ -437,7 +442,7 @@ final class ActivityStack { int i = mHistory.size()-1; while (i >= 0) { ActivityRecord r = mHistory.get(i); - if (!r.finishing && !r.delayedResume && r != notTop && r.userId == mCurrentUser) { + if (!r.finishing && !r.delayedResume && r != notTop && okToShow(r)) { return r; } i--; @@ -460,7 +465,7 @@ final class ActivityStack { ActivityRecord r = mHistory.get(i); // Note: the taskId check depends on real taskId fields being non-zero if (!r.finishing && (token != r.appToken) && (taskId != r.task.taskId) - && r.userId == mCurrentUser) { + && okToShow(r)) { return r; } i--; @@ -1806,7 +1811,8 @@ final class ActivityStack { mHistory.add(addPos, r); r.putInHistory(); mService.mWindowManager.addAppToken(addPos, r.appToken, r.task.taskId, - r.info.screenOrientation, r.fullscreen); + r.info.screenOrientation, r.fullscreen, + (r.info.flags & ActivityInfo.FLAG_SHOW_ON_LOCK_SCREEN) != 0); if (VALIDATE_TOKENS) { validateAppTokensLocked(); } @@ -1870,7 +1876,8 @@ final class ActivityStack { } r.updateOptionsLocked(options); mService.mWindowManager.addAppToken( - addPos, r.appToken, r.task.taskId, r.info.screenOrientation, r.fullscreen); + addPos, r.appToken, r.task.taskId, r.info.screenOrientation, r.fullscreen, + (r.info.flags & ActivityInfo.FLAG_SHOW_ON_LOCK_SCREEN) != 0); boolean doShow = true; if (newTask) { // Even though this activity is starting fresh, we still need @@ -1908,7 +1915,8 @@ final class ActivityStack { // If this is the first activity, don't do any fancy animations, // because there is nothing for it to animate on top of. mService.mWindowManager.addAppToken(addPos, r.appToken, r.task.taskId, - r.info.screenOrientation, r.fullscreen); + r.info.screenOrientation, r.fullscreen, + (r.info.flags & ActivityInfo.FLAG_SHOW_ON_LOCK_SCREEN) != 0); ActivityOptions.abort(options); } if (VALIDATE_TOKENS) { @@ -2616,7 +2624,6 @@ final class ActivityStack { Bundle options) { final Intent intent = r.intent; final int callingUid = r.launchedFromUid; - final int userId = r.userId; int launchFlags = intent.getFlags(); |