@@ -420,12 +420,17 @@ public void handleMessage(Message msg) {
420420 mLaunchingActivity = pm .newWakeLock (PowerManager .PARTIAL_WAKE_LOCK , "ActivityManager-Launch" );
421421 mLaunchingActivity .setReferenceCounted (false );
422422 }
423-
423+
424+ private boolean okToShow (ActivityRecord r ) {
425+ return r .userId == mCurrentUser
426+ || (r .info .flags & ActivityInfo .FLAG_SHOW_ON_LOCK_SCREEN ) != 0 ;
427+ }
428+
424429 final ActivityRecord topRunningActivityLocked (ActivityRecord notTop ) {
425430 int i = mHistory .size ()-1 ;
426431 while (i >= 0 ) {
427432 ActivityRecord r = mHistory .get (i );
428- if (!r .finishing && r != notTop && r . userId == mCurrentUser ) {
433+ if (!r .finishing && r != notTop && okToShow ( r ) ) {
429434 return r ;
430435 }
431436 i --;
@@ -437,7 +442,7 @@ final ActivityRecord topRunningNonDelayedActivityLocked(ActivityRecord notTop) {
437442 int i = mHistory .size ()-1 ;
438443 while (i >= 0 ) {
439444 ActivityRecord r = mHistory .get (i );
440- if (!r .finishing && !r .delayedResume && r != notTop && r . userId == mCurrentUser ) {
445+ if (!r .finishing && !r .delayedResume && r != notTop && okToShow ( r ) ) {
441446 return r ;
442447 }
443448 i --;
@@ -460,7 +465,7 @@ final ActivityRecord topRunningActivityLocked(IBinder token, int taskId) {
460465 ActivityRecord r = mHistory .get (i );
461466 // Note: the taskId check depends on real taskId fields being non-zero
462467 if (!r .finishing && (token != r .appToken ) && (taskId != r .task .taskId )
463- && r . userId == mCurrentUser ) {
468+ && okToShow ( r ) ) {
464469 return r ;
465470 }
466471 i --;
@@ -1806,7 +1811,8 @@ private final void startActivityLocked(ActivityRecord r, boolean newTask,
18061811 mHistory .add (addPos , r );
18071812 r .putInHistory ();
18081813 mService .mWindowManager .addAppToken (addPos , r .appToken , r .task .taskId ,
1809- r .info .screenOrientation , r .fullscreen );
1814+ r .info .screenOrientation , r .fullscreen ,
1815+ (r .info .flags & ActivityInfo .FLAG_SHOW_ON_LOCK_SCREEN ) != 0 );
18101816 if (VALIDATE_TOKENS ) {
18111817 validateAppTokensLocked ();
18121818 }
@@ -1870,7 +1876,8 @@ private final void startActivityLocked(ActivityRecord r, boolean newTask,
18701876 }
18711877 r .updateOptionsLocked (options );
18721878 mService .mWindowManager .addAppToken (
1873- addPos , r .appToken , r .task .taskId , r .info .screenOrientation , r .fullscreen );
1879+ addPos , r .appToken , r .task .taskId , r .info .screenOrientation , r .fullscreen ,
1880+ (r .info .flags & ActivityInfo .FLAG_SHOW_ON_LOCK_SCREEN ) != 0 );
18741881 boolean doShow = true ;
18751882 if (newTask ) {
18761883 // Even though this activity is starting fresh, we still need
@@ -1908,7 +1915,8 @@ private final void startActivityLocked(ActivityRecord r, boolean newTask,
19081915 // If this is the first activity, don't do any fancy animations,
19091916 // because there is nothing for it to animate on top of.
19101917 mService .mWindowManager .addAppToken (addPos , r .appToken , r .task .taskId ,
1911- r .info .screenOrientation , r .fullscreen );
1918+ r .info .screenOrientation , r .fullscreen ,
1919+ (r .info .flags & ActivityInfo .FLAG_SHOW_ON_LOCK_SCREEN ) != 0 );
19121920 ActivityOptions .abort (options );
19131921 }
19141922 if (VALIDATE_TOKENS ) {
@@ -2616,7 +2624,6 @@ final int startActivityUncheckedLocked(ActivityRecord r,
26162624 Bundle options ) {
26172625 final Intent intent = r .intent ;
26182626 final int callingUid = r .launchedFromUid ;
2619- final int userId = r .userId ;
26202627
26212628 int launchFlags = intent .getFlags ();
26222629
0 commit comments