Loading libs/WindowManager/Shell/src/com/android/wm/shell/bubbles/BubbleTransitions.java +16 −1 Original line number Diff line number Diff line Loading @@ -1672,6 +1672,8 @@ public class BubbleTransitions { private SurfaceControl mTaskLeash; private SurfaceControl.Transaction mFinishTransaction; private boolean mIsStarted = false; private boolean mHasBounds = false; private boolean mCanExpand = false; FloatingToBarConversion(Bubble bubble, BubblePositioner positioner) { this(bubble, SurfaceControl.Transaction::new, positioner); Loading Loading @@ -1760,13 +1762,26 @@ public class BubbleTransitions { @Override public void continueConvert(BubbleBarLayerView layerView) { mHasBounds = true; mPositioner.getTaskViewRestBounds(mBounds); mWct.setBounds(mBubble.getTaskView().getTaskInfo().token, mBounds); if (!mIsStarted) { if (canStart()) { startTransition(); } } @Override public void continueExpand() { mCanExpand = true; if (canStart()) { startTransition(); } } private boolean canStart() { return mHasBounds && mCanExpand && !mIsStarted; } private void startTransition() { mIsStarted = true; final TaskView tv = mBubble.getTaskView(); Loading libs/WindowManager/Shell/src/com/android/wm/shell/bubbles/BubbleViewInfoTask.java +3 −0 Original line number Diff line number Diff line Loading @@ -227,6 +227,9 @@ public class BubbleViewInfoTask { if (mCallback != null) { mCallback.onBubbleViewsReady(mBubble); } if (mBubble.isConvertingToBar()) { mBubble.getPreparingTransition().continueExpand(); } } private boolean verifyState() { Loading libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell/bubbles/BubbleTransitionsTest.java +20 −0 Original line number Diff line number Diff line Loading @@ -536,6 +536,7 @@ public class BubbleTransitionsTest extends ShellTestCase { .startTransition(eq(TRANSIT_BUBBLE_CONVERT_FLOATING_TO_BAR), any(), eq(bt))) .thenReturn(transition); bt.continueExpand(); bt.continueConvert(mLayerView); verify(mTransitions) Loading Loading @@ -609,6 +610,7 @@ public class BubbleTransitionsTest extends ShellTestCase { .startTransition(eq(TRANSIT_BUBBLE_CONVERT_FLOATING_TO_BAR), any(), eq(bt))) .thenReturn(transition); bt.continueExpand(); bt.continueConvert(mLayerView); verify(mTransitions) Loading Loading @@ -646,6 +648,7 @@ public class BubbleTransitionsTest extends ShellTestCase { mBubbleTransitions.new FloatingToBarConversion(mBubble, mBubblePositioner); verify(mTransitions, never()).startTransition(anyInt(), any(), eq(bt)); bt.continueExpand(); bt.continueConvert(mLayerView); // call continue convert again Loading @@ -656,6 +659,23 @@ public class BubbleTransitionsTest extends ShellTestCase { .startTransition(eq(TRANSIT_BUBBLE_CONVERT_FLOATING_TO_BAR), any(), eq(bt)); } @Test public void convertFloatingBubbleToBarBubble_mustContinueExpand() { setupBubble(); final BubbleTransitions.FloatingToBarConversion bt = mBubbleTransitions.new FloatingToBarConversion(mBubble, mBubblePositioner); bt.continueConvert(mLayerView); verify(mTransitions, never()).startTransition(anyInt(), any(), eq(bt)); bt.continueExpand(); // verify we only started the transition once verify(mTransitions, times(1)) .startTransition(eq(TRANSIT_BUBBLE_CONVERT_FLOATING_TO_BAR), any(), eq(bt)); } @Test @EnableFlags(FLAG_ENABLE_BUBBLE_BAR) public void notifyUnfoldTransitionStarting_bubbleBarEnabled_enqueuesExternal() { Loading Loading
libs/WindowManager/Shell/src/com/android/wm/shell/bubbles/BubbleTransitions.java +16 −1 Original line number Diff line number Diff line Loading @@ -1672,6 +1672,8 @@ public class BubbleTransitions { private SurfaceControl mTaskLeash; private SurfaceControl.Transaction mFinishTransaction; private boolean mIsStarted = false; private boolean mHasBounds = false; private boolean mCanExpand = false; FloatingToBarConversion(Bubble bubble, BubblePositioner positioner) { this(bubble, SurfaceControl.Transaction::new, positioner); Loading Loading @@ -1760,13 +1762,26 @@ public class BubbleTransitions { @Override public void continueConvert(BubbleBarLayerView layerView) { mHasBounds = true; mPositioner.getTaskViewRestBounds(mBounds); mWct.setBounds(mBubble.getTaskView().getTaskInfo().token, mBounds); if (!mIsStarted) { if (canStart()) { startTransition(); } } @Override public void continueExpand() { mCanExpand = true; if (canStart()) { startTransition(); } } private boolean canStart() { return mHasBounds && mCanExpand && !mIsStarted; } private void startTransition() { mIsStarted = true; final TaskView tv = mBubble.getTaskView(); Loading
libs/WindowManager/Shell/src/com/android/wm/shell/bubbles/BubbleViewInfoTask.java +3 −0 Original line number Diff line number Diff line Loading @@ -227,6 +227,9 @@ public class BubbleViewInfoTask { if (mCallback != null) { mCallback.onBubbleViewsReady(mBubble); } if (mBubble.isConvertingToBar()) { mBubble.getPreparingTransition().continueExpand(); } } private boolean verifyState() { Loading
libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell/bubbles/BubbleTransitionsTest.java +20 −0 Original line number Diff line number Diff line Loading @@ -536,6 +536,7 @@ public class BubbleTransitionsTest extends ShellTestCase { .startTransition(eq(TRANSIT_BUBBLE_CONVERT_FLOATING_TO_BAR), any(), eq(bt))) .thenReturn(transition); bt.continueExpand(); bt.continueConvert(mLayerView); verify(mTransitions) Loading Loading @@ -609,6 +610,7 @@ public class BubbleTransitionsTest extends ShellTestCase { .startTransition(eq(TRANSIT_BUBBLE_CONVERT_FLOATING_TO_BAR), any(), eq(bt))) .thenReturn(transition); bt.continueExpand(); bt.continueConvert(mLayerView); verify(mTransitions) Loading Loading @@ -646,6 +648,7 @@ public class BubbleTransitionsTest extends ShellTestCase { mBubbleTransitions.new FloatingToBarConversion(mBubble, mBubblePositioner); verify(mTransitions, never()).startTransition(anyInt(), any(), eq(bt)); bt.continueExpand(); bt.continueConvert(mLayerView); // call continue convert again Loading @@ -656,6 +659,23 @@ public class BubbleTransitionsTest extends ShellTestCase { .startTransition(eq(TRANSIT_BUBBLE_CONVERT_FLOATING_TO_BAR), any(), eq(bt)); } @Test public void convertFloatingBubbleToBarBubble_mustContinueExpand() { setupBubble(); final BubbleTransitions.FloatingToBarConversion bt = mBubbleTransitions.new FloatingToBarConversion(mBubble, mBubblePositioner); bt.continueConvert(mLayerView); verify(mTransitions, never()).startTransition(anyInt(), any(), eq(bt)); bt.continueExpand(); // verify we only started the transition once verify(mTransitions, times(1)) .startTransition(eq(TRANSIT_BUBBLE_CONVERT_FLOATING_TO_BAR), any(), eq(bt)); } @Test @EnableFlags(FLAG_ENABLE_BUBBLE_BAR) public void notifyUnfoldTransitionStarting_bubbleBarEnabled_enqueuesExternal() { Loading