Loading core/java/android/app/Notification.java +19 −4 Original line number Diff line number Diff line Loading @@ -24,6 +24,7 @@ import static android.app.admin.DevicePolicyResources.UNDEFINED; import static android.graphics.drawable.Icon.TYPE_URI; import static android.graphics.drawable.Icon.TYPE_URI_ADAPTIVE_BITMAP; import static android.app.Flags.evenlyDividedCallStyleActionLayout; import static android.app.Flags.updateRankingTime; import static java.util.Objects.requireNonNull; Loading Loading @@ -339,8 +340,9 @@ public class Notification implements Parcelable /** * The creation time of the notification * @hide */ private long creationTime; public long creationTime; /** * The resource id of a drawable to use as the icon in the status bar. Loading Loading @@ -2578,7 +2580,11 @@ public class Notification implements Parcelable public Notification() { this.when = System.currentTimeMillis(); if (updateRankingTime()) { creationTime = when; } else { this.creationTime = System.currentTimeMillis(); } this.priority = PRIORITY_DEFAULT; } Loading @@ -2589,6 +2595,9 @@ public class Notification implements Parcelable public Notification(Context context, int icon, CharSequence tickerText, long when, CharSequence contentTitle, CharSequence contentText, Intent contentIntent) { if (updateRankingTime()) { creationTime = when; } new Builder(context) .setWhen(when) .setSmallIcon(icon) Loading Loading @@ -2618,8 +2627,12 @@ public class Notification implements Parcelable this.icon = icon; this.tickerText = tickerText; this.when = when; if (updateRankingTime()) { creationTime = when; } else { this.creationTime = System.currentTimeMillis(); } } /** * Unflatten the notification from a parcel. Loading Loading @@ -6843,7 +6856,9 @@ public class Notification implements Parcelable } } if (!updateRankingTime()) { mN.creationTime = System.currentTimeMillis(); } // lazy stuff from mContext; see comment in Builder(Context, Notification) Notification.addFieldsFromContext(mContext, mN); Loading core/java/android/app/notification.aconfig +10 −0 Original line number Diff line number Diff line Loading @@ -72,3 +72,13 @@ flag { purpose: PURPOSE_BUGFIX } } flag { name: "update_ranking_time" namespace: "systemui" description: "Updates notification sorting criteria to highlight new content while maintaining stability" bug: "326016985" metadata { purpose: PURPOSE_BUGFIX } } No newline at end of file services/core/java/com/android/server/notification/NotificationAttentionHelper.java +6 −0 Original line number Diff line number Diff line Loading @@ -16,6 +16,7 @@ package com.android.server.notification; import static android.app.Flags.updateRankingTime; import static android.app.Notification.FLAG_INSISTENT; import static android.app.Notification.FLAG_ONLY_ALERT_ONCE; import static android.app.NotificationManager.IMPORTANCE_MIN; Loading Loading @@ -496,6 +497,11 @@ public final class NotificationAttentionHelper { Slog.v(TAG, "INTERRUPTIVENESS: " + record.getKey() + " is interruptive: alerted"); } if (updateRankingTime()) { if (buzz || beep) { record.resetRankingTime(); } } } } final int buzzBeepBlinkLoggingCode = Loading services/core/java/com/android/server/notification/NotificationManagerService.java +6 −0 Original line number Diff line number Diff line Loading @@ -142,6 +142,7 @@ import static android.service.notification.NotificationListenerService.TRIM_LIGH import static android.view.contentprotection.flags.Flags.rapidClearNotificationsByListenerAppOpEnabled; import static android.view.WindowManager.LayoutParams.TYPE_TOAST; import static android.app.Flags.updateRankingTime; import static com.android.internal.util.FrameworkStatsLog.DND_MODE_RULE; import static com.android.internal.util.FrameworkStatsLog.PACKAGE_NOTIFICATION_CHANNEL_GROUP_PREFERENCES; import static com.android.internal.util.FrameworkStatsLog.PACKAGE_NOTIFICATION_CHANNEL_PREFERENCES; Loading Loading @@ -8489,6 +8490,11 @@ public class NotificationManagerService extends SystemService { r.isUpdate = true; final boolean isInterruptive = isVisuallyInterruptive(old, r); r.setTextChanged(isInterruptive); if (updateRankingTime()) { if (isInterruptive) { r.resetRankingTime(); } } } mNotificationsByKey.put(n.getKey(), r); Loading services/core/java/com/android/server/notification/NotificationRecord.java +15 −4 Original line number Diff line number Diff line Loading @@ -15,6 +15,7 @@ */ package com.android.server.notification; import static android.app.Flags.updateRankingTime; import static android.app.NotificationChannel.USER_LOCKED_IMPORTANCE; import static android.app.NotificationManager.IMPORTANCE_DEFAULT; import static android.app.NotificationManager.IMPORTANCE_HIGH; Loading Loading @@ -65,14 +66,12 @@ import android.util.Log; import android.util.TimeUtils; import android.util.proto.ProtoOutputStream; import android.widget.RemoteViews; import com.android.internal.annotations.VisibleForTesting; import com.android.internal.logging.MetricsLogger; import com.android.internal.logging.nano.MetricsProto.MetricsEvent; import com.android.server.EventLogTags; import com.android.server.LocalServices; import com.android.server.uri.UriGrantsManagerInternal; import dalvik.annotation.optimization.NeverCompile; import java.io.PrintWriter; Loading Loading @@ -1090,9 +1089,15 @@ public final class NotificationRecord { private long calculateRankingTimeMs(long previousRankingTimeMs) { Notification n = getNotification(); // Take developer provided 'when', unless it's in the future. if (updateRankingTime()) { if (n.when != n.creationTime && n.when <= getSbn().getPostTime()){ return n.when; } } else { if (n.when != 0 && n.when <= getSbn().getPostTime()) { return n.when; } } // If we've ranked a previous instance with a timestamp, inherit it. This case is // important in order to have ranking stability for updating notifications. if (previousRankingTimeMs > 0) { Loading Loading @@ -1193,6 +1198,12 @@ public final class NotificationRecord { return mPeopleOverride; } public void resetRankingTime() { if (updateRankingTime()) { mRankingTimeMs = calculateRankingTimeMs(getSbn().getPostTime()); } } public void setInterruptive(boolean interruptive) { mIsInterruptive = interruptive; final long now = System.currentTimeMillis(); Loading Loading
core/java/android/app/Notification.java +19 −4 Original line number Diff line number Diff line Loading @@ -24,6 +24,7 @@ import static android.app.admin.DevicePolicyResources.UNDEFINED; import static android.graphics.drawable.Icon.TYPE_URI; import static android.graphics.drawable.Icon.TYPE_URI_ADAPTIVE_BITMAP; import static android.app.Flags.evenlyDividedCallStyleActionLayout; import static android.app.Flags.updateRankingTime; import static java.util.Objects.requireNonNull; Loading Loading @@ -339,8 +340,9 @@ public class Notification implements Parcelable /** * The creation time of the notification * @hide */ private long creationTime; public long creationTime; /** * The resource id of a drawable to use as the icon in the status bar. Loading Loading @@ -2578,7 +2580,11 @@ public class Notification implements Parcelable public Notification() { this.when = System.currentTimeMillis(); if (updateRankingTime()) { creationTime = when; } else { this.creationTime = System.currentTimeMillis(); } this.priority = PRIORITY_DEFAULT; } Loading @@ -2589,6 +2595,9 @@ public class Notification implements Parcelable public Notification(Context context, int icon, CharSequence tickerText, long when, CharSequence contentTitle, CharSequence contentText, Intent contentIntent) { if (updateRankingTime()) { creationTime = when; } new Builder(context) .setWhen(when) .setSmallIcon(icon) Loading Loading @@ -2618,8 +2627,12 @@ public class Notification implements Parcelable this.icon = icon; this.tickerText = tickerText; this.when = when; if (updateRankingTime()) { creationTime = when; } else { this.creationTime = System.currentTimeMillis(); } } /** * Unflatten the notification from a parcel. Loading Loading @@ -6843,7 +6856,9 @@ public class Notification implements Parcelable } } if (!updateRankingTime()) { mN.creationTime = System.currentTimeMillis(); } // lazy stuff from mContext; see comment in Builder(Context, Notification) Notification.addFieldsFromContext(mContext, mN); Loading
core/java/android/app/notification.aconfig +10 −0 Original line number Diff line number Diff line Loading @@ -72,3 +72,13 @@ flag { purpose: PURPOSE_BUGFIX } } flag { name: "update_ranking_time" namespace: "systemui" description: "Updates notification sorting criteria to highlight new content while maintaining stability" bug: "326016985" metadata { purpose: PURPOSE_BUGFIX } } No newline at end of file
services/core/java/com/android/server/notification/NotificationAttentionHelper.java +6 −0 Original line number Diff line number Diff line Loading @@ -16,6 +16,7 @@ package com.android.server.notification; import static android.app.Flags.updateRankingTime; import static android.app.Notification.FLAG_INSISTENT; import static android.app.Notification.FLAG_ONLY_ALERT_ONCE; import static android.app.NotificationManager.IMPORTANCE_MIN; Loading Loading @@ -496,6 +497,11 @@ public final class NotificationAttentionHelper { Slog.v(TAG, "INTERRUPTIVENESS: " + record.getKey() + " is interruptive: alerted"); } if (updateRankingTime()) { if (buzz || beep) { record.resetRankingTime(); } } } } final int buzzBeepBlinkLoggingCode = Loading
services/core/java/com/android/server/notification/NotificationManagerService.java +6 −0 Original line number Diff line number Diff line Loading @@ -142,6 +142,7 @@ import static android.service.notification.NotificationListenerService.TRIM_LIGH import static android.view.contentprotection.flags.Flags.rapidClearNotificationsByListenerAppOpEnabled; import static android.view.WindowManager.LayoutParams.TYPE_TOAST; import static android.app.Flags.updateRankingTime; import static com.android.internal.util.FrameworkStatsLog.DND_MODE_RULE; import static com.android.internal.util.FrameworkStatsLog.PACKAGE_NOTIFICATION_CHANNEL_GROUP_PREFERENCES; import static com.android.internal.util.FrameworkStatsLog.PACKAGE_NOTIFICATION_CHANNEL_PREFERENCES; Loading Loading @@ -8489,6 +8490,11 @@ public class NotificationManagerService extends SystemService { r.isUpdate = true; final boolean isInterruptive = isVisuallyInterruptive(old, r); r.setTextChanged(isInterruptive); if (updateRankingTime()) { if (isInterruptive) { r.resetRankingTime(); } } } mNotificationsByKey.put(n.getKey(), r); Loading
services/core/java/com/android/server/notification/NotificationRecord.java +15 −4 Original line number Diff line number Diff line Loading @@ -15,6 +15,7 @@ */ package com.android.server.notification; import static android.app.Flags.updateRankingTime; import static android.app.NotificationChannel.USER_LOCKED_IMPORTANCE; import static android.app.NotificationManager.IMPORTANCE_DEFAULT; import static android.app.NotificationManager.IMPORTANCE_HIGH; Loading Loading @@ -65,14 +66,12 @@ import android.util.Log; import android.util.TimeUtils; import android.util.proto.ProtoOutputStream; import android.widget.RemoteViews; import com.android.internal.annotations.VisibleForTesting; import com.android.internal.logging.MetricsLogger; import com.android.internal.logging.nano.MetricsProto.MetricsEvent; import com.android.server.EventLogTags; import com.android.server.LocalServices; import com.android.server.uri.UriGrantsManagerInternal; import dalvik.annotation.optimization.NeverCompile; import java.io.PrintWriter; Loading Loading @@ -1090,9 +1089,15 @@ public final class NotificationRecord { private long calculateRankingTimeMs(long previousRankingTimeMs) { Notification n = getNotification(); // Take developer provided 'when', unless it's in the future. if (updateRankingTime()) { if (n.when != n.creationTime && n.when <= getSbn().getPostTime()){ return n.when; } } else { if (n.when != 0 && n.when <= getSbn().getPostTime()) { return n.when; } } // If we've ranked a previous instance with a timestamp, inherit it. This case is // important in order to have ranking stability for updating notifications. if (previousRankingTimeMs > 0) { Loading Loading @@ -1193,6 +1198,12 @@ public final class NotificationRecord { return mPeopleOverride; } public void resetRankingTime() { if (updateRankingTime()) { mRankingTimeMs = calculateRankingTimeMs(getSbn().getPostTime()); } } public void setInterruptive(boolean interruptive) { mIsInterruptive = interruptive; final long now = System.currentTimeMillis(); Loading