Loading core/java/com/android/internal/statusbar/IStatusBarService.aidl +3 −0 Original line number Diff line number Diff line Loading @@ -239,4 +239,7 @@ interface IStatusBarService /** Unbundle a categorized notification */ void unbundleNotification(String key); /** Rebundle an (un)categorized notification */ void rebundleNotification(String key); } packages/SystemUI/tests/utils/src/android/internal/statusbar/FakeStatusBarService.kt +2 −0 Original line number Diff line number Diff line Loading @@ -435,6 +435,8 @@ class FakeStatusBarService : IStatusBarService.Stub() { override fun unbundleNotification(key: String) {} override fun rebundleNotification(key: String) {} companion object { const val DEFAULT_DISPLAY_ID = Display.DEFAULT_DISPLAY const val SECONDARY_DISPLAY_ID = 2 Loading services/core/java/com/android/server/notification/NotificationDelegate.java +5 −0 Original line number Diff line number Diff line Loading @@ -107,4 +107,9 @@ public interface NotificationDelegate { * @param key the notification key */ void unbundleNotification(String key); /** * Called when the notification should be rebundled. * @param key the notification key */ void rebundleNotification(String key); } services/core/java/com/android/server/notification/NotificationManagerService.java +31 −0 Original line number Diff line number Diff line Loading @@ -1888,6 +1888,36 @@ public class NotificationManagerService extends SystemService { } } } @Override public void rebundleNotification(String key) { if (!(notificationClassification() && notificationRegroupOnClassification())) { return; } synchronized (mNotificationLock) { NotificationRecord r = mNotificationsByKey.get(key); if (r == null) { return; } if (DBG) { Slog.v(TAG, "rebundleNotification: " + r); } if (r.getBundleType() != Adjustment.TYPE_OTHER) { final Bundle classifBundle = new Bundle(); classifBundle.putInt(KEY_TYPE, r.getBundleType()); Adjustment adj = new Adjustment(r.getSbn().getPackageName(), r.getKey(), classifBundle, "rebundle", r.getUserId()); applyAdjustmentLocked(r, adj, /* isPosted= */ true); mRankingHandler.requestSort(); } else { if (DBG) { Slog.w(TAG, "Can't rebundle. No valid bundle type for: " + r); } } } } }; NotificationManagerPrivate mNotificationManagerPrivate = new NotificationManagerPrivate() { Loading Loading @@ -7134,6 +7164,7 @@ public class NotificationManagerService extends SystemService { adjustments.putParcelable(KEY_TYPE, newChannel); logClassificationChannelAdjustmentReceived(r, isPosted, classification); r.setBundleType(classification); } } r.addAdjustment(adjustment); Loading services/core/java/com/android/server/notification/NotificationRecord.java +15 −0 Original line number Diff line number Diff line Loading @@ -222,6 +222,9 @@ public final class NotificationRecord { // lifetime extended. private boolean mCanceledAfterLifetimeExtension = false; // type of the bundle if the notification was classified private @Adjustment.Types int mBundleType = Adjustment.TYPE_OTHER; public NotificationRecord(Context context, StatusBarNotification sbn, NotificationChannel channel) { this.sbn = sbn; Loading Loading @@ -467,6 +470,10 @@ public final class NotificationRecord { } } if (android.service.notification.Flags.notificationClassification()) { mBundleType = previous.mBundleType; } // Don't copy importance information or mGlobalSortKey, recompute them. } Loading Loading @@ -1629,6 +1636,14 @@ public final class NotificationRecord { mCanceledAfterLifetimeExtension = canceledAfterLifetimeExtension; } public @Adjustment.Types int getBundleType() { return mBundleType; } public void setBundleType(@Adjustment.Types int bundleType) { mBundleType = bundleType; } /** * Whether this notification is a conversation notification. */ Loading Loading
core/java/com/android/internal/statusbar/IStatusBarService.aidl +3 −0 Original line number Diff line number Diff line Loading @@ -239,4 +239,7 @@ interface IStatusBarService /** Unbundle a categorized notification */ void unbundleNotification(String key); /** Rebundle an (un)categorized notification */ void rebundleNotification(String key); }
packages/SystemUI/tests/utils/src/android/internal/statusbar/FakeStatusBarService.kt +2 −0 Original line number Diff line number Diff line Loading @@ -435,6 +435,8 @@ class FakeStatusBarService : IStatusBarService.Stub() { override fun unbundleNotification(key: String) {} override fun rebundleNotification(key: String) {} companion object { const val DEFAULT_DISPLAY_ID = Display.DEFAULT_DISPLAY const val SECONDARY_DISPLAY_ID = 2 Loading
services/core/java/com/android/server/notification/NotificationDelegate.java +5 −0 Original line number Diff line number Diff line Loading @@ -107,4 +107,9 @@ public interface NotificationDelegate { * @param key the notification key */ void unbundleNotification(String key); /** * Called when the notification should be rebundled. * @param key the notification key */ void rebundleNotification(String key); }
services/core/java/com/android/server/notification/NotificationManagerService.java +31 −0 Original line number Diff line number Diff line Loading @@ -1888,6 +1888,36 @@ public class NotificationManagerService extends SystemService { } } } @Override public void rebundleNotification(String key) { if (!(notificationClassification() && notificationRegroupOnClassification())) { return; } synchronized (mNotificationLock) { NotificationRecord r = mNotificationsByKey.get(key); if (r == null) { return; } if (DBG) { Slog.v(TAG, "rebundleNotification: " + r); } if (r.getBundleType() != Adjustment.TYPE_OTHER) { final Bundle classifBundle = new Bundle(); classifBundle.putInt(KEY_TYPE, r.getBundleType()); Adjustment adj = new Adjustment(r.getSbn().getPackageName(), r.getKey(), classifBundle, "rebundle", r.getUserId()); applyAdjustmentLocked(r, adj, /* isPosted= */ true); mRankingHandler.requestSort(); } else { if (DBG) { Slog.w(TAG, "Can't rebundle. No valid bundle type for: " + r); } } } } }; NotificationManagerPrivate mNotificationManagerPrivate = new NotificationManagerPrivate() { Loading Loading @@ -7134,6 +7164,7 @@ public class NotificationManagerService extends SystemService { adjustments.putParcelable(KEY_TYPE, newChannel); logClassificationChannelAdjustmentReceived(r, isPosted, classification); r.setBundleType(classification); } } r.addAdjustment(adjustment); Loading
services/core/java/com/android/server/notification/NotificationRecord.java +15 −0 Original line number Diff line number Diff line Loading @@ -222,6 +222,9 @@ public final class NotificationRecord { // lifetime extended. private boolean mCanceledAfterLifetimeExtension = false; // type of the bundle if the notification was classified private @Adjustment.Types int mBundleType = Adjustment.TYPE_OTHER; public NotificationRecord(Context context, StatusBarNotification sbn, NotificationChannel channel) { this.sbn = sbn; Loading Loading @@ -467,6 +470,10 @@ public final class NotificationRecord { } } if (android.service.notification.Flags.notificationClassification()) { mBundleType = previous.mBundleType; } // Don't copy importance information or mGlobalSortKey, recompute them. } Loading Loading @@ -1629,6 +1636,14 @@ public final class NotificationRecord { mCanceledAfterLifetimeExtension = canceledAfterLifetimeExtension; } public @Adjustment.Types int getBundleType() { return mBundleType; } public void setBundleType(@Adjustment.Types int bundleType) { mBundleType = bundleType; } /** * Whether this notification is a conversation notification. */ Loading