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

Commit 05cbaf95 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "ThermalHAL: add BCL to temperature type"

parents 4c1e30ce c4c2559e
Loading
Loading
Loading
Loading
+6 −2
Original line number Diff line number Diff line
@@ -42,7 +42,7 @@ interface IThermal extends @1.0::IThermal {
        generates (ThermalStatus status, vec<Temperature> temperatures);

    /**
     * Retrieves temperature thresholds in Celsius.
     * Retrieves static temperature thresholds in Celsius.
     *
     * @param filterType whether to filter the result for a given type.
     * @param type the TemperatureType such as battery or skin.
@@ -54,7 +54,11 @@ interface IThermal extends @1.0::IThermal {
     *    devices (such as CPUs, GPUs and etc.) in the list must be kept
     *    the same regardless of the number of calls to this method even if
     *    they go offline, if these devices exist on boot. The method
     *    always returns and never removes such temperatures.
     *    always returns and never removes such temperatures. The thresholds
     *    are returned as static values and must not change across calls. The actual
     *    throttling state is determined in driver and HAL and must not be simply
     *    compared with these thresholds. To get accurate throttling status, use
     *    getCurrentTemperatures or registerThermalChangedCallback and listen.
     */
    getTemperatureThresholds(bool filterType, TemperatureType type)
        generates (ThermalStatus status, vec<TemperatureThreshold> temperatureThresholds);
+1 −0
Original line number Diff line number Diff line
@@ -2,6 +2,7 @@
    <hal format="hidl">
        <name>android.hardware.thermal</name>
        <transport>hwbinder</transport>
        <version>1.0</version>
        <version>2.0</version>
        <interface>
            <name>IThermal</name>
+14 −3
Original line number Diff line number Diff line
@@ -22,6 +22,12 @@ import android.hardware.thermal@1.0::types;
enum TemperatureType : @1.0::TemperatureType {
    USB_PORT = 4,
    POWER_AMPLIFIER = 5,
    /**
     * Battery Charge Limit - virtual thermal sensors
     */
    BCL_VOLTAGE = 6,
    BCL_CURRENT = 7,
    BCL_PERCENTAGE = 8,
};


@@ -88,6 +94,7 @@ struct TemperatureThreshold {
     * Hot throttling temperature constant for this temperature sensor in
     * level defined in ThrottlingSeverity including shutdown. Throttling
     * happens when temperature >= threshold. If not available, set to NAN.
     * Unit is same as Temperature's value.
     */
    float[ThrottlingSeverityCount:NUM_THROTTLING_LEVELS] hotThrottlingThresholds;

@@ -95,13 +102,14 @@ struct TemperatureThreshold {
     * Cold throttling temperature constant for this temperature sensor in
     * level defined in ThrottlingSeverity including shutdown. Throttling
     * happens when temperature <= threshold. If not available, set to NAN.
     * Unit is same as Temperature's value.
     */
    float[ThrottlingSeverityCount:NUM_THROTTLING_LEVELS] coldThrottlingThresholds;

    /**
     * Threshold temperature above which the VR mode clockrate minimums cannot
     * be maintained for this device.
     * If not available, set by HAL to NAN.
     * be maintained for this device. If not available, set by HAL to NAN.
     * Unit is same as Temperature's value.
     */
    float vrThrottlingThreshold;
};
@@ -121,7 +129,10 @@ struct Temperature {
    string name;

    /**
     * Current temperature in Celsius. If not available set by HAL to NAN.
     * For BCL, this is the current reading of the virtual sensor and the unit is
     * millivolt, milliamp, percentage for BCL_VOLTAGE, BCL_CURRENT and BCL_PERCENTAGE
     * respectively. For everything else, this is the current temperature in Celsius.
     * If not available set by HAL to NAN.
     */
    float value;

+3 −3
Original line number Diff line number Diff line
@@ -23,6 +23,7 @@
#include <VtsHalHidlTargetTestEnvBase.h>

using ::android::sp;
using ::android::hardware::hidl_enum_range;
using ::android::hardware::hidl_vec;
using ::android::hardware::Return;
using ::android::hardware::Void;
@@ -183,9 +184,8 @@ TEST_F(ThermalHidlTest, TemperatureTest) {
                                             EXPECT_NE(ThermalStatusCode::SUCCESS, status.code);
                                         }
                                     });
    for (int i = static_cast<int>(TemperatureType::UNKNOWN);
         i <= static_cast<int>(TemperatureType::POWER_AMPLIFIER); ++i) {
        auto type = static_cast<TemperatureType>(i);
    auto types = hidl_enum_range<TemperatureType>();
    for (const auto& type : types) {
        mThermal->getCurrentTemperatures(
            true, type, [&type](ThermalStatus status, hidl_vec<Temperature> temperatures) {
                if (temperatures.size()) {