Merge "Ignore task view task when loadAnimation" into tm-qpr-dev

This commit is contained in:
Tony Huang
2023-01-11 05:48:16 +00:00
committed by Android (Google) Code Review
7 changed files with 62 additions and 14 deletions

View File

@@ -40,7 +40,8 @@ interface ITaskOrganizerController {
void unregisterTaskOrganizer(ITaskOrganizer organizer);
/** Creates a persistent root task in WM for a particular windowing-mode. */
void createRootTask(int displayId, int windowingMode, IBinder launchCookie);
void createRootTask(int displayId, int windowingMode, IBinder launchCookie,
boolean removeWithTaskOrganizer);
/** Deletes a persistent root task in WM */
boolean deleteRootTask(in WindowContainerToken task);

View File

@@ -146,6 +146,26 @@ public class TaskOrganizer extends WindowOrganizer {
@BinderThread
public void onImeDrawnOnTask(int taskId) {}
/**
* Creates a persistent root task in WM for a particular windowing-mode.
* @param displayId The display to create the root task on.
* @param windowingMode Windowing mode to put the root task in.
* @param launchCookie Launch cookie to associate with the task so that is can be identified
* when the {@link ITaskOrganizer#onTaskAppeared} callback is called.
* @param removeWithTaskOrganizer True if this task should be removed when organizer destroyed.
* @hide
*/
@RequiresPermission(android.Manifest.permission.MANAGE_ACTIVITY_TASKS)
public void createRootTask(int displayId, int windowingMode, @Nullable IBinder launchCookie,
boolean removeWithTaskOrganizer) {
try {
mTaskOrganizerController.createRootTask(displayId, windowingMode, launchCookie,
removeWithTaskOrganizer);
} catch (RemoteException e) {
throw e.rethrowFromSystemServer();
}
}
/**
* Creates a persistent root task in WM for a particular windowing-mode.
* @param displayId The display to create the root task on.
@@ -156,11 +176,7 @@ public class TaskOrganizer extends WindowOrganizer {
@RequiresPermission(android.Manifest.permission.MANAGE_ACTIVITY_TASKS)
@Nullable
public void createRootTask(int displayId, int windowingMode, @Nullable IBinder launchCookie) {
try {
mTaskOrganizerController.createRootTask(displayId, windowingMode, launchCookie);
} catch (RemoteException e) {
throw e.rethrowFromSystemServer();
}
createRootTask(displayId, windowingMode, launchCookie, false /* removeWithTaskOrganizer */);
}
/** Deletes a persistent root task in WM */

View File

@@ -256,12 +256,30 @@ public class ShellTaskOrganizer extends TaskOrganizer implements
}
}
/**
* Creates a persistent root task in WM for a particular windowing-mode.
* @param displayId The display to create the root task on.
* @param windowingMode Windowing mode to put the root task in.
* @param listener The listener to get the created task callback.
*/
public void createRootTask(int displayId, int windowingMode, TaskListener listener) {
ProtoLog.v(WM_SHELL_TASK_ORG, "createRootTask() displayId=%d winMode=%d listener=%s",
createRootTask(displayId, windowingMode, listener, false /* removeWithTaskOrganizer */);
}
/**
* Creates a persistent root task in WM for a particular windowing-mode.
* @param displayId The display to create the root task on.
* @param windowingMode Windowing mode to put the root task in.
* @param listener The listener to get the created task callback.
* @param removeWithTaskOrganizer True if this task should be removed when organizer destroyed.
*/
public void createRootTask(int displayId, int windowingMode, TaskListener listener,
boolean removeWithTaskOrganizer) {
ProtoLog.v(WM_SHELL_TASK_ORG, "createRootTask() displayId=%d winMode=%d listener=%s" ,
displayId, windowingMode, listener.toString());
final IBinder cookie = new Binder();
setPendingLaunchCookieListener(cookie, listener);
super.createRootTask(displayId, windowingMode, cookie);
super.createRootTask(displayId, windowingMode, cookie, removeWithTaskOrganizer);
}
/**

View File

@@ -892,7 +892,7 @@ public class AppTransitionController {
*
* TODO(b/213312721): Remove this predicate and its callers once ShellTransition is enabled.
*/
private static boolean isTaskViewTask(WindowContainer wc) {
static boolean isTaskViewTask(WindowContainer wc) {
// We use Task#mRemoveWithTaskOrganizer to identify an embedded Task, but this is a hack and
// it is not guaranteed to work this logic in the future version.
return wc instanceof Task && ((Task) wc).mRemoveWithTaskOrganizer;

View File

@@ -6411,6 +6411,11 @@ class Task extends TaskFragment {
return this;
}
Builder setRemoveWithTaskOrganizer(boolean removeWithTaskOrganizer) {
mRemoveWithTaskOrganizer = removeWithTaskOrganizer;
return this;
}
private Builder setUserId(int userId) {
mUserId = userId;
return this;
@@ -6608,7 +6613,7 @@ class Task extends TaskFragment {
mCallingPackage = mActivityInfo.packageName;
mResizeMode = mActivityInfo.resizeMode;
mSupportsPictureInPicture = mActivityInfo.supportsPictureInPicture();
if (mActivityOptions != null) {
if (!mRemoveWithTaskOrganizer && mActivityOptions != null) {
mRemoveWithTaskOrganizer = mActivityOptions.getRemoveWithTaskOranizer();
}

View File

@@ -783,7 +783,8 @@ class TaskOrganizerController extends ITaskOrganizerController.Stub {
}
@Override
public void createRootTask(int displayId, int windowingMode, @Nullable IBinder launchCookie) {
public void createRootTask(int displayId, int windowingMode, @Nullable IBinder launchCookie,
boolean removeWithTaskOrganizer) {
enforceTaskPermission("createRootTask()");
final long origId = Binder.clearCallingIdentity();
try {
@@ -795,7 +796,7 @@ class TaskOrganizerController extends ITaskOrganizerController.Stub {
return;
}
createRootTask(display, windowingMode, launchCookie);
createRootTask(display, windowingMode, launchCookie, removeWithTaskOrganizer);
}
} finally {
Binder.restoreCallingIdentity(origId);
@@ -804,6 +805,12 @@ class TaskOrganizerController extends ITaskOrganizerController.Stub {
@VisibleForTesting
Task createRootTask(DisplayContent display, int windowingMode, @Nullable IBinder launchCookie) {
return createRootTask(display, windowingMode, launchCookie,
false /* removeWithTaskOrganizer */);
}
Task createRootTask(DisplayContent display, int windowingMode, @Nullable IBinder launchCookie,
boolean removeWithTaskOrganizer) {
ProtoLog.v(WM_DEBUG_WINDOW_ORGANIZER, "Create root task displayId=%d winMode=%d",
display.mDisplayId, windowingMode);
// We want to defer the task appear signal until the task is fully created and attached to
@@ -816,6 +823,7 @@ class TaskOrganizerController extends ITaskOrganizerController.Stub {
.setDeferTaskAppear(true)
.setLaunchCookie(launchCookie)
.setParent(display.getDefaultTaskDisplayArea())
.setRemoveWithTaskOrganizer(removeWithTaskOrganizer)
.build();
task.setDeferTaskAppear(false /* deferTaskAppear */);
return task;

View File

@@ -3197,11 +3197,11 @@ class WindowContainer<E extends WindowContainer> extends ConfigurationContainer<
private Animation loadAnimation(WindowManager.LayoutParams lp, int transit, boolean enter,
boolean isVoiceInteraction) {
if (isOrganized()
if (AppTransitionController.isTaskViewTask(this) || (isOrganized()
// TODO(b/161711458): Clean-up when moved to shell.
&& getWindowingMode() != WINDOWING_MODE_FULLSCREEN
&& getWindowingMode() != WINDOWING_MODE_FREEFORM
&& getWindowingMode() != WINDOWING_MODE_MULTI_WINDOW) {
&& getWindowingMode() != WINDOWING_MODE_MULTI_WINDOW)) {
return null;
}