Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 6653bb7e authored by Valentin Iftime's avatar Valentin Iftime Committed by Iavor-Valentin Iftime
Browse files

Fix userId for NotificationAssistantsTest tests

 Use ActivityManager.getCurrentUser instead of hardcoded userId '0'
 Fixes test failure when running on HSUM devices.

Flag: EXEMPT bugfix
Test: atest com.android.server.notification.NotificationAssistantsTest#testReadXml_userDisabled_restore
Bug: 383072625
Change-Id: I44be813dc69ea9ceb8d60913f211e98931f1be78
parent 91f651e5
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -274,6 +274,7 @@ public class NotificationAssistantsTest extends UiServiceTestCase {
        assertEquals(new ArraySet<>(), approved.get(true));
    }

    @SuppressWarnings("GuardedBy")
    @Test
    public void testReadXml_userDisabled_restore() throws Exception {
        String xml = "<enabled_assistants version=\"4\" defaults=\"b/b\">"
@@ -289,7 +290,8 @@ public class NotificationAssistantsTest extends UiServiceTestCase {
        mAssistants.readXml(parser, mNm::canUseManagedServices, true,
                ActivityManager.getCurrentUser());

        ArrayMap<Boolean, ArraySet<String>> approved = mAssistants.mApproved.get(0);
        ArrayMap<Boolean, ArraySet<String>> approved = mAssistants.mApproved.get(
                ActivityManager.getCurrentUser());

        // approved should not be null
        assertNotNull(approved);