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

Commit 2009edaa authored by William Xiao's avatar William Xiao Committed by Android (Google) Code Review
Browse files

Merge "Add GLANCEABLE_HUB to KeyguardState" into main

parents 247d753f 239dd632
Loading
Loading
Loading
Loading
+52 −0
Original line number Diff line number Diff line
/*
 * Copyright (C) 2023 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.animation.ValueAnimator
import com.android.app.animation.Interpolators
import com.android.systemui.Flags
import com.android.systemui.dagger.SysUISingleton
import com.android.systemui.keyguard.data.repository.KeyguardTransitionRepository
import com.android.systemui.keyguard.shared.model.KeyguardState
import javax.inject.Inject
import kotlin.time.Duration.Companion.milliseconds

@SysUISingleton
class FromGlanceableHubTransitionInteractor
@Inject
constructor(
    override val transitionRepository: KeyguardTransitionRepository,
    override val transitionInteractor: KeyguardTransitionInteractor,
) : TransitionInteractor(fromState = KeyguardState.GLANCEABLE_HUB) {
    override fun start() {
        if (!Flags.communalHub()) {
            return
        }
    }

    override fun getDefaultAnimatorForTransitionsToState(toState: KeyguardState): ValueAnimator {
        return ValueAnimator().apply {
            interpolator = Interpolators.LINEAR
            duration = DEFAULT_DURATION.inWholeMilliseconds
        }
    }

    companion object {
        const val TAG = "FromGlanceableHubTransitionInteractor"
        val DEFAULT_DURATION = 500.milliseconds
    }
}
+1 −0
Original line number Diff line number Diff line
@@ -42,6 +42,7 @@ constructor(
                    is FromGoneTransitionInteractor -> Log.d(TAG, "Started $it")
                    is FromLockscreenTransitionInteractor -> Log.d(TAG, "Started $it")
                    is FromDreamingTransitionInteractor -> Log.d(TAG, "Started $it")
                    is FromGlanceableHubTransitionInteractor -> Log.d(TAG, "Started $it")
                    is FromOccludedTransitionInteractor -> Log.d(TAG, "Started $it")
                    is FromDozingTransitionInteractor -> Log.d(TAG, "Started $it")
                    is FromAlternateBouncerTransitionInteractor -> Log.d(TAG, "Started $it")
+1 −0
Original line number Diff line number Diff line
@@ -96,6 +96,7 @@ constructor(
                KeyguardState.AOD -> false
                KeyguardState.DREAMING -> true
                KeyguardState.DREAMING_LOCKSCREEN_HOSTED -> true
                KeyguardState.GLANCEABLE_HUB -> true
                KeyguardState.ALTERNATE_BOUNCER -> true
                KeyguardState.PRIMARY_BOUNCER -> true
                KeyguardState.LOCKSCREEN -> true
+6 −0
Original line number Diff line number Diff line
@@ -67,4 +67,10 @@ abstract class StartKeyguardTransitionModule {
    abstract fun fromAlternateBouncer(
        impl: FromAlternateBouncerTransitionInteractor
    ): TransitionInteractor

    @Binds
    @IntoSet
    abstract fun fromGlanceableHub(
        impl: FromGlanceableHubTransitionInteractor
    ): TransitionInteractor
}
+7 −0
Original line number Diff line number Diff line
@@ -62,6 +62,12 @@ enum class KeyguardState {
     * unlocked if SWIPE security method is used, or if face lockscreen bypass is false.
     */
    LOCKSCREEN,
    /**
     * Device is locked or on dream and user has swiped from the right edge to enter the glanceable
     * hub UI. From this state, the user can swipe from the left edge to go back to the lock screen
     * or dream, as well as swipe down for the notifications and up for the bouncer.
     */
    GLANCEABLE_HUB,
    /*
     * Keyguard is no longer visible. In most cases the user has just authenticated and keyguard
     * is being removed, but there are other cases where the user is swiping away keyguard, such as
@@ -95,6 +101,7 @@ enum class KeyguardState {
                DOZING -> false
                DREAMING -> false
                DREAMING_LOCKSCREEN_HOSTED -> false
                GLANCEABLE_HUB -> true
                AOD -> false
                ALTERNATE_BOUNCER -> true
                PRIMARY_BOUNCER -> true