Add logging to indiciate whether a bubble is read or unread.
Bug: 123543171
Test: manual
Change-Id: Iaa4d8e3413fedf126b080da19883b22dcf85a1f2
diff --git a/cmds/statsd/src/atoms.proto b/cmds/statsd/src/atoms.proto
index d6ea7e6..fdccaad 100644
--- a/cmds/statsd/src/atoms.proto
+++ b/cmds/statsd/src/atoms.proto
@@ -5554,6 +5554,9 @@
// Normalized screen position of the bubble stack. The range is between 0 and 1.
optional float normalized_x_position = 7;
optional float normalized_y_position = 8;
+
+ // Whether the bubble is unread. If it is unread, a dot is shown in the bubble stack icon.
+ optional bool is_unread = 9;
}
/**
diff --git a/packages/SystemUI/src/com/android/systemui/bubbles/BubbleExpandedView.java b/packages/SystemUI/src/com/android/systemui/bubbles/BubbleExpandedView.java
index 8e3afd8..1ab28ab 100644
--- a/packages/SystemUI/src/com/android/systemui/bubbles/BubbleExpandedView.java
+++ b/packages/SystemUI/src/com/android/systemui/bubbles/BubbleExpandedView.java
@@ -413,7 +413,7 @@
((TextView) mPermissionView.findViewById(R.id.pkgname)).setText(mAppName);
((TextView) mPermissionView.findViewById(R.id.prompt)).setText(
getResources().getString(R.string.bubbles_prompt, mAppName));
- logBubbleClickEvent(mEntry.notification,
+ logBubbleClickEvent(mEntry,
StatsLog.BUBBLE_UICHANGED__ACTION__PERMISSION_DIALOG_SHOWN);
}
}
@@ -509,7 +509,7 @@
mStackView.collapseStack(() -> {
try {
n.contentIntent.send();
- logBubbleClickEvent(mEntry.notification,
+ logBubbleClickEvent(mEntry,
StatsLog.BUBBLE_UICHANGED__ACTION__HEADER_GO_TO_APP);
} catch (PendingIntent.CanceledException e) {
Log.w(TAG, "Failed to send intent for bubble with key: "
@@ -521,7 +521,7 @@
mEntry.notification.getUid());
mStackView.collapseStack(() -> {
mContext.startActivity(intent);
- logBubbleClickEvent(mEntry.notification,
+ logBubbleClickEvent(mEntry,
StatsLog.BUBBLE_UICHANGED__ACTION__HEADER_GO_TO_SETTINGS);
});
} else if (id == R.id.no_bubbles_button) {
@@ -544,7 +544,7 @@
mOnBubbleBlockedListener.onBubbleBlocked(mEntry);
}
mStackView.onExpandedHeightChanged();
- logBubbleClickEvent(mEntry.notification,
+ logBubbleClickEvent(mEntry,
allowed ? StatsLog.BUBBLE_UICHANGED__ACTION__PERMISSION_OPT_IN :
StatsLog.BUBBLE_UICHANGED__ACTION__PERMISSION_OPT_OUT);
} catch (RemoteException e) {
@@ -707,10 +707,11 @@
/**
* Logs bubble UI click event.
*
- * @param notification the bubble notification that user is interacting with.
+ * @param entry the bubble notification entry that user is interacting with.
* @param action the user interaction enum.
*/
- private void logBubbleClickEvent(StatusBarNotification notification, int action) {
+ private void logBubbleClickEvent(NotificationEntry entry, int action) {
+ StatusBarNotification notification = entry.notification;
StatsLog.write(StatsLog.BUBBLE_UI_CHANGED,
notification.getPackageName(),
notification.getNotification().getChannelId(),
@@ -719,7 +720,8 @@
mStackView.getBubbleCount(),
action,
mStackView.getNormalizedXPosition(),
- mStackView.getNormalizedYPosition());
+ mStackView.getNormalizedYPosition(),
+ entry.showInShadeWhenBubble());
}
private int getDimenForPackageUser(int resId, String pkg, int userId) {
diff --git a/packages/SystemUI/src/com/android/systemui/bubbles/BubbleStackView.java b/packages/SystemUI/src/com/android/systemui/bubbles/BubbleStackView.java
index 580acb8..7127d32 100644
--- a/packages/SystemUI/src/com/android/systemui/bubbles/BubbleStackView.java
+++ b/packages/SystemUI/src/com/android/systemui/bubbles/BubbleStackView.java
@@ -954,7 +954,8 @@
getBubbleCount(),
action,
getNormalizedXPosition(),
- getNormalizedYPosition());
+ getNormalizedYPosition(),
+ false /* unread notification */);
} else {
StatusBarNotification notification = bubble.entry.notification;
StatsLog.write(StatsLog.BUBBLE_UI_CHANGED,
@@ -965,7 +966,8 @@
getBubbleCount(),
action,
getNormalizedXPosition(),
- getNormalizedYPosition());
+ getNormalizedYPosition(),
+ bubble.entry.showInShadeWhenBubble());
}
}