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

Commit 8b2183b8 authored by Behnam Heydarshahi's avatar Behnam Heydarshahi
Browse files

Make tileScope background

This is done to prevent unnecessary work on the main thread.

Bug: 378661321
Test: manual. Open QS; verify tiles show up normal (no missing icon and text)
Flag: com.android.systemui.qs_new_tiles
Change-Id: Ie392b23b4e7e507ff02c8106a45da22661526b7b
parent 8bc91885
Loading
Loading
Loading
Loading
+4 −5
Original line number Diff line number Diff line
@@ -17,18 +17,17 @@
package com.android.systemui.qs.tiles.base.viewmodel

import com.android.systemui.coroutines.newTracingContext
import com.android.systemui.dagger.qualifiers.Application
import com.android.systemui.dagger.qualifiers.Background
import javax.inject.Inject
import kotlinx.coroutines.CoroutineDispatcher
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.SupervisorJob

/** Creates a [CoroutineScope] for the [QSTileViewModelImpl]. */
class QSTileCoroutineScopeFactory
@Inject
constructor(@Application private val applicationScope: CoroutineScope) {
constructor(@Background private val bgDispatcher: CoroutineDispatcher) {

    fun create(): CoroutineScope =
        CoroutineScope(
            applicationScope.coroutineContext + SupervisorJob() + newTracingContext("QSTileScope")
        )
        CoroutineScope(bgDispatcher + SupervisorJob() + newTracingContext("QSTileScope"))
}