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

Commit 234f6a5a authored by William Xiao's avatar William Xiao
Browse files

Remove no-op Immediately communal transition key

This transition key currently does nothing and just results in a
default animation. snapToScene should be used instead.

Bug: 363239820
Flag: com.android.systemui.communal_hub
Test: atest FromDozingTransitionInteractorTest
Change-Id: I6fa1ce1059217cf0c5ef787e079301011fb17683
parent ea69e895
Loading
Loading
Loading
Loading
+1 −19
Original line number Diff line number Diff line
@@ -14,22 +14,6 @@
 * limitations under the License.
 */

/*
 * 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.keyguard.domain.interactor

import android.os.PowerManager
@@ -47,7 +31,6 @@ import com.android.systemui.communal.data.repository.FakeCommunalSceneRepository
import com.android.systemui.communal.data.repository.fakeCommunalSceneRepository
import com.android.systemui.communal.domain.interactor.setCommunalAvailable
import com.android.systemui.communal.shared.model.CommunalScenes
import com.android.systemui.communal.shared.model.CommunalTransitionKeys
import com.android.systemui.coroutines.collectLastValue
import com.android.systemui.keyguard.data.repository.FakeKeyguardTransitionRepository
import com.android.systemui.keyguard.data.repository.fakeKeyguardRepository
@@ -180,8 +163,7 @@ class FromDozingTransitionInteractorTest(flags: FlagsParameterization?) : SysuiT

            // If dreaming is possible and communal is available, then we should transition to
            // GLANCEABLE_HUB when waking up due to power button press.
            verify(kosmos.fakeCommunalSceneRepository)
                .changeScene(CommunalScenes.Communal, CommunalTransitionKeys.Immediately)
            verify(kosmos.fakeCommunalSceneRepository).snapToScene(CommunalScenes.Communal)
        }

    @Test
+2 −3
Original line number Diff line number Diff line
@@ -251,9 +251,8 @@ constructor(
                Pair(CommunalScenes.Blank, CommunalTransitionKeys.SimpleFade)
            }
            from == KeyguardState.DOZING && to == KeyguardState.GLANCEABLE_HUB -> {
                // Make sure the communal hub is showing (immediately, not fading in) when
                // transitioning from dozing to hub.
                Pair(CommunalScenes.Communal, CommunalTransitionKeys.Immediately)
                // Make sure the communal hub is showing when transitioning from dozing to hub.
                Pair(CommunalScenes.Communal, CommunalTransitionKeys.SimpleFade)
            }
            else -> null
        }
+0 −2
Original line number Diff line number Diff line
@@ -30,6 +30,4 @@ object CommunalTransitionKeys {
    val ToEditMode = TransitionKey("ToEditMode")
    /** Transition to the glanceable hub after exiting edit mode */
    val FromEditMode = TransitionKey("FromEditMode")
    /** Immediately transitions without any delay */
    val Immediately = TransitionKey("Immediately")
}
+1 −4
Original line number Diff line number Diff line
@@ -24,7 +24,6 @@ import com.android.systemui.Flags.communalSceneKtfRefactor
import com.android.systemui.communal.domain.interactor.CommunalInteractor
import com.android.systemui.communal.domain.interactor.CommunalSceneInteractor
import com.android.systemui.communal.shared.model.CommunalScenes
import com.android.systemui.communal.shared.model.CommunalTransitionKeys
import com.android.systemui.dagger.SysUISingleton
import com.android.systemui.dagger.qualifiers.Background
import com.android.systemui.dagger.qualifiers.Main
@@ -234,11 +233,9 @@ constructor(

    private suspend fun transitionToGlanceableHub() {
        if (communalSceneKtfRefactor()) {
            communalSceneInteractor.changeScene(
            communalSceneInteractor.snapToScene(
                newScene = CommunalScenes.Communal,
                loggingReason = "from dozing to hub",
                // Immediately show the hub when transitioning from dozing to hub.
                transitionKey = CommunalTransitionKeys.Immediately,
            )
        } else {
            startTransitionTo(KeyguardState.GLANCEABLE_HUB)
+1 −2
Original line number Diff line number Diff line
@@ -162,10 +162,9 @@ constructor(
                .filterRelevantKeyguardStateAnd { isAsleep -> isAsleep }
                .collect {
                    if (communalSceneKtfRefactor()) {
                        communalSceneInteractor.changeScene(
                        communalSceneInteractor.snapToScene(
                            newScene = CommunalScenes.Blank,
                            loggingReason = "hub to dozing",
                            transitionKey = CommunalTransitionKeys.Immediately,
                            keyguardState = KeyguardState.DOZING,
                        )
                    } else {