@@ -428,12 +428,17 @@ public void handleMessage(Message msg) {
428428 mLaunchingActivity = pm .newWakeLock (PowerManager .PARTIAL_WAKE_LOCK , "ActivityManager-Launch" );
429429 mLaunchingActivity .setReferenceCounted (false );
430430 }
431-
431+
432+ private boolean okToShow (ActivityRecord r ) {
433+ return r .userId == mCurrentUser
434+ || (r .info .flags & ActivityInfo .FLAG_SHOW_ON_LOCK_SCREEN ) != 0 ;
435+ }
436+
432437 final ActivityRecord topRunningActivityLocked (ActivityRecord notTop ) {
433438 int i = mHistory .size ()-1 ;
434439 while (i >= 0 ) {
435440 ActivityRecord r = mHistory .get (i );
436- if (!r .finishing && r != notTop && r . userId == mCurrentUser ) {
441+ if (!r .finishing && r != notTop && okToShow ( r ) ) {
437442 return r ;
438443 }
439444 i --;
@@ -445,7 +450,7 @@ final ActivityRecord topRunningNonDelayedActivityLocked(ActivityRecord notTop) {
445450 int i = mHistory .size ()-1 ;
446451 while (i >= 0 ) {
447452 ActivityRecord r = mHistory .get (i );
448- if (!r .finishing && !r .delayedResume && r != notTop && r . userId == mCurrentUser ) {
453+ if (!r .finishing && !r .delayedResume && r != notTop && okToShow ( r ) ) {
449454 return r ;
450455 }
451456 i --;
@@ -468,7 +473,7 @@ final ActivityRecord topRunningActivityLocked(IBinder token, int taskId) {
468473 ActivityRecord r = mHistory .get (i );
469474 // Note: the taskId check depends on real taskId fields being non-zero
470475 if (!r .finishing && (token != r .appToken ) && (taskId != r .task .taskId )
471- && r . userId == mCurrentUser ) {
476+ && okToShow ( r ) ) {
472477 return r ;
473478 }
474479 i --;
@@ -1814,7 +1819,8 @@ private final void startActivityLocked(ActivityRecord r, boolean newTask,
18141819 mHistory .add (addPos , r );
18151820 r .putInHistory ();
18161821 mService .mWindowManager .addAppToken (addPos , r .appToken , r .task .taskId ,
1817- r .info .screenOrientation , r .fullscreen );
1822+ r .info .screenOrientation , r .fullscreen ,
1823+ (r .info .flags & ActivityInfo .FLAG_SHOW_ON_LOCK_SCREEN ) != 0 );
18181824 if (VALIDATE_TOKENS ) {
18191825 validateAppTokensLocked ();
18201826 }
@@ -1878,7 +1884,8 @@ private final void startActivityLocked(ActivityRecord r, boolean newTask,
18781884 }
18791885 r .updateOptionsLocked (options );
18801886 mService .mWindowManager .addAppToken (
1881- addPos , r .appToken , r .task .taskId , r .info .screenOrientation , r .fullscreen );
1887+ addPos , r .appToken , r .task .taskId , r .info .screenOrientation , r .fullscreen ,
1888+ (r .info .flags & ActivityInfo .FLAG_SHOW_ON_LOCK_SCREEN ) != 0 );
18821889 boolean doShow = true ;
18831890 if (newTask ) {
18841891 // Even though this activity is starting fresh, we still need
@@ -1916,7 +1923,8 @@ private final void startActivityLocked(ActivityRecord r, boolean newTask,
19161923 // If this is the first activity, don't do any fancy animations,
19171924 // because there is nothing for it to animate on top of.
19181925 mService .mWindowManager .addAppToken (addPos , r .appToken , r .task .taskId ,
1919- r .info .screenOrientation , r .fullscreen );
1926+ r .info .screenOrientation , r .fullscreen ,
1927+ (r .info .flags & ActivityInfo .FLAG_SHOW_ON_LOCK_SCREEN ) != 0 );
19201928 ActivityOptions .abort (options );
19211929 }
19221930 if (VALIDATE_TOKENS ) {
@@ -2624,7 +2632,6 @@ final int startActivityUncheckedLocked(ActivityRecord r,
26242632 Bundle options ) {
26252633 final Intent intent = r .intent ;
26262634 final int callingUid = r .launchedFromUid ;
2627- final int userId = r .userId ;
26282635
26292636 int launchFlags = intent .getFlags ();
26302637
0 commit comments