diff options
| author | 2020-10-27 16:26:45 -0400 | |
|---|---|---|
| committer | 2020-11-02 09:41:08 -0500 | |
| commit | 1785b2efb60b8926b97d2417f4d375ed1fe61789 (patch) | |
| tree | 67673829d5db3375fe885a3b55aa1da94744f4ea | |
| parent | f069be7b3d7224df3c46947f77661cd885c16319 (diff) | |
Add some missing conversation log fields
Test: cts, manual
Fixes: 157240045
Change-Id: I5c77649596612115c8db99d7e32221b07bf1bda6
| -rw-r--r-- | api/current.txt | 1 | ||||
| -rw-r--r-- | cmds/statsd/src/atoms.proto | 9 | ||||
| -rw-r--r-- | core/api/current.txt | 1 | ||||
| -rw-r--r-- | core/java/android/app/NotificationChannel.java | 12 | ||||
| -rw-r--r-- | services/core/java/com/android/server/notification/NotificationChannelLogger.java | 7 | ||||
| -rw-r--r-- | services/core/java/com/android/server/notification/NotificationChannelLoggerImpl.java | 13 |
6 files changed, 38 insertions, 5 deletions
diff --git a/api/current.txt b/api/current.txt index 9ff7cc255bf4..7fb08a8438fe 100644 --- a/api/current.txt +++ b/api/current.txt @@ -5972,6 +5972,7 @@ package android.app { method public long[] getVibrationPattern(); method public boolean hasUserSetImportance(); method public boolean hasUserSetSound(); + method public boolean isConversation(); method public boolean isDemoted(); method public boolean isImportantConversation(); method public void setAllowBubbles(boolean); diff --git a/cmds/statsd/src/atoms.proto b/cmds/statsd/src/atoms.proto index a379847f21da..2831db874819 100644 --- a/cmds/statsd/src/atoms.proto +++ b/cmds/statsd/src/atoms.proto @@ -4280,9 +4280,16 @@ message NotificationChannelModified { optional android.stats.sysui.NotificationImportance old_importance = 5; // New importance setting optional android.stats.sysui.NotificationImportance importance = 6; + // whether or not this channel represents a conversation + optional bool is_conversation = 7; + // Hash of app-assigned notification conversation id + optional int32 conversation_id_hash = 8; + // whether or not the user demoted this channel out of the conversation space + optional bool is_conversation_demoted = 9; + // whether this conversation is marked as being a priority + optional bool is_conversation_priority = 10; } - /** * Logs when a biometric acquire event occurs. * diff --git a/core/api/current.txt b/core/api/current.txt index 16a5f5e82f21..9c6421af4846 100644 --- a/core/api/current.txt +++ b/core/api/current.txt @@ -5972,6 +5972,7 @@ package android.app { method public long[] getVibrationPattern(); method public boolean hasUserSetImportance(); method public boolean hasUserSetSound(); + method public boolean isConversation(); method public boolean isDemoted(); method public boolean isImportantConversation(); method public void setAllowBubbles(boolean); diff --git a/core/java/android/app/NotificationChannel.java b/core/java/android/app/NotificationChannel.java index a06ffbdb4301..080aac9a9e6a 100644 --- a/core/java/android/app/NotificationChannel.java +++ b/core/java/android/app/NotificationChannel.java @@ -629,12 +629,20 @@ public final class NotificationChannel implements Parcelable { } /** + * Whether or not this channel represents a conversation. + */ + public boolean isConversation() { + return !TextUtils.isEmpty(getConversationId()); + } + + + /** * Whether or not notifications in this conversation are considered important. * * <p>Important conversations may get special visual treatment, and might be able to bypass DND. * - * <p>This is only valid for channels that represent conversations, that is, those with a valid - * {@link #getConversationId() conversation id}. + * <p>This is only valid for channels that represent conversations, that is, + * where {@link #isConversation()} is true. */ public boolean isImportantConversation() { return mImportantConvo; diff --git a/services/core/java/com/android/server/notification/NotificationChannelLogger.java b/services/core/java/com/android/server/notification/NotificationChannelLogger.java index 51faac76c447..36eec26511c3 100644 --- a/services/core/java/com/android/server/notification/NotificationChannelLogger.java +++ b/services/core/java/com/android/server/notification/NotificationChannelLogger.java @@ -215,6 +215,13 @@ public interface NotificationChannelLogger { } /** + * @return Small hash of the conversation ID, if present, or 0 otherwise. + */ + static int getConversationIdHash(@NonNull NotificationChannel channel) { + return SmallHash.hash(channel.getConversationId()); + } + + /** * @return Small hash of the channel ID, if present, or 0 otherwise. */ static int getIdHash(@NonNull NotificationChannelGroup group) { diff --git a/services/core/java/com/android/server/notification/NotificationChannelLoggerImpl.java b/services/core/java/com/android/server/notification/NotificationChannelLoggerImpl.java index fd3dd568f634..5a7bc48091bb 100644 --- a/services/core/java/com/android/server/notification/NotificationChannelLoggerImpl.java +++ b/services/core/java/com/android/server/notification/NotificationChannelLoggerImpl.java @@ -41,7 +41,12 @@ public class NotificationChannelLoggerImpl implements NotificationChannelLogger /* String package_name */ pkg, /* int32 channel_id_hash */ NotificationChannelLogger.getIdHash(channel), /* int old_importance*/ oldImportance, - /* int importance*/ newImportance); + /* int importance*/ newImportance, + /* bool is_conversation */ channel.isConversation(), + /* int32 conversation_id_hash */ + NotificationChannelLogger.getConversationIdHash(channel), + /* bool is_conversation_demoted */ channel.isDemoted(), + /* bool is_conversation_priority */ channel.isImportantConversation()); } @Override @@ -53,7 +58,11 @@ public class NotificationChannelLoggerImpl implements NotificationChannelLogger /* String package_name */ pkg, /* int32 channel_id_hash */ NotificationChannelLogger.getIdHash(channelGroup), /* int old_importance*/ NotificationChannelLogger.getImportance(wasBlocked), - /* int importance*/ NotificationChannelLogger.getImportance(channelGroup)); + /* int importance*/ NotificationChannelLogger.getImportance(channelGroup), + /* bool is_conversation */ false, + /* int32 conversation_id_hash */ 0, + /* bool is_conversation_demoted */ false, + /* bool is_conversation_priority */ false); } @Override |