Merge "Add some missing conversation log fields"

This commit is contained in:
Julia Reynolds
2020-11-04 13:14:47 +00:00
committed by Android (Google) Code Review
6 changed files with 38 additions and 5 deletions

View File

@@ -5974,6 +5974,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);

View File

@@ -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.
*

View File

@@ -5974,6 +5974,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);

View File

@@ -628,13 +628,21 @@ public final class NotificationChannel implements Parcelable {
return mBypassDnd;
}
/**
* 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;

View File

@@ -214,6 +214,13 @@ public interface NotificationChannelLogger {
return SmallHash.hash(channel.getId());
}
/**
* @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.
*/

View File

@@ -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