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

Commit 70b4ec35 authored by Lyn Han's avatar Lyn Han Committed by Android (Google) Code Review
Browse files

Merge "Decouple logging from BubbleViewProvider"

parents 7ac8bac7 53633573
Loading
Loading
Loading
Loading
+0 −16
Original line number Diff line number Diff line
@@ -712,22 +712,6 @@ class Bubble implements BubbleViewProvider {
        return Objects.hash(mKey);
    }

    @Override
    public void logUIEvent(int bubbleCount, int action, float normalX, float normalY, int index) {
        SysUiStatsLog.write(SysUiStatsLog.BUBBLE_UI_CHANGED,
                mPackageName,
                mChannelId,
                mNotificationId,
                index,
                bubbleCount,
                action,
                normalX,
                normalY,
                showInShade(),
                false /* isOngoing (unused) */,
                false /* isAppForeground (unused) */);
    }

    @Nullable
    private static String getTitle(@NonNull final NotificationEntry e) {
        final CharSequence titleCharSeq = e.getSbn().getNotification().extras.getCharSequence(
+26 −1
Original line number Diff line number Diff line
@@ -34,6 +34,7 @@ import androidx.annotation.Nullable;
import com.android.internal.annotations.VisibleForTesting;
import com.android.systemui.R;
import com.android.systemui.bubbles.BubbleController.DismissReason;
import com.android.systemui.shared.system.SysUiStatsLog;
import com.android.systemui.statusbar.notification.NotificationEntryManager;
import com.android.systemui.statusbar.notification.collection.NotificationEntry;

@@ -59,7 +60,7 @@ import javax.inject.Singleton;
@Singleton
public class BubbleData {

    private BubbleLogger mLogger = new BubbleLoggerImpl();
    private BubbleLoggerImpl mLogger = new BubbleLoggerImpl();

    private static final String TAG = TAG_WITH_CLASS_NAME ? "BubbleData" : TAG_BUBBLES;

@@ -610,6 +611,30 @@ public class BubbleData {
        mStateChange.selectionChanged = true;
    }

    /**
     * Logs the bubble UI event.
     *
     * @param provider The bubble view provider that is being interacted on. Null value indicates
     *               that the user interaction is not specific to one bubble.
     * @param action The user interaction enum
     * @param packageName SystemUI package
     * @param bubbleCount Number of bubbles in the stack
     * @param bubbleIndex Index of bubble in the stack
     * @param normalX Normalized x position of the stack
     * @param normalY Normalized y position of the stack
     */
     void logBubbleEvent(@Nullable BubbleViewProvider provider, int action, String packageName,
            int bubbleCount, int bubbleIndex, float normalX, float normalY) {
        if (provider == null) {
            mLogger.logStackUiChanged(packageName, action, bubbleCount, normalX, normalY);
        } else if (provider.getKey().equals(BubbleOverflow.KEY)) {
            mLogger.logShowOverflow(packageName, action, bubbleCount, normalX, normalY);
        } else {
            mLogger.logBubbleUiChanged((Bubble) provider, packageName, action, bubbleCount, normalX,
                    normalY, bubbleIndex);
        }
    }

    /**
     * Requests a change to the expanded state.
     *
+49 −0
Original line number Diff line number Diff line
@@ -17,6 +17,7 @@
package com.android.systemui.bubbles;

import com.android.internal.logging.UiEventLoggerImpl;
import com.android.systemui.shared.system.SysUiStatsLog;

/**
 * Implementation of UiEventLogger for logging bubble UI events.
@@ -64,4 +65,52 @@ public class BubbleLoggerImpl extends UiEventLoggerImpl implements BubbleLogger
            log(b, Event.BUBBLE_OVERFLOW_ADD_USER_GESTURE);
        }
    }

    void logStackUiChanged(String packageName, int action, int bubbleCount, float normalX,
            float normalY) {
        SysUiStatsLog.write(SysUiStatsLog.BUBBLE_UI_CHANGED,
                packageName,
                null /* notification channel */,
                0 /* notification ID */,
                0 /* bubble position */,
                bubbleCount,
                action,
                normalX,
                normalY,
                false /* unread bubble */,
                false /* on-going bubble */,
                false /* isAppForeground (unused) */);
    }

    void logShowOverflow(String packageName, int action, int bubbleCount, float normalX,
            float normalY) {
        SysUiStatsLog.write(SysUiStatsLog.BUBBLE_UI_CHANGED,
                packageName,
                BubbleOverflow.KEY  /* notification channel */,
                0 /* notification ID */,
                0 /* bubble position */,
                bubbleCount,
                action,
                normalX,
                normalY,
                false /* unread bubble */,
                false /* on-going bubble */,
                false /* isAppForeground (unused) */);
    }

    void logBubbleUiChanged(Bubble bubble, String packageName, int action, int bubbleCount,
            float normalX, float normalY, int index) {
        SysUiStatsLog.write(SysUiStatsLog.BUBBLE_UI_CHANGED,
                packageName,
                bubble.getChannelId() /* notification channel */,
                bubble.getNotificationId() /* notification ID */,
                index,
                bubbleCount,
                action,
                normalX,
                normalY,
                bubble.showInShade() /* isUnread */,
                false /* isOngoing (unused) */,
                false /* isAppForeground (unused) */);
    }
}
 No newline at end of file
+0 −6
Original line number Diff line number Diff line
@@ -162,12 +162,6 @@ public class BubbleOverflow implements BubbleViewProvider {
        mExpandedView.setContentVisibility(visible);
    }

    @Override
    public void logUIEvent(int bubbleCount, int action, float normalX, float normalY,
            int index) {
        // TODO(b/149133814) Log overflow UI events.
    }

    @Override
    public View getIconView() {
        return mOverflowBtn;
+7 −17
Original line number Diff line number Diff line
@@ -2891,23 +2891,13 @@ public class BubbleStackView extends FrameLayout
     * @param action the user interaction enum.
     */
    private void logBubbleEvent(@Nullable BubbleViewProvider provider, int action) {
        if (provider == null || provider.getKey().equals(BubbleOverflow.KEY)) {
            SysUiStatsLog.write(SysUiStatsLog.BUBBLE_UI_CHANGED,
        mBubbleData.logBubbleEvent(provider,
                action,
                mContext.getApplicationInfo().packageName,
                    provider == null ? null : BubbleOverflow.KEY /* notification channel */,
                    0 /* notification ID */,
                    0 /* bubble position */,
                getBubbleCount(),
                    action,
                getBubbleIndex(provider),
                getNormalizedXPosition(),
                    getNormalizedYPosition(),
                    false /* unread bubble */,
                    false /* on-going bubble */,
                    false /* isAppForeground (unused) */);
            return;
        }
        provider.logUIEvent(getBubbleCount(), action, getNormalizedXPosition(),
                getNormalizedYPosition(), getBubbleIndex(provider));
                getNormalizedYPosition());
    }

    /**
Loading