Loading libs/WindowManager/Shell/multivalentTests/src/com/android/wm/shell/bubbles/bar/BubbleBarLayerViewTest.kt +19 −0 Original line number Diff line number Diff line Loading @@ -294,6 +294,25 @@ class BubbleBarLayerViewTest { assertThat(bubbleBarLayerView.children.last()).isEqualTo(secondBubble.bubbleBarExpandedView) } @Test fun twoBubbles_removeBubbleInTransition_skipCollapse() { val firstBubble = createBubble("first") val secondBubble = createBubble("second") getInstrumentation().runOnMainSync { bubbleBarLayerView.showExpandedView(firstBubble) } waitForExpandedViewAnimation() getInstrumentation().runOnMainSync { bubbleBarLayerView.showExpandedView(secondBubble) } waitForExpandedViewAnimation() firstBubble.preparingTransition = object : BubbleTransitions.BubbleTransition {} getInstrumentation().runOnMainSync { bubbleBarLayerView.removeBubble(firstBubble) {} } assertThat(bubbleBarLayerView.isExpanded).isTrue() } @Test fun testEventLogging_dismissExpandedViewViaDrag() { val bubble = createBubble("first") Loading libs/WindowManager/Shell/src/com/android/wm/shell/bubbles/Bubble.java +2 −1 Original line number Diff line number Diff line Loading @@ -712,7 +712,8 @@ public class Bubble implements BubbleViewProvider { /** * Sets the current bubble-transition that is coordinating a change in this bubble. */ void setPreparingTransition(BubbleTransitions.BubbleTransition transit) { @VisibleForTesting public void setPreparingTransition(BubbleTransitions.BubbleTransition transit) { ProtoLog.d(WM_SHELL_BUBBLES_NOISY, "setPreparingTransition: transit=%s", transit); mPreparingTransition = transit; } Loading libs/WindowManager/Shell/src/com/android/wm/shell/bubbles/BubbleTransitions.java +1 −1 Original line number Diff line number Diff line Loading @@ -312,7 +312,7 @@ public class BubbleTransitions { * in order to coordinate with the bubble view logic. These steps are communicated on this * interface. */ interface BubbleTransition { public interface BubbleTransition { default void surfaceCreated() {} default void continueExpand() {} default void skip() {} Loading libs/WindowManager/Shell/src/com/android/wm/shell/bubbles/bar/BubbleBarLayerView.java +14 −5 Original line number Diff line number Diff line Loading @@ -16,6 +16,7 @@ package com.android.wm.shell.bubbles.bar; import static com.android.wm.shell.protolog.ShellProtoLogGroup.WM_SHELL_BUBBLES_NOISY; import static com.android.wm.shell.shared.animation.Interpolators.ALPHA_IN; import static com.android.wm.shell.shared.animation.Interpolators.ALPHA_OUT; import static com.android.wm.shell.bubbles.Bubbles.DISMISS_USER_GESTURE; Loading @@ -40,6 +41,7 @@ import android.widget.FrameLayout; import androidx.annotation.NonNull; import androidx.annotation.VisibleForTesting; import com.android.internal.protolog.ProtoLog; import com.android.wm.shell.R; import com.android.wm.shell.bubbles.Bubble; import com.android.wm.shell.bubbles.BubbleController; Loading Loading @@ -493,18 +495,25 @@ public class BubbleBarLayerView extends FrameLayout mAnimationHelper.getExpandedViewRestBounds(out); } /** Removes the given {@code bubble}. */ public void removeBubble(Bubble bubble, Runnable endAction) { public void removeBubble(@NonNull Bubble bubble, @NonNull Runnable endAction) { final boolean inTransition = bubble.getPreparingTransition() != null; ProtoLog.d(WM_SHELL_BUBBLES_NOISY, "BBLayerView.removeBubble(): bubble=%s hasBubbles=%b inTransition=%b", bubble, !mBubbleData.getBubbles().isEmpty(), inTransition); Runnable cleanUp = () -> { // The transition is already managing the task/wm state. bubble.cleanupViews(!inTransition); endAction.run(); }; if (mBubbleData.getBubbles().isEmpty() || inTransition) { if (mExpandedBubble != null && mExpandedBubble.getKey().equals(bubble.getKey())) { // If we are removing the last bubble or removing the current bubble via transition, // collapse the expanded view and clean up bubbles at the end. collapse(cleanUp); } else { ProtoLog.d(WM_SHELL_BUBBLES_NOISY, " Skipping, does not match expanded view"); cleanUp.run(); } } else { cleanUp.run(); } Loading Loading
libs/WindowManager/Shell/multivalentTests/src/com/android/wm/shell/bubbles/bar/BubbleBarLayerViewTest.kt +19 −0 Original line number Diff line number Diff line Loading @@ -294,6 +294,25 @@ class BubbleBarLayerViewTest { assertThat(bubbleBarLayerView.children.last()).isEqualTo(secondBubble.bubbleBarExpandedView) } @Test fun twoBubbles_removeBubbleInTransition_skipCollapse() { val firstBubble = createBubble("first") val secondBubble = createBubble("second") getInstrumentation().runOnMainSync { bubbleBarLayerView.showExpandedView(firstBubble) } waitForExpandedViewAnimation() getInstrumentation().runOnMainSync { bubbleBarLayerView.showExpandedView(secondBubble) } waitForExpandedViewAnimation() firstBubble.preparingTransition = object : BubbleTransitions.BubbleTransition {} getInstrumentation().runOnMainSync { bubbleBarLayerView.removeBubble(firstBubble) {} } assertThat(bubbleBarLayerView.isExpanded).isTrue() } @Test fun testEventLogging_dismissExpandedViewViaDrag() { val bubble = createBubble("first") Loading
libs/WindowManager/Shell/src/com/android/wm/shell/bubbles/Bubble.java +2 −1 Original line number Diff line number Diff line Loading @@ -712,7 +712,8 @@ public class Bubble implements BubbleViewProvider { /** * Sets the current bubble-transition that is coordinating a change in this bubble. */ void setPreparingTransition(BubbleTransitions.BubbleTransition transit) { @VisibleForTesting public void setPreparingTransition(BubbleTransitions.BubbleTransition transit) { ProtoLog.d(WM_SHELL_BUBBLES_NOISY, "setPreparingTransition: transit=%s", transit); mPreparingTransition = transit; } Loading
libs/WindowManager/Shell/src/com/android/wm/shell/bubbles/BubbleTransitions.java +1 −1 Original line number Diff line number Diff line Loading @@ -312,7 +312,7 @@ public class BubbleTransitions { * in order to coordinate with the bubble view logic. These steps are communicated on this * interface. */ interface BubbleTransition { public interface BubbleTransition { default void surfaceCreated() {} default void continueExpand() {} default void skip() {} Loading
libs/WindowManager/Shell/src/com/android/wm/shell/bubbles/bar/BubbleBarLayerView.java +14 −5 Original line number Diff line number Diff line Loading @@ -16,6 +16,7 @@ package com.android.wm.shell.bubbles.bar; import static com.android.wm.shell.protolog.ShellProtoLogGroup.WM_SHELL_BUBBLES_NOISY; import static com.android.wm.shell.shared.animation.Interpolators.ALPHA_IN; import static com.android.wm.shell.shared.animation.Interpolators.ALPHA_OUT; import static com.android.wm.shell.bubbles.Bubbles.DISMISS_USER_GESTURE; Loading @@ -40,6 +41,7 @@ import android.widget.FrameLayout; import androidx.annotation.NonNull; import androidx.annotation.VisibleForTesting; import com.android.internal.protolog.ProtoLog; import com.android.wm.shell.R; import com.android.wm.shell.bubbles.Bubble; import com.android.wm.shell.bubbles.BubbleController; Loading Loading @@ -493,18 +495,25 @@ public class BubbleBarLayerView extends FrameLayout mAnimationHelper.getExpandedViewRestBounds(out); } /** Removes the given {@code bubble}. */ public void removeBubble(Bubble bubble, Runnable endAction) { public void removeBubble(@NonNull Bubble bubble, @NonNull Runnable endAction) { final boolean inTransition = bubble.getPreparingTransition() != null; ProtoLog.d(WM_SHELL_BUBBLES_NOISY, "BBLayerView.removeBubble(): bubble=%s hasBubbles=%b inTransition=%b", bubble, !mBubbleData.getBubbles().isEmpty(), inTransition); Runnable cleanUp = () -> { // The transition is already managing the task/wm state. bubble.cleanupViews(!inTransition); endAction.run(); }; if (mBubbleData.getBubbles().isEmpty() || inTransition) { if (mExpandedBubble != null && mExpandedBubble.getKey().equals(bubble.getKey())) { // If we are removing the last bubble or removing the current bubble via transition, // collapse the expanded view and clean up bubbles at the end. collapse(cleanUp); } else { ProtoLog.d(WM_SHELL_BUBBLES_NOISY, " Skipping, does not match expanded view"); cleanUp.run(); } } else { cleanUp.run(); } Loading