Set Type-A HCE to Random UID am: 0881758b0b am: 01f2216035 am: 7afb5a9005
am: ec7367596d

Change-Id: I0327fc9c8160af512bb467dd2e0292ed52843501
diff --git a/audio_platform_info_tavil.xml b/audio_platform_info_tavil.xml
index f877f24..29dd509 100644
--- a/audio_platform_info_tavil.xml
+++ b/audio_platform_info_tavil.xml
@@ -103,18 +103,24 @@
       <app uc_type="PCM_CAPTURE"  mode="default" bit_width="24" id="69940" max_rate="96000" />
       <app uc_type="PCM_CAPTURE"  mode="voip" bit_width="16" id="69945" max_rate="48000" />
     </app_types>
+    <!-- Mandatory microphone characteristics include: device_id, type,     -->
+    <!-- address, location, group, index_in_the_group, directionality,      -->
+    <!-- num_frequency_responses, frequencies and responses.                -->
+    <!-- Optional microphone characteristics include: Sensitivity, max_spl, -->
+    <!-- min_spl, orientation and geometric_location. If missing they will  -->
+    <!-- be populated as unknown.                                           -->
     <microphone_characteristics>
-        <microphone valid_mask="31" device_id="builtin_mic_1" type="AUDIO_DEVICE_IN_BUILTIN_MIC" address="bottom" location="AUDIO_MICROPHONE_LOCATION_MAINBODY"
+        <microphone device_id="builtin_mic_1" type="AUDIO_DEVICE_IN_BUILTIN_MIC" address="bottom" location="AUDIO_MICROPHONE_LOCATION_MAINBODY"
             group="0" index_in_the_group="0" directionality="AUDIO_MICROPHONE_DIRECTIONALITY_OMNI" num_frequency_responses="93"
             frequencies="100.00 106.00 112.00 118.00 125.00 132.00 140.00 150.00 160.00 170.00 180.00 190.00 200.00 212.00 224.00 236.00 250.00 265.00 280.00 300.00 315.00 335.00 355.00 375.00 400.00 425.00 450.00 475.00 500.00 530.00 560.00 600.00 630.00 670.00 710.00 750.00 800.00 850.00 900.00 950.00 1000.00 1060.00 1120.00 1180.00 1250.00 1320.00 1400.00 1500.00 1600.00 1700.00 1800.00 1900.00 2000.00 2120.00 2240.00 2360.00 2500.00 2650.00 2800.00 3000.00 3150.00 3350.00 3550.00 3750.00 4000.00 4250.00 4500.00 4750.00 5000.00 5300.00 5600.00 6000.00 6300.00 6700.00 7100.00 7500.00 8000.00 8500.00 9000.00 9500.00 10000.00 10600.00 11200.00 11800.00 12500.00 13200.00 14000.00 15000.00 16000.00 17000.00 18000.00 19000.00 20000.00"
             responses="-0.98 -0.95 -0.89 -0.85 -0.81 -0.79 -0.77 -0.74 -0.71 -0.68 -0.66 -0.66 -0.63 -0.60 -0.57 -0.54 -0.53 -0.50 -0.50 -0.48 -0.46 -0.46 -0.41 -0.38 -0.33 -0.30 -0.34 -0.31 -0.29 -0.26 -0.23 -0.19 -0.17 -0.14 -0.11 -0.08 -0.05 -0.03 0.00 0.01 0.00 0.03 0.03 0.08 0.12 0.16 0.18 0.19 0.30 0.39 0.49 0.56 0.63 0.82 0.83 0.84 0.83 0.93 0.99 1.24 1.50 1.76 2.00 2.05 2.36 2.63 2.71 2.73 3.00 3.12 3.28 4.61 5.23 7.94 7.00 7.88 8.87 9.95 11.41 12.67 13.87 17.63 17.87 18.83 23.27 27.86 38.70 36.74 31.66 25.61 27.23 19.68 16.12"
             sensitivity="-37.0" max_spl="132.5" min_spl="28.5" orientation="0.0 0.0 1.0" geometric_location="0.02635 0.00454 0.00794" />
-        <microphone valid_mask="31" device_id="builtin_mic_2" type="AUDIO_DEVICE_IN_BACK_MIC" address="back" location="AUDIO_MICROPHONE_LOCATION_MAINBODY"
+        <microphone device_id="builtin_mic_2" type="AUDIO_DEVICE_IN_BACK_MIC" address="back" location="AUDIO_MICROPHONE_LOCATION_MAINBODY"
             group="0" index_in_the_group="1" directionality="AUDIO_MICROPHONE_DIRECTIONALITY_OMNI" num_frequency_responses="93"
             frequencies="100.00 106.00 112.00 118.00 125.00 132.00 140.00 150.00 160.00 170.00 180.00 190.00 200.00 212.00 224.00 236.00 250.00 265.00 280.00 300.00 315.00 335.00 355.00 375.00 400.00 425.00 450.00 475.00 500.00 530.00 560.00 600.00 630.00 670.00 710.00 750.00 800.00 850.00 900.00 950.00 1000.00 1060.00 1120.00 1180.00 1250.00 1320.00 1400.00 1500.00 1600.00 1700.00 1800.00 1900.00 2000.00 2120.00 2240.00 2360.00 2500.00 2650.00 2800.00 3000.00 3150.00 3350.00 3550.00 3750.00 4000.00 4250.00 4500.00 4750.00 5000.00 5300.00 5600.00 6000.00 6300.00 6700.00 7100.00 7500.00 8000.00 8500.00 9000.00 9500.00 10000.00 10600.00 11200.00 11800.00 12500.00 13200.00 14000.00 15000.00 16000.00 17000.00 18000.00 19000.00 20000.00"
             responses="-1.17 -1.13 -1.09 -1.06 -1.02 -0.98 -0.96 -0.94 -0.91 -0.87 -0.84 -0.82 -0.79 -0.78 -0.76 -0.75 -0.72 -0.70 -0.68 -0.66 -0.63 -0.60 -0.58 -0.55 -0.53 -0.53 -0.49 -0.46 -0.43 -0.41 -0.37 -0.33 -0.30 -0.27 -0.24 -0.21 -0.16 -0.12 -0.07 -0.02 0.00 0.06 0.09 0.12 0.17 0.24 0.25 0.25 0.35 0.45 0.56 0.66 0.78 0.96 0.98 1.08 1.26 1.49 1.67 1.93 2.04 2.28 2.47 2.65 2.86 3.42 3.93 4.54 5.03 5.59 6.40 7.59 8.72 10.83 10.43 13.91 18.52 25.40 22.48 16.63 13.18 10.53 8.41 5.85 3.78 3.68 3.19 2.93 0.59 2.93 2.62 1.44 3.01"
             sensitivity="-37.0" max_spl="132.5" min_spl="28.5" orientation="0.0 1.0 0.0" geometric_location="0.04974 0.15736 0.00426" />
-        <microphone valid_mask="31" device_id="builtin_mic_3" type="AUDIO_DEVICE_IN_BUILTIN_MIC" address="top" location="AUDIO_MICROPHONE_LOCATION_MAINBODY"
+        <microphone device_id="builtin_mic_3" type="AUDIO_DEVICE_IN_BUILTIN_MIC" address="top" location="AUDIO_MICROPHONE_LOCATION_MAINBODY"
             group="0" index_in_the_group="2" directionality="AUDIO_MICROPHONE_DIRECTIONALITY_OMNI" num_frequency_responses="93"
             frequencies="100.00 106.00 112.00 118.00 125.00 132.00 140.00 150.00 160.00 170.00 180.00 190.00 200.00 212.00 224.00 236.00 250.00 265.00 280.00 300.00 315.00 335.00 355.00 375.00 400.00 425.00 450.00 475.00 500.00 530.00 560.00 600.00 630.00 670.00 710.00 750.00 800.00 850.00 900.00 950.00 1000.00 1060.00 1120.00 1180.00 1250.00 1320.00 1400.00 1500.00 1600.00 1700.00 1800.00 1900.00 2000.00 2120.00 2240.00 2360.00 2500.00 2650.00 2800.00 3000.00 3150.00 3350.00 3550.00 3750.00 4000.00 4250.00 4500.00 4750.00 5000.00 5300.00 5600.00 6000.00 6300.00 6700.00 7100.00 7500.00 8000.00 8500.00 9000.00 9500.00 10000.00 10600.00 11200.00 11800.00 12500.00 13200.00 14000.00 15000.00 16000.00 17000.00 18000.00 19000.00 20000.00"
             responses="-0.95 -0.91 -0.87 -0.84 -0.79 -0.77 -0.76 -0.75 -0.71 -0.67 -0.65 -0.63 -0.61 -0.61 -0.59 -0.56 -0.56 -0.53 -0.51 -0.50 -0.49 -0.46 -0.45 -0.41 -0.41 -0.37 -0.33 -0.32 -0.30 -0.28 -0.24 -0.23 -0.20 -0.19 -0.15 -0.15 -0.12 -0.09 -0.04 -0.01 0.00 0.02 0.05 0.11 0.14 0.19 0.23 0.31 0.44 0.52 0.63 0.69 0.75 0.84 1.22 1.19 1.13 1.20 1.27 1.36 1.40 1.56 1.65 1.88 1.99 2.11 2.33 2.54 2.89 3.15 3.35 4.08 4.99 5.38 5.05 5.54 6.44 6.66 10.40 8.75 8.47 9.10 8.62 16.96 14.69 16.88 19.24 25.51 29.41 42.32 31.65 33.96 25.48"
diff --git a/device.mk b/device.mk
index 8b5d33d..8e2f65a 100644
--- a/device.mk
+++ b/device.mk
@@ -59,6 +59,11 @@
     device/google/taimen/thermal-engine.conf:$(TARGET_COPY_OUT_VENDOR)/etc/thermal-engine.conf \
     device/google/taimen/thermal-engine-vr.conf:$(TARGET_COPY_OUT_VENDOR)/etc/thermal-engine-vr.conf
 
+# Thermal HAL
+PRODUCT_COPY_FILES += \
+    device/google/taimen/thermal_info_config.json:$(TARGET_COPY_OUT_VENDOR)/etc/thermal_info_config.json \
+    device/google/taimen/thermal_info_config_evt.json:$(TARGET_COPY_OUT_VENDOR)/etc/thermal_info_config_evt.json
+
 # Audio
 PRODUCT_COPY_FILES += \
     device/google/taimen/mixer_paths_tavil.xml:$(TARGET_COPY_OUT_VENDOR)/etc/mixer_paths_tavil_taimen.xml \
diff --git a/init-taimen.rc b/init-taimen.rc
index e80d49f..4a70d9e 100644
--- a/init-taimen.rc
+++ b/init-taimen.rc
@@ -46,3 +46,9 @@
 
 on property:persist.vendor.charge.start.level=* && property:sys.all.modules.ready=1
     write /sys/module/lge_battery/parameters/charge_start_level ${persist.vendor.charge.start.level}
+
+on late-init && property:ro.boot.revision=rev_a
+    setprop vendor.thermal.config thermal_info_config_evt.json
+
+on late-init && property:ro.boot.revision=rev_b
+    setprop vendor.thermal.config thermal_info_config_evt.json
diff --git a/overlay/frameworks/base/core/res/res/values/dimens.xml b/overlay/frameworks/base/core/res/res/values/dimens.xml
index 87a455b..95fb558 100755
--- a/overlay/frameworks/base/core/res/res/values/dimens.xml
+++ b/overlay/frameworks/base/core/res/res/values/dimens.xml
@@ -20,4 +20,5 @@
 <resources>
     <!-- Height of the status bar -->
     <dimen name="status_bar_height_portrait">28dp</dimen>
+    <dimen name="rounded_corner_radius">91px</dimen>
 </resources>
diff --git a/overlay/frameworks/base/core/res/res/xml/power_profile.xml b/overlay/frameworks/base/core/res/res/xml/power_profile.xml
index b9ab9f3..6854eb7 100644
--- a/overlay/frameworks/base/core/res/res/xml/power_profile.xml
+++ b/overlay/frameworks/base/core/res/res/xml/power_profile.xml
@@ -151,6 +151,8 @@
         <value>212.147</value> <!-- 2457 MHz CPU speed -->
     </array>
 
+    <!-- Additional power used when screen is ambient mode -->
+    <item name="ambient.on">19</item>
     <!-- Additional power used when screen is turned on at minimum brightness -->
     <item name="screen.on">152.118</item>
     <!-- Additional power used when screen is at maximum brightness, compared to
diff --git a/overlay/frameworks/base/packages/SystemUI/res/values/dimens.xml b/overlay/frameworks/base/packages/SystemUI/res/values/dimens.xml
index 1ade9bd..5088be4 100644
--- a/overlay/frameworks/base/packages/SystemUI/res/values/dimens.xml
+++ b/overlay/frameworks/base/packages/SystemUI/res/values/dimens.xml
@@ -16,6 +16,5 @@
 */
 -->
 <resources>
-    <dimen name="rounded_corner_radius">26dp</dimen>
     <dimen name="rounded_corner_content_padding">8dp</dimen>
 </resources>
diff --git a/thermal-engine.conf b/thermal-engine.conf
index 80a0ffe..d88175e 100755
--- a/thermal-engine.conf
+++ b/thermal-engine.conf
@@ -70,8 +70,8 @@
 algo_type		monitor
 sampling		1000
 sensor			bd_therm2
-thresholds		54000
-thresholds_clr		53000
+thresholds		56000
+thresholds_clr		55000
 actions 		shutdown
 action_info		1
 
@@ -137,8 +137,8 @@
 algo_type		monitor
 sampling		1000
 sensor			bd_therm
-thresholds		66000
-thresholds_clr		65000
+thresholds		68000
+thresholds_clr		67000
 actions 		shutdown
 action_info		1
 
diff --git a/thermal_info_config.json b/thermal_info_config.json
new file mode 100644
index 0000000..86720d8
--- /dev/null
+++ b/thermal_info_config.json
@@ -0,0 +1,204 @@
+{
+    "Sensors":[
+        {
+            "Name":"tsens_tz_sensor1",
+            "Type":"CPU",
+            "HotThreshold":[
+                "NAN",
+                "NAN",
+                "NAN",
+                95.0,
+                "NAN",
+                "NAN",
+                125.0
+            ],
+            "VrThreshold":"NAN",
+            "Multiplier":0.1
+        },
+        {
+            "Name":"tsens_tz_sensor2",
+            "Type":"CPU",
+            "HotThreshold":[
+                "NAN",
+                "NAN",
+                "NAN",
+                95.0,
+                "NAN",
+                "NAN",
+                125.0
+            ],
+            "VrThreshold":"NAN",
+            "Multiplier":0.1
+        },
+        {
+            "Name":"tsens_tz_sensor4",
+            "Type":"CPU",
+            "HotThreshold":[
+                "NAN",
+                "NAN",
+                "NAN",
+                95.0,
+                "NAN",
+                "NAN",
+                125.0
+            ],
+            "VrThreshold":"NAN",
+            "Multiplier":0.1
+        },
+        {
+            "Name":"tsens_tz_sensor3",
+            "Type":"CPU",
+            "HotThreshold":[
+                "NAN",
+                "NAN",
+                "NAN",
+                95.0,
+                "NAN",
+                "NAN",
+                125.0
+            ],
+            "VrThreshold":"NAN",
+            "Multiplier":0.1
+        },
+        {
+            "Name":"tsens_tz_sensor7",
+            "Type":"CPU",
+            "HotThreshold":[
+                "NAN",
+                "NAN",
+                "NAN",
+                95.0,
+                "NAN",
+                "NAN",
+                125.0
+            ],
+            "VrThreshold":"NAN",
+            "Multiplier":0.1
+        },
+        {
+            "Name":"tsens_tz_sensor8",
+            "Type":"CPU",
+            "HotThreshold":[
+                "NAN",
+                "NAN",
+                "NAN",
+                95.0,
+                "NAN",
+                "NAN",
+                125.0
+            ],
+            "VrThreshold":"NAN",
+            "Multiplier":0.1
+        },
+        {
+            "Name":"tsens_tz_sensor9",
+            "Type":"CPU",
+            "HotThreshold":[
+                "NAN",
+                "NAN",
+                "NAN",
+                95.0,
+                "NAN",
+                "NAN",
+                125.0
+            ],
+            "VrThreshold":"NAN",
+            "Multiplier":0.1
+        },
+        {
+            "Name":"tsens_tz_sensor10",
+            "Type":"CPU",
+            "HotThreshold":[
+                "NAN",
+                "NAN",
+                "NAN",
+                95.0,
+                "NAN",
+                "NAN",
+                125.0
+            ],
+            "VrThreshold":"NAN",
+            "Multiplier":0.1
+        },
+        {
+            "Name":"tsens_tz_sensor13",
+            "Type":"GPU",
+            "HotThreshold":[
+                "NAN",
+                "NAN",
+                "NAN",
+                95.0,
+                "NAN",
+                "NAN",
+                125.0
+            ],
+            "VrThreshold":"NAN",
+            "Multiplier":0.1
+        },
+        {
+            "Name":"battery",
+            "Type":"BATTERY",
+            "HotThreshold":[
+                "NAN",
+                "NAN",
+                "NAN",
+                "NAN",
+                "NAN",
+                "NAN",
+                60.0
+            ],
+            "VrThreshold":"NAN",
+            "Multiplier":0.001
+        },
+        {
+            "Name":"usb_port_temp",
+            "Type":"USB_PORT",
+            "HotThreshold":[
+                "NAN",
+                "NAN",
+                "NAN",
+                "NAN",
+                "NAN",
+                "NAN",
+                "NAN"
+            ],
+            "VrThreshold":"NAN",
+            "Multiplier":0.1
+        },
+        {
+            "Name":"bd_therm2",
+            "Type":"SKIN",
+            "HotThreshold":[
+                "NAN",
+                38.0,
+                45.0,
+                48.0,
+                50.0,
+                52.0,
+                54.0
+            ],
+            "HotHysteresis":[
+                0.0,
+                1.0,
+                1.0,
+                1.0,
+                1.0,
+                1.0,
+                1.0
+            ],
+            "VrThreshold":50.0,
+            "Multiplier":1.0,
+            "Monitor":true
+        }
+    ],
+    "CoolingDevices":[
+        {
+            "Name":"thermal-cpufreq-0",
+            "Type":"CPU"
+        },
+        {
+            "Name":"thermal-cpufreq-1",
+            "Type":"CPU"
+        }
+    ]
+}
diff --git a/thermal_info_config_evt.json b/thermal_info_config_evt.json
new file mode 100644
index 0000000..24b2433
--- /dev/null
+++ b/thermal_info_config_evt.json
@@ -0,0 +1,204 @@
+{
+    "Sensors":[
+        {
+            "Name":"tsens_tz_sensor1",
+            "Type":"CPU",
+            "HotThreshold":[
+                "NAN",
+                "NAN",
+                "NAN",
+                95.0,
+                "NAN",
+                "NAN",
+                125.0
+            ],
+            "VrThreshold":"NAN",
+            "Multiplier":0.1
+        },
+        {
+            "Name":"tsens_tz_sensor2",
+            "Type":"CPU",
+            "HotThreshold":[
+                "NAN",
+                "NAN",
+                "NAN",
+                95.0,
+                "NAN",
+                "NAN",
+                125.0
+            ],
+            "VrThreshold":"NAN",
+            "Multiplier":0.1
+        },
+        {
+            "Name":"tsens_tz_sensor4",
+            "Type":"CPU",
+            "HotThreshold":[
+                "NAN",
+                "NAN",
+                "NAN",
+                95.0,
+                "NAN",
+                "NAN",
+                125.0
+            ],
+            "VrThreshold":"NAN",
+            "Multiplier":0.1
+        },
+        {
+            "Name":"tsens_tz_sensor3",
+            "Type":"CPU",
+            "HotThreshold":[
+                "NAN",
+                "NAN",
+                "NAN",
+                95.0,
+                "NAN",
+                "NAN",
+                125.0
+            ],
+            "VrThreshold":"NAN",
+            "Multiplier":0.1
+        },
+        {
+            "Name":"tsens_tz_sensor7",
+            "Type":"CPU",
+            "HotThreshold":[
+                "NAN",
+                "NAN",
+                "NAN",
+                95.0,
+                "NAN",
+                "NAN",
+                125.0
+            ],
+            "VrThreshold":"NAN",
+            "Multiplier":0.1
+        },
+        {
+            "Name":"tsens_tz_sensor8",
+            "Type":"CPU",
+            "HotThreshold":[
+                "NAN",
+                "NAN",
+                "NAN",
+                95.0,
+                "NAN",
+                "NAN",
+                125.0
+            ],
+            "VrThreshold":"NAN",
+            "Multiplier":0.1
+        },
+        {
+            "Name":"tsens_tz_sensor9",
+            "Type":"CPU",
+            "HotThreshold":[
+                "NAN",
+                "NAN",
+                "NAN",
+                95.0,
+                "NAN",
+                "NAN",
+                125.0
+            ],
+            "VrThreshold":"NAN",
+            "Multiplier":0.1
+        },
+        {
+            "Name":"tsens_tz_sensor10",
+            "Type":"CPU",
+            "HotThreshold":[
+                "NAN",
+                "NAN",
+                "NAN",
+                95.0,
+                "NAN",
+                "NAN",
+                125.0
+            ],
+            "VrThreshold":"NAN",
+            "Multiplier":0.1
+        },
+        {
+            "Name":"tsens_tz_sensor13",
+            "Type":"GPU",
+            "HotThreshold":[
+                "NAN",
+                "NAN",
+                "NAN",
+                95.0,
+                "NAN",
+                "NAN",
+                125.0
+            ],
+            "VrThreshold":"NAN",
+            "Multiplier":0.1
+        },
+        {
+            "Name":"battery",
+            "Type":"BATTERY",
+            "HotThreshold":[
+                "NAN",
+                "NAN",
+                "NAN",
+                "NAN",
+                "NAN",
+                "NAN",
+                60.0
+            ],
+            "VrThreshold":"NAN",
+            "Multiplier":0.001
+        },
+        {
+            "Name":"usb_port_temp",
+            "Type":"USB_PORT",
+            "HotThreshold":[
+                "NAN",
+                "NAN",
+                "NAN",
+                "NAN",
+                "NAN",
+                "NAN",
+                "NAN"
+            ],
+            "VrThreshold":"NAN",
+            "Multiplier":0.1
+        },
+        {
+            "Name":"bd_therm",
+            "Type":"SKIN",
+            "HotThreshold":[
+                "NAN",
+                49.0,
+                51.0,
+                58.0,
+                60.0,
+                64.0,
+                66.0
+            ],
+            "HotHysteresis":[
+                0.0,
+                1.0,
+                1.0,
+                1.0,
+                1.0,
+                1.0,
+                1.0
+            ],
+            "VrThreshold":62.0,
+            "Multiplier":1.0,
+            "Monitor":true
+        }
+    ],
+    "CoolingDevices":[
+        {
+            "Name":"thermal-cpufreq-0",
+            "Type":"CPU"
+        },
+        {
+            "Name":"thermal-cpufreq-1",
+            "Type":"CPU"
+        }
+    ]
+}