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 <abhishekgadewar@meta.com>
diff --git a/services/core/java/com/android/server/power/ThermalManagerService.java b/services/core/java/com/android/server/power/ThermalManagerService.java
index 24d7acd..10985a7 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 @@
         long mInactivityThresholdMillis = INACTIVITY_THRESHOLD_MILLIS;
 
         void updateThresholds() {
-            synchronized (mSamples) {
-                List<TemperatureThreshold> thresholds =
+            List<TemperatureThreshold> thresholds =
                         mHalWrapper.getTemperatureThresholds(true, Temperature.TYPE_SKIN);
+            synchronized (mSamples) {
                 if (Flags.allowThermalHeadroomThresholds()) {
                     Arrays.fill(mHeadroomThresholds, Float.NaN);
                 }