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

Commit 5f093373 authored by Brad Hinegardner's avatar Brad Hinegardner Committed by Android (Google) Code Review
Browse files

Merge "Remove and cleanup flag for Custom lockscreen shortcuts" into udc-qpr-dev

parents a022cfec aacbc652
Loading
Loading
Loading
Loading
+0 −1
Original line number Diff line number Diff line
@@ -272,7 +272,6 @@ filegroup {
        "tests/src/com/android/systemui/dock/DockManagerFake.java",
        "tests/src/com/android/systemui/dump/LogBufferHelper.kt",
        "tests/src/com/android/systemui/statusbar/phone/FakeKeyguardStateController.java",
        "tests/src/com/android/systemui/keyguard/domain/quickaffordance/FakeKeyguardQuickAffordanceRegistry.kt",

        /* Biometric converted tests */
        "tests/src/com/android/systemui/biometrics/BiometricTestExtensions.kt",
+0 −10
Original line number Diff line number Diff line
@@ -168,16 +168,6 @@ object Flags {
    // TODO(b/255607168): Tracking Bug
    @JvmField val DOZING_MIGRATION_1 = unreleasedFlag(213, "dozing_migration_1")

    /**
     * Whether to enable the code powering customizable lock screen quick affordances.
     *
     * This flag enables any new prebuilt quick affordances as well.
     */
    // TODO(b/255618149): Tracking Bug
    @JvmField
    val CUSTOMIZABLE_LOCK_SCREEN_QUICK_AFFORDANCES =
        releasedFlag(216, "customizable_lock_screen_quick_affordances")

    /**
     * Migrates control of the LightRevealScrim's reveal effect and amount from legacy code to the
     * new KeyguardTransitionRepository.
+0 −2
Original line number Diff line number Diff line
@@ -50,7 +50,6 @@ import com.android.systemui.keyguard.data.quickaffordance.KeyguardDataQuickAffor
import com.android.systemui.keyguard.data.repository.KeyguardFaceAuthModule;
import com.android.systemui.keyguard.data.repository.KeyguardRepositoryModule;
import com.android.systemui.keyguard.domain.interactor.StartKeyguardTransitionModule;
import com.android.systemui.keyguard.domain.quickaffordance.KeyguardQuickAffordanceModule;
import com.android.systemui.keyguard.shared.quickaffordance.KeyguardQuickAffordancesMetricsLogger;
import com.android.systemui.keyguard.shared.quickaffordance.KeyguardQuickAffordancesMetricsLoggerImpl;
import com.android.systemui.keyguard.ui.viewmodel.DreamingToLockscreenTransitionViewModel;
@@ -91,7 +90,6 @@ import kotlinx.coroutines.CoroutineDispatcher;
        includes = {
            FalsingModule.class,
            KeyguardDataQuickAffordanceModule.class,
            KeyguardQuickAffordanceModule.class,
            KeyguardRepositoryModule.class,
            KeyguardFaceAuthModule.class,
            StartKeyguardTransitionModule.class,
+0 −5
Original line number Diff line number Diff line
@@ -24,8 +24,6 @@ import com.android.systemui.CoreStartable
import com.android.systemui.dagger.SysUISingleton
import com.android.systemui.dagger.qualifiers.Application
import com.android.systemui.dagger.qualifiers.Background
import com.android.systemui.flags.FeatureFlags
import com.android.systemui.flags.Flags
import com.android.systemui.keyguard.data.repository.KeyguardQuickAffordanceRepository
import com.android.systemui.settings.UserFileManager
import com.android.systemui.settings.UserTracker
@@ -42,7 +40,6 @@ import javax.inject.Inject
 */
@SysUISingleton
class MuteQuickAffordanceCoreStartable @Inject constructor(
    private val featureFlags: FeatureFlags,
    private val userTracker: UserTracker,
    private val ringerModeTracker: RingerModeTracker,
    private val userFileManager: UserFileManager,
@@ -54,8 +51,6 @@ class MuteQuickAffordanceCoreStartable @Inject constructor(
    private val observer = Observer(this::updateLastNonSilentRingerMode)

    override fun start() {
        if (!featureFlags.isEnabled(Flags.CUSTOMIZABLE_LOCK_SCREEN_QUICK_AFFORDANCES)) return

        // only listen to ringerModeInternal changes when Mute is one of the selected affordances
        keyguardQuickAffordanceRepository
            .selections
+10 −39
Original line number Diff line number Diff line
@@ -38,7 +38,6 @@ import com.android.systemui.keyguard.data.quickaffordance.KeyguardQuickAffordanc
import com.android.systemui.keyguard.data.repository.BiometricSettingsRepository
import com.android.systemui.keyguard.data.repository.KeyguardQuickAffordanceRepository
import com.android.systemui.keyguard.domain.model.KeyguardQuickAffordanceModel
import com.android.systemui.keyguard.domain.quickaffordance.KeyguardQuickAffordanceRegistry
import com.android.systemui.keyguard.shared.model.KeyguardPickerFlag
import com.android.systemui.keyguard.shared.model.KeyguardQuickAffordancePickerRepresentation
import com.android.systemui.keyguard.shared.model.KeyguardSlotPickerRepresentation
@@ -68,7 +67,6 @@ class KeyguardQuickAffordanceInteractor
@Inject
constructor(
    private val keyguardInteractor: KeyguardInteractor,
    private val registry: KeyguardQuickAffordanceRegistry<out KeyguardQuickAffordanceConfig>,
    private val lockPatternUtils: LockPatternUtils,
    private val keyguardStateController: KeyguardStateController,
    private val userTracker: UserTracker,
@@ -83,20 +81,13 @@ constructor(
    @Background private val backgroundDispatcher: CoroutineDispatcher,
    @Application private val appContext: Context,
) {
    private val isUsingRepository: Boolean
        get() = featureFlags.isEnabled(Flags.CUSTOMIZABLE_LOCK_SCREEN_QUICK_AFFORDANCES)

    /**
     * Whether the UI should use the long press gesture to activate quick affordances.
     *
     * If `false`, the UI goes back to using single taps.
     */
    fun useLongPress(): Flow<Boolean> =
        if (featureFlags.isEnabled(Flags.CUSTOMIZABLE_LOCK_SCREEN_QUICK_AFFORDANCES)) {
            dockManager.retrieveIsDocked().map { !it }
        } else {
            flowOf(false)
        }
    fun useLongPress(): Flow<Boolean> = dockManager.retrieveIsDocked().map { !it }

    /** Returns an observable for the quick affordance at the given position. */
    suspend fun quickAffordance(
@@ -147,14 +138,9 @@ constructor(
        expandable: Expandable?,
        slotId: String,
    ) {
        @Suppress("UNCHECKED_CAST")
        val (decodedSlotId, decodedConfigKey) = configKey.decode()
        val config =
            if (isUsingRepository) {
                val (slotId, decodedConfigKey) = configKey.decode()
                repository.get().selections.value[slotId]?.find { it.key == decodedConfigKey }
            } else {
                registry.get(configKey)
            }
            repository.get().selections.value[decodedSlotId]?.find { it.key == decodedConfigKey }
        if (config == null) {
            Log.e(TAG, "Affordance config with key of \"$configKey\" not found!")
            return
@@ -183,7 +169,6 @@ constructor(
     * @return `true` if the affordance was selected successfully; `false` otherwise.
     */
    suspend fun select(slotId: String, affordanceId: String): Boolean {
        check(isUsingRepository)
        if (isFeatureDisabledByDevicePolicy()) {
            return false
        }
@@ -226,7 +211,6 @@ constructor(
     *   the affordance was not on the slot to begin with).
     */
    suspend fun unselect(slotId: String, affordanceId: String?): Boolean {
        check(isUsingRepository)
        if (isFeatureDisabledByDevicePolicy()) {
            return false
        }
@@ -286,17 +270,12 @@ constructor(

    private fun quickAffordanceInternal(
        position: KeyguardQuickAffordancePosition
    ): Flow<KeyguardQuickAffordanceModel> {
        return if (isUsingRepository) {
    ): Flow<KeyguardQuickAffordanceModel> =
        repository
            .get()
            .selections
            .map { it[position.toSlotId()] ?: emptyList() }
            .flatMapLatest { configs -> combinedConfigs(position, configs) }
        } else {
            combinedConfigs(position, registry.getAll(position))
        }
    }

    private fun combinedConfigs(
        position: KeyguardQuickAffordancePosition,
@@ -326,12 +305,7 @@ constructor(
                    states[index] as KeyguardQuickAffordanceConfig.LockScreenState.Visible
                val configKey = configs[index].key
                KeyguardQuickAffordanceModel.Visible(
                    configKey =
                        if (isUsingRepository) {
                            configKey.encode(position.toSlotId())
                        } else {
                            configKey
                        },
                    configKey = configKey.encode(position.toSlotId()),
                    icon = visibleState.icon,
                    activationState = visibleState.activationState,
                )
@@ -397,8 +371,6 @@ constructor(
    }

    suspend fun getSlotPickerRepresentations(): List<KeyguardSlotPickerRepresentation> {
        check(isUsingRepository)

        if (isFeatureDisabledByDevicePolicy()) {
            return emptyList()
        }
@@ -416,7 +388,6 @@ constructor(
                name = Contract.FlagsTable.FLAG_NAME_CUSTOM_LOCK_SCREEN_QUICK_AFFORDANCES_ENABLED,
                value =
                    !isFeatureDisabledByDevicePolicy() &&
                        featureFlags.isEnabled(Flags.CUSTOMIZABLE_LOCK_SCREEN_QUICK_AFFORDANCES) &&
                        appContext.resources.getBoolean(R.bool.custom_lockscreen_shortcuts_enabled),
            ),
            KeyguardPickerFlag(
Loading