Loading src/com/android/customization/picker/quickaffordance/domain/interactor/KeyguardQuickAffordancePickerInteractor.kt +6 −1 Original line number Diff line number Diff line Loading @@ -64,7 +64,7 @@ class KeyguardQuickAffordancePickerInteractor( } /** Unselects all affordances from the slot with the given ID. */ suspend fun unselectAll(slotId: String) { suspend fun unselectAllFromSlot(slotId: String) { client.deleteAllSelections( slotId = slotId, ) Loading @@ -72,6 +72,11 @@ class KeyguardQuickAffordancePickerInteractor( snapshotRestorer.get().storeSnapshot() } /** Unselects all affordances from all slots. */ suspend fun unselectAll() { client.querySlots().forEach { client.deleteAllSelections(it.id) } } /** Returns a [Drawable] for the given resource ID, from the system UI package. */ suspend fun getAffordanceIcon( @DrawableRes iconResourceId: Int, Loading src/com/android/customization/picker/quickaffordance/domain/interactor/KeyguardQuickAffordanceSnapshotRestorer.kt +7 −2 Original line number Diff line number Diff line Loading @@ -42,9 +42,14 @@ class KeyguardQuickAffordanceSnapshotRestorer( } override suspend fun restoreToSnapshot(snapshot: RestorableSnapshot) { // reset all current selections interactor.unselectAll() val allSelections = checkNotNull(snapshot.args[KEY_SELECTIONS]) if (allSelections.isEmpty()) return val selections: List<Pair<String, String>> = checkNotNull(snapshot.args[KEY_SELECTIONS]).split(SELECTION_SEPARATOR).map { selection -> allSelections.split(SELECTION_SEPARATOR).map { selection -> val (slotId, affordanceId) = selection.split(SLOT_AFFORDANCE_SEPARATOR) slotId to affordanceId } Loading src/com/android/customization/picker/quickaffordance/ui/viewmodel/KeyguardQuickAffordancePickerViewModel.kt +3 −1 Original line number Diff line number Diff line Loading @@ -217,7 +217,9 @@ private constructor( if (!isSelected) { { viewModelScope.launch { quickAffordanceInteractor.unselectAll(selectedSlotId) quickAffordanceInteractor.unselectAllFromSlot( selectedSlotId ) logger.logShortcutApplied( shortcut = "none", shortcutSlotId = selectedSlotId, Loading tests/robotests/src/com/android/customization/model/picker/quickaffordance/domain/interactor/KeyguardQuickAffordancePickerInteractorTest.kt +1 −1 Original line number Diff line number Diff line Loading @@ -132,7 +132,7 @@ class KeyguardQuickAffordancePickerInteractorTest { affordanceId = FakeCustomizationProviderClient.AFFORDANCE_3, ) underTest.unselectAll( underTest.unselectAllFromSlot( slotId = KeyguardQuickAffordanceSlots.SLOT_ID_BOTTOM_END, ) Loading Loading
src/com/android/customization/picker/quickaffordance/domain/interactor/KeyguardQuickAffordancePickerInteractor.kt +6 −1 Original line number Diff line number Diff line Loading @@ -64,7 +64,7 @@ class KeyguardQuickAffordancePickerInteractor( } /** Unselects all affordances from the slot with the given ID. */ suspend fun unselectAll(slotId: String) { suspend fun unselectAllFromSlot(slotId: String) { client.deleteAllSelections( slotId = slotId, ) Loading @@ -72,6 +72,11 @@ class KeyguardQuickAffordancePickerInteractor( snapshotRestorer.get().storeSnapshot() } /** Unselects all affordances from all slots. */ suspend fun unselectAll() { client.querySlots().forEach { client.deleteAllSelections(it.id) } } /** Returns a [Drawable] for the given resource ID, from the system UI package. */ suspend fun getAffordanceIcon( @DrawableRes iconResourceId: Int, Loading
src/com/android/customization/picker/quickaffordance/domain/interactor/KeyguardQuickAffordanceSnapshotRestorer.kt +7 −2 Original line number Diff line number Diff line Loading @@ -42,9 +42,14 @@ class KeyguardQuickAffordanceSnapshotRestorer( } override suspend fun restoreToSnapshot(snapshot: RestorableSnapshot) { // reset all current selections interactor.unselectAll() val allSelections = checkNotNull(snapshot.args[KEY_SELECTIONS]) if (allSelections.isEmpty()) return val selections: List<Pair<String, String>> = checkNotNull(snapshot.args[KEY_SELECTIONS]).split(SELECTION_SEPARATOR).map { selection -> allSelections.split(SELECTION_SEPARATOR).map { selection -> val (slotId, affordanceId) = selection.split(SLOT_AFFORDANCE_SEPARATOR) slotId to affordanceId } Loading
src/com/android/customization/picker/quickaffordance/ui/viewmodel/KeyguardQuickAffordancePickerViewModel.kt +3 −1 Original line number Diff line number Diff line Loading @@ -217,7 +217,9 @@ private constructor( if (!isSelected) { { viewModelScope.launch { quickAffordanceInteractor.unselectAll(selectedSlotId) quickAffordanceInteractor.unselectAllFromSlot( selectedSlotId ) logger.logShortcutApplied( shortcut = "none", shortcutSlotId = selectedSlotId, Loading
tests/robotests/src/com/android/customization/model/picker/quickaffordance/domain/interactor/KeyguardQuickAffordancePickerInteractorTest.kt +1 −1 Original line number Diff line number Diff line Loading @@ -132,7 +132,7 @@ class KeyguardQuickAffordancePickerInteractorTest { affordanceId = FakeCustomizationProviderClient.AFFORDANCE_3, ) underTest.unselectAll( underTest.unselectAllFromSlot( slotId = KeyguardQuickAffordanceSlots.SLOT_ID_BOTTOM_END, ) Loading