From 6f17eac4807d99abe0b7ada0b95d1eef0e2994e6 Mon Sep 17 00:00:00 2001 From: Lyn Han Date: Fri, 12 Jun 2020 01:49:05 -0700 Subject: [PATCH] Decouple logUIevent from Bubble class Log STACK_MOVED & STACK_DISMISSED for null bubbles and overflow Fixes: 158661994 Test: atest Change-Id: I137749f29b4bdcdb049904ad90b54b0aa632c663 --- .../systemui/bubbles/BubbleStackView.java | 45 +++++++++---------- 1 file changed, 20 insertions(+), 25 deletions(-) diff --git a/packages/SystemUI/src/com/android/systemui/bubbles/BubbleStackView.java b/packages/SystemUI/src/com/android/systemui/bubbles/BubbleStackView.java index 23bd174ac4a53..271f7503d38ae 100644 --- a/packages/SystemUI/src/com/android/systemui/bubbles/BubbleStackView.java +++ b/packages/SystemUI/src/com/android/systemui/bubbles/BubbleStackView.java @@ -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; @@ -1027,10 +1028,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); }); } @@ -2713,16 +2712,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)); } /** @@ -2761,20 +2772,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()) - ); - } }