From ea076f25034d4c78f79e6df19a154142f19da0d3 Mon Sep 17 00:00:00 2001 From: Polina Bondarenko Date: Thu, 19 Jan 2017 13:58:14 +0000 Subject: [PATCH] Revert "thermal: add getUndefinedTemperature function." This reverts commit 3c053c66c9783dddc91f2aca9ebdc8323eadf276. Change-Id: Ie1d7b80052d26575544d2039b59171fe03b3c8b9 --- thermal/1.0/IThermal.hal | 15 ----------- thermal/1.0/default/Thermal.cpp | 7 ----- thermal/1.0/default/Thermal.h | 1 - thermal/1.0/types.hal | 12 ++++++--- thermal/1.0/vts/Thermal.vts | 21 --------------- .../vts/functional/thermal_hidl_hal_test.cpp | 27 +++++++------------ 6 files changed, 17 insertions(+), 66 deletions(-) diff --git a/thermal/1.0/IThermal.hal b/thermal/1.0/IThermal.hal index 076b697541..e5f70cb58d 100644 --- a/thermal/1.0/IThermal.hal +++ b/thermal/1.0/IThermal.hal @@ -75,19 +75,4 @@ interface IThermal { getCoolingDevices() generates (ThermalStatus status, vec devices); - /* Retrieves an undefined temperature value. - * - * @return status Status of the operation. If status code is FAILURE, - * the status.debugMessage must be populated with the human-readable - * error message. - * @return undefinedTemperature returns an undefined temperature value if - * status code is SUCCESS. Undefined temperature value is an - * unreachable constant device temperature value for HAL. - * - */ - @callflow(next={"*"}) - @entry - @exit - getUndefinedTemperature() - generates (ThermalStatus status, float undefinedTemperature); }; diff --git a/thermal/1.0/default/Thermal.cpp b/thermal/1.0/default/Thermal.cpp index 5bc313d80e..8a8ad0a423 100644 --- a/thermal/1.0/default/Thermal.cpp +++ b/thermal/1.0/default/Thermal.cpp @@ -169,13 +169,6 @@ Return Thermal::getCoolingDevices(getCoolingDevices_cb _hidl_cb) { return Void(); } -Return Thermal::getUndefinedTemperature(getUndefinedTemperature_cb _hidl_cb) { - ThermalStatus status; - status.code = ThermalStatusCode::SUCCESS; - _hidl_cb(status, UNKNOWN_TEMPERATURE); - return Void(); -} - IThermal* HIDL_FETCH_IThermal(const char* /* name */) { thermal_module_t* module; status_t err = hw_get_module(THERMAL_HARDWARE_MODULE_ID, diff --git a/thermal/1.0/default/Thermal.h b/thermal/1.0/default/Thermal.h index eec0ff5016..2e062893ff 100644 --- a/thermal/1.0/default/Thermal.h +++ b/thermal/1.0/default/Thermal.h @@ -45,7 +45,6 @@ struct Thermal : public IThermal { Return getTemperatures(getTemperatures_cb _hidl_cb) override; Return getCpuUsages(getCpuUsages_cb _hidl_cb) override; Return getCoolingDevices(getCoolingDevices_cb _hidl_cb) override; - Return getUndefinedTemperature(getUndefinedTemperature_cb _hidl_cb) override; private: thermal_module_t* mModule; }; diff --git a/thermal/1.0/types.hal b/thermal/1.0/types.hal index 30cfdd97e1..8864f43328 100644 --- a/thermal/1.0/types.hal +++ b/thermal/1.0/types.hal @@ -46,27 +46,27 @@ struct Temperature { /** * Current temperature in Celsius. If not available set by HAL to - * undefined temperature value. + * UNKNOWN_TEMPERATURE. * Current temperature can be in any units if type=UNKNOWN. */ float currentValue; /** * Throttling temperature constant for this temperature. - * If not available, set by HAL to undefined temperature value. + * If not available, set by HAL to UNKNOWN_TEMPERATURE. */ float throttlingThreshold; /** * Shutdown temperature constant for this temperature. - * If not available, set by HAL to undefined temperature value. + * If not available, set by HAL to UNKNOWN_TEMPERATURE. */ float shutdownThreshold; /** * Threshold temperature above which the VR mode clockrate minimums cannot * be maintained for this device. - * If not available, set by HAL to undefined temperature value. + * If not available, set by HAL to UNKNOWN_TEMPERATURE. */ float vrThrottlingThreshold; @@ -135,3 +135,7 @@ struct ThermalStatus { */ string debugMessage; }; + +/** + * TODO(pbond): add float constant UNDEFINED_TEMPERATURE. + */ diff --git a/thermal/1.0/vts/Thermal.vts b/thermal/1.0/vts/Thermal.vts index d8cc670280..e76d943fa7 100644 --- a/thermal/1.0/vts/Thermal.vts +++ b/thermal/1.0/vts/Thermal.vts @@ -79,25 +79,4 @@ interface: { } } - api: { - name: "getUndefinedTemperature" - return_type_hidl: { - type: TYPE_STRUCT - predefined_type: "::android::hardware::thermal::V1_0::ThermalStatus" - } - return_type_hidl: { - type: TYPE_SCALAR - scalar_type: "float_t" - } - callflow: { - next: "*" - } - callflow: { - entry: true - } - callflow: { - exit: true - } - } - } diff --git a/thermal/1.0/vts/functional/thermal_hidl_hal_test.cpp b/thermal/1.0/vts/functional/thermal_hidl_hal_test.cpp index 6eb62693be..8a5ea2c988 100644 --- a/thermal/1.0/vts/functional/thermal_hidl_hal_test.cpp +++ b/thermal/1.0/vts/functional/thermal_hidl_hal_test.cpp @@ -43,6 +43,8 @@ using ::android::sp; #define THERMAL_SERVICE_NAME "thermal" #define MONITORING_OPERATION_NUMBER 10 +#define UNDEFINED_TEMPERATURE (-FLT_MAX) + #define MAX_DEVICE_TEMPERATURE 200 #define MAX_FAN_SPEED 20000 @@ -54,17 +56,6 @@ class ThermalHidlTest : public ::testing::Test { ASSERT_NE(thermal_, nullptr); baseSize_ = 0; names_.clear(); - - { - float undefined_temperature; - thermal_->getUndefinedTemperature( - [&undefined_temperature](ThermalStatus status, float temperature) { - EXPECT_EQ(ThermalStatusCode::SUCCESS, status.code); - EXPECT_LT(MAX_DEVICE_TEMPERATURE, std::abs(undefined_temperature)); - undefined_temperature = temperature; - }); - undefined_temperature_ = undefined_temperature; - } } virtual void TearDown() override {} @@ -136,20 +127,21 @@ class ThermalHidlTest : public ::testing::Test { // .currentValue of known type is in Celsius and must be reasonable. EXPECT_TRUE(temperature.type == TemperatureType::UNKNOWN || std::abs(temperature.currentValue) < MAX_DEVICE_TEMPERATURE || - temperature.currentValue == undefined_temperature_); + temperature.currentValue == UNDEFINED_TEMPERATURE); // .name must not be empty. EXPECT_LT(0u, temperature.name.size()); // .currentValue must not exceed .shutdwonThreshold if defined. EXPECT_TRUE(temperature.currentValue < temperature.shutdownThreshold || - temperature.currentValue == undefined_temperature_ || - temperature.shutdownThreshold == undefined_temperature_); + temperature.currentValue == UNDEFINED_TEMPERATURE || + temperature.shutdownThreshold == UNDEFINED_TEMPERATURE); // .throttlingThreshold must not exceed .shutdownThreshold if defined. - EXPECT_TRUE(temperature.throttlingThreshold < temperature.shutdownThreshold || - temperature.throttlingThreshold == undefined_temperature_ || - temperature.shutdownThreshold == undefined_temperature_); + EXPECT_TRUE(temperature.throttlingThreshold < + temperature.shutdownThreshold || + temperature.throttlingThreshold == UNDEFINED_TEMPERATURE || + temperature.shutdownThreshold == UNDEFINED_TEMPERATURE); } // Check validity of CPU usage returned by Thermal HAL. @@ -172,7 +164,6 @@ class ThermalHidlTest : public ::testing::Test { size_t baseSize_; std::vector names_; - float undefined_temperature_; }; // Sanity test for Thermal::getTemperatures().