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

Commit bc3901ff authored by Chris Li's avatar Chris Li Committed by Android (Google) Code Review
Browse files

Merge "Disable Bubble Task to enter PiP" into main

parents a9f71de5 43edb9e1
Loading
Loading
Loading
Loading
+9 −4
Original line number Diff line number Diff line
@@ -62,6 +62,7 @@ import android.view.accessibility.AccessibilityNodeInfo;
import android.widget.FrameLayout;
import android.widget.LinearLayout;
import android.window.ScreenCapture;
import android.window.WindowContainerToken;
import android.window.WindowContainerTransaction;

import androidx.annotation.Nullable;
@@ -303,12 +304,16 @@ public class BubbleExpandedView extends LinearLayout {
                mManager.setNoteBubbleTaskId(mBubble.getKey(), mTaskId);
            }

            if (com.android.window.flags.Flags.excludeTaskFromRecents()) {
            final TaskViewTaskController tvc = mTaskView.getController();
            final WindowContainerToken token = tvc.getTaskToken();
            final WindowContainerTransaction wct = new WindowContainerTransaction();
                wct.setTaskForceExcludedFromRecents(tvc.getTaskToken(), true /* forceExcluded */);
                tvc.getTaskOrganizer().applyTransaction(wct);
            if (com.android.window.flags.Flags.excludeTaskFromRecents()) {
                wct.setTaskForceExcludedFromRecents(token, true /* forceExcluded */);
            }
            if (com.android.window.flags.Flags.disallowBubbleToEnterPip()) {
                wct.setDisablePip(tvc.getTaskToken(), true /* disablePip */);
            }
            tvc.getTaskOrganizer().applyTransaction(wct);

            // With the task org, the taskAppeared callback will only happen once the task has
            // already drawn
+3 −0
Original line number Diff line number Diff line
@@ -139,6 +139,9 @@ class BubbleTaskStackListener(
        val wct = WindowContainerTransaction()
        wct.setTaskForceExcludedFromRecents(task.token, false /* forceExcluded */)
            .setLaunchNextToBubble(task.token, false /* launchNextToBubble */)
        if (com.android.window.flags.Flags.disallowBubbleToEnterPip()) {
            wct.setDisablePip(task.token, false /* disablePip */)
        }
        taskOrganizer.applyTransaction(wct)

        taskOrganizer.setInterceptBackPressedOnTaskRoot(task.token, false /* intercept */)
+9 −4
Original line number Diff line number Diff line
@@ -33,6 +33,7 @@ import android.graphics.Rect;
import android.util.Log;
import android.view.View;
import android.view.ViewGroup;
import android.window.WindowContainerToken;
import android.window.WindowContainerTransaction;

import androidx.annotation.Nullable;
@@ -198,12 +199,16 @@ public class BubbleTaskViewListener implements TaskView.Listener {
            mExpandedViewManager.setNoteBubbleTaskId(mBubble.getKey(), mTaskId);
        }

        if (com.android.window.flags.Flags.excludeTaskFromRecents()) {
            final TaskViewTaskController tvCtrl = mTaskView.getController();
        final TaskViewTaskController tvc = mTaskView.getController();
        final WindowContainerToken token = tvc.getTaskToken();
        final WindowContainerTransaction wct = new WindowContainerTransaction();
            wct.setTaskForceExcludedFromRecents(tvCtrl.getTaskToken(), true /* forceExcluded */);
            tvCtrl.getTaskOrganizer().applyTransaction(wct);
        if (com.android.window.flags.Flags.excludeTaskFromRecents()) {
            wct.setTaskForceExcludedFromRecents(token, true /* forceExcluded */);
        }
        if (com.android.window.flags.Flags.disallowBubbleToEnterPip()) {
            wct.setDisablePip(token, true /* disablePip */);
        }
        tvc.getTaskOrganizer().applyTransaction(wct);

        // With the task org, the taskAppeared callback will only happen once the task has
        // already drawn
+9 −0
Original line number Diff line number Diff line
@@ -299,6 +299,9 @@ public class BubbleTransitions {
            if (com.android.window.flags.Flags.excludeTaskFromRecents()) {
                wct.setTaskForceExcludedFromRecents(mTaskInfo.token, true /* forceExcluded */);
            }
            if (com.android.window.flags.Flags.disallowBubbleToEnterPip()) {
                wct.setDisablePip(mTaskInfo.token, true /* disablePip */);
            }
            wct.setWindowingMode(mTaskInfo.token, WINDOWING_MODE_MULTI_WINDOW);
            wct.setBounds(mTaskInfo.token, launchBounds);

@@ -538,6 +541,9 @@ public class BubbleTransitions {
            if (com.android.window.flags.Flags.excludeTaskFromRecents()) {
                wct.setTaskForceExcludedFromRecents(token, false /* forceExcluded */);
            }
            if (com.android.window.flags.Flags.disallowBubbleToEnterPip()) {
                wct.setDisablePip(token, false /* disablePip */);
            }
            mTaskOrganizer.setInterceptBackPressedOnTaskRoot(token, false /* intercept */);
            mTaskViewTransitions.enqueueExternal(
                    mBubble.getTaskView().getController(),
@@ -702,6 +708,9 @@ public class BubbleTransitions {
            if (com.android.window.flags.Flags.excludeTaskFromRecents()) {
                wct.setTaskForceExcludedFromRecents(token, false /* forceExcluded */);
            }
            if (com.android.window.flags.Flags.disallowBubbleToEnterPip()) {
                wct.setDisablePip(token, false /* disablePip */);
            }
            wct.setWindowingMode(token, WINDOWING_MODE_UNDEFINED);
            wct.reorder(token, /* onTop= */ true);
            wct.setHidden(token, false);
+3 −0
Original line number Diff line number Diff line
@@ -457,6 +457,9 @@ public class TaskViewTransitions implements Transitions.TransitionHandler, TaskV
        if (com.android.window.flags.Flags.excludeTaskFromRecents()) {
            wct.setTaskForceExcludedFromRecents(taskToken, false /* forceExcluded */);
        }
        if (com.android.window.flags.Flags.disallowBubbleToEnterPip()) {
            wct.setDisablePip(taskToken, false /* disablePip */);
        }
        mShellExecutor.execute(() -> {
            mTaskOrganizer.setInterceptBackPressedOnTaskRoot(taskToken, false /* intercept */);
            mPending.add(new PendingTransition(TRANSIT_CHANGE, wct, taskView, null /* cookie */));