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

Commit 69523965 authored by Ats Jenk's avatar Ats Jenk
Browse files

Switch from logcat to protolog for bubbles gesture logs

Trying to understand why a test for bubbles gesture is failing.
Current method of relying on a compile-time constant can't be used
for enabling logs only in a test.
Switching to protolog, which can be enabled from a test.

Bug: 294406308
Test: run a build
Test: enable protolog to logcat and verify bubbles logs are there
Change-Id: Ic206e01132d4f09d893b51cd008e2a03dff64e77
parent 1926d700
Loading
Loading
Loading
Loading
+3 −4
Original line number Diff line number Diff line
@@ -25,7 +25,6 @@ import static android.view.View.VISIBLE;
import static android.view.WindowManager.LayoutParams.LAYOUT_IN_DISPLAY_CUTOUT_MODE_ALWAYS;

import static com.android.wm.shell.bubbles.BubbleDebugConfig.DEBUG_BUBBLE_CONTROLLER;
import static com.android.wm.shell.bubbles.BubbleDebugConfig.DEBUG_BUBBLE_GESTURE;
import static com.android.wm.shell.bubbles.BubbleDebugConfig.TAG_BUBBLES;
import static com.android.wm.shell.bubbles.BubbleDebugConfig.TAG_WITH_CLASS_NAME;
import static com.android.wm.shell.bubbles.Bubbles.DISMISS_BLOCKED;
@@ -37,6 +36,7 @@ import static com.android.wm.shell.bubbles.Bubbles.DISMISS_NO_LONGER_BUBBLE;
import static com.android.wm.shell.bubbles.Bubbles.DISMISS_PACKAGE_REMOVED;
import static com.android.wm.shell.bubbles.Bubbles.DISMISS_SHORTCUT_REMOVED;
import static com.android.wm.shell.bubbles.Bubbles.DISMISS_USER_CHANGED;
import static com.android.wm.shell.protolog.ShellProtoLogGroup.WM_SHELL_BUBBLES;
import static com.android.wm.shell.sysui.ShellSharedConstants.KEY_EXTRA_SHELL_BUBBLES;

import android.annotation.BinderThread;
@@ -85,6 +85,7 @@ import androidx.annotation.MainThread;
import androidx.annotation.Nullable;

import com.android.internal.annotations.VisibleForTesting;
import com.android.internal.protolog.common.ProtoLog;
import com.android.internal.statusbar.IStatusBarService;
import com.android.launcher3.icons.BubbleIconFactory;
import com.android.wm.shell.R;
@@ -1004,9 +1005,7 @@ public class BubbleController implements ConfigurationChangeListener,
    }

    private void onNotificationPanelExpandedChanged(boolean expanded) {
        if (DEBUG_BUBBLE_GESTURE) {
            Log.d(TAG, "onNotificationPanelExpandedChanged: expanded=" + expanded);
        }
        ProtoLog.d(WM_SHELL_BUBBLES, "onNotificationPanelExpandedChanged: expanded=%b", expanded);
        if (mStackView != null && mStackView.isExpanded()) {
            if (expanded) {
                mStackView.stopMonitoringSwipeUpGesture();
+0 −1
Original line number Diff line number Diff line
@@ -47,7 +47,6 @@ public class BubbleDebugConfig {
    static final boolean DEBUG_USER_EDUCATION = false;
    static final boolean DEBUG_POSITIONER = false;
    public static final boolean DEBUG_COLLAPSE_ANIMATOR = false;
    static final boolean DEBUG_BUBBLE_GESTURE = false;
    public static boolean DEBUG_EXPANDED_VIEW_DRAGGING = false;

    private static final boolean FORCE_SHOW_USER_EDUCATION = false;
+4 −7
Original line number Diff line number Diff line
@@ -21,11 +21,11 @@ import static android.view.ViewGroup.LayoutParams.WRAP_CONTENT;

import static com.android.wm.shell.animation.Interpolators.ALPHA_IN;
import static com.android.wm.shell.animation.Interpolators.ALPHA_OUT;
import static com.android.wm.shell.bubbles.BubbleDebugConfig.DEBUG_BUBBLE_GESTURE;
import static com.android.wm.shell.bubbles.BubbleDebugConfig.DEBUG_BUBBLE_STACK_VIEW;
import static com.android.wm.shell.bubbles.BubbleDebugConfig.TAG_BUBBLES;
import static com.android.wm.shell.bubbles.BubbleDebugConfig.TAG_WITH_CLASS_NAME;
import static com.android.wm.shell.bubbles.BubblePositioner.NUM_VISIBLE_WHEN_RESTING;
import static com.android.wm.shell.protolog.ShellProtoLogGroup.WM_SHELL_BUBBLES;

import android.animation.Animator;
import android.animation.AnimatorListenerAdapter;
@@ -75,6 +75,7 @@ import androidx.dynamicanimation.animation.SpringForce;

import com.android.internal.annotations.VisibleForTesting;
import com.android.internal.policy.ScreenDecorationsUtils;
import com.android.internal.protolog.common.ProtoLog;
import com.android.internal.util.FrameworkStatsLog;
import com.android.wm.shell.R;
import com.android.wm.shell.animation.Interpolators;
@@ -2024,9 +2025,7 @@ public class BubbleStackView extends FrameLayout
     * Monitor for swipe up gesture that is used to collapse expanded view
     */
    void startMonitoringSwipeUpGesture() {
        if (DEBUG_BUBBLE_GESTURE) {
            Log.d(TAG, "startMonitoringSwipeUpGesture");
        }
        ProtoLog.d(WM_SHELL_BUBBLES, "startMonitoringSwipeUpGesture");
        stopMonitoringSwipeUpGestureInternal();

        if (isGestureNavEnabled()) {
@@ -2046,9 +2045,7 @@ public class BubbleStackView extends FrameLayout
     * Stop monitoring for swipe up gesture
     */
    void stopMonitoringSwipeUpGesture() {
        if (DEBUG_BUBBLE_GESTURE) {
            Log.d(TAG, "stopMonitoringSwipeUpGesture");
        }
        ProtoLog.d(WM_SHELL_BUBBLES, "stopMonitoringSwipeUpGesture");
        stopMonitoringSwipeUpGestureInternal();
    }

+5 −10
Original line number Diff line number Diff line
@@ -18,10 +18,10 @@ package com.android.wm.shell.bubbles;

import static com.android.wm.shell.bubbles.BubbleDebugConfig.TAG_BUBBLES;
import static com.android.wm.shell.bubbles.BubbleDebugConfig.TAG_WITH_CLASS_NAME;
import static com.android.wm.shell.protolog.ShellProtoLogGroup.WM_SHELL_BUBBLES;

import android.content.Context;
import android.hardware.input.InputManager;
import android.util.Log;
import android.view.Choreographer;
import android.view.InputChannel;
import android.view.InputEventReceiver;
@@ -29,6 +29,7 @@ import android.view.InputMonitor;

import androidx.annotation.Nullable;

import com.android.internal.protolog.common.ProtoLog;
import com.android.wm.shell.bubbles.BubblesNavBarMotionEventHandler.MotionEventListener;

/**
@@ -58,9 +59,7 @@ class BubblesNavBarGestureTracker {
     * @param listener listener that is notified of touch events
     */
    void start(MotionEventListener listener) {
        if (BubbleDebugConfig.DEBUG_BUBBLE_GESTURE) {
            Log.d(TAG, "start monitoring bubbles swipe up gesture");
        }
        ProtoLog.d(WM_SHELL_BUBBLES, "start monitoring bubbles swipe up gesture");

        stopInternal();

@@ -76,9 +75,7 @@ class BubblesNavBarGestureTracker {
    }

    void stop() {
        if (BubbleDebugConfig.DEBUG_BUBBLE_GESTURE) {
            Log.d(TAG, "stop monitoring bubbles swipe up gesture");
        }
        ProtoLog.d(WM_SHELL_BUBBLES, "stop monitoring bubbles swipe up gesture");
        stopInternal();
    }

@@ -94,9 +91,7 @@ class BubblesNavBarGestureTracker {
    }

    private void onInterceptTouch() {
        if (BubbleDebugConfig.DEBUG_BUBBLE_GESTURE) {
            Log.d(TAG, "intercept touch event");
        }
        ProtoLog.d(WM_SHELL_BUBBLES, "intercept touch event");
        if (mInputMonitor != null) {
            mInputMonitor.pilferPointers();
        }
+5 −6
Original line number Diff line number Diff line
@@ -16,19 +16,20 @@

package com.android.wm.shell.bubbles;

import static com.android.wm.shell.bubbles.BubbleDebugConfig.DEBUG_BUBBLE_GESTURE;
import static com.android.wm.shell.bubbles.BubbleDebugConfig.TAG_BUBBLES;
import static com.android.wm.shell.bubbles.BubbleDebugConfig.TAG_WITH_CLASS_NAME;
import static com.android.wm.shell.protolog.ShellProtoLogGroup.WM_SHELL_BUBBLES;

import android.content.Context;
import android.graphics.PointF;
import android.util.Log;
import android.view.MotionEvent;
import android.view.VelocityTracker;
import android.view.ViewConfiguration;

import androidx.annotation.Nullable;

import com.android.internal.protolog.common.ProtoLog;

/**
 * Handles {@link MotionEvent}s for bubbles that begin in the nav bar area
 */
@@ -112,10 +113,8 @@ class BubblesNavBarMotionEventHandler {
    private boolean isInGestureRegion(MotionEvent ev) {
        // Only handles touch events beginning in navigation bar system gesture zone
        if (mPositioner.getNavBarGestureZone().contains((int) ev.getX(), (int) ev.getY())) {
            if (DEBUG_BUBBLE_GESTURE) {
                Log.d(TAG, "handling touch y=" + ev.getY()
                        + " navBarGestureZone=" + mPositioner.getNavBarGestureZone());
            }
            ProtoLog.d(WM_SHELL_BUBBLES, "handling touch x=%d y=%d navBarGestureZone=%s",
                    (int) ev.getX(), (int) ev.getY(), mPositioner.getNavBarGestureZone());
            return true;
        }
        return false;
Loading