Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 7d6dbf02 authored by Ats Jenk's avatar Ats Jenk
Browse files

Adding logging to debug bubble drag failures

DragAndDismiss test is flaky. Bubble should be dragged to the dismiss
view, but dismiss view is not shown. And bubble is not dismissed. Add
some debug logging around drag events to help root cause the issue.

Bug: 417749498
Flag: EXEMPT adding logging, no behavior changes
Test: presubmit
Change-Id: Ia5447249b8d104d91cff33a021dea05669954eaa
parent aa3956e4
Loading
Loading
Loading
Loading
+6 −3
Original line number Diff line number Diff line
@@ -147,10 +147,12 @@ class DismissView(context: Context) : FrameLayout(context) {

    /**
     * Animates this view in.
     *
     * @return `true` if the view was shown, `false` otherwise
     */
    fun show() {
        if (isShowing) return
        val gradientDrawable = checkExists(gradientDrawable) ?: return
    fun show(): Boolean {
        if (isShowing) return false
        val gradientDrawable = checkExists(gradientDrawable) ?: return false
        isShowing = true
        setVisibility(View.VISIBLE)
        val alphaAnim = ObjectAnimator.ofInt(gradientDrawable, GRADIENT_ALPHA,
@@ -162,6 +164,7 @@ class DismissView(context: Context) : FrameLayout(context) {
        animator
            .spring(DynamicAnimation.TRANSLATION_Y, 0f, spring)
            .start()
        return true
    }

    /**
+50 −1
Original line number Diff line number Diff line
@@ -636,6 +636,9 @@ public class BubbleStackView extends FrameLayout
            }

            if (mBubbleData.isExpanded()) {
                // TODO(b/417749498): Delete debug log
                ProtoLog.v(
                        WM_SHELL_BUBBLES_NOISY, "BubbleStackView.bubbleDrag.onDown: isExpanded");
                if (mManageEduView != null) {
                    mManageEduView.hide();
                }
@@ -650,6 +653,9 @@ public class BubbleStackView extends FrameLayout
                // Save the magnetized individual bubble so we can dispatch touch events to it.
                mMagnetizedObject = mExpandedAnimationController.getMagnetizedBubbleDraggingOut();
            } else {
                // TODO(b/417749498): Delete debug log
                ProtoLog.v(
                        WM_SHELL_BUBBLES_NOISY, "BubbleStackView.bubbleDrag.onDown: isCollapsed");
                // If we're collapsed, prepare to drag the stack. Cancel active animations, set the
                // animation controller, and hide the flyout.
                mStackAnimationController.cancelStackPositionAnimations();
@@ -678,8 +684,21 @@ public class BubbleStackView extends FrameLayout
        @Override
        public void onMove(@NonNull View v, @NonNull MotionEvent ev, float viewInitialX,
                float viewInitialY, float dx, float dy) {
            // TODO(b/417749498): Delete debug log
            ProtoLog.v(
                    WM_SHELL_BUBBLES_NOISY,
                    "BubbleStackView.bubbleDrag.onMove: dx=%f, dy=%f",
                    dx,
                    dy);
            // If we're expanding or collapsing, ignore all touch events.
            if (mIsExpansionAnimating || mShowedUserEducationInTouchListenerActive) {
                // TODO(b/417749498): Delete debug log
                ProtoLog.v(
                        WM_SHELL_BUBBLES_NOISY,
                        "BubbleStackView.bubbleDrag.onMove: ignore isExpansionAnimating=%b"
                                + " showedUserEDU=%b",
                        mIsExpansionAnimating,
                        mShowedUserEducationInTouchListenerActive);
                return;
            }

@@ -688,7 +707,13 @@ public class BubbleStackView extends FrameLayout
            }

            // Show the dismiss target, if we haven't already.
            mDismissView.show();
            boolean shown = mDismissView.show();
            // TODO(b/417749498): Delete debug log
            ProtoLog.v(
                    WM_SHELL_BUBBLES_NOISY,
                    "BubbleStackView.bubbleDrag.onMove: dismissView(%d) shown=%b",
                    mDismissView.hashCode(),
                    shown);

            if (mIsExpanded && mExpandedBubble != null && v.equals(mExpandedBubble.getIconView())) {
                // Hide the expanded view if we're dragging out the expanded bubble, and we haven't
@@ -718,16 +743,29 @@ public class BubbleStackView extends FrameLayout
                float viewInitialY, float dx, float dy, float velX, float velY) {
            // If we're expanding or collapsing, ignore all touch events.
            if (mIsExpansionAnimating) {
                // TODO(b/417749498): Delete debug log
                ProtoLog.v(
                        WM_SHELL_BUBBLES_NOISY,
                        "BubbleStackView.bubbleDrag.onUp: isExpansionAnimating ignore");
                return;
            }
            if (mShowedUserEducationInTouchListenerActive) {
                mShowedUserEducationInTouchListenerActive = false;
                // TODO(b/417749498): Delete debug log
                ProtoLog.v(
                        WM_SHELL_BUBBLES_NOISY,
                        "BubbleStackView.bubbleDrag.onUp: showed user EDU ignore");
                return;
            }

            // First, see if the magnetized object consumes the event - if so, the bubble was
            // released in the target or flung out of it, and we should ignore the event.
            if (!passEventToMagnetizedObject(ev)) {
                // TODO(b/417749498): Delete debug log
                ProtoLog.v(
                        WM_SHELL_BUBBLES_NOISY,
                        "BubbleStackView.bubbleDrag.onUp: magnetized object not handling"
                                + " event");
                if (mBubbleData.isExpanded()) {
                    mExpandedAnimationController.snapBubbleBack(v, velX, velY);

@@ -745,7 +783,16 @@ public class BubbleStackView extends FrameLayout
                    logBubbleEvent(null /* no bubble associated with bubble stack move */,
                            FrameworkStatsLog.BUBBLE_UICHANGED__ACTION__STACK_MOVED);
                }
                // TODO(b/417749498): Delete debug log
                ProtoLog.v(
                        WM_SHELL_BUBBLES_NOISY,
                        "BubbleStackView.bubbleDrag.onUp: hide dismiss view");
                mDismissView.hide();
            } else {
                // TODO(b/417749498): Delete debug log
                ProtoLog.v(
                        WM_SHELL_BUBBLES_NOISY,
                        "BubbleStackView.bubbleDrag.onUp: magnetized object handling up");
            }

            onDraggingEnded();
@@ -758,6 +805,8 @@ public class BubbleStackView extends FrameLayout
        @Override
        public void onCancel(@NonNull View v, @NonNull MotionEvent ev, float viewInitialX,
                float viewInitialY) {
            // TODO(b/417749498): Delete debug log
            ProtoLog.v(WM_SHELL_BUBBLES_NOISY, "BubbleStackView.bubbleDrag.onCancel");
            animateStashedState(false /* stashImmediately */);
        }
    };