Remove redundant primary-stack movement in start-from-recents
The createStack routines used by startActivity already handle
the case of converting WINDOWING_MODE_PRIMARY into move-to-
primary root-task. Doing that work in startActivityFromRecents
was redundant.
Additionally, because the recents version was executing before
the normal activity-start logic, it was making the new
activity visible before postStartActivityProcessing which is
supposed to run before the activity-start happens. It was
effectively starting the activity twice which is wrong and
also wasteful.
Bug: 154575664
Test: Alternate launch activity from recents into primary and
expand it to fullscreen repeatedly.
Change-Id: I5c6341f8589e8ac3ddd4afb728efd05bd9445945
This commit is contained in:
@@ -69,7 +69,6 @@ import static com.android.server.wm.ActivityTaskManagerDebugConfig.TAG_WITH_CLAS
|
||||
import static com.android.server.wm.ActivityTaskManagerService.ANIMATE;
|
||||
import static com.android.server.wm.ActivityTaskManagerService.H.FIRST_SUPERVISOR_STACK_MSG;
|
||||
import static com.android.server.wm.ActivityTaskManagerService.RELAUNCH_REASON_NONE;
|
||||
import static com.android.server.wm.RootWindowContainer.MATCH_TASK_IN_STACKS_ONLY;
|
||||
import static com.android.server.wm.RootWindowContainer.MATCH_TASK_IN_STACKS_OR_RECENT_TASKS;
|
||||
import static com.android.server.wm.RootWindowContainer.MATCH_TASK_IN_STACKS_OR_RECENT_TASKS_AND_RESTORE;
|
||||
import static com.android.server.wm.RootWindowContainer.TAG_STATES;
|
||||
@@ -125,7 +124,6 @@ import android.os.UserManager;
|
||||
import android.os.WorkSource;
|
||||
import android.provider.MediaStore;
|
||||
import android.util.ArrayMap;
|
||||
import android.util.ArraySet;
|
||||
import android.util.MergedConfiguration;
|
||||
import android.util.Slog;
|
||||
import android.util.SparseArray;
|
||||
@@ -364,11 +362,6 @@ public class ActivityStackSupervisor implements RecentTasks.Callbacks {
|
||||
*/
|
||||
boolean mAppVisibilitiesChangedSinceLastPause;
|
||||
|
||||
/**
|
||||
* Set of tasks that are in resizing mode during an app transition to fill the "void".
|
||||
*/
|
||||
private final ArraySet<Integer> mResizingTasksDuringAnimation = new ArraySet<>();
|
||||
|
||||
private KeyguardController mKeyguardController;
|
||||
|
||||
private PowerManager mPowerManager;
|
||||
@@ -1415,18 +1408,6 @@ public class ActivityStackSupervisor implements RecentTasks.Callbacks {
|
||||
return mLaunchParamsController;
|
||||
}
|
||||
|
||||
void notifyAppTransitionDone() {
|
||||
for (int i = mResizingTasksDuringAnimation.size() - 1; i >= 0; i--) {
|
||||
final int taskId = mResizingTasksDuringAnimation.valueAt(i);
|
||||
final Task task =
|
||||
mRootWindowContainer.anyTaskForId(taskId, MATCH_TASK_IN_STACKS_ONLY);
|
||||
if (task != null) {
|
||||
task.setTaskDockedResizing(false);
|
||||
}
|
||||
}
|
||||
mResizingTasksDuringAnimation.clear();
|
||||
}
|
||||
|
||||
void setSplitScreenResizing(boolean resizing) {
|
||||
if (resizing == mDockedStackResizing) {
|
||||
return;
|
||||
@@ -2460,16 +2441,6 @@ public class ActivityStackSupervisor implements RecentTasks.Callbacks {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Puts a task into resizing mode during the next app transition.
|
||||
*
|
||||
* @param task The task to put into resizing mode
|
||||
*/
|
||||
void setResizingDuringAnimation(Task task) {
|
||||
mResizingTasksDuringAnimation.add(task.mTaskId);
|
||||
task.setTaskDockedResizing(true);
|
||||
}
|
||||
|
||||
int startActivityFromRecents(int callingPid, int callingUid, int taskId,
|
||||
SafeActivityOptions options) {
|
||||
Task task = null;
|
||||
@@ -2497,22 +2468,12 @@ public class ActivityStackSupervisor implements RecentTasks.Callbacks {
|
||||
|
||||
mService.deferWindowLayout();
|
||||
try {
|
||||
if (windowingMode == WINDOWING_MODE_SPLIT_SCREEN_PRIMARY) {
|
||||
// TODO(task-hierarchy): Remove when tiles are in hierarchy.
|
||||
// Unset launching windowing mode to prevent creating split-screen-primary stack
|
||||
// in RWC#anyTaskForId() below.
|
||||
activityOptions.setLaunchWindowingMode(WINDOWING_MODE_UNDEFINED);
|
||||
}
|
||||
|
||||
task = mRootWindowContainer.anyTaskForId(taskId,
|
||||
MATCH_TASK_IN_STACKS_OR_RECENT_TASKS_AND_RESTORE, activityOptions, ON_TOP);
|
||||
if (task == null) {
|
||||
mWindowManager.executeAppTransition();
|
||||
throw new IllegalArgumentException(
|
||||
"startActivityFromRecents: Task " + taskId + " not found.");
|
||||
} else if (windowingMode == WINDOWING_MODE_SPLIT_SCREEN_PRIMARY
|
||||
&& task.getWindowingMode() != windowingMode) {
|
||||
mService.moveTaskToSplitScreenPrimaryTask(task, true /* toTop */);
|
||||
}
|
||||
|
||||
if (windowingMode != WINDOWING_MODE_SPLIT_SCREEN_PRIMARY) {
|
||||
@@ -2561,12 +2522,6 @@ public class ActivityStackSupervisor implements RecentTasks.Callbacks {
|
||||
false /* validateIncomingUser */, null /* originatingPendingIntent */,
|
||||
false /* allowBackgroundActivityStart */);
|
||||
} finally {
|
||||
if (windowingMode == WINDOWING_MODE_SPLIT_SCREEN_PRIMARY && task != null) {
|
||||
// If we are launching the task in the docked stack, put it into resizing mode so
|
||||
// the window renders full-screen with the background filling the void. Also only
|
||||
// call this at the end to make sure that tasks exists on the window manager side.
|
||||
setResizingDuringAnimation(task);
|
||||
}
|
||||
mService.continueWindowLayout();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -151,17 +151,6 @@ public abstract class ActivityTaskManagerInternal {
|
||||
IVoiceInteractionSession mSession,
|
||||
IVoiceInteractor mInteractor);
|
||||
|
||||
/**
|
||||
* Callback for window manager to let activity manager know that the app transition was
|
||||
* cancelled.
|
||||
*/
|
||||
public abstract void notifyAppTransitionCancelled();
|
||||
|
||||
/**
|
||||
* Callback for window manager to let activity manager know that the app transition is finished.
|
||||
*/
|
||||
public abstract void notifyAppTransitionFinished();
|
||||
|
||||
/**
|
||||
* Returns the top activity from each of the currently visible stacks. The first entry will be
|
||||
* the focused activity.
|
||||
|
||||
@@ -6078,20 +6078,6 @@ public class ActivityTaskManagerService extends IActivityTaskManager.Stub {
|
||||
mTaskChangeNotificationController.notifySingleTaskDisplayDrawn(displayId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void notifyAppTransitionFinished() {
|
||||
synchronized (mGlobalLock) {
|
||||
mStackSupervisor.notifyAppTransitionDone();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void notifyAppTransitionCancelled() {
|
||||
synchronized (mGlobalLock) {
|
||||
mStackSupervisor.notifyAppTransitionDone();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<IBinder> getTopVisibleActivities() {
|
||||
synchronized (mGlobalLock) {
|
||||
|
||||
@@ -82,7 +82,6 @@ import static com.android.server.wm.ActivityTaskManagerDebugConfig.POSTFIX_TASKS
|
||||
import static com.android.server.wm.ActivityTaskManagerDebugConfig.TAG_ATM;
|
||||
import static com.android.server.wm.ActivityTaskManagerDebugConfig.TAG_WITH_CLASS_NAME;
|
||||
import static com.android.server.wm.ActivityTaskManagerService.TAG_STACK;
|
||||
import static com.android.server.wm.DragResizeMode.DRAG_RESIZE_MODE_DOCKED_DIVIDER;
|
||||
import static com.android.server.wm.IdentifierProto.HASH_CODE;
|
||||
import static com.android.server.wm.IdentifierProto.TITLE;
|
||||
import static com.android.server.wm.IdentifierProto.USER_ID;
|
||||
@@ -3059,15 +3058,6 @@ class Task extends WindowContainer<WindowContainer> {
|
||||
return mDragResizeMode;
|
||||
}
|
||||
|
||||
/**
|
||||
* Puts this task into docked drag resizing mode. See {@link DragResizeMode}.
|
||||
*
|
||||
* @param resizing Whether to put the task into drag resize mode.
|
||||
*/
|
||||
public void setTaskDockedResizing(boolean resizing) {
|
||||
setDragResizing(resizing, DRAG_RESIZE_MODE_DOCKED_DIVIDER);
|
||||
}
|
||||
|
||||
void adjustBoundsForDisplayChangeIfNeeded(final DisplayContent displayContent) {
|
||||
if (displayContent == null) {
|
||||
return;
|
||||
|
||||
@@ -1064,12 +1064,10 @@ public class WindowManagerService extends IWindowManager.Stub
|
||||
|
||||
@Override
|
||||
public void onAppTransitionCancelledLocked(int transit) {
|
||||
mAtmInternal.notifyAppTransitionCancelled();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAppTransitionFinishedLocked(IBinder token) {
|
||||
mAtmInternal.notifyAppTransitionFinished();
|
||||
final ActivityRecord atoken = mRoot.getActivityRecord(token);
|
||||
if (atoken == null) {
|
||||
return;
|
||||
|
||||
Reference in New Issue
Block a user