diff options
| author | android-build-team Robot <android-build-team-robot@google.com> | 2018-11-14 04:05:02 +0000 |
|---|---|---|
| committer | android-build-team Robot <android-build-team-robot@google.com> | 2018-11-14 04:05:02 +0000 |
| commit | 62fd888bb70901e9020687520c302ee90f3e5ec9 (patch) | |
| tree | 7189e04b06b6b33897f3618fd344e4da03e2abd8 | |
| parent | 1db69af06fe29675dfdc7d40f4add2e4983ce101 (diff) | |
| parent | 53c4f6a17aff98f4e8dffd99ad5e9ab107e7bb38 (diff) | |
Snap for 5130385 from 53c4f6a17aff98f4e8dffd99ad5e9ab107e7bb38 to pi-qpr2-release
Change-Id: I53e3d3019c103645b3e75f4c092e7c7b275b5bba
| -rw-r--r-- | BoardConfig-common.mk | 1 | ||||
| -rw-r--r-- | acdbdata/OEM/sdm845-tavil-b1-snd-card/Handset_cal.acdb | bin | 302207 -> 317120 bytes | |||
| -rw-r--r-- | acdbdata/OEM/sdm845-tavil-b1-snd-card/Speaker_cal.acdb | bin | 290963 -> 288444 bytes | |||
| -rw-r--r-- | acdbdata/OEM/sdm845-tavil-c1-snd-card/Handset_cal.acdb | bin | 307652 -> 322564 bytes | |||
| -rw-r--r-- | acdbdata/OEM/sdm845-tavil-c1-snd-card/Speaker_cal.acdb | bin | 292120 -> 291592 bytes | |||
| -rw-r--r-- | audio_platform_info_tavil_b1.xml | 56 | ||||
| -rw-r--r-- | audio_platform_info_tavil_c1.xml | 56 | ||||
| -rw-r--r-- | audio_policy_volumes_b1.xml | 6 | ||||
| -rw-r--r-- | audio_policy_volumes_c1.xml | 6 | ||||
| -rw-r--r-- | overlay/packages/apps/Bluetooth/res/values/config.xml | 2 | ||||
| -rw-r--r-- | thermal/Android.bp | 1 | ||||
| -rw-r--r-- | thermal/Thermal.cpp | 3 | ||||
| -rw-r--r-- | thermal/thermal-helper.cpp | 10 | ||||
| -rw-r--r-- | thermal/thermal-helper.h | 3 | ||||
| -rw-r--r-- | thermal/utils/battery_threshold.cpp | 249 | ||||
| -rw-r--r-- | thermal/utils/battery_threshold.h | 66 |
16 files changed, 110 insertions, 349 deletions
diff --git a/BoardConfig-common.mk b/BoardConfig-common.mk index c5fcf65..488e152 100644 --- a/BoardConfig-common.mk +++ b/BoardConfig-common.mk @@ -184,6 +184,7 @@ BOARD_SUPPORTS_SOUND_TRIGGER := true AUDIO_FEATURE_FLICKER_SENSOR_INPUT := true SOUND_TRIGGER_FEATURE_LPMA_ENABLED := true AUDIO_FEATURE_ENABLED_MAXX_AUDIO := true +AUDIO_FEATURE_ENABLED_24BITS_CAMCORDER := true # Graphics TARGET_USES_GRALLOC1 := true diff --git a/acdbdata/OEM/sdm845-tavil-b1-snd-card/Handset_cal.acdb b/acdbdata/OEM/sdm845-tavil-b1-snd-card/Handset_cal.acdb Binary files differindex e21cebf..29a6567 100644 --- a/acdbdata/OEM/sdm845-tavil-b1-snd-card/Handset_cal.acdb +++ b/acdbdata/OEM/sdm845-tavil-b1-snd-card/Handset_cal.acdb diff --git a/acdbdata/OEM/sdm845-tavil-b1-snd-card/Speaker_cal.acdb b/acdbdata/OEM/sdm845-tavil-b1-snd-card/Speaker_cal.acdb Binary files differindex 966cfc4..db1fbf5 100644 --- a/acdbdata/OEM/sdm845-tavil-b1-snd-card/Speaker_cal.acdb +++ b/acdbdata/OEM/sdm845-tavil-b1-snd-card/Speaker_cal.acdb diff --git a/acdbdata/OEM/sdm845-tavil-c1-snd-card/Handset_cal.acdb b/acdbdata/OEM/sdm845-tavil-c1-snd-card/Handset_cal.acdb Binary files differindex 83ed4e0..62fcca7 100644 --- a/acdbdata/OEM/sdm845-tavil-c1-snd-card/Handset_cal.acdb +++ b/acdbdata/OEM/sdm845-tavil-c1-snd-card/Handset_cal.acdb diff --git a/acdbdata/OEM/sdm845-tavil-c1-snd-card/Speaker_cal.acdb b/acdbdata/OEM/sdm845-tavil-c1-snd-card/Speaker_cal.acdb Binary files differindex dd3dd8a..78ac25c 100644 --- a/acdbdata/OEM/sdm845-tavil-c1-snd-card/Speaker_cal.acdb +++ b/acdbdata/OEM/sdm845-tavil-c1-snd-card/Speaker_cal.acdb diff --git a/audio_platform_info_tavil_b1.xml b/audio_platform_info_tavil_b1.xml index 42b6b09..66ab6b9 100644 --- a/audio_platform_info_tavil_b1.xml +++ b/audio_platform_info_tavil_b1.xml @@ -54,10 +54,10 @@ <device name="SND_DEVICE_IN_VOICE_DMIC_TMUS" acdb_id="99"/> <device name="SND_DEVICE_IN_VOICE_SPEAKER_DMIC" acdb_id="19"/> <device name="SND_DEVICE_IN_VOICE_TTY_VCO_HANDSET_MIC" acdb_id="19"/> - <device name="SND_DEVICE_IN_VOICE_REC_MIC" acdb_id="4"/> - <device name="SND_DEVICE_IN_VOICE_REC_MIC_NS" acdb_id="4"/> - <device name="SND_DEVICE_IN_VOICE_REC_MIC_AEC" acdb_id="4"/> - <device name="SND_DEVICE_IN_VOICE_REC_MIC_AEC_NS" acdb_id="4"/> + <device name="SND_DEVICE_IN_VOICE_REC_MIC" acdb_id="143"/> + <device name="SND_DEVICE_IN_VOICE_REC_MIC_NS" acdb_id="143"/> + <device name="SND_DEVICE_IN_VOICE_REC_MIC_AEC" acdb_id="143"/> + <device name="SND_DEVICE_IN_VOICE_REC_MIC_AEC_NS" acdb_id="143"/> <device name="SND_DEVICE_IN_UNPROCESSED_MIC" acdb_id="143"/> <device name="SND_DEVICE_IN_UNPROCESSED_STEREO_MIC" acdb_id="144"/> <device name="SND_DEVICE_IN_UNPROCESSED_THREE_MIC" acdb_id="145"/> @@ -72,6 +72,12 @@ <device name="SND_DEVICE_IN_SPEAKER_MIC" acdb_id="4"/> <device name="SND_DEVICE_OUT_VOICE_TTY_HCO_SPEAKER" acdb_id="14"/> <device name="SND_DEVICE_IN_VOICE_TTY_VCO_SPEAKER_MIC" acdb_id="19"/> + <device name="SND_DEVICE_IN_CAMCORDER_LANDSCAPE" acdb_id="61"/> + <device name="SND_DEVICE_IN_CAMCORDER_INVERT_LANDSCAPE" acdb_id="61"/> + <device name="SND_DEVICE_IN_CAMCORDER_PORTRAIT" acdb_id="61"/> + <device name="SND_DEVICE_IN_CAMCORDER_SELFIE_LANDSCAPE" acdb_id="66"/> + <device name="SND_DEVICE_IN_CAMCORDER_SELFIE_INVERT_LANDSCAPE" acdb_id="66"/> + <device name="SND_DEVICE_IN_CAMCORDER_SELFIE_PORTRAIT" acdb_id="66"/> </acdb_ids> <bit_width_configs> <device name="SND_DEVICE_OUT_SPEAKER" bit_width="24"/> @@ -176,7 +182,47 @@ <snd_devices> <input_snd_device> <input_snd_device_mic_mapping> - <snd_dev in_snd_device="SND_DEVICE_IN_CAMCORDER_MIC"> + <snd_dev in_snd_device="SND_DEVICE_IN_CAMCORDER_LANDSCAPE"> + <mic_info mic_device_id="builtin_mic_1" + channel_mapping="AUDIO_MICROPHONE_CHANNEL_MAPPING_PROCESSED AUDIO_MICROPHONE_CHANNEL_MAPPING_PROCESSED"/> + <mic_info mic_device_id="builtin_mic_2" + channel_mapping="AUDIO_MICROPHONE_CHANNEL_MAPPING_PROCESSED AUDIO_MICROPHONE_CHANNEL_MAPPING_PROCESSED"/> + <mic_info mic_device_id="builtin_mic_3" + channel_mapping="AUDIO_MICROPHONE_CHANNEL_MAPPING_PROCESSED AUDIO_MICROPHONE_CHANNEL_MAPPING_PROCESSED"/> + </snd_dev> + <snd_dev in_snd_device="SND_DEVICE_IN_CAMCORDER_INVERT_LANDSCAPE"> + <mic_info mic_device_id="builtin_mic_1" + channel_mapping="AUDIO_MICROPHONE_CHANNEL_MAPPING_PROCESSED AUDIO_MICROPHONE_CHANNEL_MAPPING_PROCESSED"/> + <mic_info mic_device_id="builtin_mic_2" + channel_mapping="AUDIO_MICROPHONE_CHANNEL_MAPPING_PROCESSED AUDIO_MICROPHONE_CHANNEL_MAPPING_PROCESSED"/> + <mic_info mic_device_id="builtin_mic_3" + channel_mapping="AUDIO_MICROPHONE_CHANNEL_MAPPING_PROCESSED AUDIO_MICROPHONE_CHANNEL_MAPPING_PROCESSED"/> + </snd_dev> + <snd_dev in_snd_device="SND_DEVICE_IN_CAMCORDER_PORTRAIT"> + <mic_info mic_device_id="builtin_mic_1" + channel_mapping="AUDIO_MICROPHONE_CHANNEL_MAPPING_PROCESSED AUDIO_MICROPHONE_CHANNEL_MAPPING_PROCESSED"/> + <mic_info mic_device_id="builtin_mic_2" + channel_mapping="AUDIO_MICROPHONE_CHANNEL_MAPPING_PROCESSED AUDIO_MICROPHONE_CHANNEL_MAPPING_PROCESSED"/> + <mic_info mic_device_id="builtin_mic_3" + channel_mapping="AUDIO_MICROPHONE_CHANNEL_MAPPING_PROCESSED AUDIO_MICROPHONE_CHANNEL_MAPPING_PROCESSED"/> + </snd_dev> + <snd_dev in_snd_device="SND_DEVICE_IN_CAMCORDER_SELFIE_LANDSCAPE"> + <mic_info mic_device_id="builtin_mic_1" + channel_mapping="AUDIO_MICROPHONE_CHANNEL_MAPPING_PROCESSED AUDIO_MICROPHONE_CHANNEL_MAPPING_PROCESSED"/> + <mic_info mic_device_id="builtin_mic_2" + channel_mapping="AUDIO_MICROPHONE_CHANNEL_MAPPING_PROCESSED AUDIO_MICROPHONE_CHANNEL_MAPPING_PROCESSED"/> + <mic_info mic_device_id="builtin_mic_3" + channel_mapping="AUDIO_MICROPHONE_CHANNEL_MAPPING_PROCESSED AUDIO_MICROPHONE_CHANNEL_MAPPING_PROCESSED"/> + </snd_dev> + <snd_dev in_snd_device="SND_DEVICE_IN_CAMCORDER_SELFIE_INVERT_LANDSCAPE"> + <mic_info mic_device_id="builtin_mic_1" + channel_mapping="AUDIO_MICROPHONE_CHANNEL_MAPPING_PROCESSED AUDIO_MICROPHONE_CHANNEL_MAPPING_PROCESSED"/> + <mic_info mic_device_id="builtin_mic_2" + channel_mapping="AUDIO_MICROPHONE_CHANNEL_MAPPING_PROCESSED AUDIO_MICROPHONE_CHANNEL_MAPPING_PROCESSED"/> + <mic_info mic_device_id="builtin_mic_3" + channel_mapping="AUDIO_MICROPHONE_CHANNEL_MAPPING_PROCESSED AUDIO_MICROPHONE_CHANNEL_MAPPING_PROCESSED"/> + </snd_dev> + <snd_dev in_snd_device="SND_DEVICE_IN_CAMCORDER_SELFIE_PORTRAIT"> <mic_info mic_device_id="builtin_mic_1" channel_mapping="AUDIO_MICROPHONE_CHANNEL_MAPPING_PROCESSED AUDIO_MICROPHONE_CHANNEL_MAPPING_PROCESSED"/> <mic_info mic_device_id="builtin_mic_2" diff --git a/audio_platform_info_tavil_c1.xml b/audio_platform_info_tavil_c1.xml index bfe1cbe..1dbedf8 100644 --- a/audio_platform_info_tavil_c1.xml +++ b/audio_platform_info_tavil_c1.xml @@ -54,10 +54,10 @@ <device name="SND_DEVICE_IN_VOICE_DMIC_TMUS" acdb_id="99"/> <device name="SND_DEVICE_IN_VOICE_SPEAKER_DMIC" acdb_id="19"/> <device name="SND_DEVICE_IN_VOICE_TTY_VCO_HANDSET_MIC" acdb_id="19"/> - <device name="SND_DEVICE_IN_VOICE_REC_MIC" acdb_id="4"/> - <device name="SND_DEVICE_IN_VOICE_REC_MIC_NS" acdb_id="4"/> - <device name="SND_DEVICE_IN_VOICE_REC_MIC_AEC" acdb_id="4"/> - <device name="SND_DEVICE_IN_VOICE_REC_MIC_AEC_NS" acdb_id="4"/> + <device name="SND_DEVICE_IN_VOICE_REC_MIC" acdb_id="143"/> + <device name="SND_DEVICE_IN_VOICE_REC_MIC_NS" acdb_id="143"/> + <device name="SND_DEVICE_IN_VOICE_REC_MIC_AEC" acdb_id="143"/> + <device name="SND_DEVICE_IN_VOICE_REC_MIC_AEC_NS" acdb_id="143"/> <device name="SND_DEVICE_IN_UNPROCESSED_MIC" acdb_id="143"/> <device name="SND_DEVICE_IN_UNPROCESSED_STEREO_MIC" acdb_id="144"/> <device name="SND_DEVICE_IN_UNPROCESSED_THREE_MIC" acdb_id="145"/> @@ -72,6 +72,12 @@ <device name="SND_DEVICE_IN_SPEAKER_MIC" acdb_id="4"/> <device name="SND_DEVICE_OUT_VOICE_TTY_HCO_SPEAKER" acdb_id="14"/> <device name="SND_DEVICE_IN_VOICE_TTY_VCO_SPEAKER_MIC" acdb_id="19"/> + <device name="SND_DEVICE_IN_CAMCORDER_LANDSCAPE" acdb_id="61"/> + <device name="SND_DEVICE_IN_CAMCORDER_INVERT_LANDSCAPE" acdb_id="61"/> + <device name="SND_DEVICE_IN_CAMCORDER_PORTRAIT" acdb_id="61"/> + <device name="SND_DEVICE_IN_CAMCORDER_SELFIE_LANDSCAPE" acdb_id="66"/> + <device name="SND_DEVICE_IN_CAMCORDER_SELFIE_INVERT_LANDSCAPE" acdb_id="66"/> + <device name="SND_DEVICE_IN_CAMCORDER_SELFIE_PORTRAIT" acdb_id="66"/> </acdb_ids> <bit_width_configs> <device name="SND_DEVICE_OUT_SPEAKER" bit_width="24"/> @@ -176,7 +182,47 @@ <snd_devices> <input_snd_device> <input_snd_device_mic_mapping> - <snd_dev in_snd_device="SND_DEVICE_IN_CAMCORDER_MIC"> + <snd_dev in_snd_device="SND_DEVICE_IN_CAMCORDER_LANDSCAPE"> + <mic_info mic_device_id="builtin_mic_1" + channel_mapping="AUDIO_MICROPHONE_CHANNEL_MAPPING_PROCESSED AUDIO_MICROPHONE_CHANNEL_MAPPING_PROCESSED"/> + <mic_info mic_device_id="builtin_mic_2" + channel_mapping="AUDIO_MICROPHONE_CHANNEL_MAPPING_PROCESSED AUDIO_MICROPHONE_CHANNEL_MAPPING_PROCESSED"/> + <mic_info mic_device_id="builtin_mic_3" + channel_mapping="AUDIO_MICROPHONE_CHANNEL_MAPPING_PROCESSED AUDIO_MICROPHONE_CHANNEL_MAPPING_PROCESSED"/> + </snd_dev> + <snd_dev in_snd_device="SND_DEVICE_IN_CAMCORDER_INVERT_LANDSCAPE"> + <mic_info mic_device_id="builtin_mic_1" + channel_mapping="AUDIO_MICROPHONE_CHANNEL_MAPPING_PROCESSED AUDIO_MICROPHONE_CHANNEL_MAPPING_PROCESSED"/> + <mic_info mic_device_id="builtin_mic_2" + channel_mapping="AUDIO_MICROPHONE_CHANNEL_MAPPING_PROCESSED AUDIO_MICROPHONE_CHANNEL_MAPPING_PROCESSED"/> + <mic_info mic_device_id="builtin_mic_3" + channel_mapping="AUDIO_MICROPHONE_CHANNEL_MAPPING_PROCESSED AUDIO_MICROPHONE_CHANNEL_MAPPING_PROCESSED"/> + </snd_dev> + <snd_dev in_snd_device="SND_DEVICE_IN_CAMCORDER_PORTRAIT"> + <mic_info mic_device_id="builtin_mic_1" + channel_mapping="AUDIO_MICROPHONE_CHANNEL_MAPPING_PROCESSED AUDIO_MICROPHONE_CHANNEL_MAPPING_PROCESSED"/> + <mic_info mic_device_id="builtin_mic_2" + channel_mapping="AUDIO_MICROPHONE_CHANNEL_MAPPING_PROCESSED AUDIO_MICROPHONE_CHANNEL_MAPPING_PROCESSED"/> + <mic_info mic_device_id="builtin_mic_3" + channel_mapping="AUDIO_MICROPHONE_CHANNEL_MAPPING_PROCESSED AUDIO_MICROPHONE_CHANNEL_MAPPING_PROCESSED"/> + </snd_dev> + <snd_dev in_snd_device="SND_DEVICE_IN_CAMCORDER_SELFIE_LANDSCAPE"> + <mic_info mic_device_id="builtin_mic_1" + channel_mapping="AUDIO_MICROPHONE_CHANNEL_MAPPING_PROCESSED AUDIO_MICROPHONE_CHANNEL_MAPPING_PROCESSED"/> + <mic_info mic_device_id="builtin_mic_2" + channel_mapping="AUDIO_MICROPHONE_CHANNEL_MAPPING_PROCESSED AUDIO_MICROPHONE_CHANNEL_MAPPING_PROCESSED"/> + <mic_info mic_device_id="builtin_mic_3" + channel_mapping="AUDIO_MICROPHONE_CHANNEL_MAPPING_PROCESSED AUDIO_MICROPHONE_CHANNEL_MAPPING_PROCESSED"/> + </snd_dev> + <snd_dev in_snd_device="SND_DEVICE_IN_CAMCORDER_SELFIE_INVERT_LANDSCAPE"> + <mic_info mic_device_id="builtin_mic_1" + channel_mapping="AUDIO_MICROPHONE_CHANNEL_MAPPING_PROCESSED AUDIO_MICROPHONE_CHANNEL_MAPPING_PROCESSED"/> + <mic_info mic_device_id="builtin_mic_2" + channel_mapping="AUDIO_MICROPHONE_CHANNEL_MAPPING_PROCESSED AUDIO_MICROPHONE_CHANNEL_MAPPING_PROCESSED"/> + <mic_info mic_device_id="builtin_mic_3" + channel_mapping="AUDIO_MICROPHONE_CHANNEL_MAPPING_PROCESSED AUDIO_MICROPHONE_CHANNEL_MAPPING_PROCESSED"/> + </snd_dev> + <snd_dev in_snd_device="SND_DEVICE_IN_CAMCORDER_SELFIE_PORTRAIT"> <mic_info mic_device_id="builtin_mic_1" channel_mapping="AUDIO_MICROPHONE_CHANNEL_MAPPING_PROCESSED AUDIO_MICROPHONE_CHANNEL_MAPPING_PROCESSED"/> <mic_info mic_device_id="builtin_mic_2" diff --git a/audio_policy_volumes_b1.xml b/audio_policy_volumes_b1.xml index d99f45b..42e1d6a 100644 --- a/audio_policy_volumes_b1.xml +++ b/audio_policy_volumes_b1.xml @@ -30,9 +30,9 @@ volume index from 0 to 100. <point>100,0</point> </volume> <volume stream="AUDIO_STREAM_VOICE_CALL" deviceCategory="DEVICE_CATEGORY_SPEAKER"> - <point>0,-2400</point> - <point>33,-1600</point> - <point>66,-800</point> + <point>0,-3000</point> + <point>33,-2000</point> + <point>66,-1000</point> <point>100,0</point> </volume> <volume stream="AUDIO_STREAM_VOICE_CALL" deviceCategory="DEVICE_CATEGORY_EARPIECE"> diff --git a/audio_policy_volumes_c1.xml b/audio_policy_volumes_c1.xml index 82932ea..f2a4eab 100644 --- a/audio_policy_volumes_c1.xml +++ b/audio_policy_volumes_c1.xml @@ -30,9 +30,9 @@ volume index from 0 to 100. <point>100,0</point> </volume> <volume stream="AUDIO_STREAM_VOICE_CALL" deviceCategory="DEVICE_CATEGORY_SPEAKER"> - <point>0,-2400</point> - <point>33,-1600</point> - <point>66,-800</point> + <point>0,-3000</point> + <point>33,-2000</point> + <point>66,-1000</point> <point>100,0</point> </volume> <volume stream="AUDIO_STREAM_VOICE_CALL" deviceCategory="DEVICE_CATEGORY_EARPIECE"> diff --git a/overlay/packages/apps/Bluetooth/res/values/config.xml b/overlay/packages/apps/Bluetooth/res/values/config.xml index e403105..087e238 100644 --- a/overlay/packages/apps/Bluetooth/res/values/config.xml +++ b/overlay/packages/apps/Bluetooth/res/values/config.xml @@ -29,5 +29,5 @@ IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --> <resources> <bool name="profile_supported_sap">true</bool> - <bool name="profile_supported_hearing_aid">true</bool> + <bool name="profile_supported_hearing_aid">false</bool> </resources> diff --git a/thermal/Android.bp b/thermal/Android.bp index 9e90b84..eaac77d 100644 --- a/thermal/Android.bp +++ b/thermal/Android.bp @@ -12,7 +12,6 @@ cc_binary { "service.cpp", "Thermal.cpp", "thermal-helper.cpp", - "utils/battery_threshold.cpp", "utils/cooling_devices.cpp", "utils/device_file_watcher.cpp", "utils/sensors.cpp", diff --git a/thermal/Thermal.cpp b/thermal/Thermal.cpp index 37edb13..70ac1d2 100644 --- a/thermal/Thermal.cpp +++ b/thermal/Thermal.cpp @@ -218,9 +218,6 @@ Return<void> Thermal::debug( << std::endl; } - if (!thermal_helper_.fillBatteryThresholdDebugInfo(dump_buf)) { - dump_buf << "error while filling BatteryThresholdDebugInfo." << std::endl; - } } std::string buf = dump_buf.str(); if (!android::base::WriteStringToFd(buf, fd)) { diff --git a/thermal/thermal-helper.cpp b/thermal/thermal-helper.cpp index 3d7debe..6e8e1f9 100644 --- a/thermal/thermal-helper.cpp +++ b/thermal/thermal-helper.cpp @@ -250,11 +250,6 @@ bool ThermalHelper::readTemperature( out->name = sensor_name; out->currentValue = std::stoi(temp) * sensor_info.multiplier; out->throttlingThreshold = getThresholdFromType(sensor_info.type, thresholds_); - if (sensor_info.type == TemperatureType::SKIN) { - out->throttlingThreshold = low_temp_threshold_adjuster_.adjustThreshold( - out->throttlingThreshold, out->currentValue); - } - out->shutdownThreshold = getThresholdFromType( sensor_info.type, shutdown_thresholds_); out->vrThrottlingThreshold = getThresholdFromType( @@ -416,11 +411,6 @@ bool ThermalHelper::checkThrottlingData( return false; } -bool ThermalHelper::fillBatteryThresholdDebugInfo(std::ostringstream& dump_buf) -{ - return low_temp_threshold_adjuster_.fillBatteryThresholdDebugInfo(dump_buf); -} - std::string ThermalHelper::getSkinSensorType() { // The skin sensor is checked dynamically, since -evt uses quiet-therm-adc // and -prod uses fps-therm-adc. diff --git a/thermal/thermal-helper.h b/thermal/thermal-helper.h index 670cc3b..c864931 100644 --- a/thermal/thermal-helper.h +++ b/thermal/thermal-helper.h @@ -39,7 +39,6 @@ #include <fnmatch.h> #include <android/hardware/thermal/1.0/IThermal.h> -#include "utils/battery_threshold.h" #include "utils/cooling_devices.h" #include "utils/sensors.h" @@ -77,7 +76,6 @@ class ThermalHelper { bool fillTemperatures(hidl_vec<Temperature>* temperatures); bool fillCpuUsages(hidl_vec<CpuUsage>* cpu_usages); - bool fillBatteryThresholdDebugInfo(std::ostringstream& dump_buf); // Dissallow copy and assign. ThermalHelper(const ThermalHelper&) = delete; @@ -132,7 +130,6 @@ class ThermalHelper { ThrottlingThresholds vr_thresholds_; ThrottlingThresholds shutdown_thresholds_; const bool is_initialized_; - const BatteryThresholdLUT low_temp_threshold_adjuster_; }; } // namespace implementation diff --git a/thermal/utils/battery_threshold.cpp b/thermal/utils/battery_threshold.cpp deleted file mode 100644 index 8dc196c..0000000 --- a/thermal/utils/battery_threshold.cpp +++ /dev/null @@ -1,249 +0,0 @@ -/* - * Copyright (C) 2018 The Android Open Source Project - * - * 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. - */ - -#include <android-base/file.h> -#include <android-base/logging.h> -#include <android-base/strings.h> -#include "battery_threshold.h" - -namespace android { -namespace hardware { -namespace thermal { -namespace V1_1 { -namespace implementation { - -enum class AgeRange -{ - Fresh, - Above200, - Above400, - Above600, - Above900 -}; -enum class TempRange -{ - AboveZero, - ZeroToNegFive, - NegFiveToNegTen, - BelowNegTen -}; - -namespace { - -TempRange rangeFromTemp(float current_temp) -{ - if (current_temp >= 0.0) { - return TempRange::AboveZero; - } - if ((current_temp >= -5.0) && (current_temp < 0.0)) { - return TempRange::ZeroToNegFive; - } - if ((current_temp >= -10.0) && (current_temp < -5.0)) { - return TempRange::NegFiveToNegTen; - } - if ((current_temp < -10.0)) { - return TempRange::BelowNegTen; - } - return TempRange::AboveZero; -} - -AgeRange ageFromCC(int cycle_count) -{ - if ( cycle_count < 200) { - return AgeRange::Fresh; - } - if (( cycle_count >= 200) && (cycle_count < 400)) { - return AgeRange::Above200; - } - if (( cycle_count >= 400) && (cycle_count < 600)) { - return AgeRange::Above400; - } - if (( cycle_count >= 600) && (cycle_count < 900)) { - return AgeRange::Above600; - } - return AgeRange::Above900; -} - -std::ostream& operator<<(std::ostream& os, const AgeRange& age) -{ - switch (age) { - case AgeRange::Fresh: - os << "Fresh"; - break; - case AgeRange::Above200: - os << "Above200"; - break; - case AgeRange::Above400: - os << "Above400"; - break; - case AgeRange::Above600: - os << "Above600"; - break; - case AgeRange::Above900: - os << "Above900"; - break; - default: - break; - } - return os; -} - -std::ostream& operator<<(std::ostream& os, const TempRange& temp) -{ - switch (temp) { - case TempRange::AboveZero: - os << "AboveZero"; - break; - case TempRange::ZeroToNegFive: - os << "ZeroToNegFive"; - break; - case TempRange::NegFiveToNegTen: - os << "NegFiveToNegTen"; - break; - case TempRange::BelowNegTen: - os << "BelowNegTen"; - break; - default: - break; - } - return os; -} -} // namespace - -bool BatteryThresholdLUT::readCycleCount(int& cycle_count) const -{ - std::string contents; - if (!android::base::ReadFileToString(cycle_count_filename_, &contents)) { - return false; - } - cycle_count = std::stoi(android::base::Trim(contents)); - return true; -} - -bool BatteryThresholdLUT::readSoC(int& soc) const -{ - std::string contents; - if (!android::base::ReadFileToString( - state_of_charge_filename_, &contents)) { - return false; - } - soc = std::stoi(android::base::Trim(contents)); - return true; -} - -bool BatteryThresholdLUT::readStatus(std::string& status) const -{ - if (!android::base::ReadFileToString(status_filename_, &status)) { - return false; - } - status = android::base::Trim(status); - return true; -} - -constexpr float kThresholdDecrease = 5.0; -float BatteryThresholdLUT::adjustThreshold( - float configured_threshold, float current_temperature) const -{ - int current_soc = 100; - int cycle_count = 0; - std::string status; - bool rc = readStatus(status); - if (!rc || status != "Discharging") { - return configured_threshold; - } - - TempRange temp_range = rangeFromTemp(current_temperature); - - if (!readCycleCount(cycle_count)) { - return configured_threshold; - } - AgeRange age = ageFromCC(cycle_count); - - auto it = battery_conditions_lut_.find({temp_range, age}); - if (it == battery_conditions_lut_.end()) { - return configured_threshold; - } - int low_soc = it->second; - - if (!readSoC(current_soc) || (low_soc <= current_soc)) { - return configured_threshold; - } - - //TODO: We should expand the semantics of the Thermal Hal so that the - // temperature thresholds have a max and a min. For now, just set the - // threshold below the actual value. - float low_temp_threshold = current_temperature - kThresholdDecrease; - LOG(DEBUG) << "Low temp and battery conditions present." - << " (cycle_count: " << cycle_count - << " SoC: " << current_soc - << " temperature: " << current_temperature << ")\n" - << " Recommending threshold : " << low_temp_threshold; - return low_temp_threshold; -} - -BatteryThresholdLUT::BatteryThresholdLUT() : - battery_conditions_lut_ { - {{ TempRange::ZeroToNegFive, AgeRange::Above900 }, 40 }, - {{ TempRange::NegFiveToNegTen, AgeRange::Above400 }, 5 }, - {{ TempRange::NegFiveToNegTen, AgeRange::Above600 }, 15 }, - {{ TempRange::NegFiveToNegTen, AgeRange::Above900 }, 50 }, - {{ TempRange::BelowNegTen, AgeRange::Fresh }, 5 }, - {{ TempRange::BelowNegTen, AgeRange::Above200 }, 12 }, - {{ TempRange::BelowNegTen, AgeRange::Above400 }, 45 }, - {{ TempRange::BelowNegTen, AgeRange::Above600 }, 60 }, - {{ TempRange::BelowNegTen, AgeRange::Above900 }, 100 } - }, - cycle_count_filename_{"/sys/class/power_supply/battery/cycle_count"}, - state_of_charge_filename_{"/sys/class/power_supply/battery/capacity"}, - status_filename_{"/sys/class/power_supply/battery/status"} -{ -} - -bool BatteryThresholdLUT::fillBatteryThresholdDebugInfo( - std::ostringstream& dump_buf) const -{ - int soc = -1; - int cycle_count = -1; - std::string status; - bool rc = readSoC(soc); - rc |= readCycleCount(cycle_count); - rc |= readStatus(status); - - dump_buf << "ThermalBattery: Status: " << status - << " SoC: " << soc - << " Cycle count: " << cycle_count << std::endl; - dump_buf << "ThermalBattery: LookupTable: " << std::endl; - - for (const auto & entry : battery_conditions_lut_) { - dump_buf << "\t(Temp: " << entry.first.first - << ", Age: " << entry.first.second - << ") -> " << entry.second << " SoC Level" << std::endl; - } - return rc; - -} - -size_t BatteryThresholdLUT::TempAgeHash::operator()( - const std::pair<TempRange, AgeRange>& k) const -{ - return static_cast<size_t>(k.first) << 16 | static_cast<size_t>(k.second); -} - -} // namespace implementation -} // namespace V1_1 -} // namespace thermal -} // namespace hardware -} // namespace android diff --git a/thermal/utils/battery_threshold.h b/thermal/utils/battery_threshold.h deleted file mode 100644 index 47249b1..0000000 --- a/thermal/utils/battery_threshold.h +++ /dev/null @@ -1,66 +0,0 @@ -/* - * Copyright (C) 2018 The Android Open Source Project - * - * 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. - */ - -#ifndef __BATTERY_THRESHOLD_H__ -#define __BATTERY_THRESHOLD_H__ - -#include <android/hardware/thermal/1.0/IThermal.h> -#include <string> -#include <unordered_map> -#include <utility> - -namespace android { -namespace hardware { -namespace thermal { -namespace V1_1 { -namespace implementation { -using ::android::hardware::hidl_vec; -using ::android::hardware::thermal::V1_0::CpuUsage; -using ::android::hardware::thermal::V1_0::Temperature; -using ::android::hardware::thermal::V1_0::TemperatureType; - -enum class AgeRange; -enum class TempRange; -class BatteryThresholdLUT -{ -public: - BatteryThresholdLUT(); - float adjustThreshold( - float configured_threshold, float current_temperature) const; - bool fillBatteryThresholdDebugInfo(std::ostringstream& dump_buf) const; -private: - bool readCycleCount(int& cycle_count) const; - bool readSoC(int& soc) const; - bool readStatus(std::string& status) const; - - struct TempAgeHash - { - size_t operator()(const std::pair<TempRange, AgeRange>& key) const; - }; - const std::unordered_map<std::pair<TempRange, AgeRange>, int, TempAgeHash> - battery_conditions_lut_; - const char* cycle_count_filename_; - const char* state_of_charge_filename_; - const char* status_filename_; -}; - -} // namespace implementation -} // namespace V1_1 -} // namespace thermal -} // namespace hardware -} // namespace android - -#endif // __THERMAL_HELPER_H__ |
