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

Commit 230d25c4 authored by Treehugger Robot's avatar Treehugger Robot Committed by Automerger Merge Worker
Browse files

Merge changes from topic "blackflash" into udc-qpr-dev am: fba6a29e

parents 530fda75 fba6a29e
Loading
Loading
Loading
Loading
+6 −6
Original line number Diff line number Diff line
@@ -15,6 +15,7 @@
 */
package com.android.customization.module

import android.app.Activity
import android.app.UiModeManager
import android.app.WallpaperManager
import android.content.Context
@@ -111,7 +112,7 @@ internal constructor(
    private var clockPickerInteractor: ClockPickerInteractor? = null
    private var clockSectionViewModel: ClockSectionViewModel? = null
    private var clockCarouselViewModelFactory: ClockCarouselViewModel.Factory? = null
    private var clockViewFactories: MutableMap<Int, ClockViewFactory> = HashMap()
    private var clockViewFactory: ClockViewFactory? = null
    private var clockPickerSnapshotRestorer: ClockPickerSnapshotRestorer? = null
    private var notificationsInteractor: NotificationsInteractor? = null
    private var notificationSectionViewModelFactory: NotificationSectionViewModel.Factory? = null
@@ -388,8 +389,7 @@ internal constructor(
    }

    override fun getClockViewFactory(activity: ComponentActivity): ClockViewFactory {
        val activityHashCode = activity.hashCode()
        return clockViewFactories[activityHashCode]
        return clockViewFactory
            ?: ClockViewFactory(
                    activity.applicationContext,
                    ScreenSizeCalculator.getInstance()
@@ -398,13 +398,13 @@ internal constructor(
                    getClockRegistry(activity.applicationContext),
                )
                .also {
                    clockViewFactories[activityHashCode] = it
                    clockViewFactory = it
                    activity.lifecycle.addObserver(
                        object : DefaultLifecycleObserver {
                            override fun onDestroy(owner: LifecycleOwner) {
                                super.onDestroy(owner)
                                clockViewFactories[activityHashCode]?.onDestroy()
                                clockViewFactories.remove(activityHashCode)
                                if ((owner as Activity).isChangingConfigurations()) return
                                clockViewFactory?.onDestroy()
                            }
                        }
                    )