From 2af2a8c35619557d206c0616a21e12470854f1a5 Mon Sep 17 00:00:00 2001 From: Abhishek Gadewar Date: Mon, 9 Sep 2024 17:08:08 -0700 Subject: ThermalManager: Don't hold mSamples lock while calling power HAL Summary: There is no need to hold the lock while making the call to the power HAL. In the case the HAL call takes a long time due to hardware reads, holding the lock may cause lock contention from other threads. Test: build passes Tags: Change-Id: I6b1f8d1228de17e4bf188bd99037b02ac7ebff1a Signed-off-by: Abhishek Gadewar --- .../core/java/com/android/server/power/ThermalManagerService.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/services/core/java/com/android/server/power/ThermalManagerService.java b/services/core/java/com/android/server/power/ThermalManagerService.java index 24d7acd772c1..10985a79466e 100644 --- a/services/core/java/com/android/server/power/ThermalManagerService.java +++ b/services/core/java/com/android/server/power/ThermalManagerService.java @@ -1591,9 +1591,9 @@ public class ThermalManagerService extends SystemService { long mInactivityThresholdMillis = INACTIVITY_THRESHOLD_MILLIS; void updateThresholds() { - synchronized (mSamples) { - List thresholds = + List thresholds = mHalWrapper.getTemperatureThresholds(true, Temperature.TYPE_SKIN); + synchronized (mSamples) { if (Flags.allowThermalHeadroomThresholds()) { Arrays.fill(mHeadroomThresholds, Float.NaN); } -- cgit v1.2.3-59-g8ed1b