Loading services/core/java/com/android/server/am/ActivityStack.java +29 −3 Original line number Diff line number Diff line Loading @@ -1677,7 +1677,33 @@ final class ActivityStack { + " behindFullscreenActivity=" + behindFullscreenActivity); // At this point, nothing else needs to be shown in this task. behindFullscreenActivity = true; } else if (!isHomeStack() && r.frontOfTask && task.isOverHomeStack()) { } else if (isHomeStack()) { if (r.isHomeActivity()) { if (DEBUG_VISIBILITY) Slog.v(TAG_VISIBILITY, "Home activity: at " + r + " stackInvisible=" + stackInvisible + " behindFullscreenActivity=" + behindFullscreenActivity); // No other activity in the home stack should be visible behind the home activity. // Home activities is usually a translucent activity with the wallpaper behind them. // However, when they don't have the wallpaper behind them, we want to show // activities in the next application stack behind them vs. another activity in the // home stack like recents. behindFullscreenActivity = true; } else if (r.isRecentsActivity() && task.getTaskToReturnTo() == APPLICATION_ACTIVITY_TYPE) { if (DEBUG_VISIBILITY) Slog.v(TAG_VISIBILITY, "Recents activity returning to app: at " + r + " stackInvisible=" + stackInvisible + " behindFullscreenActivity=" + behindFullscreenActivity); // We don't want any other activities in the home stack visible if the recents // activity is going to be returning to an application activity type. // We do this to preserve the visible order the user used to get into the recents // activity. The recents activity is normally translucent and if it doesn't have // the wallpaper behind it the next activity in the home stack shouldn't be visible // when the home stack is brought to the front to display the recents activity from // an app. behindFullscreenActivity = true; } } else if (r.frontOfTask && task.isOverHomeStack()) { if (DEBUG_VISIBILITY) Slog.v(TAG_VISIBILITY, "Showing home: at " + r + " stackInvisible=" + stackInvisible + " behindFullscreenActivity=" + behindFullscreenActivity); Loading services/core/java/com/android/server/am/ActivityStarter.java +21 −11 Original line number Diff line number Diff line Loading @@ -48,6 +48,7 @@ import static com.android.server.am.ActivityManagerDebugConfig.POSTFIX_USER_LEAV import static com.android.server.am.ActivityManagerDebugConfig.TAG_AM; import static com.android.server.am.ActivityManagerDebugConfig.TAG_WITH_CLASS_NAME; import static com.android.server.am.ActivityManagerService.ANIMATE; import static com.android.server.am.ActivityRecord.APPLICATION_ACTIVITY_TYPE; import static com.android.server.am.ActivityRecord.HOME_ACTIVITY_TYPE; import static com.android.server.am.ActivityRecord.RECENTS_ACTIVITY_TYPE; import static com.android.server.am.ActivityStack.ActivityState.RESUMED; Loading Loading @@ -941,12 +942,8 @@ class ActivityStarter { Slog.e(TAG, "Attempted Lock Task Mode violation mStartActivity=" + mStartActivity); return START_RETURN_LOCK_TASK_MODE_VIOLATION; } if (!mMovedHome && (mLaunchFlags & (FLAG_ACTIVITY_NEW_TASK | FLAG_ACTIVITY_TASK_ON_HOME)) == (FLAG_ACTIVITY_NEW_TASK | FLAG_ACTIVITY_TASK_ON_HOME)) { // Caller wants to appear on home activity, so before starting // their own activity we will bring home to the front. mStartActivity.task.setTaskToReturnTo(HOME_ACTIVITY_TYPE); if (!mMovedHome) { updateTaskReturnToType(mStartActivity.task, mLaunchFlags, topStack); } } else if (mSourceRecord != null) { if (mSupervisor.isLockTaskModeViolation(mSourceRecord.task)) { Loading Loading @@ -1287,11 +1284,7 @@ class ActivityStarter { mOptions, mStartActivity.appTimeTracker, "bringingFoundTaskToFront"); mMovedToFront = true; } if ((mLaunchFlags & (FLAG_ACTIVITY_NEW_TASK | FLAG_ACTIVITY_TASK_ON_HOME)) == (FLAG_ACTIVITY_NEW_TASK | FLAG_ACTIVITY_TASK_ON_HOME)) { // Caller wants to appear on home activity. intentActivity.task.setTaskToReturnTo(HOME_ACTIVITY_TYPE); } updateTaskReturnToType(intentActivity.task, mLaunchFlags, focusStack); mOptions = null; } } Loading @@ -1308,6 +1301,23 @@ class ActivityStarter { return intentActivity; } private void updateTaskReturnToType( TaskRecord task, int launchFlags, ActivityStack focusedStack) { if ((launchFlags & (FLAG_ACTIVITY_NEW_TASK | FLAG_ACTIVITY_TASK_ON_HOME)) == (FLAG_ACTIVITY_NEW_TASK | FLAG_ACTIVITY_TASK_ON_HOME)) { // Caller wants to appear on home activity. task.setTaskToReturnTo(HOME_ACTIVITY_TYPE); return; } else if (focusedStack == null || focusedStack.mStackId == HOME_STACK_ID) { // Task will be launched over the home stack, so return home. task.setTaskToReturnTo(HOME_ACTIVITY_TYPE); return; } // Else we are coming from an application stack so return to an application. task.setTaskToReturnTo(APPLICATION_ACTIVITY_TYPE); } private void setTaskFromIntentActivity(ActivityRecord intentActivity) { if ((mLaunchFlags & (FLAG_ACTIVITY_NEW_TASK | FLAG_ACTIVITY_CLEAR_TASK)) == (FLAG_ACTIVITY_NEW_TASK | FLAG_ACTIVITY_CLEAR_TASK)) { Loading services/core/java/com/android/server/am/TaskRecord.java +2 −4 Original line number Diff line number Diff line Loading @@ -128,8 +128,6 @@ final class TaskRecord { private static final String TASK_THUMBNAIL_SUFFIX = "_task_thumbnail"; static final boolean IGNORE_RETURN_TO_RECENTS = true; static final int INVALID_TASK_ID = -1; final int taskId; // Unique identifier for this task. Loading Loading @@ -459,7 +457,7 @@ final class TaskRecord { } void setTaskToReturnTo(int taskToReturnTo) { mTaskToReturnTo = (IGNORE_RETURN_TO_RECENTS && taskToReturnTo == RECENTS_ACTIVITY_TYPE) mTaskToReturnTo = (taskToReturnTo == RECENTS_ACTIVITY_TYPE) ? HOME_ACTIVITY_TYPE : taskToReturnTo; } Loading Loading
services/core/java/com/android/server/am/ActivityStack.java +29 −3 Original line number Diff line number Diff line Loading @@ -1677,7 +1677,33 @@ final class ActivityStack { + " behindFullscreenActivity=" + behindFullscreenActivity); // At this point, nothing else needs to be shown in this task. behindFullscreenActivity = true; } else if (!isHomeStack() && r.frontOfTask && task.isOverHomeStack()) { } else if (isHomeStack()) { if (r.isHomeActivity()) { if (DEBUG_VISIBILITY) Slog.v(TAG_VISIBILITY, "Home activity: at " + r + " stackInvisible=" + stackInvisible + " behindFullscreenActivity=" + behindFullscreenActivity); // No other activity in the home stack should be visible behind the home activity. // Home activities is usually a translucent activity with the wallpaper behind them. // However, when they don't have the wallpaper behind them, we want to show // activities in the next application stack behind them vs. another activity in the // home stack like recents. behindFullscreenActivity = true; } else if (r.isRecentsActivity() && task.getTaskToReturnTo() == APPLICATION_ACTIVITY_TYPE) { if (DEBUG_VISIBILITY) Slog.v(TAG_VISIBILITY, "Recents activity returning to app: at " + r + " stackInvisible=" + stackInvisible + " behindFullscreenActivity=" + behindFullscreenActivity); // We don't want any other activities in the home stack visible if the recents // activity is going to be returning to an application activity type. // We do this to preserve the visible order the user used to get into the recents // activity. The recents activity is normally translucent and if it doesn't have // the wallpaper behind it the next activity in the home stack shouldn't be visible // when the home stack is brought to the front to display the recents activity from // an app. behindFullscreenActivity = true; } } else if (r.frontOfTask && task.isOverHomeStack()) { if (DEBUG_VISIBILITY) Slog.v(TAG_VISIBILITY, "Showing home: at " + r + " stackInvisible=" + stackInvisible + " behindFullscreenActivity=" + behindFullscreenActivity); Loading
services/core/java/com/android/server/am/ActivityStarter.java +21 −11 Original line number Diff line number Diff line Loading @@ -48,6 +48,7 @@ import static com.android.server.am.ActivityManagerDebugConfig.POSTFIX_USER_LEAV import static com.android.server.am.ActivityManagerDebugConfig.TAG_AM; import static com.android.server.am.ActivityManagerDebugConfig.TAG_WITH_CLASS_NAME; import static com.android.server.am.ActivityManagerService.ANIMATE; import static com.android.server.am.ActivityRecord.APPLICATION_ACTIVITY_TYPE; import static com.android.server.am.ActivityRecord.HOME_ACTIVITY_TYPE; import static com.android.server.am.ActivityRecord.RECENTS_ACTIVITY_TYPE; import static com.android.server.am.ActivityStack.ActivityState.RESUMED; Loading Loading @@ -941,12 +942,8 @@ class ActivityStarter { Slog.e(TAG, "Attempted Lock Task Mode violation mStartActivity=" + mStartActivity); return START_RETURN_LOCK_TASK_MODE_VIOLATION; } if (!mMovedHome && (mLaunchFlags & (FLAG_ACTIVITY_NEW_TASK | FLAG_ACTIVITY_TASK_ON_HOME)) == (FLAG_ACTIVITY_NEW_TASK | FLAG_ACTIVITY_TASK_ON_HOME)) { // Caller wants to appear on home activity, so before starting // their own activity we will bring home to the front. mStartActivity.task.setTaskToReturnTo(HOME_ACTIVITY_TYPE); if (!mMovedHome) { updateTaskReturnToType(mStartActivity.task, mLaunchFlags, topStack); } } else if (mSourceRecord != null) { if (mSupervisor.isLockTaskModeViolation(mSourceRecord.task)) { Loading Loading @@ -1287,11 +1284,7 @@ class ActivityStarter { mOptions, mStartActivity.appTimeTracker, "bringingFoundTaskToFront"); mMovedToFront = true; } if ((mLaunchFlags & (FLAG_ACTIVITY_NEW_TASK | FLAG_ACTIVITY_TASK_ON_HOME)) == (FLAG_ACTIVITY_NEW_TASK | FLAG_ACTIVITY_TASK_ON_HOME)) { // Caller wants to appear on home activity. intentActivity.task.setTaskToReturnTo(HOME_ACTIVITY_TYPE); } updateTaskReturnToType(intentActivity.task, mLaunchFlags, focusStack); mOptions = null; } } Loading @@ -1308,6 +1301,23 @@ class ActivityStarter { return intentActivity; } private void updateTaskReturnToType( TaskRecord task, int launchFlags, ActivityStack focusedStack) { if ((launchFlags & (FLAG_ACTIVITY_NEW_TASK | FLAG_ACTIVITY_TASK_ON_HOME)) == (FLAG_ACTIVITY_NEW_TASK | FLAG_ACTIVITY_TASK_ON_HOME)) { // Caller wants to appear on home activity. task.setTaskToReturnTo(HOME_ACTIVITY_TYPE); return; } else if (focusedStack == null || focusedStack.mStackId == HOME_STACK_ID) { // Task will be launched over the home stack, so return home. task.setTaskToReturnTo(HOME_ACTIVITY_TYPE); return; } // Else we are coming from an application stack so return to an application. task.setTaskToReturnTo(APPLICATION_ACTIVITY_TYPE); } private void setTaskFromIntentActivity(ActivityRecord intentActivity) { if ((mLaunchFlags & (FLAG_ACTIVITY_NEW_TASK | FLAG_ACTIVITY_CLEAR_TASK)) == (FLAG_ACTIVITY_NEW_TASK | FLAG_ACTIVITY_CLEAR_TASK)) { Loading
services/core/java/com/android/server/am/TaskRecord.java +2 −4 Original line number Diff line number Diff line Loading @@ -128,8 +128,6 @@ final class TaskRecord { private static final String TASK_THUMBNAIL_SUFFIX = "_task_thumbnail"; static final boolean IGNORE_RETURN_TO_RECENTS = true; static final int INVALID_TASK_ID = -1; final int taskId; // Unique identifier for this task. Loading Loading @@ -459,7 +457,7 @@ final class TaskRecord { } void setTaskToReturnTo(int taskToReturnTo) { mTaskToReturnTo = (IGNORE_RETURN_TO_RECENTS && taskToReturnTo == RECENTS_ACTIVITY_TYPE) mTaskToReturnTo = (taskToReturnTo == RECENTS_ACTIVITY_TYPE) ? HOME_ACTIVITY_TYPE : taskToReturnTo; } Loading