Loading core/java/com/android/internal/statusbar/IStatusBarService.aidl +3 −0 Original line number Diff line number Diff line Loading @@ -236,4 +236,7 @@ interface IStatusBarService /** Shows rear display educational dialog */ void showRearDisplayDialog(int currentBaseState); /** Unbundle a categorized notification */ void unbundleNotification(String key); } packages/SystemUI/tests/utils/src/android/internal/statusbar/FakeStatusBarService.kt +2 −0 Original line number Diff line number Diff line Loading @@ -433,6 +433,8 @@ class FakeStatusBarService : IStatusBarService.Stub() { override fun showRearDisplayDialog(currentBaseState: Int) {} override fun unbundleNotification(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 +6 −0 Original line number Diff line number Diff line Loading @@ -101,4 +101,10 @@ public interface NotificationDelegate { void onNotificationFeedbackReceived(String key, Bundle feedback); void prepareForPossibleShutdown(); /** * Called when the notification should be unbundled. * @param key the notification key */ void unbundleNotification(String key); } services/core/java/com/android/server/notification/NotificationManagerService.java +37 −0 Original line number Diff line number Diff line Loading @@ -112,6 +112,7 @@ import static android.service.notification.Flags.FLAG_NOTIFICATION_CONVERSATION_ import static android.service.notification.Flags.callstyleCallbackApi; import static android.service.notification.Flags.notificationClassification; import static android.service.notification.Flags.notificationForceGrouping; import static android.service.notification.Flags.notificationRegroupOnClassification; import static android.service.notification.Flags.redactSensitiveNotificationsBigTextStyle; import static android.service.notification.Flags.redactSensitiveNotificationsFromUntrustedListeners; import static android.service.notification.NotificationListenerService.FLAG_FILTER_TYPE_ALERTING; Loading Loading @@ -1851,6 +1852,42 @@ public class NotificationManagerService extends SystemService { } } @Override public void unbundleNotification(String key) { if (!(notificationClassification() && notificationRegroupOnClassification())) { return; } synchronized (mNotificationLock) { NotificationRecord r = mNotificationsByKey.get(key); if (r == null) { return; } if (DBG) { Slog.v(TAG, "unbundleNotification: " + r); } boolean hasOriginalSummary = false; if (r.getSbn().isAppGroup() && r.getNotification().isGroupChild()) { final String oldGroupKey = GroupHelper.getFullAggregateGroupKey( r.getSbn().getPackageName(), r.getOriginalGroupKey(), r.getUserId()); NotificationRecord groupSummary = mSummaryByGroupKey.get(oldGroupKey); // We only care about app-provided valid groups hasOriginalSummary = (groupSummary != null && !GroupHelper.isAggregatedGroup(groupSummary)); } // Only NotificationRecord's mChannel is updated when bundled, the Notification // mChannelId will always be the original channel. String origChannelId = r.getNotification().getChannelId(); NotificationChannel originalChannel = mPreferencesHelper.getNotificationChannel( r.getSbn().getPackageName(), r.getUid(), origChannelId, false); if (originalChannel != null && !origChannelId.equals(r.getChannel().getId())) { r.updateNotificationChannel(originalChannel); mGroupHelper.onNotificationUnbundled(r, hasOriginalSummary); } } } }; NotificationManagerPrivate mNotificationManagerPrivate = new NotificationManagerPrivate() { Loading services/core/java/com/android/server/statusbar/StatusBarManagerService.java +13 −0 Original line number Diff line number Diff line Loading @@ -2175,6 +2175,19 @@ public class StatusBarManagerService extends IStatusBarService.Stub implements D } } /** * Called when the notification should be unbundled. * @param key the notification key */ @Override public void unbundleNotification(@Nullable String key) { enforceStatusBarService(); enforceValidCallingUser(); Binder.withCleanCallingIdentity(() -> { mNotificationDelegate.unbundleNotification(key); }); } @Override public void onShellCommand(FileDescriptor in, FileDescriptor out, FileDescriptor err, Loading Loading
core/java/com/android/internal/statusbar/IStatusBarService.aidl +3 −0 Original line number Diff line number Diff line Loading @@ -236,4 +236,7 @@ interface IStatusBarService /** Shows rear display educational dialog */ void showRearDisplayDialog(int currentBaseState); /** Unbundle a categorized notification */ void unbundleNotification(String key); }
packages/SystemUI/tests/utils/src/android/internal/statusbar/FakeStatusBarService.kt +2 −0 Original line number Diff line number Diff line Loading @@ -433,6 +433,8 @@ class FakeStatusBarService : IStatusBarService.Stub() { override fun showRearDisplayDialog(currentBaseState: Int) {} override fun unbundleNotification(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 +6 −0 Original line number Diff line number Diff line Loading @@ -101,4 +101,10 @@ public interface NotificationDelegate { void onNotificationFeedbackReceived(String key, Bundle feedback); void prepareForPossibleShutdown(); /** * Called when the notification should be unbundled. * @param key the notification key */ void unbundleNotification(String key); }
services/core/java/com/android/server/notification/NotificationManagerService.java +37 −0 Original line number Diff line number Diff line Loading @@ -112,6 +112,7 @@ import static android.service.notification.Flags.FLAG_NOTIFICATION_CONVERSATION_ import static android.service.notification.Flags.callstyleCallbackApi; import static android.service.notification.Flags.notificationClassification; import static android.service.notification.Flags.notificationForceGrouping; import static android.service.notification.Flags.notificationRegroupOnClassification; import static android.service.notification.Flags.redactSensitiveNotificationsBigTextStyle; import static android.service.notification.Flags.redactSensitiveNotificationsFromUntrustedListeners; import static android.service.notification.NotificationListenerService.FLAG_FILTER_TYPE_ALERTING; Loading Loading @@ -1851,6 +1852,42 @@ public class NotificationManagerService extends SystemService { } } @Override public void unbundleNotification(String key) { if (!(notificationClassification() && notificationRegroupOnClassification())) { return; } synchronized (mNotificationLock) { NotificationRecord r = mNotificationsByKey.get(key); if (r == null) { return; } if (DBG) { Slog.v(TAG, "unbundleNotification: " + r); } boolean hasOriginalSummary = false; if (r.getSbn().isAppGroup() && r.getNotification().isGroupChild()) { final String oldGroupKey = GroupHelper.getFullAggregateGroupKey( r.getSbn().getPackageName(), r.getOriginalGroupKey(), r.getUserId()); NotificationRecord groupSummary = mSummaryByGroupKey.get(oldGroupKey); // We only care about app-provided valid groups hasOriginalSummary = (groupSummary != null && !GroupHelper.isAggregatedGroup(groupSummary)); } // Only NotificationRecord's mChannel is updated when bundled, the Notification // mChannelId will always be the original channel. String origChannelId = r.getNotification().getChannelId(); NotificationChannel originalChannel = mPreferencesHelper.getNotificationChannel( r.getSbn().getPackageName(), r.getUid(), origChannelId, false); if (originalChannel != null && !origChannelId.equals(r.getChannel().getId())) { r.updateNotificationChannel(originalChannel); mGroupHelper.onNotificationUnbundled(r, hasOriginalSummary); } } } }; NotificationManagerPrivate mNotificationManagerPrivate = new NotificationManagerPrivate() { Loading
services/core/java/com/android/server/statusbar/StatusBarManagerService.java +13 −0 Original line number Diff line number Diff line Loading @@ -2175,6 +2175,19 @@ public class StatusBarManagerService extends IStatusBarService.Stub implements D } } /** * Called when the notification should be unbundled. * @param key the notification key */ @Override public void unbundleNotification(@Nullable String key) { enforceStatusBarService(); enforceValidCallingUser(); Binder.withCleanCallingIdentity(() -> { mNotificationDelegate.unbundleNotification(key); }); } @Override public void onShellCommand(FileDescriptor in, FileDescriptor out, FileDescriptor err, Loading