Add rank & count event to notification clicks and dismisses

For click/action click/dismiss, passing rank(0-based) and
count at the time of the actions to events.

Bug: 70724602
Test: runtest systemui-notification
Test: atest packages/SystemUI/tests/src/com/android/systemui/statusbar/notification
Change-Id: I07c440f84ccb745f744eb4e317881b72d2b41683
This commit is contained in:
Dieter Hsu
2018-04-14 02:08:30 +08:00
parent 52842feb14
commit d39f0d52dc
16 changed files with 123 additions and 44 deletions

View File

@@ -54,12 +54,13 @@ interface IStatusBarService
void onPanelHidden();
// Mark current notifications as "seen" and stop ringing, vibrating, blinking.
void clearNotificationEffects();
void onNotificationClick(String key);
void onNotificationActionClick(String key, int actionIndex);
void onNotificationClick(String key, in NotificationVisibility nv);
void onNotificationActionClick(String key, int actionIndex, in NotificationVisibility nv);
void onNotificationError(String pkg, String tag, int id,
int uid, int initialPid, String message, int userId);
void onClearAllNotifications(int userId);
void onNotificationClear(String pkg, String tag, int id, int userId, String key, int dismissalSurface);
void onNotificationClear(String pkg, String tag, int id, int userId, String key,
int dismissalSurface, in NotificationVisibility nv);
void onNotificationVisibilityChanged( in NotificationVisibility[] newlyVisibleKeys,
in NotificationVisibility[] noLongerVisibleKeys);
void onNotificationExpansionChanged(in String key, in boolean userAction, in boolean expanded);

View File

@@ -32,6 +32,7 @@ public class NotificationVisibility implements Parcelable {
public String key;
public int rank;
public int count;
public boolean visible = true;
/*package*/ int id;
@@ -39,10 +40,11 @@ public class NotificationVisibility implements Parcelable {
id = sNexrId++;
}
private NotificationVisibility(String key, int rank, boolean visibile) {
private NotificationVisibility(String key, int rank, int count, boolean visibile) {
this();
this.key = key;
this.rank = rank;
this.count = count;
this.visible = visibile;
}
@@ -51,13 +53,14 @@ public class NotificationVisibility implements Parcelable {
return "NotificationVisibility(id=" + id
+ "key=" + key
+ " rank=" + rank
+ " count=" + count
+ (visible?" visible":"")
+ " )";
}
@Override
public NotificationVisibility clone() {
return obtain(this.key, this.rank, this.visible);
return obtain(this.key, this.rank, this.count, this.visible);
}
@Override
@@ -85,12 +88,14 @@ public class NotificationVisibility implements Parcelable {
public void writeToParcel(Parcel out, int flags) {
out.writeString(this.key);
out.writeInt(this.rank);
out.writeInt(this.count);
out.writeInt(this.visible ? 1 : 0);
}
private void readFromParcel(Parcel in) {
this.key = in.readString();
this.rank = in.readInt();
this.count = in.readInt();
this.visible = in.readInt() != 0;
}
@@ -98,10 +103,11 @@ public class NotificationVisibility implements Parcelable {
* Return a new NotificationVisibility instance from the global pool. Allows us to
* avoid allocating new objects in many cases.
*/
public static NotificationVisibility obtain(String key, int rank, boolean visible) {
public static NotificationVisibility obtain(String key, int rank, int count, boolean visible) {
NotificationVisibility vo = obtain();
vo.key = key;
vo.rank = rank;
vo.count = count;
vo.visible = visible;
return vo;
}