Set textChanged for new notifications

Test: atest NotificationManagerServiceTest
Fixes: 205915893
Change-Id: Id6033e64e98886db8c9ed20e1f34d0cd39d2123f
This commit is contained in:
Mady Mellor
2021-11-15 16:01:04 -08:00
parent 65031c3762
commit 6f5cbf7249
2 changed files with 16 additions and 1 deletions

View File

@@ -7065,7 +7065,9 @@ public class NotificationManagerService extends SystemService {
if (index < 0) {
mNotificationList.add(r);
mUsageStats.registerPostedByApp(r);
r.setInterruptive(isVisuallyInterruptive(null, r));
final boolean isInterruptive = isVisuallyInterruptive(null, r);
r.setInterruptive(isInterruptive);
r.setTextChanged(isInterruptive);
} else {
old = mNotificationList.get(index); // Potentially *changes* old
mNotificationList.set(index, r);

View File

@@ -3871,6 +3871,19 @@ public class NotificationManagerServiceTest extends UiServiceTestCase {
r.getStats().getDismissalSentiment());
}
@Test
public void testTextChangedSet_forNewNotifs() throws Exception {
NotificationRecord original = generateNotificationRecord(mTestNotificationChannel);
mService.addEnqueuedNotification(original);
NotificationManagerService.PostNotificationRunnable runnable =
mService.new PostNotificationRunnable(original.getKey());
runnable.run();
waitForIdle();
assertTrue(original.isTextChanged());
}
@Test
public void testVisuallyInterruptive_notSeen() throws Exception {
NotificationRecord original = generateNotificationRecord(mTestNotificationChannel);