Loading core/java/android/service/notification/NotificationStats.java +49 −1 Original line number Diff line number Diff line Loading @@ -52,7 +52,7 @@ public final class NotificationStats implements Parcelable { /** * Notification has not been dismissed yet. */ public static final int DISMISSAL_NOT_DISMISSED = -1; public static final int DISMISSAL_NOT_DISMISSED = -1000; /** * Notification has been dismissed from a {@link NotificationListenerService} or the app * itself. Loading @@ -71,6 +71,37 @@ public final class NotificationStats implements Parcelable { */ public static final int DISMISSAL_SHADE = 3; /** @hide */ @IntDef(prefix = { "DISMISS_SENTIMENT_" }, value = { DISMISS_SENTIMENT_UNKNOWN, DISMISS_SENTIMENT_NEGATIVE, DISMISS_SENTIMENT_NEUTRAL, DISMISS_SENTIMENT_POSITIVE }) @Retention(RetentionPolicy.SOURCE) public @interface DismissalSentiment {} /** * No information is available about why this notification was dismissed, or the notification * isn't dismissed yet. */ public static final int DISMISS_SENTIMENT_UNKNOWN = -1000; /** * The user indicated while dismissing that they did not like the notification. */ public static final int DISMISS_SENTIMENT_NEGATIVE = 0; /** * The user didn't indicate one way or another how they felt about the notification while * dismissing it. */ public static final int DISMISS_SENTIMENT_NEUTRAL = 1; /** * The user indicated while dismissing that they did like the notification. */ public static final int DISMISS_SENTIMENT_POSITIVE = 2; private @DismissalSentiment int mDismissalSentiment = DISMISS_SENTIMENT_UNKNOWN; public NotificationStats() { } Loading @@ -82,6 +113,7 @@ public final class NotificationStats implements Parcelable { mViewedSettings = in.readByte() != 0; mInteracted = in.readByte() != 0; mDismissalSurface = in.readInt(); mDismissalSentiment = in.readInt(); } @Override Loading @@ -93,6 +125,7 @@ public final class NotificationStats implements Parcelable { dest.writeByte((byte) (mViewedSettings ? 1 : 0)); dest.writeByte((byte) (mInteracted ? 1 : 0)); dest.writeInt(mDismissalSurface); dest.writeInt(mDismissalSentiment); } @Override Loading Loading @@ -212,6 +245,21 @@ public final class NotificationStats implements Parcelable { mDismissalSurface = dismissalSurface; } /** * Records whether the user indicated how they felt about a notification before or * during dismissal. */ public void setDismissalSentiment(@DismissalSentiment int dismissalSentiment) { mDismissalSentiment = dismissalSentiment; } /** * Returns how the user indicated they felt about a notification before or during dismissal. */ public @DismissalSentiment int getDismissalSentiment() { return mDismissalSentiment; } @Override public boolean equals(Object o) { if (this == o) return true; Loading core/java/com/android/internal/statusbar/IStatusBarService.aidl +1 −1 Original line number Diff line number Diff line Loading @@ -60,7 +60,7 @@ interface IStatusBarService 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, in NotificationVisibility nv); int dismissalSurface, int dismissalSentiment, in NotificationVisibility nv); void onNotificationVisibilityChanged( in NotificationVisibility[] newlyVisibleKeys, in NotificationVisibility[] noLongerVisibleKeys); void onNotificationExpansionChanged(in String key, in boolean userAction, in boolean expanded); Loading packages/ExtServices/src/android/ext/services/notification/Assistant.java +13 −9 Original line number Diff line number Diff line Loading @@ -316,7 +316,7 @@ public class Assistant extends NotificationAssistantService { saveFile(); } } catch (Throwable e) { Slog.e(TAG, "Error occurred processing removal", e); Slog.e(TAG, "Error occurred processing removal of " + sbn, e); } } Loading @@ -327,6 +327,7 @@ public class Assistant extends NotificationAssistantService { @Override public void onNotificationsSeen(List<String> keys) { try { if (keys == null) { return; } Loading @@ -339,6 +340,9 @@ public class Assistant extends NotificationAssistantService { mAgingHelper.onNotificationSeen(entry); } } } catch (Throwable e) { Slog.e(TAG, "Error occurred processing seen", e); } } @Override Loading packages/SystemUI/src/com/android/systemui/statusbar/notification/NotificationEntryManager.java +3 −1 Original line number Diff line number Diff line Loading @@ -414,7 +414,9 @@ public class NotificationEntryManager implements Dumpable, NotificationInflater. } else if (mListContainer.hasPulsingNotifications()) { dismissalSurface = NotificationStats.DISMISSAL_AOD; } mBarService.onNotificationClear(pkg, tag, id, userId, n.getKey(), dismissalSurface, nv); int dismissalSentiment = NotificationStats.DISMISS_SENTIMENT_NEUTRAL; mBarService.onNotificationClear(pkg, tag, id, userId, n.getKey(), dismissalSurface, dismissalSentiment, nv); removeNotification(n.getKey(), null); } catch (RemoteException ex) { Loading packages/SystemUI/src/com/android/systemui/statusbar/notification/row/ExpandableNotificationRow.java +1 −0 Original line number Diff line number Diff line Loading @@ -1307,6 +1307,7 @@ public class ExpandableNotificationRow extends ActivatableNotificationView } setDismissed(fromAccessibility); if (isClearable()) { // TODO: track dismiss sentiment if (mOnDismissRunnable != null) { mOnDismissRunnable.run(); } Loading Loading
core/java/android/service/notification/NotificationStats.java +49 −1 Original line number Diff line number Diff line Loading @@ -52,7 +52,7 @@ public final class NotificationStats implements Parcelable { /** * Notification has not been dismissed yet. */ public static final int DISMISSAL_NOT_DISMISSED = -1; public static final int DISMISSAL_NOT_DISMISSED = -1000; /** * Notification has been dismissed from a {@link NotificationListenerService} or the app * itself. Loading @@ -71,6 +71,37 @@ public final class NotificationStats implements Parcelable { */ public static final int DISMISSAL_SHADE = 3; /** @hide */ @IntDef(prefix = { "DISMISS_SENTIMENT_" }, value = { DISMISS_SENTIMENT_UNKNOWN, DISMISS_SENTIMENT_NEGATIVE, DISMISS_SENTIMENT_NEUTRAL, DISMISS_SENTIMENT_POSITIVE }) @Retention(RetentionPolicy.SOURCE) public @interface DismissalSentiment {} /** * No information is available about why this notification was dismissed, or the notification * isn't dismissed yet. */ public static final int DISMISS_SENTIMENT_UNKNOWN = -1000; /** * The user indicated while dismissing that they did not like the notification. */ public static final int DISMISS_SENTIMENT_NEGATIVE = 0; /** * The user didn't indicate one way or another how they felt about the notification while * dismissing it. */ public static final int DISMISS_SENTIMENT_NEUTRAL = 1; /** * The user indicated while dismissing that they did like the notification. */ public static final int DISMISS_SENTIMENT_POSITIVE = 2; private @DismissalSentiment int mDismissalSentiment = DISMISS_SENTIMENT_UNKNOWN; public NotificationStats() { } Loading @@ -82,6 +113,7 @@ public final class NotificationStats implements Parcelable { mViewedSettings = in.readByte() != 0; mInteracted = in.readByte() != 0; mDismissalSurface = in.readInt(); mDismissalSentiment = in.readInt(); } @Override Loading @@ -93,6 +125,7 @@ public final class NotificationStats implements Parcelable { dest.writeByte((byte) (mViewedSettings ? 1 : 0)); dest.writeByte((byte) (mInteracted ? 1 : 0)); dest.writeInt(mDismissalSurface); dest.writeInt(mDismissalSentiment); } @Override Loading Loading @@ -212,6 +245,21 @@ public final class NotificationStats implements Parcelable { mDismissalSurface = dismissalSurface; } /** * Records whether the user indicated how they felt about a notification before or * during dismissal. */ public void setDismissalSentiment(@DismissalSentiment int dismissalSentiment) { mDismissalSentiment = dismissalSentiment; } /** * Returns how the user indicated they felt about a notification before or during dismissal. */ public @DismissalSentiment int getDismissalSentiment() { return mDismissalSentiment; } @Override public boolean equals(Object o) { if (this == o) return true; Loading
core/java/com/android/internal/statusbar/IStatusBarService.aidl +1 −1 Original line number Diff line number Diff line Loading @@ -60,7 +60,7 @@ interface IStatusBarService 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, in NotificationVisibility nv); int dismissalSurface, int dismissalSentiment, in NotificationVisibility nv); void onNotificationVisibilityChanged( in NotificationVisibility[] newlyVisibleKeys, in NotificationVisibility[] noLongerVisibleKeys); void onNotificationExpansionChanged(in String key, in boolean userAction, in boolean expanded); Loading
packages/ExtServices/src/android/ext/services/notification/Assistant.java +13 −9 Original line number Diff line number Diff line Loading @@ -316,7 +316,7 @@ public class Assistant extends NotificationAssistantService { saveFile(); } } catch (Throwable e) { Slog.e(TAG, "Error occurred processing removal", e); Slog.e(TAG, "Error occurred processing removal of " + sbn, e); } } Loading @@ -327,6 +327,7 @@ public class Assistant extends NotificationAssistantService { @Override public void onNotificationsSeen(List<String> keys) { try { if (keys == null) { return; } Loading @@ -339,6 +340,9 @@ public class Assistant extends NotificationAssistantService { mAgingHelper.onNotificationSeen(entry); } } } catch (Throwable e) { Slog.e(TAG, "Error occurred processing seen", e); } } @Override Loading
packages/SystemUI/src/com/android/systemui/statusbar/notification/NotificationEntryManager.java +3 −1 Original line number Diff line number Diff line Loading @@ -414,7 +414,9 @@ public class NotificationEntryManager implements Dumpable, NotificationInflater. } else if (mListContainer.hasPulsingNotifications()) { dismissalSurface = NotificationStats.DISMISSAL_AOD; } mBarService.onNotificationClear(pkg, tag, id, userId, n.getKey(), dismissalSurface, nv); int dismissalSentiment = NotificationStats.DISMISS_SENTIMENT_NEUTRAL; mBarService.onNotificationClear(pkg, tag, id, userId, n.getKey(), dismissalSurface, dismissalSentiment, nv); removeNotification(n.getKey(), null); } catch (RemoteException ex) { Loading
packages/SystemUI/src/com/android/systemui/statusbar/notification/row/ExpandableNotificationRow.java +1 −0 Original line number Diff line number Diff line Loading @@ -1307,6 +1307,7 @@ public class ExpandableNotificationRow extends ActivatableNotificationView } setDismissed(fromAccessibility); if (isClearable()) { // TODO: track dismiss sentiment if (mOnDismissRunnable != null) { mOnDismissRunnable.run(); } Loading