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

Commit 49e32d90 authored by Jiaming Cheng's avatar Jiaming Cheng Committed by Android (Google) Code Review
Browse files

Merge "[QSDetailedView] Fix the crash when reopening Internet Details" into main

parents 3ab7af71 0316f00e
Loading
Loading
Loading
Loading
+12 −9
Original line number Diff line number Diff line
@@ -198,18 +198,21 @@ constructor(
    }

    /**
     * Initializes the LifecycleRegistry if it hasn't been initialized yet. It sets the initial
     * state of the LifecycleRegistry to Lifecycle.State.CREATED.
     * Initializes the LifecycleRegistry. It sets the initial state of the LifecycleRegistry to
     * Lifecycle.State.CREATED.
     */
    fun initializeLifecycle() {
        if (!::lifecycleRegistry.isInitialized) {
        // If a lifecycle already exists, destroy it before creating a new one.
        if (::lifecycleRegistry.isInitialized) {
            lifecycleRegistry.currentState = Lifecycle.State.DESTROYED
        }

        lifecycleOwner =
            object : LifecycleOwner {
                override val lifecycle: Lifecycle
                    get() = lifecycleRegistry
            }
        lifecycleRegistry = LifecycleRegistry(lifecycleOwner!!)
        }
        lifecycleRegistry.currentState = Lifecycle.State.CREATED
    }