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

Commit fb898493 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Automerger Merge Worker
Browse files

Merge "Disable NAS migration notification" into sc-dev am: 75f7a289

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/15156770

Change-Id: Ibe4be08dd444d2ae64a47e0f8f9b4e3b674b8d23
parents 1bf3ed87 75f7a289
Loading
Loading
Loading
Loading
+3 −2
Original line number Diff line number Diff line
@@ -773,12 +773,13 @@ public class NotificationManagerService extends SystemService {
                    mAssistants.resetDefaultFromConfig();
                    continue;
                }
                // TODO(b/192450820): re-enable when "user set" isn't over triggering
                //User selected different NAS, need onboarding
                enqueueNotificationInternal(getContext().getPackageName(),
                /*enqueueNotificationInternal(getContext().getPackageName(),
                        getContext().getOpPackageName(), Binder.getCallingUid(),
                        Binder.getCallingPid(), TAG,
                        SystemMessageProto.SystemMessage.NOTE_NAS_UPGRADE,
                        createNASUpgradeNotification(userId), userId);
                        createNASUpgradeNotification(userId), userId);*/
            }
        }
    }
+22 −14
Original line number Diff line number Diff line
@@ -4855,6 +4855,9 @@ public class NotificationManagerServiceTest extends UiServiceTestCase {

    @Test
    public void testAreBubblesEnabled() throws Exception {
        Settings.Secure.putInt(mContext.getContentResolver(),
                Settings.Secure.NOTIFICATION_BUBBLES, 1);
        mService.mPreferencesHelper.updateBubblesEnabled();
        assertTrue(mBinderService.areBubblesEnabled(UserHandle.getUserHandleForUid(mUid)));
    }

@@ -5907,7 +5910,8 @@ public class NotificationManagerServiceTest extends UiServiceTestCase {

        service.migrateDefaultNASShowNotificationIfNecessary();
        assertFalse(service.isNASMigrationDone(userId));
        verify(service, times(1)).createNASUpgradeNotification(eq(userId));
        //TODO(b/192450820)
        //verify(service, times(1)).createNASUpgradeNotification(eq(userId));
        verify(mAssistants, times(0)).resetDefaultFromConfig();

        //Test user clear data before enable/disable from onboarding notification
@@ -5926,7 +5930,8 @@ public class NotificationManagerServiceTest extends UiServiceTestCase {

        //The notification should be still there
        assertFalse(service.isNASMigrationDone(userId));
        verify(service, times(2)).createNASUpgradeNotification(eq(userId));
        //TODO(b/192450820)
        //verify(service, times(2)).createNASUpgradeNotification(eq(userId));
        verify(mAssistants, times(0)).resetDefaultFromConfig();
        assertEquals(oldDefaultComponent, service.getApprovedAssistant(userId));
    }
@@ -5962,7 +5967,8 @@ public class NotificationManagerServiceTest extends UiServiceTestCase {
        assertFalse(service.isNASMigrationDone(userId1));
        assertTrue(service.isNASMigrationDone(userId2));

        verify(service, times(1)).createNASUpgradeNotification(any(Integer.class));
        //TODO(b/192450820)
        //verify(service, times(1)).createNASUpgradeNotification(any(Integer.class));
        // only user2's default get updated
        verify(mAssistants, times(1)).resetDefaultFromConfig();
    }
@@ -5997,9 +6003,9 @@ public class NotificationManagerServiceTest extends UiServiceTestCase {
        assertFalse(service.isNASMigrationDone(userId1));
        assertFalse(service.isNASMigrationDone(userId2));

        // only user1 get notification
        verify(service, times(1)).createNASUpgradeNotification(eq(userId1));
        verify(service, times(0)).createNASUpgradeNotification(eq(userId2));
        // TODO(b/192450820): only user1 get notification
        //verify(service, times(1)).createNASUpgradeNotification(eq(userId1));
        //verify(service, times(0)).createNASUpgradeNotification(eq(userId2));
    }


@@ -6029,8 +6035,8 @@ public class NotificationManagerServiceTest extends UiServiceTestCase {
        //Test migrate flow again
        service.migrateDefaultNASShowNotificationIfNecessary();

        //The notification should not appear again
        verify(service, times(0)).createNASUpgradeNotification(eq(userId));
        //TODO(b/192450820): The notification should not appear again
        //verify(service, times(0)).createNASUpgradeNotification(eq(userId));
        verify(mAssistants, times(0)).resetDefaultFromConfig();
    }

@@ -6055,9 +6061,9 @@ public class NotificationManagerServiceTest extends UiServiceTestCase {
        verify(mAssistants, times(1)).clearDefaults();
        verify(mAssistants, times(0)).resetDefaultFromConfig();

        //No more notification after disabled
        service.migrateDefaultNASShowNotificationIfNecessary();
        verify(service, times(0)).createNASUpgradeNotification(anyInt());
        //TODO(b/192450820):No more notification after disabled
        //service.migrateDefaultNASShowNotificationIfNecessary();
        //verify(service, times(0)).createNASUpgradeNotification(anyInt());
    }

    @Test
@@ -6077,8 +6083,9 @@ public class NotificationManagerServiceTest extends UiServiceTestCase {
        assertFalse(service.isNASMigrationDone(userId2));
        verify(mAssistants, times(1)).resetDefaultFromConfig();

        service.migrateDefaultNASShowNotificationIfNecessary();
        verify(service, times(0)).createNASUpgradeNotification(eq(userId1));
        //TODO(b/192450820)
        //service.migrateDefaultNASShowNotificationIfNecessary();
        //verify(service, times(0)).createNASUpgradeNotification(eq(userId1));
    }

    @Test
@@ -6093,7 +6100,8 @@ public class NotificationManagerServiceTest extends UiServiceTestCase {

        verify(mContext, times(1)).startActivity(any(Intent.class));
        assertFalse(service.isNASMigrationDone(userId));
        verify(service, times(0)).createNASUpgradeNotification(eq(userId));
        //TODO(b/192450820)
        //verify(service, times(0)).createNASUpgradeNotification(eq(userId));
        verify(mAssistants, times(0)).resetDefaultFromConfig();
    }