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

Commit db308379 authored by Priyanka Advani's avatar Priyanka Advani Committed by Android (Google) Code Review
Browse files

Revert "Implement UMO transitions to & from the communal hub"

This reverts commit eb8bf797.

Reason for revert: Probable culprit for b/327643568. Will be verifying through ABTD for confirmation and before submitting the revert.

Change-Id: I702c9347db7e76ad34d09a87dcd3cf97d9ce7dbd
parent eb8bf797
Loading
Loading
Loading
Loading
+0 −7
Original line number Diff line number Diff line
@@ -23,8 +23,6 @@ import com.android.systemui.communal.data.repository.CommunalRepositoryModule
import com.android.systemui.communal.data.repository.CommunalSettingsRepositoryModule
import com.android.systemui.communal.data.repository.CommunalTutorialRepositoryModule
import com.android.systemui.communal.data.repository.CommunalWidgetRepositoryModule
import com.android.systemui.communal.ui.viewmodel.CommunalTransitionViewModel
import com.android.systemui.communal.ui.viewmodel.CommunalTransitionViewModelImpl
import com.android.systemui.communal.widgets.CommunalWidgetModule
import com.android.systemui.communal.widgets.EditWidgetsActivityStarter
import com.android.systemui.communal.widgets.EditWidgetsActivityStarterImpl
@@ -49,9 +47,4 @@ interface CommunalModule {
    fun bindEditWidgetsActivityStarter(
        starter: EditWidgetsActivityStarterImpl
    ): EditWidgetsActivityStarter

    @Binds
    fun bindCommunalTransitionViewModel(
        impl: CommunalTransitionViewModelImpl
    ): CommunalTransitionViewModel
}
+0 −58
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.ui.viewmodel

import com.android.systemui.dagger.SysUISingleton
import com.android.systemui.keyguard.ui.viewmodel.DreamingToGlanceableHubTransitionViewModel
import com.android.systemui.keyguard.ui.viewmodel.GlanceableHubToDreamingTransitionViewModel
import com.android.systemui.keyguard.ui.viewmodel.GlanceableHubToLockscreenTransitionViewModel
import com.android.systemui.keyguard.ui.viewmodel.LockscreenToGlanceableHubTransitionViewModel
import javax.inject.Inject
import kotlinx.coroutines.ExperimentalCoroutinesApi
import kotlinx.coroutines.flow.Flow
import kotlinx.coroutines.flow.distinctUntilChanged
import kotlinx.coroutines.flow.merge

/** View model for transitions related to the communal hub. */
interface CommunalTransitionViewModel {
    val isUmoOnCommunal: Flow<Boolean>
}

@OptIn(ExperimentalCoroutinesApi::class)
@SysUISingleton
class CommunalTransitionViewModelImpl
@Inject
constructor(
    glanceableHubToLockscreenTransitionViewModel: GlanceableHubToLockscreenTransitionViewModel,
    lockscreenToGlanceableHubTransitionViewModel: LockscreenToGlanceableHubTransitionViewModel,
    dreamToGlanceableHubTransitionViewModel: DreamingToGlanceableHubTransitionViewModel,
    glanceableHubToDreamTransitionViewModel: GlanceableHubToDreamingTransitionViewModel,
) : CommunalTransitionViewModel {
    /**
     * Whether UMO location should be on communal. This flow is responsive to transitions so that a
     * new value is emitted at the right step of a transition to/from communal hub that the location
     * of UMO should be updated.
     */
    override val isUmoOnCommunal: Flow<Boolean> =
        merge(
                lockscreenToGlanceableHubTransitionViewModel.showUmo,
                glanceableHubToLockscreenTransitionViewModel.showUmo,
                dreamToGlanceableHubTransitionViewModel.showUmo,
                glanceableHubToDreamTransitionViewModel.showUmo,
            )
            .distinctUntilChanged()
}
+0 −10
Original line number Diff line number Diff line
@@ -28,7 +28,6 @@ import kotlin.time.Duration.Companion.seconds
import kotlinx.coroutines.ExperimentalCoroutinesApi
import kotlinx.coroutines.flow.Flow
import kotlinx.coroutines.flow.flatMapLatest
import kotlinx.coroutines.flow.map

@OptIn(ExperimentalCoroutinesApi::class)
@SysUISingleton
@@ -66,15 +65,6 @@ constructor(
            name = "DREAMING->GLANCEABLE_HUB: dreamOverlayAlpha",
        )

    // Show UMO once the transition starts.
    val showUmo: Flow<Boolean> =
        transitionAnimation
            .sharedFlow(
                duration = TO_GLANCEABLE_HUB_DURATION,
                onStep = { it },
            )
            .map { step -> step != 0f }

    private companion object {
        val TO_GLANCEABLE_HUB_DURATION = 1.seconds
    }
+0 −10
Original line number Diff line number Diff line
@@ -28,7 +28,6 @@ import kotlin.time.Duration.Companion.seconds
import kotlinx.coroutines.ExperimentalCoroutinesApi
import kotlinx.coroutines.flow.Flow
import kotlinx.coroutines.flow.flatMapLatest
import kotlinx.coroutines.flow.map

@OptIn(ExperimentalCoroutinesApi::class)
@SysUISingleton
@@ -67,15 +66,6 @@ constructor(
                )
            }

    // Show UMO until transition finishes.
    val showUmo: Flow<Boolean> =
        transitionAnimation
            .sharedFlow(
                duration = FROM_GLANCEABLE_HUB_DURATION,
                onStep = { it },
            )
            .map { step -> step != 1f }

    private companion object {
        val FROM_GLANCEABLE_HUB_DURATION = 1.seconds
    }
+0 −3
Original line number Diff line number Diff line
@@ -64,9 +64,6 @@ constructor(
            )
            .onStart { emit(0f) }

    // Show UMO as long as keyguard is not visible.
    val showUmo: Flow<Boolean> = keyguardAlpha.map { alpha -> alpha == 0f }

    val keyguardTranslationX: Flow<StateToValue> =
        configurationInteractor
            .dimensionPixelSize(R.dimen.hub_to_lockscreen_transition_lockscreen_translation_x)
Loading