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

Commit 8ca34bc0 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Setting/getting per-screen wallpaper (2/3)." into tm-qpr-dev

parents d6772973 328a8bf0
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -83,6 +83,7 @@ public final class DefaultCustomizationSections implements CustomizationSections
        // Wallpaper quick switch section.
        sectionControllers.add(
                new WallpaperQuickSwitchSectionController(
                        screen,
                        wallpaperQuickSwitchViewModel,
                        lifecycleOwner,
                        sectionNavigationController));
+2 −1
Original line number Diff line number Diff line
@@ -18,12 +18,13 @@
package com.android.customization.picker.clock.domain.interactor

import com.android.wallpaper.picker.undo.domain.interactor.SnapshotRestorer
import com.android.wallpaper.picker.undo.domain.interactor.SnapshotStore
import com.android.wallpaper.picker.undo.shared.model.RestorableSnapshot

/** Handles state restoration for clocks. */
class ClocksSnapshotRestorer : SnapshotRestorer {
    override suspend fun setUpSnapshotRestorer(
        updater: (RestorableSnapshot) -> Unit,
        store: SnapshotStore,
    ): RestorableSnapshot {
        // TODO(b/262924055): implement as part of the clock settings screen.
        return RestorableSnapshot(mapOf())
+5 −4
Original line number Diff line number Diff line
@@ -19,6 +19,7 @@ package com.android.customization.picker.quickaffordance.domain.interactor

import com.android.systemui.shared.customization.data.content.CustomizationProviderClient
import com.android.wallpaper.picker.undo.domain.interactor.SnapshotRestorer
import com.android.wallpaper.picker.undo.domain.interactor.SnapshotStore
import com.android.wallpaper.picker.undo.shared.model.RestorableSnapshot

/** Handles state restoration for the quick affordances system. */
@@ -27,16 +28,16 @@ class KeyguardQuickAffordanceSnapshotRestorer(
    private val client: CustomizationProviderClient,
) : SnapshotRestorer {

    private lateinit var snapshotUpdater: (RestorableSnapshot) -> Unit
    private lateinit var snapshotStore: SnapshotStore

    suspend fun storeSnapshot() {
        snapshotUpdater(snapshot())
        snapshotStore.store(snapshot())
    }

    override suspend fun setUpSnapshotRestorer(
        updater: (RestorableSnapshot) -> Unit,
        store: SnapshotStore,
    ): RestorableSnapshot {
        snapshotUpdater = updater
        snapshotStore = store
        return snapshot()
    }

+2 −1
Original line number Diff line number Diff line
@@ -24,6 +24,7 @@ import com.android.customization.picker.quickaffordance.domain.interactor.Keygua
import com.android.customization.picker.quickaffordance.shared.model.KeyguardQuickAffordancePickerSelectionModel
import com.android.systemui.shared.customization.data.content.FakeCustomizationProviderClient
import com.android.systemui.shared.keyguard.shared.model.KeyguardQuickAffordanceSlots
import com.android.wallpaper.testing.FakeSnapshotStore
import com.android.wallpaper.testing.collectLastValue
import com.google.common.truth.Truth.assertThat
import kotlinx.coroutines.Dispatchers
@@ -69,7 +70,7 @@ class KeyguardQuickAffordancePickerInteractorTest {
                            interactor = underTest,
                            client = client,
                        )
                        .apply { runBlocking { setUpSnapshotRestorer {} } }
                        .apply { runBlocking { setUpSnapshotRestorer(FakeSnapshotStore()) } }
                },
            )
    }
+2 −1
Original line number Diff line number Diff line
@@ -35,6 +35,7 @@ import com.android.wallpaper.module.InjectorProvider
import com.android.wallpaper.picker.undo.data.repository.UndoRepository
import com.android.wallpaper.picker.undo.domain.interactor.UndoInteractor
import com.android.wallpaper.testing.FAKE_RESTORERS
import com.android.wallpaper.testing.FakeSnapshotStore
import com.android.wallpaper.testing.TestCurrentWallpaperInfoFactory
import com.android.wallpaper.testing.TestInjector
import com.android.wallpaper.testing.collectLastValue
@@ -90,7 +91,7 @@ class KeyguardQuickAffordancePickerViewModelTest {
                            interactor = quickAffordanceInteractor,
                            client = client,
                        )
                        .apply { runBlocking { setUpSnapshotRestorer {} } }
                        .apply { runBlocking { setUpSnapshotRestorer(FakeSnapshotStore()) } }
                },
            )
        val undoInteractor =