Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit bae20314 authored by Android Build Coastguard Worker's avatar Android Build Coastguard Worker
Browse files

Merge cherrypicks of ['googleplex-android-review.googlesource.com/31182058',...

Merge cherrypicks of ['googleplex-android-review.googlesource.com/31182058', 'googleplex-android-review.googlesource.com/31179613', 'googleplex-android-review.googlesource.com/31179654', 'googleplex-android-review.googlesource.com/31179655'] into 25Q1-release.

Change-Id: Ieac5e6801297c32870bf75b38128bfc66b6b2bc8
parents efc0f876 12de0a9e
Loading
Loading
Loading
Loading
+7 −2
Original line number Diff line number Diff line
@@ -332,7 +332,9 @@ public class DragAndDropController implements RemoteCallable<DragAndDropControll
            dragSession = new DragSession(ActivityTaskManager.getInstance(),
                    mDisplayController.getDisplayLayout(displayId), event.getClipData(),
                    event.getDragFlags());
            dragSession.initialize();
            // Only update the running task for now to determine if we should defer to desktop to
            // handle the drag
            dragSession.updateRunningTask();
            final ActivityManager.RunningTaskInfo taskInfo = dragSession.runningTaskInfo;
            // Desktop tasks will have their own drag handling.
            final boolean isDesktopDrag = taskInfo != null && taskInfo.isFreeform()
@@ -340,7 +342,8 @@ public class DragAndDropController implements RemoteCallable<DragAndDropControll
            pd.isHandlingDrag = DragUtils.canHandleDrag(event) && !isDesktopDrag;
            ProtoLog.v(ShellProtoLogGroup.WM_SHELL_DRAG_AND_DROP,
                    "Clip description: handlingDrag=%b itemCount=%d mimeTypes=%s flags=%s",
                    pd.isHandlingDrag, event.getClipData().getItemCount(),
                    pd.isHandlingDrag,
                    event.getClipData() != null ? event.getClipData().getItemCount() : -1,
                    DragUtils.getMimeTypesConcatenated(description),
                    DragUtils.dragFlagsToString(event.getDragFlags()));
        }
@@ -355,6 +358,8 @@ public class DragAndDropController implements RemoteCallable<DragAndDropControll
                    Slog.w(TAG, "Unexpected drag start during an active drag");
                    return false;
                }
                // Only initialize the session after we've checked that we're handling the drag
                dragSession.initialize(true /* skipUpdateRunningTask */);
                pd.dragSession = dragSession;
                pd.activeDragCount++;
                pd.dragLayout.prepare(pd.dragSession, mLogger.logStart(pd.dragSession));
+6 −5
Original line number Diff line number Diff line
@@ -29,7 +29,6 @@ import android.content.ClipData;
import android.content.ClipDescription;
import android.content.Intent;
import android.content.pm.ActivityInfo;
import android.os.PersistableBundle;

import androidx.annotation.Nullable;

@@ -44,6 +43,7 @@ import java.util.List;
 */
public class DragSession {
    private final ActivityTaskManager mActivityTaskManager;
    @Nullable
    private final ClipData mInitialDragData;
    private final int mInitialDragFlags;

@@ -66,7 +66,7 @@ public class DragSession {
    @WindowConfiguration.ActivityType
    int runningTaskActType = ACTIVITY_TYPE_STANDARD;
    boolean dragItemSupportsSplitscreen;
    int hideDragSourceTaskId = -1;
    final int hideDragSourceTaskId;

    DragSession(ActivityTaskManager activityTaskManager,
            DisplayLayout dispLayout, ClipData data, int dragFlags) {
@@ -83,7 +83,6 @@ public class DragSession {

    /**
     * Returns the clip description associated with the drag.
     * @return
     */
    ClipDescription getClipDescription() {
        return mInitialDragData.getDescription();
@@ -125,8 +124,10 @@ public class DragSession {
    /**
     * Updates the session data based on the current state of the system at the start of the drag.
     */
    void initialize() {
    void initialize(boolean skipUpdateRunningTask) {
        if (!skipUpdateRunningTask) {
            updateRunningTask();
        }

        activityInfo = mInitialDragData.getItemAt(0).getActivityInfo();
        // TODO: This should technically check & respect config_supportsNonResizableMultiWindow
+1 −1
Original line number Diff line number Diff line
@@ -49,7 +49,7 @@ public class DragUtils {
     * Returns whether we can handle this particular drag.
     */
    public static boolean canHandleDrag(DragEvent event) {
        if (event.getClipData().getItemCount() <= 0) {
        if (event.getClipData() == null || event.getClipData().getItemCount() <= 0) {
            // No clip data, ignore this drag
            return false;
        }
+2 −1
Original line number Diff line number Diff line
@@ -2155,7 +2155,8 @@ public class StageCoordinator implements SplitLayout.SplitLayoutHandler,
        wct.setForceTranslucent(mRootTaskInfo.token, translucent);
    }

    /** Callback when split roots visiblility changed. */
    /** Callback when split roots visiblility changed.
     * NOTICE: This only be called on legacy transition. */
    @Override
    public void onStageVisibilityChanged(StageTaskListener stageListener) {
        // If split didn't active, just ignore this callback because we should already did these
+3 −11
Original line number Diff line number Diff line
@@ -240,20 +240,12 @@ public class StageTaskListener implements ShellTaskOrganizer.TaskListener {
    @Override
    @CallSuper
    public void onTaskInfoChanged(ActivityManager.RunningTaskInfo taskInfo) {
        ProtoLog.d(WM_SHELL_SPLIT_SCREEN,
                "onTaskInfoChanged: taskId=%d vis=%b reqVis=%b baseAct=%s stageId=%s",
                taskInfo.taskId, taskInfo.isVisible, taskInfo.isVisibleRequested,
                taskInfo.baseActivity, stageTypeToString(mId));
        ProtoLog.d(WM_SHELL_SPLIT_SCREEN, "onTaskInfoChanged: taskId=%d taskAct=%s "
                        + "stageId=%s",
                taskInfo.taskId, taskInfo.baseActivity, stageTypeToString(mId));
        mWindowDecorViewModel.ifPresent(viewModel -> viewModel.onTaskInfoChanged(taskInfo));
        if (mRootTaskInfo.taskId == taskInfo.taskId) {
            mRootTaskInfo = taskInfo;
            boolean isVisible = taskInfo.isVisible && taskInfo.isVisibleRequested;
            if (mVisible != isVisible) {
                ProtoLog.d(WM_SHELL_SPLIT_SCREEN, "onTaskInfoChanged: currentVis=%b newVis=%b",
                        mVisible, isVisible);
                mVisible = isVisible;
                mCallbacks.onStageVisibilityChanged(this);
            }
        } else if (taskInfo.parentTaskId == mRootTaskInfo.taskId) {
            if (!taskInfo.supportsMultiWindow
                    || !ArrayUtils.contains(CONTROLLED_ACTIVITY_TYPES, taskInfo.getActivityType())
Loading