Loading libs/WindowManager/Shell/multivalentTests/src/com/android/wm/shell/bubbles/BubblePositionerTest.kt +9 −25 Original line number Diff line number Diff line Loading @@ -218,11 +218,10 @@ class BubblePositionerTest { insets = Insets.of(10, 20, 5, 15), windowBounds = Rect(0, 0, 1800, 2600) ) val bubbleBarBounds = Rect(1700, 2500, 1780, 2600) positioner.setShowingInBubbleBar(true) positioner.update(deviceConfig) positioner.bubbleBarBounds = bubbleBarBounds positioner.bubbleBarTopOnScreen = 2500 val spaceBetweenTopInsetAndBubbleBarInLandscape = 1680 val expandedViewVerticalSpacing = Loading @@ -246,10 +245,9 @@ class BubblePositionerTest { insets = Insets.of(10, 20, 5, 15), windowBounds = Rect(0, 0, screenWidth, 2600) ) val bubbleBarBounds = Rect(100, 2500, 280, 2550) positioner.setShowingInBubbleBar(true) positioner.update(deviceConfig) positioner.bubbleBarBounds = bubbleBarBounds positioner.bubbleBarTopOnScreen = 2500 val spaceBetweenTopInsetAndBubbleBarInLandscape = 180 val expandedViewSpacing = Loading Loading @@ -597,16 +595,19 @@ class BubblePositionerTest { private fun testGetBubbleBarExpandedViewBounds(onLeft: Boolean, isOverflow: Boolean) { positioner.setShowingInBubbleBar(true) val windowBounds = Rect(0, 0, 2000, 2600) val insets = Insets.of(10, 20, 5, 15) val deviceConfig = defaultDeviceConfig.copy( isLargeScreen = true, isLandscape = true, insets = Insets.of(10, 20, 5, 15), windowBounds = Rect(0, 0, 2000, 2600) insets = insets, windowBounds = windowBounds ) positioner.update(deviceConfig) positioner.bubbleBarBounds = getBubbleBarBounds(onLeft, deviceConfig) val bubbleBarHeight = 100 positioner.bubbleBarTopOnScreen = windowBounds.bottom - insets.bottom - bubbleBarHeight val expandedViewPadding = context.resources.getDimensionPixelSize(R.dimen.bubble_expanded_view_padding) Loading @@ -624,7 +625,7 @@ class BubblePositionerTest { left = right - positioner.getExpandedViewWidthForBubbleBar(isOverflow) } // Above the bubble bar val bottom = positioner.bubbleBarBounds.top - expandedViewPadding val bottom = positioner.bubbleBarTopOnScreen - expandedViewPadding // Calculate right and top based on size val top = bottom - positioner.getExpandedViewHeightForBubbleBar(isOverflow) val expectedBounds = Rect(left, top, right, bottom) Loading Loading @@ -666,21 +667,4 @@ class BubblePositionerTest { positioner.getAllowableStackPositionRegion(1 /* bubbleCount */) return allowableStackRegion.top + allowableStackRegion.height() * offsetPercent } private fun getBubbleBarBounds(onLeft: Boolean, deviceConfig: DeviceConfig): Rect { val width = 200 val height = 100 val bottom = deviceConfig.windowBounds.bottom - deviceConfig.insets.bottom val top = bottom - height val left: Int val right: Int if (onLeft) { left = deviceConfig.insets.left right = left + width } else { right = deviceConfig.windowBounds.right - deviceConfig.insets.right left = right - width } return Rect(left, top, right, bottom) } } libs/WindowManager/Shell/multivalentTests/src/com/android/wm/shell/bubbles/bar/BubbleExpandedViewPinControllerTest.kt +6 −12 Original line number Diff line number Diff line Loading @@ -53,7 +53,6 @@ class BubbleExpandedViewPinControllerTest { const val SCREEN_WIDTH = 2000 const val SCREEN_HEIGHT = 1000 const val BUBBLE_BAR_WIDTH = 100 const val BUBBLE_BAR_HEIGHT = 50 } Loading Loading @@ -84,14 +83,8 @@ class BubbleExpandedViewPinControllerTest { insets = Insets.of(10, 20, 30, 40) ) positioner.update(deviceConfig) positioner.bubbleBarBounds = Rect( SCREEN_WIDTH - deviceConfig.insets.right - BUBBLE_BAR_WIDTH, SCREEN_HEIGHT - deviceConfig.insets.bottom - BUBBLE_BAR_HEIGHT, SCREEN_WIDTH - deviceConfig.insets.right, SCREEN_HEIGHT - deviceConfig.insets.bottom ) positioner.bubbleBarTopOnScreen = SCREEN_HEIGHT - deviceConfig.insets.bottom - BUBBLE_BAR_HEIGHT controller = BubbleExpandedViewPinController(context, container, positioner) testListener = TestLocationChangeListener() controller.setListener(testListener) Loading Loading @@ -247,7 +240,8 @@ class BubbleExpandedViewPinControllerTest { private val dropTargetView: View? get() = container.findViewById(R.id.bubble_bar_drop_target) private fun getExpectedDropTargetBounds(onLeft: Boolean): Rect = Rect().also { private fun getExpectedDropTargetBounds(onLeft: Boolean): Rect = Rect().also { positioner.getBubbleBarExpandedViewBounds(onLeft, false /* isOveflowExpanded */, it) } Loading libs/WindowManager/Shell/src/com/android/wm/shell/bubbles/BubbleController.java +12 −11 Original line number Diff line number Diff line Loading @@ -1190,9 +1190,11 @@ public class BubbleController implements ConfigurationChangeListener, * Will be called only when bubble bar is expanded. * * @param location location where bubble was released * @param topOnScreen top coordinate of the bubble bar on the screen after release */ public void stopBubbleDrag(BubbleBarLocation location) { public void stopBubbleDrag(BubbleBarLocation location, int topOnScreen) { mBubblePositioner.setBubbleBarLocation(location); mBubblePositioner.setBubbleBarTopOnScreen(topOnScreen); if (mBubbleData.getSelectedBubble() != null) { mBubbleBarViewCallback.expansionChanged(/* isExpanded = */ true); } Loading Loading @@ -1248,8 +1250,8 @@ public class BubbleController implements ConfigurationChangeListener, * <p>This is used by external callers (launcher). */ @VisibleForTesting public void expandStackAndSelectBubbleFromLauncher(String key, Rect bubbleBarBounds) { mBubblePositioner.setBubbleBarBounds(bubbleBarBounds); public void expandStackAndSelectBubbleFromLauncher(String key, int topOnScreen) { mBubblePositioner.setBubbleBarTopOnScreen(topOnScreen); if (BubbleOverflow.KEY.equals(key)) { mBubbleData.setSelectedBubbleFromLauncher(mBubbleData.getOverflow()); Loading Loading @@ -2364,10 +2366,9 @@ public class BubbleController implements ConfigurationChangeListener, } @Override public void showBubble(String key, Rect bubbleBarBounds) { public void showBubble(String key, int topOnScreen) { mMainExecutor.execute( () -> mController.expandStackAndSelectBubbleFromLauncher( key, bubbleBarBounds)); () -> mController.expandStackAndSelectBubbleFromLauncher(key, topOnScreen)); } @Override Loading @@ -2386,8 +2387,8 @@ public class BubbleController implements ConfigurationChangeListener, } @Override public void stopBubbleDrag(BubbleBarLocation location) { mMainExecutor.execute(() -> mController.stopBubbleDrag(location)); public void stopBubbleDrag(BubbleBarLocation location, int topOnScreen) { mMainExecutor.execute(() -> mController.stopBubbleDrag(location, topOnScreen)); } @Override Loading @@ -2408,9 +2409,9 @@ public class BubbleController implements ConfigurationChangeListener, } @Override public void setBubbleBarBounds(Rect bubbleBarBounds) { public void updateBubbleBarTopOnScreen(int topOnScreen) { mMainExecutor.execute(() -> { mBubblePositioner.setBubbleBarBounds(bubbleBarBounds); mBubblePositioner.setBubbleBarTopOnScreen(topOnScreen); if (mLayerView != null) mLayerView.updateExpandedView(); }); } Loading libs/WindowManager/Shell/src/com/android/wm/shell/bubbles/BubblePositioner.java +8 −8 Original line number Diff line number Diff line Loading @@ -98,7 +98,7 @@ public class BubblePositioner { private boolean mShowingInBubbleBar; private BubbleBarLocation mBubbleBarLocation = BubbleBarLocation.DEFAULT; private final Rect mBubbleBarBounds = new Rect(); private int mBubbleBarTopOnScreen; public BubblePositioner(Context context, WindowManager windowManager) { mContext = context; Loading Loading @@ -846,17 +846,17 @@ public class BubblePositioner { } /** * Sets the position of the bubble bar in display coordinates. * Set top coordinate of bubble bar on screen */ public void setBubbleBarBounds(Rect bubbleBarBounds) { mBubbleBarBounds.set(bubbleBarBounds); public void setBubbleBarTopOnScreen(int topOnScreen) { mBubbleBarTopOnScreen = topOnScreen; } /** * Returns the display coordinates of the bubble bar. * Returns the top coordinate of bubble bar on screen */ public Rect getBubbleBarBounds() { return mBubbleBarBounds; public int getBubbleBarTopOnScreen() { return mBubbleBarTopOnScreen; } /** Loading Loading @@ -908,7 +908,7 @@ public class BubblePositioner { /** The bottom position of the expanded view when showing above the bubble bar. */ public int getExpandedViewBottomForBubbleBar() { return mBubbleBarBounds.top - mExpandedViewPadding; return mBubbleBarTopOnScreen - mExpandedViewPadding; } /** Loading libs/WindowManager/Shell/src/com/android/wm/shell/bubbles/IBubbles.aidl +3 −3 Original line number Diff line number Diff line Loading @@ -31,7 +31,7 @@ interface IBubbles { oneway void unregisterBubbleListener(in IBubblesListener listener) = 2; oneway void showBubble(in String key, in Rect bubbleBarBounds) = 3; oneway void showBubble(in String key, in int topOnScreen) = 3; oneway void dragBubbleToDismiss(in String key) = 4; Loading @@ -45,7 +45,7 @@ interface IBubbles { oneway void setBubbleBarLocation(in BubbleBarLocation location) = 9; oneway void setBubbleBarBounds(in Rect bubbleBarBounds) = 10; oneway void updateBubbleBarTopOnScreen(in int topOnScreen) = 10; oneway void stopBubbleDrag(in BubbleBarLocation location) = 11; oneway void stopBubbleDrag(in BubbleBarLocation location, in int topOnScreen) = 11; } No newline at end of file Loading
libs/WindowManager/Shell/multivalentTests/src/com/android/wm/shell/bubbles/BubblePositionerTest.kt +9 −25 Original line number Diff line number Diff line Loading @@ -218,11 +218,10 @@ class BubblePositionerTest { insets = Insets.of(10, 20, 5, 15), windowBounds = Rect(0, 0, 1800, 2600) ) val bubbleBarBounds = Rect(1700, 2500, 1780, 2600) positioner.setShowingInBubbleBar(true) positioner.update(deviceConfig) positioner.bubbleBarBounds = bubbleBarBounds positioner.bubbleBarTopOnScreen = 2500 val spaceBetweenTopInsetAndBubbleBarInLandscape = 1680 val expandedViewVerticalSpacing = Loading @@ -246,10 +245,9 @@ class BubblePositionerTest { insets = Insets.of(10, 20, 5, 15), windowBounds = Rect(0, 0, screenWidth, 2600) ) val bubbleBarBounds = Rect(100, 2500, 280, 2550) positioner.setShowingInBubbleBar(true) positioner.update(deviceConfig) positioner.bubbleBarBounds = bubbleBarBounds positioner.bubbleBarTopOnScreen = 2500 val spaceBetweenTopInsetAndBubbleBarInLandscape = 180 val expandedViewSpacing = Loading Loading @@ -597,16 +595,19 @@ class BubblePositionerTest { private fun testGetBubbleBarExpandedViewBounds(onLeft: Boolean, isOverflow: Boolean) { positioner.setShowingInBubbleBar(true) val windowBounds = Rect(0, 0, 2000, 2600) val insets = Insets.of(10, 20, 5, 15) val deviceConfig = defaultDeviceConfig.copy( isLargeScreen = true, isLandscape = true, insets = Insets.of(10, 20, 5, 15), windowBounds = Rect(0, 0, 2000, 2600) insets = insets, windowBounds = windowBounds ) positioner.update(deviceConfig) positioner.bubbleBarBounds = getBubbleBarBounds(onLeft, deviceConfig) val bubbleBarHeight = 100 positioner.bubbleBarTopOnScreen = windowBounds.bottom - insets.bottom - bubbleBarHeight val expandedViewPadding = context.resources.getDimensionPixelSize(R.dimen.bubble_expanded_view_padding) Loading @@ -624,7 +625,7 @@ class BubblePositionerTest { left = right - positioner.getExpandedViewWidthForBubbleBar(isOverflow) } // Above the bubble bar val bottom = positioner.bubbleBarBounds.top - expandedViewPadding val bottom = positioner.bubbleBarTopOnScreen - expandedViewPadding // Calculate right and top based on size val top = bottom - positioner.getExpandedViewHeightForBubbleBar(isOverflow) val expectedBounds = Rect(left, top, right, bottom) Loading Loading @@ -666,21 +667,4 @@ class BubblePositionerTest { positioner.getAllowableStackPositionRegion(1 /* bubbleCount */) return allowableStackRegion.top + allowableStackRegion.height() * offsetPercent } private fun getBubbleBarBounds(onLeft: Boolean, deviceConfig: DeviceConfig): Rect { val width = 200 val height = 100 val bottom = deviceConfig.windowBounds.bottom - deviceConfig.insets.bottom val top = bottom - height val left: Int val right: Int if (onLeft) { left = deviceConfig.insets.left right = left + width } else { right = deviceConfig.windowBounds.right - deviceConfig.insets.right left = right - width } return Rect(left, top, right, bottom) } }
libs/WindowManager/Shell/multivalentTests/src/com/android/wm/shell/bubbles/bar/BubbleExpandedViewPinControllerTest.kt +6 −12 Original line number Diff line number Diff line Loading @@ -53,7 +53,6 @@ class BubbleExpandedViewPinControllerTest { const val SCREEN_WIDTH = 2000 const val SCREEN_HEIGHT = 1000 const val BUBBLE_BAR_WIDTH = 100 const val BUBBLE_BAR_HEIGHT = 50 } Loading Loading @@ -84,14 +83,8 @@ class BubbleExpandedViewPinControllerTest { insets = Insets.of(10, 20, 30, 40) ) positioner.update(deviceConfig) positioner.bubbleBarBounds = Rect( SCREEN_WIDTH - deviceConfig.insets.right - BUBBLE_BAR_WIDTH, SCREEN_HEIGHT - deviceConfig.insets.bottom - BUBBLE_BAR_HEIGHT, SCREEN_WIDTH - deviceConfig.insets.right, SCREEN_HEIGHT - deviceConfig.insets.bottom ) positioner.bubbleBarTopOnScreen = SCREEN_HEIGHT - deviceConfig.insets.bottom - BUBBLE_BAR_HEIGHT controller = BubbleExpandedViewPinController(context, container, positioner) testListener = TestLocationChangeListener() controller.setListener(testListener) Loading Loading @@ -247,7 +240,8 @@ class BubbleExpandedViewPinControllerTest { private val dropTargetView: View? get() = container.findViewById(R.id.bubble_bar_drop_target) private fun getExpectedDropTargetBounds(onLeft: Boolean): Rect = Rect().also { private fun getExpectedDropTargetBounds(onLeft: Boolean): Rect = Rect().also { positioner.getBubbleBarExpandedViewBounds(onLeft, false /* isOveflowExpanded */, it) } Loading
libs/WindowManager/Shell/src/com/android/wm/shell/bubbles/BubbleController.java +12 −11 Original line number Diff line number Diff line Loading @@ -1190,9 +1190,11 @@ public class BubbleController implements ConfigurationChangeListener, * Will be called only when bubble bar is expanded. * * @param location location where bubble was released * @param topOnScreen top coordinate of the bubble bar on the screen after release */ public void stopBubbleDrag(BubbleBarLocation location) { public void stopBubbleDrag(BubbleBarLocation location, int topOnScreen) { mBubblePositioner.setBubbleBarLocation(location); mBubblePositioner.setBubbleBarTopOnScreen(topOnScreen); if (mBubbleData.getSelectedBubble() != null) { mBubbleBarViewCallback.expansionChanged(/* isExpanded = */ true); } Loading Loading @@ -1248,8 +1250,8 @@ public class BubbleController implements ConfigurationChangeListener, * <p>This is used by external callers (launcher). */ @VisibleForTesting public void expandStackAndSelectBubbleFromLauncher(String key, Rect bubbleBarBounds) { mBubblePositioner.setBubbleBarBounds(bubbleBarBounds); public void expandStackAndSelectBubbleFromLauncher(String key, int topOnScreen) { mBubblePositioner.setBubbleBarTopOnScreen(topOnScreen); if (BubbleOverflow.KEY.equals(key)) { mBubbleData.setSelectedBubbleFromLauncher(mBubbleData.getOverflow()); Loading Loading @@ -2364,10 +2366,9 @@ public class BubbleController implements ConfigurationChangeListener, } @Override public void showBubble(String key, Rect bubbleBarBounds) { public void showBubble(String key, int topOnScreen) { mMainExecutor.execute( () -> mController.expandStackAndSelectBubbleFromLauncher( key, bubbleBarBounds)); () -> mController.expandStackAndSelectBubbleFromLauncher(key, topOnScreen)); } @Override Loading @@ -2386,8 +2387,8 @@ public class BubbleController implements ConfigurationChangeListener, } @Override public void stopBubbleDrag(BubbleBarLocation location) { mMainExecutor.execute(() -> mController.stopBubbleDrag(location)); public void stopBubbleDrag(BubbleBarLocation location, int topOnScreen) { mMainExecutor.execute(() -> mController.stopBubbleDrag(location, topOnScreen)); } @Override Loading @@ -2408,9 +2409,9 @@ public class BubbleController implements ConfigurationChangeListener, } @Override public void setBubbleBarBounds(Rect bubbleBarBounds) { public void updateBubbleBarTopOnScreen(int topOnScreen) { mMainExecutor.execute(() -> { mBubblePositioner.setBubbleBarBounds(bubbleBarBounds); mBubblePositioner.setBubbleBarTopOnScreen(topOnScreen); if (mLayerView != null) mLayerView.updateExpandedView(); }); } Loading
libs/WindowManager/Shell/src/com/android/wm/shell/bubbles/BubblePositioner.java +8 −8 Original line number Diff line number Diff line Loading @@ -98,7 +98,7 @@ public class BubblePositioner { private boolean mShowingInBubbleBar; private BubbleBarLocation mBubbleBarLocation = BubbleBarLocation.DEFAULT; private final Rect mBubbleBarBounds = new Rect(); private int mBubbleBarTopOnScreen; public BubblePositioner(Context context, WindowManager windowManager) { mContext = context; Loading Loading @@ -846,17 +846,17 @@ public class BubblePositioner { } /** * Sets the position of the bubble bar in display coordinates. * Set top coordinate of bubble bar on screen */ public void setBubbleBarBounds(Rect bubbleBarBounds) { mBubbleBarBounds.set(bubbleBarBounds); public void setBubbleBarTopOnScreen(int topOnScreen) { mBubbleBarTopOnScreen = topOnScreen; } /** * Returns the display coordinates of the bubble bar. * Returns the top coordinate of bubble bar on screen */ public Rect getBubbleBarBounds() { return mBubbleBarBounds; public int getBubbleBarTopOnScreen() { return mBubbleBarTopOnScreen; } /** Loading Loading @@ -908,7 +908,7 @@ public class BubblePositioner { /** The bottom position of the expanded view when showing above the bubble bar. */ public int getExpandedViewBottomForBubbleBar() { return mBubbleBarBounds.top - mExpandedViewPadding; return mBubbleBarTopOnScreen - mExpandedViewPadding; } /** Loading
libs/WindowManager/Shell/src/com/android/wm/shell/bubbles/IBubbles.aidl +3 −3 Original line number Diff line number Diff line Loading @@ -31,7 +31,7 @@ interface IBubbles { oneway void unregisterBubbleListener(in IBubblesListener listener) = 2; oneway void showBubble(in String key, in Rect bubbleBarBounds) = 3; oneway void showBubble(in String key, in int topOnScreen) = 3; oneway void dragBubbleToDismiss(in String key) = 4; Loading @@ -45,7 +45,7 @@ interface IBubbles { oneway void setBubbleBarLocation(in BubbleBarLocation location) = 9; oneway void setBubbleBarBounds(in Rect bubbleBarBounds) = 10; oneway void updateBubbleBarTopOnScreen(in int topOnScreen) = 10; oneway void stopBubbleDrag(in BubbleBarLocation location) = 11; oneway void stopBubbleDrag(in BubbleBarLocation location, in int topOnScreen) = 11; } No newline at end of file