Loading packages/SystemUI/src/com/android/systemui/controls/ui/ControlsUiControllerImpl.kt +2 −2 Original line number Diff line number Diff line Loading @@ -327,8 +327,8 @@ class ControlsUiControllerImpl @Inject constructor ( @VisibleForTesting internal fun startRemovingApp(componentName: ComponentName, appName: CharSequence) { removeAppDialog?.cancel() removeAppDialog = dialogsFactory.createRemoveAppDialog(context, appName) { if (!controlsController.get().removeFavorites(componentName)) { removeAppDialog = dialogsFactory.createRemoveAppDialog(context, appName) { shouldRemove -> if (!shouldRemove || !controlsController.get().removeFavorites(componentName)) { return@createRemoveAppDialog } Loading packages/SystemUI/tests/src/com/android/systemui/controls/ui/ControlsUiControllerImplTest.kt +22 −2 Original line number Diff line number Diff line Loading @@ -361,6 +361,26 @@ class ControlsUiControllerImplTest : SysuiTestCase() { assertThat(preferredPanelRepository.getSelectedComponent()).isNull() } @Test fun testCancelRemovingAppsDoesntRemoveFavorite() { val componentName = ComponentName(context, "cls") whenever(controlsController.removeFavorites(eq(componentName))).thenReturn(true) val panel = SelectedItem.PanelItem("App name", componentName) preferredPanelRepository.setSelectedComponent( SelectedComponentRepository.SelectedComponent(panel) ) underTest.show(parent, {}, context) underTest.startRemovingApp(componentName, "Test App") fakeDialogController.clickNeutral() verify(controlsController, never()).removeFavorites(eq(componentName)) assertThat(underTest.getPreferredSelectedItem(emptyList())).isEqualTo(panel) assertThat(preferredPanelRepository.shouldAddDefaultComponent()).isTrue() assertThat(preferredPanelRepository.getSelectedComponent()) .isEqualTo(SelectedComponentRepository.SelectedComponent(panel)) } @Test fun testHideCancelsTheRemoveAppDialog() { val componentName = ComponentName(context, "cls") Loading Loading
packages/SystemUI/src/com/android/systemui/controls/ui/ControlsUiControllerImpl.kt +2 −2 Original line number Diff line number Diff line Loading @@ -327,8 +327,8 @@ class ControlsUiControllerImpl @Inject constructor ( @VisibleForTesting internal fun startRemovingApp(componentName: ComponentName, appName: CharSequence) { removeAppDialog?.cancel() removeAppDialog = dialogsFactory.createRemoveAppDialog(context, appName) { if (!controlsController.get().removeFavorites(componentName)) { removeAppDialog = dialogsFactory.createRemoveAppDialog(context, appName) { shouldRemove -> if (!shouldRemove || !controlsController.get().removeFavorites(componentName)) { return@createRemoveAppDialog } Loading
packages/SystemUI/tests/src/com/android/systemui/controls/ui/ControlsUiControllerImplTest.kt +22 −2 Original line number Diff line number Diff line Loading @@ -361,6 +361,26 @@ class ControlsUiControllerImplTest : SysuiTestCase() { assertThat(preferredPanelRepository.getSelectedComponent()).isNull() } @Test fun testCancelRemovingAppsDoesntRemoveFavorite() { val componentName = ComponentName(context, "cls") whenever(controlsController.removeFavorites(eq(componentName))).thenReturn(true) val panel = SelectedItem.PanelItem("App name", componentName) preferredPanelRepository.setSelectedComponent( SelectedComponentRepository.SelectedComponent(panel) ) underTest.show(parent, {}, context) underTest.startRemovingApp(componentName, "Test App") fakeDialogController.clickNeutral() verify(controlsController, never()).removeFavorites(eq(componentName)) assertThat(underTest.getPreferredSelectedItem(emptyList())).isEqualTo(panel) assertThat(preferredPanelRepository.shouldAddDefaultComponent()).isTrue() assertThat(preferredPanelRepository.getSelectedComponent()) .isEqualTo(SelectedComponentRepository.SelectedComponent(panel)) } @Test fun testHideCancelsTheRemoveAppDialog() { val componentName = ComponentName(context, "cls") Loading