Merge "Support to transfer freeform task into split screen" into sc-v2-dev am: 7d7857b2c5

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/16170298

Change-Id: Ibb058b437f1fcea9ba7f84229c21b1e2324f2431
This commit is contained in:
Jerry Chang
2021-11-03 00:55:10 +00:00
committed by Automerger Merge Worker

View File

@@ -16,6 +16,7 @@
package com.android.wm.shell.freeform; package com.android.wm.shell.freeform;
import static android.app.WindowConfiguration.WINDOWING_MODE_UNDEFINED;
import static android.content.pm.PackageManager.FEATURE_FREEFORM_WINDOW_MANAGEMENT; import static android.content.pm.PackageManager.FEATURE_FREEFORM_WINDOW_MANAGEMENT;
import static android.provider.Settings.Global.DEVELOPMENT_ENABLE_FREEFORM_WINDOWS_SUPPORT; import static android.provider.Settings.Global.DEVELOPMENT_ENABLE_FREEFORM_WINDOWS_SUPPORT;
@@ -27,6 +28,7 @@ import android.provider.Settings;
import android.util.Slog; import android.util.Slog;
import android.util.SparseArray; import android.util.SparseArray;
import android.view.SurfaceControl; import android.view.SurfaceControl;
import android.window.WindowContainerTransaction;
import com.android.internal.protolog.common.ProtoLog; import com.android.internal.protolog.common.ProtoLog;
import com.android.wm.shell.ShellTaskOrganizer; import com.android.wm.shell.ShellTaskOrganizer;
@@ -83,6 +85,13 @@ public class FreeformTaskListener implements ShellTaskOrganizer.TaskListener {
Slog.e(TAG, "Task already vanished: #" + taskInfo.taskId); Slog.e(TAG, "Task already vanished: #" + taskInfo.taskId);
return; return;
} }
// Clears windowing mode and window bounds to let the task inherits from its new parent.
final WindowContainerTransaction wct = new WindowContainerTransaction();
wct.setBounds(taskInfo.token, null)
.setWindowingMode(taskInfo.token, WINDOWING_MODE_UNDEFINED);
mSyncQueue.queue(wct);
ProtoLog.v(ShellProtoLogGroup.WM_SHELL_TASK_ORG, "Freeform Task Vanished: #%d", ProtoLog.v(ShellProtoLogGroup.WM_SHELL_TASK_ORG, "Freeform Task Vanished: #%d",
taskInfo.taskId); taskInfo.taskId);
mTasks.remove(taskInfo.taskId); mTasks.remove(taskInfo.taskId);