Loading quickstep/src/com/android/launcher3/taskbar/bubbles/BubbleBarController.java +28 −10 Original line number Diff line number Diff line Loading @@ -151,6 +151,9 @@ public class BubbleBarController extends IBubblesListener.Stub { private BubbleStashController mBubbleStashController; private BubbleStashedHandleViewController mBubbleStashedHandleViewController; // Keep track of bubble bar bounds sent to shell to avoid sending duplicate updates private final Rect mLastSentBubbleBarBounds = new Rect(); /** * Similar to {@link BubbleBarUpdate} but rather than {@link BubbleInfo}s it uses * {@link BubbleBarBubble}s so that it can be used to update the views. Loading Loading @@ -221,6 +224,7 @@ public class BubbleBarController extends IBubblesListener.Stub { !sBubbleBarEnabled || mBubbles.isEmpty()); mBubbleBarViewController.setUpdateSelectedBubbleAfterCollapse( key -> setSelectedBubbleInternal(mBubbles.get(key))); mBubbleBarViewController.setBoundsChangeListener(this::onBubbleBarBoundsChanged); }); } Loading Loading @@ -426,7 +430,9 @@ public class BubbleBarController extends IBubblesListener.Stub { info.getFlags() | Notification.BubbleMetadata.FLAG_SUPPRESS_NOTIFICATION); mSelectedBubble.getView().updateDotVisibility(true /* animate */); } mSystemUiProxy.showBubble(getSelectedBubbleKey(), getExpandedBubbleBarDisplayBounds()); Rect bounds = getExpandedBubbleBarDisplayBounds(); mLastSentBubbleBarBounds.set(bounds); mSystemUiProxy.showBubble(getSelectedBubbleKey(), bounds); } else { Log.w(TAG, "Trying to show the selected bubble but it's null"); } Loading Loading @@ -609,27 +615,39 @@ public class BubbleBarController extends IBubblesListener.Stub { return mIconFactory.createBadgedIconBitmap(drawable).icon; } private void onBubbleBarBoundsChanged(Rect newBounds) { Rect displayBounds = convertToDisplayBounds(newBounds); // Only send bounds over if they changed if (!displayBounds.equals(mLastSentBubbleBarBounds)) { mLastSentBubbleBarBounds.set(displayBounds); mSystemUiProxy.setBubbleBarBounds(displayBounds); } } /** * Get bounds of the bubble bar as if it would be expanded. * Calculates the bounds instead of retrieving current view location as the view may be * animating. */ private Rect getExpandedBubbleBarDisplayBounds() { return convertToDisplayBounds(mBarView.getBubbleBarBounds()); } private Rect convertToDisplayBounds(Rect currentBarBounds) { Point displaySize = DisplayController.INSTANCE.get(mContext).getInfo().currentSize; Rect currentBarBounds = mBarView.getBubbleBarBounds(); Rect location = new Rect(); Rect displayBounds = new Rect(); // currentBarBounds is only useful for distance from left or right edge. // It contains the current bounds, calculate the expanded bounds. if (mBarView.getBubbleBarLocation().isOnLeft(mBarView.isLayoutRtl())) { location.left = currentBarBounds.left; location.right = (int) (currentBarBounds.left + mBarView.expandedWidth()); displayBounds.left = currentBarBounds.left; displayBounds.right = (int) (currentBarBounds.left + mBarView.expandedWidth()); } else { location.left = (int) (currentBarBounds.right - mBarView.expandedWidth()); location.right = currentBarBounds.right; displayBounds.left = (int) (currentBarBounds.right - mBarView.expandedWidth()); displayBounds.right = currentBarBounds.right; } final int translation = (int) abs(mBubbleStashController.getBubbleBarTranslationY()); location.top = displaySize.y - currentBarBounds.height() - translation; location.bottom = displaySize.y - translation; return location; displayBounds.top = displaySize.y - currentBarBounds.height() - translation; displayBounds.bottom = displaySize.y - translation; return displayBounds; } } quickstep/src/com/android/launcher3/taskbar/bubbles/BubbleBarViewController.java +32 −3 Original line number Diff line number Diff line Loading @@ -27,6 +27,7 @@ import android.view.View; import android.widget.FrameLayout; import androidx.annotation.NonNull; import androidx.annotation.Nullable; import com.android.launcher3.R; import com.android.launcher3.anim.AnimatedFloat; Loading Loading @@ -84,6 +85,11 @@ public class BubbleBarViewController { private BubbleBarViewAnimator mBubbleBarViewAnimator; @Nullable private BubbleBarBoundsChangeListener mBoundsChangeListener; private final Rect mPreviousBubbleBarBounds = new Rect(); public BubbleBarViewController(TaskbarActivityContext activity, BubbleBarView barView) { mActivity = activity; mBarView = barView; Loading Loading @@ -113,9 +119,17 @@ public class BubbleBarViewController { mBubbleBarClickListener = v -> onBubbleBarClicked(); mBubbleDragController.setupBubbleBarView(mBarView); mBarView.setOnClickListener(mBubbleBarClickListener); mBarView.addOnLayoutChangeListener((view, i, i1, i2, i3, i4, i5, i6, i7) -> mTaskbarInsetsController.onTaskbarOrBubblebarWindowHeightOrInsetsChanged() ); mBarView.addOnLayoutChangeListener( (v, left, top, right, bottom, oldLeft, oldTop, oldRight, oldBottom) -> { mTaskbarInsetsController.onTaskbarOrBubblebarWindowHeightOrInsetsChanged(); Rect bubbleBarBounds = mBarView.getBubbleBarBounds(); if (!bubbleBarBounds.equals(mPreviousBubbleBarBounds)) { mPreviousBubbleBarBounds.set(bubbleBarBounds); if (mBoundsChangeListener != null) { mBoundsChangeListener.onBoundsChanged(bubbleBarBounds); } } }); mBubbleBarViewAnimator = new BubbleBarViewAnimator(mBarView, mBubbleStashController); } Loading Loading @@ -426,4 +440,19 @@ public class BubbleBarViewController { public void onDismissAllBubblesWhileDragging() { mSystemUiProxy.removeAllBubbles(); } /** * Set listener to be notified when bubble bar bounds have changed */ public void setBoundsChangeListener(@Nullable BubbleBarBoundsChangeListener listener) { mBoundsChangeListener = listener; } /** * Listener to receive updates about bubble bar bounds changing */ public interface BubbleBarBoundsChangeListener { /** Called when bounds have changed */ void onBoundsChanged(Rect newBounds); } } quickstep/src/com/android/quickstep/SystemUiProxy.java +12 −0 Original line number Diff line number Diff line Loading @@ -830,6 +830,18 @@ public class SystemUiProxy implements ISystemUiProxy, NavHandle { } } /** * Tells SysUI the bounds for the bubble bar * @param bubbleBarBounds bounds of the bubble bar in display coordinates */ public void setBubbleBarBounds(Rect bubbleBarBounds) { try { mBubbles.setBubbleBarBounds(bubbleBarBounds); } catch (RemoteException e) { Log.w(TAG, "Failed call setBubbleBarBounds"); } } // // Splitscreen // Loading Loading
quickstep/src/com/android/launcher3/taskbar/bubbles/BubbleBarController.java +28 −10 Original line number Diff line number Diff line Loading @@ -151,6 +151,9 @@ public class BubbleBarController extends IBubblesListener.Stub { private BubbleStashController mBubbleStashController; private BubbleStashedHandleViewController mBubbleStashedHandleViewController; // Keep track of bubble bar bounds sent to shell to avoid sending duplicate updates private final Rect mLastSentBubbleBarBounds = new Rect(); /** * Similar to {@link BubbleBarUpdate} but rather than {@link BubbleInfo}s it uses * {@link BubbleBarBubble}s so that it can be used to update the views. Loading Loading @@ -221,6 +224,7 @@ public class BubbleBarController extends IBubblesListener.Stub { !sBubbleBarEnabled || mBubbles.isEmpty()); mBubbleBarViewController.setUpdateSelectedBubbleAfterCollapse( key -> setSelectedBubbleInternal(mBubbles.get(key))); mBubbleBarViewController.setBoundsChangeListener(this::onBubbleBarBoundsChanged); }); } Loading Loading @@ -426,7 +430,9 @@ public class BubbleBarController extends IBubblesListener.Stub { info.getFlags() | Notification.BubbleMetadata.FLAG_SUPPRESS_NOTIFICATION); mSelectedBubble.getView().updateDotVisibility(true /* animate */); } mSystemUiProxy.showBubble(getSelectedBubbleKey(), getExpandedBubbleBarDisplayBounds()); Rect bounds = getExpandedBubbleBarDisplayBounds(); mLastSentBubbleBarBounds.set(bounds); mSystemUiProxy.showBubble(getSelectedBubbleKey(), bounds); } else { Log.w(TAG, "Trying to show the selected bubble but it's null"); } Loading Loading @@ -609,27 +615,39 @@ public class BubbleBarController extends IBubblesListener.Stub { return mIconFactory.createBadgedIconBitmap(drawable).icon; } private void onBubbleBarBoundsChanged(Rect newBounds) { Rect displayBounds = convertToDisplayBounds(newBounds); // Only send bounds over if they changed if (!displayBounds.equals(mLastSentBubbleBarBounds)) { mLastSentBubbleBarBounds.set(displayBounds); mSystemUiProxy.setBubbleBarBounds(displayBounds); } } /** * Get bounds of the bubble bar as if it would be expanded. * Calculates the bounds instead of retrieving current view location as the view may be * animating. */ private Rect getExpandedBubbleBarDisplayBounds() { return convertToDisplayBounds(mBarView.getBubbleBarBounds()); } private Rect convertToDisplayBounds(Rect currentBarBounds) { Point displaySize = DisplayController.INSTANCE.get(mContext).getInfo().currentSize; Rect currentBarBounds = mBarView.getBubbleBarBounds(); Rect location = new Rect(); Rect displayBounds = new Rect(); // currentBarBounds is only useful for distance from left or right edge. // It contains the current bounds, calculate the expanded bounds. if (mBarView.getBubbleBarLocation().isOnLeft(mBarView.isLayoutRtl())) { location.left = currentBarBounds.left; location.right = (int) (currentBarBounds.left + mBarView.expandedWidth()); displayBounds.left = currentBarBounds.left; displayBounds.right = (int) (currentBarBounds.left + mBarView.expandedWidth()); } else { location.left = (int) (currentBarBounds.right - mBarView.expandedWidth()); location.right = currentBarBounds.right; displayBounds.left = (int) (currentBarBounds.right - mBarView.expandedWidth()); displayBounds.right = currentBarBounds.right; } final int translation = (int) abs(mBubbleStashController.getBubbleBarTranslationY()); location.top = displaySize.y - currentBarBounds.height() - translation; location.bottom = displaySize.y - translation; return location; displayBounds.top = displaySize.y - currentBarBounds.height() - translation; displayBounds.bottom = displaySize.y - translation; return displayBounds; } }
quickstep/src/com/android/launcher3/taskbar/bubbles/BubbleBarViewController.java +32 −3 Original line number Diff line number Diff line Loading @@ -27,6 +27,7 @@ import android.view.View; import android.widget.FrameLayout; import androidx.annotation.NonNull; import androidx.annotation.Nullable; import com.android.launcher3.R; import com.android.launcher3.anim.AnimatedFloat; Loading Loading @@ -84,6 +85,11 @@ public class BubbleBarViewController { private BubbleBarViewAnimator mBubbleBarViewAnimator; @Nullable private BubbleBarBoundsChangeListener mBoundsChangeListener; private final Rect mPreviousBubbleBarBounds = new Rect(); public BubbleBarViewController(TaskbarActivityContext activity, BubbleBarView barView) { mActivity = activity; mBarView = barView; Loading Loading @@ -113,9 +119,17 @@ public class BubbleBarViewController { mBubbleBarClickListener = v -> onBubbleBarClicked(); mBubbleDragController.setupBubbleBarView(mBarView); mBarView.setOnClickListener(mBubbleBarClickListener); mBarView.addOnLayoutChangeListener((view, i, i1, i2, i3, i4, i5, i6, i7) -> mTaskbarInsetsController.onTaskbarOrBubblebarWindowHeightOrInsetsChanged() ); mBarView.addOnLayoutChangeListener( (v, left, top, right, bottom, oldLeft, oldTop, oldRight, oldBottom) -> { mTaskbarInsetsController.onTaskbarOrBubblebarWindowHeightOrInsetsChanged(); Rect bubbleBarBounds = mBarView.getBubbleBarBounds(); if (!bubbleBarBounds.equals(mPreviousBubbleBarBounds)) { mPreviousBubbleBarBounds.set(bubbleBarBounds); if (mBoundsChangeListener != null) { mBoundsChangeListener.onBoundsChanged(bubbleBarBounds); } } }); mBubbleBarViewAnimator = new BubbleBarViewAnimator(mBarView, mBubbleStashController); } Loading Loading @@ -426,4 +440,19 @@ public class BubbleBarViewController { public void onDismissAllBubblesWhileDragging() { mSystemUiProxy.removeAllBubbles(); } /** * Set listener to be notified when bubble bar bounds have changed */ public void setBoundsChangeListener(@Nullable BubbleBarBoundsChangeListener listener) { mBoundsChangeListener = listener; } /** * Listener to receive updates about bubble bar bounds changing */ public interface BubbleBarBoundsChangeListener { /** Called when bounds have changed */ void onBoundsChanged(Rect newBounds); } }
quickstep/src/com/android/quickstep/SystemUiProxy.java +12 −0 Original line number Diff line number Diff line Loading @@ -830,6 +830,18 @@ public class SystemUiProxy implements ISystemUiProxy, NavHandle { } } /** * Tells SysUI the bounds for the bubble bar * @param bubbleBarBounds bounds of the bubble bar in display coordinates */ public void setBubbleBarBounds(Rect bubbleBarBounds) { try { mBubbles.setBubbleBarBounds(bubbleBarBounds); } catch (RemoteException e) { Log.w(TAG, "Failed call setBubbleBarBounds"); } } // // Splitscreen // Loading