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

Commit 0240160d authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Automerger Merge Worker
Browse files

Merge "Decouple logUIevent from Bubble class" into rvc-dev am: bcbcca7d am: 5993341a

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/11849441

Change-Id: I67892206b4a854fb5644ebfcc42ac88e23a1edd7
parents 21d6c127 5993341a
Loading
Loading
Loading
Loading
+20 −25
Original line number Diff line number Diff line
@@ -51,6 +51,7 @@ import android.graphics.drawable.TransitionDrawable;
import android.os.Bundle;
import android.os.Handler;
import android.provider.Settings;
import android.service.notification.StatusBarNotification;
import android.util.Log;
import android.view.Choreographer;
import android.view.DisplayCutout;
@@ -1065,10 +1066,8 @@ public class BubbleStackView extends FrameLayout
                    if (bubble != null && mBubbleData.hasBubbleInStackWithKey(bubble.getKey())) {
                        final Intent intent = bubble.getSettingsIntent(mContext);
                        collapseStack(() -> {

                            mContext.startActivityAsUser(intent, bubble.getUser());
                            logBubbleClickEvent(
                                    bubble,
                            logBubbleEvent(bubble,
                                    SysUiStatsLog.BUBBLE_UICHANGED__ACTION__HEADER_GO_TO_SETTINGS);
                        });
                    }
@@ -2757,16 +2756,28 @@ public class BubbleStackView extends FrameLayout
    /**
     * Logs the bubble UI event.
     *
     * @param bubble the bubble that is being interacted on. Null value indicates that
     *               the user interaction is not specific to one bubble.
     * @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.
     */
    private void logBubbleEvent(@Nullable BubbleViewProvider bubble, int action) {
        if (bubble == null) {
    private void logBubbleEvent(@Nullable BubbleViewProvider provider, int action) {
        if (provider == null || provider.getKey().equals(BubbleOverflow.KEY)) {
            SysUiStatsLog.write(SysUiStatsLog.BUBBLE_UI_CHANGED,
                    mContext.getApplicationInfo().packageName,
                    provider == null ? null : BubbleOverflow.KEY /* notification channel */,
                    0 /* notification ID */,
                    0 /* bubble position */,
                    getBubbleCount(),
                    action,
                    getNormalizedXPosition(),
                    getNormalizedYPosition(),
                    false /* unread bubble */,
                    false /* on-going bubble */,
                    false /* isAppForeground (unused) */);
            return;
        }
        bubble.logUIEvent(getBubbleCount(), action, getNormalizedXPosition(),
                getNormalizedYPosition(), getBubbleIndex(bubble));
        provider.logUIEvent(getBubbleCount(), action, getNormalizedXPosition(),
                getNormalizedYPosition(), getBubbleIndex(provider));
    }

    /**
@@ -2805,20 +2816,4 @@ public class BubbleStackView extends FrameLayout
        }
        return bubbles;
    }

    /**
     * Logs bubble UI click event.
     *
     * @param bubble the bubble notification entry that user is interacting with.
     * @param action the user interaction enum.
     */
    private void logBubbleClickEvent(Bubble bubble, int action) {
        bubble.logUIEvent(
                getBubbleCount(),
                action,
                getNormalizedXPosition(),
                getNormalizedYPosition(),
                getBubbleIndex(getExpandedBubble())
        );
    }
}