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

Commit 93080fd6 authored by Beverly's avatar Beverly
Browse files

Update device entry icon color

When bg protection isn't being used, use
the wallpaper text color.

When bg protection is being used, use
the primary text color.

Bug: 305234447
Flag: ACONFIG com.android.systemui.device_entry_udfps_refactor DEVELOPMENT
Test: manually see color on non-udfps device
Change-Id: I65111727f24bb1ba63e47437947d65220b720140
parent 418eb70e
Loading
Loading
Loading
Loading
+16 −5
Original line number Original line Diff line number Diff line
@@ -31,6 +31,7 @@ import kotlinx.coroutines.ExperimentalCoroutinesApi
import kotlinx.coroutines.flow.Flow
import kotlinx.coroutines.flow.Flow
import kotlinx.coroutines.flow.combine
import kotlinx.coroutines.flow.combine
import kotlinx.coroutines.flow.distinctUntilChanged
import kotlinx.coroutines.flow.distinctUntilChanged
import kotlinx.coroutines.flow.flatMapLatest
import kotlinx.coroutines.flow.map
import kotlinx.coroutines.flow.map
import kotlinx.coroutines.flow.onStart
import kotlinx.coroutines.flow.onStart


@@ -49,12 +50,22 @@ constructor(
        transitionInteractor.startedKeyguardState.map { keyguardState ->
        transitionInteractor.startedKeyguardState.map { keyguardState ->
            keyguardState == KeyguardState.AOD
            keyguardState == KeyguardState.AOD
        }
        }

    private fun getColor(usingBackgroundProtection: Boolean): Int {
        return if (usingBackgroundProtection) {
            Utils.getColorAttrDefaultColor(context, android.R.attr.textColorPrimary)
        } else {
            Utils.getColorAttrDefaultColor(context, R.attr.wallpaperTextColorAccent)
        }
    }

    private val color: Flow<Int> =
    private val color: Flow<Int> =
        deviceEntryIconViewModel.useBackgroundProtection.flatMapLatest { useBgProtection ->
            configurationRepository.onAnyConfigurationChange
            configurationRepository.onAnyConfigurationChange
            .map { Utils.getColorAttrDefaultColor(context, android.R.attr.textColorPrimary) }
                .map { getColor(useBgProtection) }
            .onStart {
                .onStart { emit(getColor(useBgProtection)) }
                emit(Utils.getColorAttrDefaultColor(context, android.R.attr.textColorPrimary))
        }
        }

    private val useAodIconVariant: Flow<Boolean> =
    private val useAodIconVariant: Flow<Boolean> =
        combine(isShowingAod, deviceEntryUdfpsInteractor.isUdfpsSupported) {
        combine(isShowingAod, deviceEntryUdfpsInteractor.isUdfpsSupported) {
                isTransitionToAod,
                isTransitionToAod,