Loading services/core/java/com/android/server/notification/NotificationManagerService.java +3 −2 Original line number Diff line number Diff line Loading @@ -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);*/ } } } Loading services/tests/uiservicestests/src/com/android/server/notification/NotificationManagerServiceTest.java +22 −14 Original line number Diff line number Diff line Loading @@ -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))); } Loading Loading @@ -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 Loading @@ -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)); } Loading Loading @@ -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(); } Loading Loading @@ -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)); } Loading Loading @@ -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(); } Loading @@ -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 Loading @@ -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 Loading @@ -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(); } Loading Loading
services/core/java/com/android/server/notification/NotificationManagerService.java +3 −2 Original line number Diff line number Diff line Loading @@ -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);*/ } } } Loading
services/tests/uiservicestests/src/com/android/server/notification/NotificationManagerServiceTest.java +22 −14 Original line number Diff line number Diff line Loading @@ -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))); } Loading Loading @@ -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 Loading @@ -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)); } Loading Loading @@ -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(); } Loading Loading @@ -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)); } Loading Loading @@ -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(); } Loading @@ -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 Loading @@ -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 Loading @@ -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(); } Loading