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

Commit b761dbb9 authored by Darrell Shi's avatar Darrell Shi
Browse files

Rename CommunalWidgetRepositoryImpl

This change renames the CommunalWidgetRepositoryImpl to
CommunalWidgetRepositoryLocalImpl, indicating that this implementation
manages data locally, in contrast to the upcoming
CommunalWidgetRepositoryRemoteImpl, which gets data through a remote
service.

Test: NONE simple renaming
Bug: 357621815
Flag: EXEMPT simple renaming

Change-Id: I27887eb9bcedae884b6d4e2cb44a14a9c846c8e3
parent 7548806d
Loading
Loading
Loading
Loading
+4 −4
Original line number Diff line number Diff line
@@ -73,7 +73,7 @@ import org.mockito.kotlin.whenever
@OptIn(ExperimentalCoroutinesApi::class)
@SmallTest
@RunWith(AndroidJUnit4::class)
class CommunalWidgetRepositoryImplTest : SysuiTestCase() {
class CommunalWidgetRepositoryLocalImplTest : SysuiTestCase() {
    @Mock private lateinit var appWidgetHost: CommunalAppWidgetHost
    @Mock private lateinit var providerInfoA: AppWidgetProviderInfo
    @Mock private lateinit var providerInfoB: AppWidgetProviderInfo
@@ -105,14 +105,14 @@ class CommunalWidgetRepositoryImplTest : SysuiTestCase() {
            "com.android.fake/WidgetProviderC",
        )

    private lateinit var underTest: CommunalWidgetRepositoryImpl
    private lateinit var underTest: CommunalWidgetRepositoryLocalImpl

    @Before
    fun setUp() {
        MockitoAnnotations.initMocks(this)
        fakeWidgets = MutableStateFlow(emptyMap())
        fakeProviders = MutableStateFlow(emptyMap())
        logBuffer = logcatLogBuffer(name = "CommunalWidgetRepoImplTest")
        logBuffer = logcatLogBuffer(name = "CommunalWidgetRepoLocalImplTest")
        backupUtils = CommunalBackupUtils(kosmos.applicationContext)

        setAppWidgetIds(emptyList())
@@ -126,7 +126,7 @@ class CommunalWidgetRepositoryImplTest : SysuiTestCase() {
        restoreUser(mainUser)

        underTest =
            CommunalWidgetRepositoryImpl(
            CommunalWidgetRepositoryLocalImpl(
                appWidgetHost,
                testScope.backgroundScope,
                kosmos.testDispatcher,
+7 −3
Original line number Diff line number Diff line
@@ -21,6 +21,7 @@ import android.appwidget.AppWidgetProviderInfo
import android.content.ComponentName
import android.os.UserHandle
import android.os.UserManager
import com.android.app.tracing.coroutines.launchTraced as launch
import com.android.systemui.Flags.communalWidgetResizing
import com.android.systemui.common.data.repository.PackageChangeRepository
import com.android.systemui.common.shared.model.PackageInstallSession
@@ -51,7 +52,6 @@ import kotlinx.coroutines.flow.flatMapLatest
import kotlinx.coroutines.flow.flowOf
import kotlinx.coroutines.flow.flowOn
import kotlinx.coroutines.flow.map
import com.android.app.tracing.coroutines.launchTraced as launch

/** Encapsulates the state of widgets for communal mode. */
interface CommunalWidgetRepository {
@@ -106,8 +106,12 @@ interface CommunalWidgetRepository {
    fun resizeWidget(appWidgetId: Int, spanY: Int, widgetIdToRankMap: Map<Int, Int>)
}

/**
 * The local implementation of the [CommunalWidgetRepository] that should be injected in a
 * foreground user process.
 */
@SysUISingleton
class CommunalWidgetRepositoryImpl
class CommunalWidgetRepositoryLocalImpl
@Inject
constructor(
    private val appWidgetHost: CommunalAppWidgetHost,
@@ -123,7 +127,7 @@ constructor(
    private val defaultWidgetPopulation: DefaultWidgetPopulation,
) : CommunalWidgetRepository {
    companion object {
        const val TAG = "CommunalWidgetRepository"
        const val TAG = "CommunalWidgetRepositoryLocalImpl"
    }

    private val logger = Logger(logBuffer, TAG)
+1 −1
Original line number Diff line number Diff line
@@ -23,5 +23,5 @@ import dagger.Module
@Module
interface CommunalWidgetRepositoryModule {
    @Binds
    fun communalWidgetRepository(impl: CommunalWidgetRepositoryImpl): CommunalWidgetRepository
    fun communalWidgetRepository(impl: CommunalWidgetRepositoryLocalImpl): CommunalWidgetRepository
}