@@ -422,11 +422,10 @@ public void handleMessage(Message msg) {
422422 }
423423
424424 final ActivityRecord topRunningActivityLocked (ActivityRecord notTop ) {
425- // TODO: Don't look for any tasks from other users
426425 int i = mHistory .size ()-1 ;
427426 while (i >= 0 ) {
428427 ActivityRecord r = mHistory .get (i );
429- if (!r .finishing && r != notTop ) {
428+ if (!r .finishing && r != notTop && r . userId == mCurrentUser ) {
430429 return r ;
431430 }
432431 i --;
@@ -435,11 +434,10 @@ final ActivityRecord topRunningActivityLocked(ActivityRecord notTop) {
435434 }
436435
437436 final ActivityRecord topRunningNonDelayedActivityLocked (ActivityRecord notTop ) {
438- // TODO: Don't look for any tasks from other users
439437 int i = mHistory .size ()-1 ;
440438 while (i >= 0 ) {
441439 ActivityRecord r = mHistory .get (i );
442- if (!r .finishing && !r .delayedResume && r != notTop ) {
440+ if (!r .finishing && !r .delayedResume && r != notTop && r . userId == mCurrentUser ) {
443441 return r ;
444442 }
445443 i --;
@@ -457,12 +455,12 @@ final ActivityRecord topRunningNonDelayedActivityLocked(ActivityRecord notTop) {
457455 * @return Returns the HistoryRecord of the next activity on the stack.
458456 */
459457 final ActivityRecord topRunningActivityLocked (IBinder token , int taskId ) {
460- // TODO: Don't look for any tasks from other users
461458 int i = mHistory .size ()-1 ;
462459 while (i >= 0 ) {
463460 ActivityRecord r = mHistory .get (i );
464461 // Note: the taskId check depends on real taskId fields being non-zero
465- if (!r .finishing && (token != r .appToken ) && (taskId != r .task .taskId )) {
462+ if (!r .finishing && (token != r .appToken ) && (taskId != r .task .taskId )
463+ && r .userId == mCurrentUser ) {
466464 return r ;
467465 }
468466 i --;
@@ -1400,7 +1398,7 @@ final boolean resumeTopActivityLocked(ActivityRecord prev, Bundle options) {
14001398 // Launcher...
14011399 if (mMainStack ) {
14021400 ActivityOptions .abort (options );
1403- return mService .startHomeActivityLocked (0 , null );
1401+ return mService .startHomeActivityLocked (mCurrentUser , null );
14041402 }
14051403 }
14061404
0 commit comments