Merge "Add notification opPkg to logs"

This commit is contained in:
Julia Reynolds
2019-03-20 12:36:37 +00:00
committed by Android (Google) Code Review
3 changed files with 10 additions and 3 deletions

View File

@@ -292,9 +292,9 @@ public class StatusBarNotification implements Parcelable {
return uid;
}
/** The package that posted the notification.
*<p>
* Might be different from {@link #getPackageName()} if the app owning the notification has
/**
* The package that posted the notification.
* <p> Might be different from {@link #getPackageName()} if the app owning the notification has
* a {@link NotificationManager#setNotificationDelegate(String) notification delegate}.
*/
public @NonNull String getOpPkg() {

View File

@@ -66,6 +66,10 @@ message NotificationRecordProto {
optional bool can_show_light = 8;
optional string group_key = 9 [ (.android.privacy).dest = DEST_EXPLICIT ];
optional sint32 importance = 10;
// The package the notification was posted for.
optional string package = 11;
// The package that posted the notification. It might not be the same as package.
optional string delegate_package = 12;
}
message ListenersDisablingEffectsProto {

View File

@@ -438,6 +438,8 @@ public final class NotificationRecord {
if (getAudioAttributes() != null) {
getAudioAttributes().writeToProto(proto, NotificationRecordProto.AUDIO_ATTRIBUTES);
}
proto.write(NotificationRecordProto.PACKAGE, sbn.getPackageName());
proto.write(NotificationRecordProto.DELEGATE_PACKAGE, sbn.getOpPkg());
proto.end(token);
}
@@ -458,6 +460,7 @@ public final class NotificationRecord {
pw.println(prefix + this);
prefix = prefix + " ";
pw.println(prefix + "uid=" + sbn.getUid() + " userId=" + sbn.getUserId());
pw.println(prefix + "opPkg=" + sbn.getOpPkg());
pw.println(prefix + "icon=" + iconStr);
pw.println(prefix + "flags=0x" + Integer.toHexString(notification.flags));
pw.println(prefix + "pri=" + notification.priority);