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

Commit 8c5d5f35 authored by Rohit Sekhar's avatar Rohit Sekhar
Browse files

Revert "UdfpsHelper: Avoid hardcoding 4095 for maximum panel brightness"

This reverts commit 1da07de1.
parent fd1d60c4
Loading
Loading
Loading
Loading
+4 −9
Original line number Diff line number Diff line
@@ -21,16 +21,11 @@
    <!-- Whether to enable framework dimming for UDFPS -->
    <bool name="config_udfpsFrameworkDimming">false</bool>

    <!-- Brightness-to-alpha lookup table (LUT) for UDFPS framework dimming.
         Each entry is in the format <brightness>,<alpha> where:
           - brightness = panel backlight level
           - alpha = dim layer transparency applied at that brightness
         Rules:
           • The entries should be strictly ascending by brightness.
           • First entry = <minBrightness,maxAlpha>.
           • Last entry  = <maxBrightness,minAlpha>.
    -->
    <!-- Array of brightness-alpha LUT for framework dimming -->
    <string-array name="config_udfpsDimmingBrightnessAlphaArray" translatable="false">
          <item>0,255</item>
          <item>1,248</item>
          <item>2,242</item>
          <item>3,238</item>
          <item>4,236</item>
          <item>6,236</item>
+1 −2
Original line number Diff line number Diff line
@@ -70,7 +70,6 @@ class UdfpsHelper(
            val (brightness, alpha) = it.split(",").map { value -> value.trim().toInt() }
            brightness to alpha
        }
    val maxPanelBrightness: Int = brightnessAlphaMap.keys.max()

    private val dimLayoutParams = WindowManager.LayoutParams(
        WindowManager.LayoutParams.TYPE_NAVIGATION_BAR_PANEL,
@@ -149,7 +148,7 @@ class UdfpsHelper(
    // brightness_alpha_lut array from the kernel. This provides a comparable array.
    private fun brightnessToAlpha() {
        val adjustedBrightness =
            (currentBrightness.coerceIn(minBrightness, maxBrightness) * maxPanelBrightness).toInt()
            (currentBrightness.coerceIn(minBrightness, maxBrightness) * 4095).toInt()

        val targetAlpha = brightnessAlphaMap[adjustedBrightness]?.div(255.0f)
            ?: interpolateAlpha(adjustedBrightness)