am f03ef334: am 43387c0c: am eb6f138b: Honor the sort and group keys for notification ranking.
* commit 'f03ef334c4e91643ba834d136b489f28cfbaf117': Honor the sort and group keys for notification ranking.
This commit is contained in:
@@ -30,6 +30,7 @@ public class StatusBarNotification implements Parcelable {
|
||||
private final int id;
|
||||
private final String tag;
|
||||
private final String key;
|
||||
private final String groupKey;
|
||||
|
||||
private final int uid;
|
||||
private final String opPkg;
|
||||
@@ -65,6 +66,7 @@ public class StatusBarNotification implements Parcelable {
|
||||
this.notification.setUser(user);
|
||||
this.postTime = postTime;
|
||||
this.key = key();
|
||||
this.groupKey = groupKey();
|
||||
}
|
||||
|
||||
public StatusBarNotification(Parcel in) {
|
||||
@@ -84,12 +86,26 @@ public class StatusBarNotification implements Parcelable {
|
||||
this.notification.setUser(this.user);
|
||||
this.postTime = in.readLong();
|
||||
this.key = key();
|
||||
this.groupKey = groupKey();
|
||||
}
|
||||
|
||||
private String key() {
|
||||
return user.getIdentifier() + "|" + pkg + "|" + id + "|" + tag + "|" + uid;
|
||||
}
|
||||
|
||||
private String groupKey() {
|
||||
final String group = getNotification().getGroup();
|
||||
final String sortKey = getNotification().getSortKey();
|
||||
if (group == null && sortKey == null) {
|
||||
// a group of one
|
||||
return key;
|
||||
}
|
||||
return user.getIdentifier() + "|" + pkg + "|" +
|
||||
(group == null
|
||||
? "p:" + notification.priority
|
||||
: "g:" + group);
|
||||
}
|
||||
|
||||
public void writeToParcel(Parcel out, int flags) {
|
||||
out.writeString(this.pkg);
|
||||
out.writeString(this.opPkg);
|
||||
@@ -240,4 +256,11 @@ public class StatusBarNotification implements Parcelable {
|
||||
public String getKey() {
|
||||
return key;
|
||||
}
|
||||
|
||||
/**
|
||||
* A key that indicates the group with which this message ranks.
|
||||
*/
|
||||
public String getGroupKey() {
|
||||
return groupKey;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user