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

Commit 2a7418d2 authored by Lyn Han's avatar Lyn Han
Browse files

Log persisted bubbles

Bug: 167729787
Test: adb shell cmd stats print-logs
Change-Id: I07b470212684e1d186f9f4da9d5e6ee3291cfef5
parent 0138bf5f
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -458,6 +458,8 @@ public class BubbleController implements ConfigurationController.ConfigurationLi

        mSavedBubbleKeysPerUser = new SparseSetArray<>();
        mCurrentUserId = mNotifUserManager.getCurrentUserId();
        mBubbleData.setCurrentUserId(mCurrentUserId);

        mNotifUserManager.addUserChangedListener(
                new NotificationLockscreenUserManager.UserChangedListener() {
                    @Override
@@ -466,6 +468,7 @@ public class BubbleController implements ConfigurationController.ConfigurationLi
                        mBubbleData.dismissAll(DISMISS_USER_CHANGED);
                        BubbleController.this.restoreBubbles(newUserId);
                        mCurrentUserId = newUserId;
                        mBubbleData.setCurrentUserId(newUserId);
                    }
                });

+10 −1
Original line number Diff line number Diff line
@@ -35,6 +35,7 @@ import com.android.internal.annotations.VisibleForTesting;
import com.android.systemui.R;
import com.android.systemui.bubbles.BubbleController.DismissReason;
import com.android.systemui.dagger.SysUISingleton;
import com.android.systemui.shared.system.SysUiStatsLog;
import com.android.systemui.statusbar.notification.NotificationEntryManager;
import com.android.systemui.statusbar.notification.collection.NotificationEntry;

@@ -61,6 +62,8 @@ public class BubbleData {

    private BubbleLoggerImpl mLogger = new BubbleLoggerImpl();

    private int mCurrentUserId;

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

    private static final Comparator<Bubble> BUBBLES_BY_SORT_KEY_DESCENDING =
@@ -617,6 +620,10 @@ public class BubbleData {
        mStateChange.selectionChanged = true;
    }

    void setCurrentUserId(int uid) {
        mCurrentUserId = uid;
    }

    /**
     * Logs the bubble UI event.
     *
@@ -634,7 +641,9 @@ public class BubbleData {
        if (provider == null) {
            mLogger.logStackUiChanged(packageName, action, bubbleCount, normalX, normalY);
        } else if (provider.getKey().equals(BubbleOverflow.KEY)) {
            mLogger.logShowOverflow(packageName, action, bubbleCount, normalX, normalY);
            if (action == SysUiStatsLog.BUBBLE_UICHANGED__ACTION__EXPANDED) {
                mLogger.logShowOverflow(packageName, mCurrentUserId);
            }
        } else {
            mLogger.logBubbleUiChanged((Bubble) provider, packageName, action, bubbleCount, normalX,
                    normalY, bubbleIndex);
+4 −1
Original line number Diff line number Diff line
@@ -53,7 +53,10 @@ public interface BubbleLogger extends UiEventLogger {
        BUBBLE_OVERFLOW_REMOVE_BACK_TO_STACK(489),

        @UiEvent(doc = "User blocked notification from bubbling, remove bubble from overflow.")
        BUBBLE_OVERFLOW_REMOVE_BLOCKED(490);
        BUBBLE_OVERFLOW_REMOVE_BLOCKED(490),

        @UiEvent(doc = "User selected the overflow.")
        BUBBLE_OVERFLOW_SELECTED(600);

        private final int mId;

+6 −19
Original line number Diff line number Diff line
@@ -16,6 +16,8 @@

package com.android.systemui.bubbles;

import android.os.UserHandle;

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

@@ -31,11 +33,7 @@ public class BubbleLoggerImpl extends UiEventLoggerImpl implements BubbleLogger
     * @param e UI event
     */
    public void log(Bubble b, UiEventEnum e) {
        if (b.getInstanceId() == null) {
            // Added from persistence -- TODO log this with specific event?
            return;
        }
        logWithInstanceId(e, b.getAppUid(), b.getPackageName(), b.getInstanceId());
        super.log(e, b.getUser().getIdentifier(), b.getPackageName());
    }

    /**
@@ -82,20 +80,9 @@ public class BubbleLoggerImpl extends UiEventLoggerImpl implements BubbleLogger
                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 logShowOverflow(String packageName, int currentUserId) {
        super.log(BubbleLogger.Event.BUBBLE_OVERFLOW_SELECTED, currentUserId,
                packageName);
    }

    void logBubbleUiChanged(Bubble bubble, String packageName, int action, int bubbleCount,