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

Commit b314f861 authored by Alejandro Nijamkin's avatar Alejandro Nijamkin
Browse files

KeyguardBottomArea: migrates to Expandable

Uses Expandable instead of ActivityLaunchAnimator.Controller which
allows future configs to open a dialog instead of an activity.

Fix: 243408565
Test: unit tests all pass. Manually verified on device that home
controls and wallet buttons still open their activities properly.

Change-Id: I967b7fb75e34c5e2aea6bed818fd957c5f70fad6
parent e7e879de
Loading
Loading
Loading
Loading
+8 −8
Original line number Diff line number Diff line
@@ -19,7 +19,7 @@ package com.android.systemui.keyguard.domain.interactor

import android.content.Intent
import com.android.internal.widget.LockPatternUtils
import com.android.systemui.animation.ActivityLaunchAnimator
import com.android.systemui.animation.Expandable
import com.android.systemui.dagger.SysUISingleton
import com.android.systemui.keyguard.domain.model.KeyguardQuickAffordanceModel
import com.android.systemui.keyguard.domain.model.KeyguardQuickAffordancePosition
@@ -67,19 +67,19 @@ constructor(
     *
     * @param configKey The configuration key corresponding to the [KeyguardQuickAffordanceModel] of
     * the affordance that was clicked
     * @param animationController An optional controller for the activity-launch animation
     * @param expandable An optional [Expandable] for the activity- or dialog-launch animation
     */
    fun onQuickAffordanceClicked(
        configKey: KClass<out KeyguardQuickAffordanceConfig>,
        animationController: ActivityLaunchAnimator.Controller?,
        expandable: Expandable?,
    ) {
        @Suppress("UNCHECKED_CAST") val config = registry.get(configKey as KClass<Nothing>)
        when (val result = config.onQuickAffordanceClicked(animationController)) {
        when (val result = config.onQuickAffordanceClicked(expandable)) {
            is KeyguardQuickAffordanceConfig.OnClickedResult.StartActivity ->
                launchQuickAffordance(
                    intent = result.intent,
                    canShowWhileLocked = result.canShowWhileLocked,
                    animationController = animationController
                    expandable = expandable,
                )
            is KeyguardQuickAffordanceConfig.OnClickedResult.Handled -> Unit
        }
@@ -115,7 +115,7 @@ constructor(
    private fun launchQuickAffordance(
        intent: Intent,
        canShowWhileLocked: Boolean,
        animationController: ActivityLaunchAnimator.Controller?,
        expandable: Expandable?,
    ) {
        @LockPatternUtils.StrongAuthTracker.StrongAuthFlags
        val strongAuthFlags =
@@ -131,13 +131,13 @@ constructor(
            activityStarter.postStartActivityDismissingKeyguard(
                intent,
                0 /* delay */,
                animationController
                expandable?.activityLaunchController(),
            )
        } else {
            activityStarter.startActivity(
                intent,
                true /* dismissShade */,
                animationController,
                expandable?.activityLaunchController(),
                true /* showOverLockscreenWhenLocked */,
            )
        }
+2 −2
Original line number Diff line number Diff line
@@ -20,7 +20,7 @@ package com.android.systemui.keyguard.domain.quickaffordance
import android.content.Context
import android.content.Intent
import androidx.annotation.DrawableRes
import com.android.systemui.animation.ActivityLaunchAnimator
import com.android.systemui.animation.Expandable
import com.android.systemui.common.coroutine.ChannelExt.trySendWithFailureLogging
import com.android.systemui.common.coroutine.ConflatedCallbackFlow.conflatedCallbackFlow
import com.android.systemui.common.shared.model.ContentDescription
@@ -61,7 +61,7 @@ constructor(
        }

    override fun onQuickAffordanceClicked(
        animationController: ActivityLaunchAnimator.Controller?,
        expandable: Expandable?,
    ): KeyguardQuickAffordanceConfig.OnClickedResult {
        return KeyguardQuickAffordanceConfig.OnClickedResult.StartActivity(
            intent =
+2 −4
Original line number Diff line number Diff line
@@ -18,7 +18,7 @@
package com.android.systemui.keyguard.domain.quickaffordance

import android.content.Intent
import com.android.systemui.animation.ActivityLaunchAnimator
import com.android.systemui.animation.Expandable
import com.android.systemui.common.shared.model.Icon
import com.android.systemui.keyguard.shared.quickaffordance.KeyguardQuickAffordanceToggleState
import kotlinx.coroutines.flow.Flow
@@ -28,9 +28,7 @@ interface KeyguardQuickAffordanceConfig {

    val state: Flow<State>

    fun onQuickAffordanceClicked(
        animationController: ActivityLaunchAnimator.Controller?
    ): OnClickedResult
    fun onQuickAffordanceClicked(expandable: Expandable?): OnClickedResult

    /**
     * Encapsulates the state of a "quick affordance" in the keyguard bottom area (for example, a
+2 −2
Original line number Diff line number Diff line
@@ -18,7 +18,7 @@
package com.android.systemui.keyguard.domain.quickaffordance

import com.android.systemui.R
import com.android.systemui.animation.ActivityLaunchAnimator
import com.android.systemui.animation.Expandable
import com.android.systemui.common.coroutine.ChannelExt.trySendWithFailureLogging
import com.android.systemui.common.coroutine.ConflatedCallbackFlow.conflatedCallbackFlow
import com.android.systemui.common.shared.model.ContentDescription
@@ -66,7 +66,7 @@ constructor(
    }

    override fun onQuickAffordanceClicked(
        animationController: ActivityLaunchAnimator.Controller?,
        expandable: Expandable?,
    ): KeyguardQuickAffordanceConfig.OnClickedResult {
        return KeyguardQuickAffordanceConfig.OnClickedResult.StartActivity(
            intent = controller.intent,
+3 −3
Original line number Diff line number Diff line
@@ -23,7 +23,7 @@ import android.service.quickaccesswallet.GetWalletCardsResponse
import android.service.quickaccesswallet.QuickAccessWalletClient
import android.util.Log
import com.android.systemui.R
import com.android.systemui.animation.ActivityLaunchAnimator
import com.android.systemui.animation.Expandable
import com.android.systemui.common.coroutine.ChannelExt.trySendWithFailureLogging
import com.android.systemui.common.coroutine.ConflatedCallbackFlow.conflatedCallbackFlow
import com.android.systemui.common.shared.model.ContentDescription
@@ -84,11 +84,11 @@ constructor(
    }

    override fun onQuickAffordanceClicked(
        animationController: ActivityLaunchAnimator.Controller?,
        expandable: Expandable?,
    ): KeyguardQuickAffordanceConfig.OnClickedResult {
        walletController.startQuickAccessUiIntent(
            activityStarter,
            animationController,
            expandable?.activityLaunchController(),
            /* hasCard= */ true,
        )
        return KeyguardQuickAffordanceConfig.OnClickedResult.Handled
Loading