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

Commit bfeba49c authored by Treehugger Robot's avatar Treehugger Robot Committed by Android (Google) Code Review
Browse files

Merge "[power-throttling] Remove log and change variable name" into main

parents b2a71bb3 be2f18c0
Loading
Loading
Loading
Loading
+7 −7
Original line number Diff line number Diff line
@@ -150,7 +150,7 @@ import javax.xml.datatype.DatatypeConfigurationException;
 *      <screenBrightnessDefault>0.65</screenBrightnessDefault>
 *      <powerThrottlingConfig>
 *        <brightnessLowestCapAllowed>0.1</brightnessLowestCapAllowed>
 *        <customAnimationRateSec>0.004</customAnimationRateSec>
 *        <customAnimationRate>0.004</customAnimationRate>
 *        <pollingWindowMaxMillis>30000</pollingWindowMaxMillis>
 *        <pollingWindowMinMillis>10000</pollingWindowMinMillis>
 *          <powerThrottlingMap>
@@ -2193,11 +2193,11 @@ public class DisplayDeviceConfig {
            return;
        }
        float lowestBrightnessCap = powerThrottlingCfg.getBrightnessLowestCapAllowed().floatValue();
        float customAnimationRateSec = powerThrottlingCfg.getCustomAnimationRateSec().floatValue();
        float customAnimationRate = powerThrottlingCfg.getCustomAnimationRate().floatValue();
        int pollingWindowMaxMillis = powerThrottlingCfg.getPollingWindowMaxMillis().intValue();
        int pollingWindowMinMillis = powerThrottlingCfg.getPollingWindowMinMillis().intValue();
        mPowerThrottlingConfigData = new PowerThrottlingConfigData(lowestBrightnessCap,
                                                                   customAnimationRateSec,
                                                                   customAnimationRate,
                                                                   pollingWindowMaxMillis,
                                                                   pollingWindowMinMillis);
    }
@@ -3012,16 +3012,16 @@ public class DisplayDeviceConfig {
        /** Lowest brightness cap allowed for this device. */
        public final float brightnessLowestCapAllowed;
        /** Time take to animate brightness in seconds. */
        public final float customAnimationRateSec;
        public final float customAnimationRate;
        /** Time window for maximum polling power in milliseconds. */
        public final int pollingWindowMaxMillis;
        /** Time window for minimum polling power in milliseconds. */
        public final int pollingWindowMinMillis;
        public PowerThrottlingConfigData(float brightnessLowestCapAllowed,
                float customAnimationRateSec, int pollingWindowMaxMillis,
                float customAnimationRate, int pollingWindowMaxMillis,
                int pollingWindowMinMillis) {
            this.brightnessLowestCapAllowed = brightnessLowestCapAllowed;
            this.customAnimationRateSec = customAnimationRateSec;
            this.customAnimationRate = customAnimationRate;
            this.pollingWindowMaxMillis = pollingWindowMaxMillis;
            this.pollingWindowMinMillis = pollingWindowMinMillis;
        }
@@ -3031,7 +3031,7 @@ public class DisplayDeviceConfig {
            return "PowerThrottlingConfigData{"
                    + "brightnessLowestCapAllowed: "
                    + brightnessLowestCapAllowed
                    + ", customAnimationRateSec: " + customAnimationRateSec
                    + ", customAnimationRate: " + customAnimationRate
                    + ", pollingWindowMaxMillis: " + pollingWindowMaxMillis
                    + ", pollingWindowMinMillis: " + pollingWindowMinMillis
                    + "} ";
+8 −12
Original line number Diff line number Diff line
@@ -85,7 +85,7 @@ class BrightnessPowerClamper extends
    private String mDataId = null;
    private float mCurrentBrightness = PowerManager.BRIGHTNESS_INVALID;
    private float mCustomAnimationRateSec = DisplayBrightnessState.CUSTOM_ANIMATION_RATE_NOT_SET;
    private float mCustomAnimationRateSecDeviceConfig =
    private float mCustomAnimationRateDeviceConfig =
                        DisplayBrightnessState.CUSTOM_ANIMATION_RATE_NOT_SET;
    private final BiFunction<String, String, ThrottlingLevel> mDataPointMapper = (key, value) -> {
        try {
@@ -117,7 +117,7 @@ class BrightnessPowerClamper extends
        };
        mPowerThrottlingConfigData = powerData.getPowerThrottlingConfigData();
        if (mPowerThrottlingConfigData != null) {
            mCustomAnimationRateSecDeviceConfig = mPowerThrottlingConfigData.customAnimationRateSec;
            mCustomAnimationRateDeviceConfig = mPowerThrottlingConfigData.customAnimationRate;
        }
        mThermalLevelListener = new ThermalLevelListener(handler);
        mPmicMonitor =
@@ -228,10 +228,6 @@ class BrightnessPowerClamper extends
        }

        mPowerThrottlingConfigData = data.getPowerThrottlingConfigData();
        if (mPowerThrottlingConfigData == null) {
            Slog.d(TAG,
                    "Power throttling data is missing for configuration data.");
        }
    }

    private void recalculateBrightnessCap() {
@@ -282,13 +278,13 @@ class BrightnessPowerClamper extends
            mIsActive = isActive;
            Slog.i(TAG, "Power clamper changing current brightness cap mBrightnessCap: "
                    + mBrightnessCap + " to target brightness cap:" + targetBrightnessCap
                    + " for current screen brightness: " + mCurrentBrightness);
            mBrightnessCap = targetBrightnessCap;
            Slog.i(TAG, "Power clamper changed state: thermalStatus:" + mCurrentThermalLevel
                    + " for current screen brightness: " + mCurrentBrightness + "\n"
                    + "Power clamper changed state: thermalStatus:" + mCurrentThermalLevel
                    + " mCurrentThermalLevelChanged:" + mCurrentThermalLevelChanged
                    + " mCurrentAvgPowerConsumed:" + mCurrentAvgPowerConsumed
                    + " mCustomAnimationRateSec:" + mCustomAnimationRateSecDeviceConfig);
            mCustomAnimationRateSec = mCustomAnimationRateSecDeviceConfig;
                    + " mCustomAnimationRateSec:" + mCustomAnimationRateDeviceConfig);
            mBrightnessCap = targetBrightnessCap;
            mCustomAnimationRateSec = mCustomAnimationRateDeviceConfig;
            mChangeListener.onChanged();
        } else {
            mCustomAnimationRateSec = DisplayBrightnessState.CUSTOM_ANIMATION_RATE_NOT_SET;
@@ -344,7 +340,7 @@ class BrightnessPowerClamper extends
                    + mPowerThrottlingConfigData.pollingWindowMinMillis + " msec.");
            return;
        }
        mCustomAnimationRateSecDeviceConfig = mPowerThrottlingConfigData.customAnimationRateSec;
        mCustomAnimationRateDeviceConfig = mPowerThrottlingConfigData.customAnimationRate;
        mThermalLevelListener.start();
    }

+1 −1
Original line number Diff line number Diff line
@@ -464,7 +464,7 @@
            <xs:annotation name="nonnull"/>
            <xs:annotation name="final"/>
        </xs:element>
        <xs:element name="customAnimationRateSec" type="nonNegativeDecimal" minOccurs="0" maxOccurs="1">
        <xs:element name="customAnimationRate" type="nonNegativeDecimal" minOccurs="0" maxOccurs="1">
            <xs:annotation name="nonnull"/>
            <xs:annotation name="final"/>
        </xs:element>
+2 −2
Original line number Diff line number Diff line
@@ -345,12 +345,12 @@ package com.android.server.display.config {
  public class PowerThrottlingConfig {
    ctor public PowerThrottlingConfig();
    method @NonNull public final java.math.BigDecimal getBrightnessLowestCapAllowed();
    method @NonNull public final java.math.BigDecimal getCustomAnimationRateSec();
    method @NonNull public final java.math.BigDecimal getCustomAnimationRate();
    method @NonNull public final java.math.BigInteger getPollingWindowMaxMillis();
    method @NonNull public final java.math.BigInteger getPollingWindowMinMillis();
    method public final java.util.List<com.android.server.display.config.PowerThrottlingMap> getPowerThrottlingMap();
    method public final void setBrightnessLowestCapAllowed(@NonNull java.math.BigDecimal);
    method public final void setCustomAnimationRateSec(@NonNull java.math.BigDecimal);
    method public final void setCustomAnimationRate(@NonNull java.math.BigDecimal);
    method public final void setPollingWindowMaxMillis(@NonNull java.math.BigInteger);
    method public final void setPollingWindowMinMillis(@NonNull java.math.BigInteger);
  }
+2 −2
Original line number Diff line number Diff line
@@ -265,7 +265,7 @@ public final class DisplayDeviceConfigTest {
                mDisplayDeviceConfig.getPowerThrottlingConfigData();
        assertNotNull(powerThrottlingConfigData);
        assertEquals(0.1f, powerThrottlingConfigData.brightnessLowestCapAllowed, SMALL_DELTA);
        assertEquals(15f, powerThrottlingConfigData.customAnimationRateSec, SMALL_DELTA);
        assertEquals(15f, powerThrottlingConfigData.customAnimationRate, SMALL_DELTA);
        assertEquals(20000, powerThrottlingConfigData.pollingWindowMaxMillis);
        assertEquals(10000, powerThrottlingConfigData.pollingWindowMinMillis);
    }
@@ -1299,7 +1299,7 @@ public final class DisplayDeviceConfigTest {
    private String getPowerThrottlingConfig() {
        return  "<powerThrottlingConfig >\n"
                +       "<brightnessLowestCapAllowed>0.1</brightnessLowestCapAllowed>\n"
                +       "<customAnimationRateSec>15</customAnimationRateSec>\n"
                +       "<customAnimationRate>15</customAnimationRate>\n"
                +       "<pollingWindowMaxMillis>20000</pollingWindowMaxMillis>\n"
                +       "<pollingWindowMinMillis>10000</pollingWindowMinMillis>\n"
                +       "<powerThrottlingMap>\n"