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

Commit 029499c8 authored by Lucas Silva's avatar Lucas Silva Committed by Android (Google) Code Review
Browse files

Merge "Refactor syncing between communal STL state and KTF" into main

parents fe63303e de528e86
Loading
Loading
Loading
Loading
+10 −0
Original line number Diff line number Diff line
@@ -987,6 +987,16 @@ flag {
  }
}

flag {
  name: "communal_scene_ktf_refactor"
  namespace: "systemui"
  description: "refactors the syncing mechanism between communal STL and KTF state."
  bug: "327225415"
  metadata {
    purpose: PURPOSE_BUGFIX
  }
}

flag {
  name: "app_clips_backlinks"
  namespace: "systemui"
+685 −0

File added.

Preview size limit exceeded, changes collapsed.

+11 −0
Original line number Diff line number Diff line
@@ -17,6 +17,7 @@
package com.android.systemui.communal.dagger

import android.content.Context
import com.android.systemui.CoreStartable
import com.android.systemui.communal.data.backup.CommunalBackupUtils
import com.android.systemui.communal.data.db.CommunalDatabaseModule
import com.android.systemui.communal.data.repository.CommunalMediaRepositoryModule
@@ -26,6 +27,7 @@ import com.android.systemui.communal.data.repository.CommunalSettingsRepositoryM
import com.android.systemui.communal.data.repository.CommunalSmartspaceRepositoryModule
import com.android.systemui.communal.data.repository.CommunalTutorialRepositoryModule
import com.android.systemui.communal.data.repository.CommunalWidgetRepositoryModule
import com.android.systemui.communal.domain.interactor.CommunalSceneTransitionInteractor
import com.android.systemui.communal.shared.model.CommunalScenes
import com.android.systemui.communal.util.CommunalColors
import com.android.systemui.communal.util.CommunalColorsImpl
@@ -40,6 +42,8 @@ import com.android.systemui.scene.shared.model.SceneDataSourceDelegator
import dagger.Binds
import dagger.Module
import dagger.Provides
import dagger.multibindings.ClassKey
import dagger.multibindings.IntoMap
import kotlinx.coroutines.CoroutineScope

@Module(
@@ -69,6 +73,13 @@ interface CommunalModule {

    @Binds fun bindCommunalColors(impl: CommunalColorsImpl): CommunalColors

    @Binds
    @IntoMap
    @ClassKey(CommunalSceneTransitionInteractor::class)
    abstract fun bindCommunalSceneTransitionInteractor(
        impl: CommunalSceneTransitionInteractor
    ): CoreStartable

    companion object {
        @Provides
        @Communal
+2 −4
Original line number Diff line number Diff line
@@ -28,7 +28,6 @@ import com.android.systemui.scene.shared.model.SceneDataSource
import javax.inject.Inject
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.ExperimentalCoroutinesApi
import kotlinx.coroutines.delay
import kotlinx.coroutines.flow.Flow
import kotlinx.coroutines.flow.MutableStateFlow
import kotlinx.coroutines.flow.SharingStarted
@@ -52,7 +51,7 @@ interface CommunalSceneRepository {
    fun changeScene(toScene: SceneKey, transitionKey: TransitionKey? = null)

    /** Immediately snaps to the desired scene. */
    fun snapToScene(toScene: SceneKey, delayMillis: Long = 0)
    fun snapToScene(toScene: SceneKey)

    /**
     * Updates the transition state of the hub [SceneTransitionLayout].
@@ -93,11 +92,10 @@ constructor(
        }
    }

    override fun snapToScene(toScene: SceneKey, delayMillis: Long) {
    override fun snapToScene(toScene: SceneKey) {
        applicationScope.launch {
            // SceneTransitionLayout state updates must be triggered on the thread the STL was
            // created on.
            delay(delayMillis)
            sceneDataSource.snapToScene(toScene)
        }
    }
+32 −0
Original line number Diff line number Diff line
/*
 * Copyright (C) 2024 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package com.android.systemui.communal.data.repository

import com.android.systemui.dagger.SysUISingleton
import com.android.systemui.keyguard.shared.model.KeyguardState
import javax.inject.Inject
import kotlinx.coroutines.flow.MutableStateFlow

@SysUISingleton
class CommunalSceneTransitionRepository @Inject constructor() {
    /**
     * This [KeyguardState] will indicate which sub state within KTF should be navigated to when the
     * next transition away from communal scene is started. It will be consumed exactly once and
     * after that the state will be set back to null.
     */
    val nextLockscreenTargetState: MutableStateFlow<KeyguardState?> = MutableStateFlow(null)
}
Loading