Introduce bubble bar location that is driven by shell

Adds bubble bar location to the update object that is sent by shell.
Allows repositioning the bubble bar if the location changes.

Bug: 313661121
Flag: ACONFIG com.android.wm.shell.enable_bubble_bar DEVELOPMENT

Test: manually sending the update to reposition, dragging coming soon
Change-Id: Id430a98116d860a7badcf607edc166c751e12cf8
This commit is contained in:
Ats Jenk
2024-02-01 13:39:45 -08:00
parent a9338897a4
commit cd0f35383f
6 changed files with 80 additions and 19 deletions
@@ -16,7 +16,6 @@
package com.android.launcher3.taskbar.bubbles;
import static android.view.View.INVISIBLE;
import static android.view.View.LAYOUT_DIRECTION_RTL;
import static android.view.View.VISIBLE;
import android.animation.Animator;
@@ -39,6 +38,7 @@ import com.android.launcher3.util.Executors;
import com.android.launcher3.util.MultiPropertyFactory;
import com.android.launcher3.util.MultiValueAlpha;
import com.android.systemui.shared.navigationbar.RegionSamplingHelper;
import com.android.wm.shell.common.bubbles.BubbleBarLocation;
/**
* Handles properties/data collection, then passes the results to our stashed handle View to render.
@@ -119,14 +119,14 @@ public class BubbleStashedHandleViewController {
}, Executors.UI_HELPER_EXECUTOR);
mStashedHandleView.addOnLayoutChangeListener((view, i, i1, i2, i3, i4, i5, i6, i7) ->
updateBounds());
updateBounds(mBarViewController.getBubbleBarLocation()));
}
private void updateBounds() {
private void updateBounds(BubbleBarLocation bubbleBarLocation) {
// As more bubbles get added, the icon bounds become larger. To ensure a consistent
// handle bar position, we pin it to the edge of the screen.
final int stashedCenterY = mStashedHandleView.getHeight() - mStashedTaskbarHeight / 2;
if (isOnLeft()) {
if (bubbleBarLocation.isOnLeft(mStashedHandleView.isLayoutRtl())) {
final int left = mBarViewController.getHorizontalMargin();
mStashedHandleBounds.set(
left,
@@ -149,11 +149,6 @@ public class BubbleStashedHandleViewController {
mStashedHandleView.setPivotY(mStashedHandleView.getHeight() - mStashedTaskbarHeight / 2f);
}
private boolean isOnLeft() {
// TODO(b/313661121): set this based on bubble bar position and not LTR or RTL
return mStashedHandleView.getLayoutDirection() == LAYOUT_DIRECTION_RTL;
}
public void onDestroy() {
mRegionSamplingHelper.stopAndDestroy();
mRegionSamplingHelper = null;
@@ -301,4 +296,9 @@ public class BubbleStashedHandleViewController {
public boolean containsX(int x) {
return x >= mStashedHandleBounds.left && x <= mStashedHandleBounds.right;
}
/** Set a bubble bar location */
public void setBubbleBarLocation(BubbleBarLocation bubbleBarLocation) {
updateBounds(bubbleBarLocation);
}
}