From ca615997ea7f8d870e12e63943263559a854c61a Mon Sep 17 00:00:00 2001 From: Chaohui Wang Date: Sat, 29 Apr 2023 15:41:29 +0800 Subject: [PATCH] Use string notifications_disabled instead of off notifications_disabled was changed to off in Change: I5f84d09f223efd478461ded93aeac82bf7b128d8 And reverted from off to notifications_disabled in Change: Iaad301c5513478fb95e40987ea3ccb4f923d71fa This usage is branched from AppNotificationPreferenceController.java, and missed in revert. Bug: 272603842 Test: Visual Test: Unit test Change-Id: I5b8466134c1342e10de7a2ead8c52931e0c19377 --- .../settings/spa/notification/AppNotificationRepository.kt | 6 ++++-- .../spa/notification/AppNotificationRepositoryTest.kt | 4 ++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/src/com/android/settings/spa/notification/AppNotificationRepository.kt b/src/com/android/settings/spa/notification/AppNotificationRepository.kt index 8dc4f20e591..f35d3089c0b 100644 --- a/src/com/android/settings/spa/notification/AppNotificationRepository.kt +++ b/src/com/android/settings/spa/notification/AppNotificationRepository.kt @@ -123,13 +123,15 @@ class AppNotificationRepository( } override fun getNotificationSummary(app: ApplicationInfo): String { - if (!isEnabled(app)) return context.getString(R.string.off) + if (!isEnabled(app)) return context.getString(R.string.notifications_disabled) val channelCount = getChannelCount(app) if (channelCount == 0) { return calculateFrequencySummary(getSentCount(app)) } val blockedChannelCount = getBlockedChannelCount(app) - if (channelCount == blockedChannelCount) return context.getString(R.string.off) + if (channelCount == blockedChannelCount) { + return context.getString(R.string.notifications_disabled) + } val frequencySummary = calculateFrequencySummary(getSentCount(app)) if (blockedChannelCount == 0) return frequencySummary return context.getString( diff --git a/tests/spa_unit/src/com/android/settings/spa/notification/AppNotificationRepositoryTest.kt b/tests/spa_unit/src/com/android/settings/spa/notification/AppNotificationRepositoryTest.kt index a1d8d3fe2fc..12fdc23ac30 100644 --- a/tests/spa_unit/src/com/android/settings/spa/notification/AppNotificationRepositoryTest.kt +++ b/tests/spa_unit/src/com/android/settings/spa/notification/AppNotificationRepositoryTest.kt @@ -251,7 +251,7 @@ class AppNotificationRepositoryTest { val summary = repository.getNotificationSummary(APP) - assertThat(summary).isEqualTo(context.getString(R.string.off)) + assertThat(summary).isEqualTo(context.getString(R.string.notifications_disabled)) } @Test @@ -273,7 +273,7 @@ class AppNotificationRepositoryTest { val summary = repository.getNotificationSummary(APP) - assertThat(summary).isEqualTo(context.getString(R.string.off)) + assertThat(summary).isEqualTo(context.getString(R.string.notifications_disabled)) } @Test