diff options
| author | 2024-12-13 16:47:43 +0100 | |
|---|---|---|
| committer | 2024-12-13 16:53:38 +0100 | |
| commit | 34d40dd104593b1388c8e8aa49f4578d7a566286 (patch) | |
| tree | 229e077bdf9b9a8030382fec81ef8db00794096f | |
| parent | 27224f9cdd4157dc311723f84064c49b6932f17c (diff) | |
Fix Zen tests setup in NotificationManagerServiceTest
ZenModeHelper can only act on Zen configurations for users that have been switched to at least once (or user 0). When running the unit test on an HSUM device this had never happened, so a couple tests were failing.
Fixes: 383071237
Fixes: 383072845
Test: atest NotificationManagerServiceTest
Flag: TEST_ONLY
Change-Id: Ie33d277435d8d3044ed4ea5a616145479ce4d67f
| -rw-r--r-- | services/tests/uiservicestests/src/com/android/server/notification/NotificationManagerServiceTest.java | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/services/tests/uiservicestests/src/com/android/server/notification/NotificationManagerServiceTest.java b/services/tests/uiservicestests/src/com/android/server/notification/NotificationManagerServiceTest.java index 1fc0d245fbe5..20f4bb65d27b 100644 --- a/services/tests/uiservicestests/src/com/android/server/notification/NotificationManagerServiceTest.java +++ b/services/tests/uiservicestests/src/com/android/server/notification/NotificationManagerServiceTest.java @@ -16712,6 +16712,10 @@ public class NotificationManagerServiceTest extends UiServiceTestCase { when(mResources.getResourceName(eq(iconResId))).thenReturn(iconResName); when(mResources.getIdentifier(eq(iconResName), any(), any())).thenReturn(iconResId); when(mPackageManagerClient.getResourcesForApplication(eq(pkg))).thenReturn(mResources); + + // Ensure that there is a zen configuration for the user running the test (won't be + // USER_SYSTEM if running on HSUM). + mService.mZenModeHelper.onUserSwitched(mUserId); } @Test |