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

Commit 4ed4ee4a authored by Liran Binyamin's avatar Liran Binyamin Committed by Android (Google) Code Review
Browse files

Merge "Consume bubble entry point in wm shell" into main

parents b50e61a4 cb6e6783
Loading
Loading
Loading
Loading
+21 −4
Original line number Diff line number Diff line
@@ -34,6 +34,7 @@ import com.android.wm.shell.bubbles.BubbleController
import com.android.wm.shell.shared.bubbles.BubbleBarLocation
import com.android.wm.shell.shared.bubbles.DragZoneFactory
import com.android.wm.shell.shared.bubbles.DropTargetView
import com.android.wm.shell.shared.bubbles.logging.EntryPoint
import com.google.common.truth.Truth.assertThat
import org.junit.Before
import org.junit.Rule
@@ -41,6 +42,7 @@ import org.junit.Test
import org.junit.runner.RunWith
import org.mockito.kotlin.any
import org.mockito.kotlin.doReturn
import org.mockito.kotlin.eq
import org.mockito.kotlin.mock
import org.mockito.kotlin.never
import org.mockito.kotlin.stub
@@ -136,7 +138,12 @@ class DragToBubbleControllerTest {
        }

        verify(bubbleController)
            .expandStackAndSelectBubble(pendingIntent, userHandle, BubbleBarLocation.LEFT)
            .expandStackAndSelectBubble(
                pendingIntent,
                userHandle,
                EntryPoint.TASKBAR_ICON_DRAG,
                BubbleBarLocation.LEFT,
            )
        assertThat(dragToBubbleController.isDropHandled).isTrue()
    }

@@ -153,7 +160,12 @@ class DragToBubbleControllerTest {
            dragToBubbleController.onItemDropped(shortcutInfo)
        }

        verify(bubbleController).expandStackAndSelectBubble(shortcutInfo, BubbleBarLocation.LEFT)
        verify(bubbleController)
            .expandStackAndSelectBubble(
                shortcutInfo,
                EntryPoint.TASKBAR_ICON_DRAG,
                BubbleBarLocation.LEFT,
            )
        assertThat(dragToBubbleController.isDropHandled).isTrue()
    }

@@ -181,9 +193,14 @@ class DragToBubbleControllerTest {
        runOnMainSync { dragToBubbleController.onItemDropped(shortcutInfo) }

        assertThat(dropTargetContainer.childCount).isEqualTo(0)
        verify(bubbleController, never()).expandStackAndSelectBubble(any<ShortcutInfo>(), any())
        verify(bubbleController, never())
            .expandStackAndSelectBubble(any<PendingIntent>(), any(), any())
            .expandStackAndSelectBubble(
                any<ShortcutInfo>(),
                eq(EntryPoint.TASKBAR_ICON_DRAG),
                any(),
            )
        verify(bubbleController, never())
            .expandStackAndSelectBubble(any<PendingIntent>(), any(), any(), any())
    }

    @Test
+4 −0
Original line number Diff line number Diff line
@@ -59,7 +59,9 @@ android_library {
        "com_android_wm_shell_flags_lib",
        "com.android.window.flags.window-aconfig-java",
        "jsr330",
        "kotlin-parcelize-runtime",
    ],
    kotlin_plugins: ["kotlin-parcelize-compiler-plugin"],
    kotlincflags: ["-Xjvm-default=all"],
    use_resource_processor: true,
}
@@ -94,5 +96,7 @@ java_library {
    static_libs: [
        "com_android_wm_shell_flags_lib",
        "com.android.window.flags.window-aconfig-java",
        "kotlin-parcelize-runtime",
    ],
    kotlin_plugins: ["kotlin-parcelize-compiler-plugin"],
}
+19 −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.shared.bubbles.logging;

parcelable EntryPoint;
+5 −1
Original line number Diff line number Diff line
@@ -16,8 +16,12 @@

package com.android.wm.shell.shared.bubbles.logging

import android.os.Parcelable
import kotlinx.parcelize.Parcelize

/** Entry points for creating Bubbles. */
enum class EntryPoint {
@Parcelize
enum class EntryPoint : Parcelable {
    TASKBAR_ICON_MENU,
    LAUNCHER_ICON_MENU,
    ALL_APPS_ICON_MENU,
+19 −10
Original line number Diff line number Diff line
@@ -140,6 +140,7 @@ import com.android.wm.shell.shared.bubbles.BubbleDropTargetBoundsProvider;
import com.android.wm.shell.shared.bubbles.ContextUtils;
import com.android.wm.shell.shared.bubbles.DeviceConfig;
import com.android.wm.shell.shared.bubbles.logging.BubbleLog;
import com.android.wm.shell.shared.bubbles.logging.EntryPoint;
import com.android.wm.shell.splitscreen.SplitScreenController;
import com.android.wm.shell.sysui.ConfigurationChangeListener;
import com.android.wm.shell.sysui.ShellCommandHandler;
@@ -1718,9 +1719,10 @@ public class BubbleController implements ConfigurationChangeListener,
     *
     * @param info the shortcut info for the bubble.
     * @param bubbleBarLocation optional location in case bubble bar should be repositioned.
     * @param entryPoint optional entry point indicating how the bubble was created.
     */
    public void expandStackAndSelectBubble(ShortcutInfo info,
            @Nullable BubbleBarLocation bubbleBarLocation) {
            @Nullable EntryPoint entryPoint, @Nullable BubbleBarLocation bubbleBarLocation) {
        if (!BubbleAnythingFlagHelper.enableCreateAnyBubble()) return;
        Bubble b = mBubbleData.getOrCreateBubble(info); // Removes from overflow
        ProtoLog.v(WM_SHELL_BUBBLES, "expandStackAndSelectBubble - shortcut=%s", info);
@@ -1735,9 +1737,13 @@ public class BubbleController implements ConfigurationChangeListener,
     * Expands and selects a bubble created or found for this app.
     *
     * @param intent the intent for the bubble.
     * @param user the user requesting the bubble.
     * @param bubbleBarLocation optional bubble bar location. if present the bubble bar will be at
     *                          the specified location.
     * @param entryPoint optional entry point indicating how the bubble was created.
     */
    public void expandStackAndSelectBubble(Intent intent, UserHandle user,
            @Nullable BubbleBarLocation bubbleBarLocation) {
            @Nullable EntryPoint entryPoint, @Nullable BubbleBarLocation bubbleBarLocation) {
        if (!BubbleAnythingFlagHelper.enableCreateAnyBubble()) return;
        Bubble b = mBubbleData.getOrCreateBubble(intent, user); // Removes from overflow
        ProtoLog.v(WM_SHELL_BUBBLES, "expandStackAndSelectBubble - intent=%s", intent);
@@ -1755,7 +1761,7 @@ public class BubbleController implements ConfigurationChangeListener,
     * @param bubbleBarLocation optional location in case bubble bar should be repositioned.
     */
    public void expandStackAndSelectBubble(PendingIntent pendingIntent, UserHandle user,
            @Nullable BubbleBarLocation bubbleBarLocation) {
            @Nullable EntryPoint entryPoint, @Nullable BubbleBarLocation bubbleBarLocation) {
        if (!BubbleAnythingFlagHelper.enableCreateAnyBubble()) return;
        Bubble b = mBubbleData.getOrCreateBubble(pendingIntent, user); // Removes from overflow
        ProtoLog.v(WM_SHELL_BUBBLES, "expandStackAndSelectBubble - pendingIntent=%s",
@@ -3299,24 +3305,28 @@ public class BubbleController implements ConfigurationChangeListener,
        }

        @Override
        public void showShortcutBubble(ShortcutInfo info, @Nullable BubbleBarLocation location) {
        public void showShortcutBubble(ShortcutInfo info, EntryPoint entryPoint,
                @Nullable BubbleBarLocation location) {
            ProtoLog.d(WM_SHELL_BUBBLES_NOISY, "IBubbles.showShortcutBubble: info=%s loc=%s",
                    info, location);
            executeRemoteCallWithTaskPermission(
                    mController,
                    "showShortcutBubble",
                    (controller) -> controller.expandStackAndSelectBubble(info, location));
                    controller ->
                            controller.expandStackAndSelectBubble(info, entryPoint, location));
        }

        @Override
        public void showAppBubble(Intent intent, UserHandle user,
                @Nullable BubbleBarLocation location) {
                EntryPoint entryPoint, @Nullable BubbleBarLocation location) {
            ProtoLog.d(WM_SHELL_BUBBLES_NOISY, "IBubbles.showAppBubble: intent=%s user=%s loc=%s",
                    intent, user, location);
            executeRemoteCallWithTaskPermission(
                    mController,
                    "showAppBubble",
                    (controller) -> controller.expandStackAndSelectBubble(intent, user, location));
                    controller ->
                            controller.expandStackAndSelectBubble(
                                    intent, user, entryPoint, location));
        }

        @Override
@@ -3609,9 +3619,8 @@ public class BubbleController implements ConfigurationChangeListener,
        @Override
        public void expandStackAndSelectBubble(ShortcutInfo info) {
            mMainExecutor.execute(() ->
                    BubbleController.this
                            .expandStackAndSelectBubble(info, /* bubbleBarLocation = */ null)
            );
                    BubbleController.this.expandStackAndSelectBubble(
                            info, /* entryPoint= */ null, /* bubbleBarLocation = */ null));
        }

        @Override
Loading