Show the bubble bar edu view

We now show the bubble bar edu view after a request from shell
to show it was received, and as soon as the user performs a touch
gesture on the bubble bar or flyout that causes the bar to be
expanded.

The click listener on the bubble bar is removed with this change
because the input consumer already handles taps. Removing the
listener avoids processing the tap twice which causes the edu view
to not be displayed. Removing the click listener solves the issue
but ideally we should move the edu view to launcher since that
would allow us to manage its state easily.

Flag: com.android.wm.shell.enable_bubble_bar
Fixes: 374842575
Test: atest PersistentBubbleStashControllerTest
Test: atest BubbleBarSwipeControllerTest
Test: atest TransientBubbleStashControllerTest
Test: manual
       - force show the bar edu view
       - send a bubble
       - tap the bubble bar to expand
       - observe bubble bar edu is visible
       - repeat with swiping on the bar and tapping the flyout
       - launch an app
       - swipe up to show the taskbar
       - observe edu view not visible
       - send a bubble with auto expand
       - observe bubble bar expanded and edu view not visible
Change-Id: I98ec44e6edf6c69d6d47b5709140796c2ecab23e
This commit is contained in:
Liran Binyamin committed 2024-11-26 10:23:45 -05:00
1 parent 0b0452eda9
commit 16a604fe0c
11 files changed
+175 -60

No files matched your search

@@ -95,7 +95,6 @@ public class BubbleBarViewController {
private TaskbarInsetsController mTaskbarInsetsController;
private TaskbarViewPropertiesProvider mTaskbarViewPropertiesProvider;
private View.OnClickListener mBubbleClickListener;
private View.OnClickListener mBubbleBarClickListener;
private BubbleView.Controller mBubbleViewController;
private BubbleBarOverflow mOverflowBubble;
@@ -178,13 +177,11 @@ public class BubbleBarViewController {
dp -> onBubbleBarConfigurationChanged(/* animate= */ true));
mBubbleBarScaleY.updateValue(1f);
mBubbleClickListener = v -> onBubbleClicked((BubbleView) v);
mBubbleBarClickListener = v -> expandBubbleBar();
mBubbleDragController.setupBubbleBarView(mBarView);
mOverflowBubble = bubbleControllers.bubbleCreator.createOverflow(mBarView);
if (!Flags.enableOptionalBubbleOverflow()) {
showOverflow(true);
}
mBarView.setOnClickListener(mBubbleBarClickListener);
mBarView.addOnLayoutChangeListener(
(v, left, top, right, bottom, oldLeft, oldTop, oldRight, oldBottom) -> {
mTaskbarInsetsController.onTaskbarOrBubblebarWindowHeightOrInsetsChanged();
@@ -211,7 +208,8 @@ public class BubbleBarViewController {
@Override
public void expandBubbleBar() {
BubbleBarViewController.this.expandBubbleBar();
BubbleBarViewController.this.setExpanded(
/* isExpanded= */ true, /* maybeShowEdu*/ true);
}
@Override
@@ -332,7 +330,7 @@ public class BubbleBarViewController {
@Override
public void flyoutClicked() {
interruptAnimationForTouch();
expandBubbleBar();
setExpanded(/* isExpanded= */ true, /* maybeShowEdu*/ true);
}
};
}
@@ -360,25 +358,6 @@ public class BubbleBarViewController {
mBubbleStashController.onNewBubbleAnimationInterrupted(false, mBarView.getTranslationY());
}
private void expandBubbleBar() {
if (mShouldShowEducation) {
mShouldShowEducation = false;
// Get the bubble bar bounds on screen
Rect bounds = new Rect();
mBarView.getBoundsOnScreen(bounds);
// Calculate user education reference position in Screen coordinates
Point position = new Point(bounds.centerX(), bounds.top);
// Show user education relative to the reference point
mSystemUiProxy.showUserEducation(position);
} else {
// ensure that the bubble bar has the correct translation. we may have just interrupted
// the animation by touching the bubble bar.
mBubbleBarTranslationY.animateToValue(mBubbleStashController.getBubbleBarTranslationY())
.start();
setExpanded(true);
}
}
private void collapseBubbleBar() {
setExpanded(false);
mBubbleStashController.stashBubbleBar();
@@ -391,6 +370,22 @@ public class BubbleBarViewController {
}
}
/** Shows the education view if it was previously requested. */
private boolean maybeShowEduView() {
if (mShouldShowEducation) {
mShouldShowEducation = false;
// Get the bubble bar bounds on screen
Rect bounds = new Rect();
mBarView.getBoundsOnScreen(bounds);
// Calculate user education reference position in Screen coordinates
Point position = new Point(bounds.centerX(), bounds.top);
// Show user education relative to the reference point
mSystemUiProxy.showUserEducation(position);
return true;
}
return false;
}
/** Notifies that the IME became visible. */
public void onImeVisible() {
if (isAnimatingNewBubble()) {
@@ -946,13 +941,25 @@ public class BubbleBarViewController {
mBarView.setSelectedBubble(newlySelected.getView());
}
/** @see #setExpanded(boolean, boolean) */
public void setExpanded(boolean isExpanded) {
setExpanded(isExpanded, /* maybeShowEdu= */ false);
}
/**
* Sets whether the bubble bar should be expanded (not unstashed, but have the contents
* within it expanded). This method notifies SystemUI that the bubble bar is expanded and
* showing a selected bubble. This method should ONLY be called from UI events originating
* from Launcher.
*
* @param isExpanded whether the bar should be expanded
* @param maybeShowEdu whether we should show the edu view before expanding
*/
public void setExpanded(boolean isExpanded) {
public void setExpanded(boolean isExpanded, boolean maybeShowEdu) {
// if we're trying to expand try showing the edu view instead
if (maybeShowEdu && isExpanded && !mBarView.isExpanded() && maybeShowEduView()) {
return;
}
if (!mBubbleBarPinning.isAnimating() && isExpanded != mBarView.isExpanded()) {
mBarView.setExpanded(isExpanded);
adjustTaskbarAndHotseatToBubbleBarState(isExpanded);
@@ -1012,7 +1019,11 @@ public class BubbleBarViewController {
}
}
/** Marks as should show education. */
/**
* Stores a request to show the education view for later processing when appropriate.
*
* @see #maybeShowEduView()
*/
public void prepareToShowEducation() {
mShouldShowEducation = true;
}