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

Commit 89454f6c authored by Louis Chang's avatar Louis Chang
Browse files

Making the Bubble task to continue launch next as bubble

This CL also fixes the issue of unable launching the apps that
use Task trampoline into Bubble. That's because the new Bubble Task
inherits the windowingMode and bounds from the trampoline Bubble
Task, which allows the launch cookie to be propagated.

However, we still need to ensure the bubble task is always-on-top,
because it may not be the initial task if the app trampolines
to a new task.

Bug: 388651207
Test: wm presubmit
Flag: com.android.wm.shell.enable_create_any_bubble
Change-Id: Ia69d449981d2e718f512e052691622b713baa632
parent 1fbcfd73
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -365,8 +365,8 @@ public class BubbleController implements ConfigurationChangeListener,
        mDisplayController = displayController;
        final TaskViewTransitions tvTransitions;
        if (TaskViewTransitions.useRepo()) {
            tvTransitions = new TaskViewTransitions(transitions, taskViewRepository, organizer,
                    syncQueue);
            tvTransitions = new BubbleTaskViewTransitions(transitions, taskViewRepository,
                    organizer, syncQueue);
        } else {
            tvTransitions = taskViewTransitions;
        }
+2 −0
Original line number Diff line number Diff line
@@ -245,6 +245,7 @@ public class BubbleExpandedView extends LinearLayout {
                                // Needs to be mutable for the fillInIntent
                                PendingIntent.FLAG_MUTABLE | PendingIntent.FLAG_UPDATE_CURRENT,
                                /* options= */ null);
                        options.setLaunchNextToBubble(true);
                        mTaskView.startActivity(pi, fillInIntent, options, launchBounds);
                    } else if (!mIsOverflow && isShortcutBubble) {
                        ProtoLog.v(WM_SHELL_BUBBLES, "startingShortcutBubble=%s", getBubbleKey());
@@ -252,6 +253,7 @@ public class BubbleExpandedView extends LinearLayout {
                            options.setLaunchedFromBubble(true);
                            options.setApplyActivityFlagsForBubbles(true);
                        } else {
                            options.setLaunchNextToBubble(true);
                            options.setApplyMultipleTaskFlagForShortcut(true);
                        }
                        mTaskView.startShortcutActivity(mBubble.getShortcutInfo(),
+2 −0
Original line number Diff line number Diff line
@@ -142,12 +142,14 @@ public class BubbleTaskViewListener implements TaskView.Listener {
                                PendingIntent.FLAG_MUTABLE | PendingIntent.FLAG_UPDATE_CURRENT,
                                /* options= */ null);
                    }
                    options.setLaunchNextToBubble(true);
                    mTaskView.startActivity(pi, fillInIntent, options, launchBounds);
                } else if (isShortcutBubble) {
                    if (mBubble.isChat()) {
                        options.setLaunchedFromBubble(true);
                        options.setApplyActivityFlagsForBubbles(true);
                    } else {
                        options.setLaunchNextToBubble(true);
                        options.setApplyMultipleTaskFlagForShortcut(true);
                    }
                    mTaskView.startShortcutActivity(mBubble.getShortcutInfo(),
+48 −0
Original line number Diff line number Diff line
/*
 * Copyright (C) 2025 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package com.android.wm.shell.bubbles;

import android.app.ActivityManager;
import android.view.SurfaceControl;
import android.window.WindowContainerTransaction;

import com.android.wm.shell.ShellTaskOrganizer;
import com.android.wm.shell.common.SyncTransactionQueue;
import com.android.wm.shell.taskview.TaskViewRepository;
import com.android.wm.shell.taskview.TaskViewTaskController;
import com.android.wm.shell.taskview.TaskViewTransitions;
import com.android.wm.shell.transition.Transitions;

public class BubbleTaskViewTransitions extends TaskViewTransitions {

    public BubbleTaskViewTransitions(Transitions transitions, TaskViewRepository repository,
            ShellTaskOrganizer taskOrganizer, SyncTransactionQueue syncQueue) {
        super(transitions, repository, taskOrganizer, syncQueue);
    }

    @Override
    public void prepareOpenAnimation(TaskViewTaskController taskView, boolean newTask,
            SurfaceControl.Transaction startTransaction,
            SurfaceControl.Transaction finishTransaction, ActivityManager.RunningTaskInfo taskInfo,
            SurfaceControl leash, WindowContainerTransaction wct) {
        if (!taskInfo.getConfiguration().windowConfiguration.isAlwaysOnTop()) {
            wct.setAlwaysOnTop(taskInfo.token, true /* alwaysOnTop */);
        }
        super.prepareOpenAnimation(taskView, newTask, startTransaction, finishTransaction, taskInfo,
                leash, wct);
    }
}