summaryrefslogtreecommitdiff
path: root/src/com/android/customization/picker/clock/ui/fragment/ClockCustomDemoFragment.kt
diff options
context:
space:
mode:
authorSantiago Etchebehere <santie@google.com>2023-05-23 20:56:19 -0700
committerSantiago Etchebehere <santie@google.com>2023-05-26 12:19:32 -0700
commite980bd3a5d89fe6e7783af713be5748a4f419711 (patch)
tree575055d6d9fe71e4807270d8851bbc064e88b40c /src/com/android/customization/picker/clock/ui/fragment/ClockCustomDemoFragment.kt
parent73e46698a0e18fe3eb2f05fa344c5a52c8d5ea18 (diff)
downloadThemePicker-e980bd3a5d89fe6e7783af713be5748a4f419711.tar.gz
Unregister listeners from ClockRegistry when destroyed
We now need to keep track of ClockRegistry per lifecycleOwner or we could risk having a ClockRegistry with already unregistered listeners used elsewhere (eg, if the injector is called from 2 different Activities) Fixes: 283124260 Test: manually verified going through all screens with clocks and checking no leaks Change-Id: I1390646a1dfbf745a0c7b90dcd1c6a988ed4421d
Diffstat (limited to 'src/com/android/customization/picker/clock/ui/fragment/ClockCustomDemoFragment.kt')
-rw-r--r--src/com/android/customization/picker/clock/ui/fragment/ClockCustomDemoFragment.kt3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/com/android/customization/picker/clock/ui/fragment/ClockCustomDemoFragment.kt b/src/com/android/customization/picker/clock/ui/fragment/ClockCustomDemoFragment.kt
index 7e53ac44..6203e24c 100644
--- a/src/com/android/customization/picker/clock/ui/fragment/ClockCustomDemoFragment.kt
+++ b/src/com/android/customization/picker/clock/ui/fragment/ClockCustomDemoFragment.kt
@@ -36,7 +36,8 @@ class ClockCustomDemoFragment : AppbarFragment() {
setUpToolbar(view)
clockRegistry =
(InjectorProvider.getInjector() as ThemePickerInjector).getClockRegistry(
- requireContext()
+ requireContext(),
+ this
)
val listInUse = clockRegistry.getClocks().filter { "NOT_IN_USE" !in it.clockId }