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

Commit d119cca9 authored by Priyanka Advani (xWF)'s avatar Priyanka Advani (xWF)
Browse files

Revert "cleanup: Rename and clarify some status bar icon tint me..."

Revert submission 34529017

Reason for revert: Droidmonitor created revert due to b/432771990. Will be verifying through ABTD before submission.

Fix: 432771990

Reverted changes: /q/submissionid:34529017

Change-Id: Ib84da6e817647bd4a03cafc9e522b0d3c9e0edb0
parent 43ff1795
Loading
Loading
Loading
Loading
+0 −6
Original line number Diff line number Diff line
@@ -55,13 +55,7 @@ public interface SysuiDarkIconDispatcher extends DarkIconDispatcher, Dumpable {
            this.tint = tint;
        }

        /**
         * Regions where icons should be dark. Icons outside of these regions should be light.
         * Note: This is empty if all icons should be the same color, regardless of light or dark.
         * This is only non-empty when some icons should be light and others dark.
         */
        public final Collection<Rect> areas;
        /** 0.0f = white icons, 1.0f = black icons */
        public final float darkIntensity;
        public final int tint;
    }
+7 −15
Original line number Diff line number Diff line
@@ -36,7 +36,7 @@ class DarkIconInteractor @Inject constructor(private val repository: DarkIconRep

    /**
     * Given a display id: returns a flow of [IsAreaDark], a function that can tell you if a given
     * [Rect] should be tinted dark theme or not. This flow ignores [DarkChange.tint] and
     * [Rect] should be tinted dark or not. This flow ignores [DarkChange.tint] and
     * [DarkChange.darkIntensity]
     */
    fun isAreaDark(displayId: Int): Flow<IsAreaDark> {
@@ -51,18 +51,13 @@ class DarkIconInteractor @Inject constructor(private val repository: DarkIconRep
        @JvmStatic
        fun Flow<DarkChange>.toIsAreaDark(): Flow<IsAreaDark> =
            map { darkChange ->
                    // Note: DarkChange.darkIntensity is 0.0f when icons should be white (for dark
                    // theme) and 1.0f when icons should be black (for light theme).
                    DarkStateWithoutIntensity(
                        darkChange.areas,
                        isDarkTheme = darkChange.darkIntensity < 0.5f,
                    )
                    DarkStateWithoutIntensity(darkChange.areas, darkChange.darkIntensity < 0.5f)
                }
                .distinctUntilChanged()
                .map { darkState ->
                    IsAreaDark { viewBounds: Rect ->
                        if (DarkIconDispatcher.isInAreas(darkState.darkIconAreas, viewBounds)) {
                            darkState.isDarkTheme
                        if (DarkIconDispatcher.isInAreas(darkState.areas, viewBounds)) {
                            darkState.isDark
                        } else {
                            false
                        }
@@ -74,12 +69,9 @@ class DarkIconInteractor @Inject constructor(private val repository: DarkIconRep
}

/** So we can map between [DarkState] and a single boolean, but based on intensity */
private data class DarkStateWithoutIntensity(
    val darkIconAreas: Collection<Rect>,
    val isDarkTheme: Boolean,
)
private data class DarkStateWithoutIntensity(val areas: Collection<Rect>, val isDark: Boolean)

/** Given a region on screen, determine if content in this region should use dark or light theme */
/** Given a region on screen, determine if the foreground should be dark or light */
fun interface IsAreaDark {
    fun isDarkTheme(viewBounds: Rect): Boolean
    fun isDark(viewBounds: Rect): Boolean
}
+2 −2
Original line number Diff line number Diff line
@@ -83,7 +83,7 @@ fun BatteryWithChargeStatus(
        val path = viewModel.batteryFrame

        val colorProvider = {
            if (isDarkProvider().isDarkTheme(bounds)) {
            if (isDarkProvider().isDark(bounds)) {
                viewModel.colorProfile.dark
            } else {
                viewModel.colorProfile.light
@@ -105,7 +105,7 @@ fun BatteryWithChargeStatus(
        if (shouldShowPercent(showPercentMode, viewModel)) {
            // The text can just use the Default.fill color, since we don't want to colorize it
            val colorProducer = {
                if (isDarkProvider().isDarkTheme(bounds)) {
                if (isDarkProvider().isDark(bounds)) {
                    BatteryColors.DarkTheme.Default.fill
                } else {
                    BatteryColors.LightTheme.Default.fill
+1 −1
Original line number Diff line number Diff line
@@ -170,7 +170,7 @@ fun UnifiedBattery(
    var bounds by remember { mutableStateOf(Rect()) }

    val colorProvider = {
        if (isDarkProvider().isDarkTheme(bounds)) {
        if (isDarkProvider().isDark(bounds)) {
            viewModel.colorProfile.dark
        } else {
            viewModel.colorProfile.light