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

Commit 0c7fb9a4 authored by Annie Lin's avatar Annie Lin
Browse files

Show a warning toast if a task is not valid to bubble in onTaskInfoChanged.

Demo: http://screencast/cast/NjQ0MjkyOTY5MzM5Mjg5NnwzZjNlOWQzMy1jYg
Bug: 411558731
Bug: 419341634
Bug: 419379112
Test: wm presubmit
Flag: com.android.wm.shell.enable_create_any_bubble
Change-Id: I940d732658e0feeb71feeb7704d78b3efe0165cd
parent 01e50f35
Loading
Loading
Loading
Loading
+10 −0
Original line number Diff line number Diff line
@@ -44,6 +44,7 @@ import com.android.internal.protolog.ProtoLog
import com.android.window.flags.Flags.FLAG_DISALLOW_BUBBLE_TO_ENTER_PIP
import com.android.window.flags.Flags.FLAG_EXCLUDE_TASK_FROM_RECENTS
import com.android.wm.shell.Flags.FLAG_ENABLE_BUBBLE_ANYTHING
import com.android.wm.shell.Flags.FLAG_ENABLE_CREATE_ANY_BUBBLE
import com.android.wm.shell.R
import com.android.wm.shell.ShellTaskOrganizer
import com.android.wm.shell.bubbles.Bubbles.BubbleMetadataFlagListener
@@ -531,6 +532,15 @@ class BubbleTaskViewListenerTest {
        verify(listenerCallback).onTaskRemovalStarted()
    }

    @EnableFlags(FLAG_ENABLE_CREATE_ANY_BUBBLE)
    @Test
    fun onTaskInfoChanged() {
        getInstrumentation().runOnMainSync {
            bubbleTaskViewListener.onTaskInfoChanged(taskInfo)
        }
        verify(listenerCallback).onTaskInfoChanged(taskInfo)
    }

    @Test
    fun onBackPressedOnTaskRoot_expanded() {
        val taskId = 123
+2 −0
Original line number Diff line number Diff line
@@ -74,6 +74,8 @@
    <string name="forced_resizable_secondary_display">App may not work on a secondary display.</string>
    <!-- Warning message when we try to launch a non-resizeable activity on a secondary display and launch it on the primary instead. -->
    <string name="activity_launch_on_secondary_display_failed_text">App does not support launch on secondary displays.</string>
    <!-- Warning message when we try to bubble a task in an unsupported environment [CHAR LIMIT=NONE] -->
    <string name="bubble_not_supported_text">App does not support bubble</string>

    <!-- Accessibility label and window tile for the divider that separates the windows in split screen mode [CHAR LIMIT=NONE] -->
    <string name="accessibility_divider">Split screen divider</string>
+6 −0
Original line number Diff line number Diff line
@@ -32,6 +32,7 @@ import static com.android.wm.shell.shared.TypefaceUtils.setTypeface;

import android.annotation.NonNull;
import android.annotation.SuppressLint;
import android.app.ActivityManager.RunningTaskInfo;
import android.app.ActivityOptions;
import android.app.PendingIntent;
import android.content.ComponentName;
@@ -517,6 +518,11 @@ public class BubbleExpandedView extends LinearLayout {
                            public void onTaskRemovalStarted() {
                                // nothing to do / handled in listener.
                            }

                            @Override
                            public void onTaskInfoChanged(RunningTaskInfo taskInfo) {
                                // nothing to do / handled in listener.
                            }
                        });
            } else {
                mCurrentTaskViewListener = mTaskViewListener;
+5 −0
Original line number Diff line number Diff line
@@ -16,6 +16,7 @@

package com.android.wm.shell.bubbles

import android.app.ActivityManager.RunningTaskInfo
import android.app.ActivityTaskManager.INVALID_TASK_ID
import android.content.ComponentName
import androidx.annotation.VisibleForTesting
@@ -88,6 +89,10 @@ class BubbleTaskView(val taskView: TaskView, executor: Executor) {
            delegateListener?.onTaskRemovalStarted(taskId)
        }

        override fun onTaskInfoChanged(taskInfo: RunningTaskInfo?) {
            delegateListener?.onTaskInfoChanged(taskInfo)
        }

        override fun onBackPressedOnTaskRoot(taskId: Int) {
            delegateListener?.onBackPressedOnTaskRoot(taskId)
        }
+10 −0
Original line number Diff line number Diff line
@@ -70,6 +70,9 @@ public class BubbleTaskViewListener implements TaskView.Listener {

        /** Called when task removal has started. */
        void onTaskRemovalStarted();

        /** Called when the task's info has changed. */
        void onTaskInfoChanged(ActivityManager.RunningTaskInfo taskInfo);
    }

    private final Context mContext;
@@ -263,6 +266,13 @@ public class BubbleTaskViewListener implements TaskView.Listener {
        mCallback.onTaskRemovalStarted();
    }

    @Override
    public void onTaskInfoChanged(ActivityManager.RunningTaskInfo taskInfo) {
        if (BubbleAnythingFlagHelper.enableCreateAnyBubble()) {
            mCallback.onTaskInfoChanged(taskInfo);
        }
    }

    @Override
    public void onBackPressedOnTaskRoot(int taskId) {
        if (mTaskId == taskId && mExpandedViewManager.isStackExpanded()) {
Loading