<?xml version='1.0' encoding='utf-8' standalone='yes' ?>

<!-- Copyright (C) 2023 Google Inc.

    Licensed under the Apache License, Version 2.0 (the "License");
    you may not use this file except in compliance with the License.
    You may obtain a copy of the License at

      http://www.apache.org/licenses/LICENSE-2.0

    Unless required by applicable law or agreed to in writing, software
    distributed under the License is distributed on an "AS IS" BASIS,
    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    See the License for the specific language governing permissions and
    limitations under the License.
-->

<displayConfiguration>
    <screenBrightnessMap>
        <point>
            <value>0.0</value>
            <nits>2.0</nits>
        </point>
        <point>
            <value>0.67</value>
            <nits>1200.0</nits>
        </point>
        <point>
            <value>1.0</value>
            <nits>1800.0</nits>
        </point>
    </screenBrightnessMap>

    <!-- 140 nits: (140-2)/(1200-2)*(0.67-0.0)+0.0 = 0.077178631 -->
    <screenBrightnessDefault>0.077178631</screenBrightnessDefault>

    <highBrightnessMode enabled="true">
        <transitionPoint>0.67</transitionPoint>
        <minimumLux>10000</minimumLux>
        <timing>
            <!-- allow for 5 minutes out of every 20 minutes -->
            <timeWindowSecs>1200</timeWindowSecs>
            <timeMaxSecs>300</timeMaxSecs>
            <timeMinSecs>60</timeMinSecs>
        </timing>
        <allowInLowPowerMode>false</allowInLowPowerMode>
        <minimumHdrPercentOfScreen>0</minimumHdrPercentOfScreen>
        <sdrHdrRatioMap>
            <point>
                <sdrNits>2.000</sdrNits>
                <hdrRatio>4.000</hdrRatio>
            </point>
            <point>
                <sdrNits>5.000</sdrNits>
                <hdrRatio>8.000</hdrRatio>
            </point>
            <point>
                <sdrNits>500.000</sdrNits>
                <hdrRatio>8.000</hdrRatio>
            </point>
        </sdrHdrRatioMap>
    </highBrightnessMode>

    <densityMapping>
        <density>
            <height>1080</height>
            <width>2424</width>
            <density>420</density>
        </density>
    </densityMapping>

    <tempSensor>
        <type>DISPLAY</type>
        <name>VIRTUAL-SKIN-DISPLAY</name>
    </tempSensor>

    <screenBrightnessRampIncreaseMaxMillis>2000</screenBrightnessRampIncreaseMaxMillis>

    <ambientBrightnessChangeThresholds>
        <brighteningThresholds>
            <minimum>10</minimum>
        </brighteningThresholds>
        <darkeningThresholds>
            <minimum>0</minimum>
        </darkeningThresholds>
    </ambientBrightnessChangeThresholds>

    <ambientLightHorizonLong>5000</ambientLightHorizonLong>
    <ambientLightHorizonShort>50</ambientLightHorizonShort>

    <thermalThrottling>
        <brightnessThrottlingMap>
            <brightnessThrottlingPoint>
                <thermalStatus>light</thermalStatus>
                <!-- Throttling to 518 nits: (518-2)/(1200-2)*(0.67-0.0)+0.0 = 0.288580968 -->
                <brightness>0.288580968</brightness>
            </brightnessThrottlingPoint>
            <brightnessThrottlingPoint>
                <thermalStatus>moderate</thermalStatus>
                <!-- Throttling to 353 nits: (353-2)/(1200-2)*(0.67-0.0)+0.0 = 0.19630217 -->
                <brightness>0.19630217</brightness>
            </brightnessThrottlingPoint>
            <brightnessThrottlingPoint>
                <thermalStatus>severe</thermalStatus>
                <!-- Throttling to 271 nits: (271-2)/(1200-2)*(0.67-0.0)+0.0 = 0.150442404 -->
                <brightness>0.150442404</brightness>
            </brightnessThrottlingPoint>
            <brightnessThrottlingPoint>
                <thermalStatus>critical</thermalStatus>
                <!-- Throttling to 210 nits: (210-2)/(1200-2)*(0.67-0.0)+0.0 = 0.116327212 -->
                <brightness>0.116327212</brightness>
            </brightnessThrottlingPoint>
        </brightnessThrottlingMap>
    </thermalThrottling>

    <screenBrightnessRampFastDecrease>0.7047244</screenBrightnessRampFastDecrease>
    <screenBrightnessRampFastIncrease>0.7047244</screenBrightnessRampFastIncrease>
    <screenBrightnessRampSlowDecrease>0.05</screenBrightnessRampSlowDecrease>
    <screenBrightnessRampSlowIncrease>0.05</screenBrightnessRampSlowIncrease>
    <luxThrottling>
        <brightnessLimitMap>
            <type>adaptive</type>
            <map>
                <point>
                    <first>1000</first>
                    <!-- 600 nits (600-2)/(1200-2)*(0.67-0.0)+0.0 = 0.334440735  -->
                    <second>0.334440735</second>
                </point>
                <point>
                    <first>6000</first>
                    <!-- 850 nits (850-2)/(1200-2)*(0.67-0.0)+0.0 = 0.474257095 -->
                    <second>0.474257095</second>
                </point>
                <point>
                    <first>10000</first>
                    <!-- 1000 nits (1000-2)/(1200-2)*(0.67-0.0)+0.0 = 0.558146912 -->
                    <second>0.558146912</second>
                </point>
            </map>
        </brightnessLimitMap>
    </luxThrottling>

    <screenOffBrightnessSensor>
        <type>com.google.sensor.binned_brightness</type>
    </screenOffBrightnessSensor>
    <screenOffBrightnessSensorValueToLux>
        <item>-1</item> <!-- 0: OFF -->
        <item>0</item>  <!-- 1: NIGHT -->
        <item>5</item>  <!-- 2: LOW -->
        <item>80</item> <!-- 3: HIGH -->
        <item>1500</item> <!-- 4: SUN -->
    </screenOffBrightnessSensorValueToLux>

    <idleScreenRefreshRateTimeout>
        <luxThresholds>
            <point>
                <lux>0</lux>
                <timeout>1500</timeout>
            </point>
            <point>
                <lux>50</lux>
                <timeout>1000</timeout>
            </point>
            <point>
                <lux>3001</lux>
                <timeout>500</timeout>
            </point>
        </luxThresholds>
    </idleScreenRefreshRateTimeout>

    <refreshRate>
        <lowerBlockingZoneConfigs>
            <defaultRefreshRate>120</defaultRefreshRate>
            <blockingZoneThreshold>
                <displayBrightnessPoint>
                    <lux>-1</lux>
                    <nits>10</nits>
                </displayBrightnessPoint>
            </blockingZoneThreshold>
       </lowerBlockingZoneConfigs>
    </refreshRate>
    <proxSensor featureFlag="com.android.server.display.feature.flags.use_fusion_prox_sensor">
        <type>com.google.sensor.prox_voice_call</type>
        <name>Proximity(Voice Calls) Sensor (wake-up)</name>
    </proxSensor>
</displayConfiguration>
