Merge ab/7061308 into stage.

Bug: 180401296
Merged-In: If9dead858eae636267b36f3fa8fdecea4195a21c
Change-Id: Ie5b6e5a83380a10bcd98812d232d378593f8b458
diff --git a/audio/sound_trigger_mixer_paths.xml b/audio/sound_trigger_mixer_paths.xml
index d7b62fa..5bfd5a7 100644
--- a/audio/sound_trigger_mixer_paths.xml
+++ b/audio/sound_trigger_mixer_paths.xml
@@ -91,9 +91,9 @@
     <ctl name="EC Reference SampleRate" value="0"/>
     <ctl name="PRI_TDM_TX_0 LSM Function" value="None" />
     <ctl name="PRI_TDM_TX_0 Channels" value="One" />
-    <ctl name="Sto1 ADC MIXL DMIC Switch" value="0" />
-    <ctl name="Sto2 ADC MIXL DMIC Switch" value="0" />
-    <ctl name="Sto2 ADC MIXR DMIC Switch" value="0" />
+    <ctl name="Sto1 ADC MIXL BargeIn DMIC Switch" value="0" />
+    <ctl name="Sto2 ADC MIXL BargeIn DMIC Switch" value="0" />
+    <ctl name="Sto2 ADC MIXR BargeIn DMIC Switch" value="0" />
 
     <path name="listen-voice-wakeup-1">
         <ctl name="PRI_TDM_TX_0 LSM Function" value="AUDIO" />
@@ -259,15 +259,15 @@
         <ctl name="ADC1 Capture Volume" value="23" />
         <ctl name="ADC2 Capture Volume" value="23" />
         <ctl name="PRI_TDM_TX_0 Channels" value="One" />
-        <ctl name="Sto1 ADC MIXL DMIC Switch" value="1" />
+        <ctl name="Sto1 ADC MIXL BargeIn DMIC Switch" value="1" />
     </path>
 
     <path name="listen-ape-handset-dmic">
         <ctl name="ADC1 Capture Volume" value="23"/>
         <ctl name="ADC2 Capture Volume" value="23"/>
         <ctl name="PRI_TDM_TX_0 Channels" value="Two"/>
-        <ctl name="Sto1 ADC MIXL DMIC Switch" value="1" />
-        <ctl name="Sto2 ADC MIXL DMIC Switch" value="1" />
+        <ctl name="Sto1 ADC MIXL BargeIn DMIC Switch" value="1" />
+        <ctl name="Sto2 ADC MIXL BargeIn DMIC Switch" value="1" />
     </path>
 
     <path name="listen-ape-handset-tmic">
diff --git a/bramble/init.bramble.rc b/bramble/init.bramble.rc
index e6b5830..641f428 100644
--- a/bramble/init.bramble.rc
+++ b/bramble/init.bramble.rc
@@ -39,6 +39,8 @@
     class core
     group system wakelock
 
-# Override thermal HAL config for B5M
-on property:ro.boot.hardware.majorid=0x0F
-    setprop vendor.thermal.config thermal_info_config_m.json
+on late-init
+    chown system system /sys/devices/virtual/thermal/tz-by-name/skin-therm-monitor/trip_point_0_temp
+    chown system system /sys/devices/virtual/thermal/tz-by-name/skin-therm-monitor/trip_point_0_hyst
+    chown system system /sys/devices/virtual/thermal/tz-by-name/usbc-therm-monitor/trip_point_0_temp
+    chown system system /sys/devices/virtual/thermal/tz-by-name/usbc-therm-monitor/trip_point_0_hyst
diff --git a/device-bramble.mk b/device-bramble.mk
index 7069eb6..f7f248c 100644
--- a/device-bramble.mk
+++ b/device-bramble.mk
@@ -18,15 +18,15 @@
 
 ifeq ($(TARGET_PREBUILT_KERNEL),)
     ifneq (,$(filter userdebug eng, $(TARGET_BUILD_VARIANT)))
-        LOCAL_KERNEL := device/google/bramble-kernel/Image.lz4
+        LOCAL_KERNEL := device/google/redbull-kernel/Image.lz4
     else
-        LOCAL_KERNEL := device/google/bramble-kernel/vintf/Image.lz4
+        LOCAL_KERNEL := device/google/redbull-kernel/vintf/Image.lz4
     endif
 else
     LOCAL_KERNEL := $(TARGET_PREBUILT_KERNEL)
 endif
 
-PRODUCT_VENDOR_KERNEL_HEADERS := device/google/bramble-kernel/sm7250/kernel-headers
+PRODUCT_VENDOR_KERNEL_HEADERS := device/google/redbull-kernel/sm7250/kernel-headers
 
 include build/make/target/product/iorap_large_memory_config.mk
 include device/google/redbull/device-common.mk
@@ -153,7 +153,6 @@
 # Thermal HAL config
 PRODUCT_COPY_FILES += \
     $(LOCAL_PATH)/thermal_info_config_$(PRODUCT_HARDWARE).json:$(TARGET_COPY_OUT_VENDOR)/etc/thermal_info_config.json \
-    $(LOCAL_PATH)/thermal_info_config_$(PRODUCT_HARDWARE)_m.json:$(TARGET_COPY_OUT_VENDOR)/etc/thermal_info_config_m.json
 
 # Support to disable thermal protection at run time
 ifneq (,$(filter userdebug eng, $(TARGET_BUILD_VARIANT)))
@@ -196,4 +195,4 @@
     SettingsOverlayG025E
 
 # Keyboard bottom padding in dp for portrait mode
-PRODUCT_PRODUCT_PROPERTIES += ro.com.google.ime.kb_pad_port_b=10
\ No newline at end of file
+PRODUCT_PRODUCT_PROPERTIES += ro.com.google.ime.kb_pad_port_b=10
diff --git a/dumpstate/DumpstateDevice.cpp b/dumpstate/DumpstateDevice.cpp
index 4b9737b..e355c36 100755
--- a/dumpstate/DumpstateDevice.cpp
+++ b/dumpstate/DumpstateDevice.cpp
@@ -685,6 +685,9 @@
     DumpFileToFd(fd, "TTF details", "/sys/class/power_supply/battery/ttf_details");
     DumpFileToFd(fd, "TTF stats", "/sys/class/power_supply/battery/ttf_stats");
     DumpFileToFd(fd, "ipc-local-ports", "/d/msm_ipc_router/dump_local_ports");
+    RunCommandToFd(fd, "TRICKLE-DEFEND Config", {"/vendor/bin/sh", "-c", " cd /sys/devices/platform/soc/soc:google,battery/power_supply/battery/; echo \"bd_trickle_enable: `cat bd_trickle_enable`\"; echo \"bd_trickle_cnt: `cat bd_trickle_cnt`\";  echo \"bd_trickle_recharge_soc: `cat bd_trickle_recharge_soc`\";  echo \"bd_trickle_dry_run: `cat bd_trickle_dry_run`\";  echo \"bd_trickle_reset_sec: `cat bd_trickle_reset_sec`\""});
+    RunCommandToFd(fd, "DWELL-DEFEND Config", {"/vendor/bin/sh", "-c", " cd /sys/devices/platform/soc/soc:google,charger/; for f in `ls charge_s*` ; do echo \"$f: `cat $f`\" ; done"});
+    RunCommandToFd(fd, "TEMP-DEFEND Config", {"/vendor/bin/sh", "-c", " cd /sys/devices/platform/soc/soc:google,charger/; for f in `ls bd_*` ; do echo \"$f: `cat $f`\" ; done"});
     RunCommandToFd(fd, "USB Device Descriptors", {"/vendor/bin/sh", "-c", "cd /sys/bus/usb/devices/1-1 && cat product && cat bcdDevice; cat descriptors | od -t x1 -w16 -N96"});
     RunCommandToFd(fd, "Power supply properties", {"/vendor/bin/sh", "-c", "for f in `ls /sys/class/power_supply/*/uevent` ; do echo \"------ $f\\n`cat $f`\\n\" ; done"});
     RunCommandToFd(fd, "PMIC Votables", {"/vendor/bin/sh", "-c", "cat /sys/kernel/debug/pmic-votable/*/status"});
diff --git a/gnss_antenna_info.conf b/gnss_antenna_info.conf
index 2b5ba03..79a2aef 100644
--- a/gnss_antenna_info.conf
+++ b/gnss_antenna_info.conf
@@ -71,6 +71,14 @@
 # SIGNAL_GAIN_CORRECTION_UNC
 #   2D vectors of 1-sigma uncertainty in dBi associated with the signal
 #   gain correction values.
+#
+# The number of rows and columns could be the same for PC variation correction
+# and signal gain corrections, or could be different
+# If the former then NUMBER_OF_ROWS_ and NUMBER_OF_COLUMNS_ are specified once
+# only, if the latter then NUMBER_OF_ROWS_ and NUMBER_OF_COLUMNS_ represent
+# the number of rows/columns for PC variation correction and
+# NUMBER_OF_ROWS_SGC_ and NUMBER_OF_COLUMNS_SGC_ represent the number of
+# rows/columns for signal gain corrections
 
 ANTENNA_INFO_VECTOR_SIZE = 2
 
@@ -104,6 +112,8 @@
 
 NUMBER_OF_ROWS_1 = 4
 NUMBER_OF_COLUMNS_1 = 2
+NUMBER_OF_ROWS_SGC_1 = 3
+NUMBER_OF_COLUMNS_SGC_1 = 4
 
 PC_VARIATION_CORRECTION_1_ROW_0 = 55.66 77.88
 PC_VARIATION_CORRECTION_1_ROW_1 = 11.22 33.44
@@ -115,12 +125,10 @@
 PC_VARIATION_CORRECTION_UNC_1_ROW_2 = 2.1 2.2
 PC_VARIATION_CORRECTION_UNC_1_ROW_3 = 0.1 0.2
 
-SIGNAL_GAIN_CORRECTION_1_ROW_0 = 7.6 6.5
-SIGNAL_GAIN_CORRECTION_1_ROW_1 = 5.4 4.3
-SIGNAL_GAIN_CORRECTION_1_ROW_2 = 1.3 2.4
-SIGNAL_GAIN_CORRECTION_1_ROW_3 = 9.8 8.7
+SIGNAL_GAIN_CORRECTION_1_ROW_0 = 7.6 6.5 5.4 4.3
+SIGNAL_GAIN_CORRECTION_1_ROW_1 = 1.3 2.4 9.8 8.7
+SIGNAL_GAIN_CORRECTION_1_ROW_2 = 1.4 2.5 3.6 4.7
 
-SIGNAL_GAIN_CORRECTION_UNC_1_ROW_0 = 0.91 0.92
-SIGNAL_GAIN_CORRECTION_UNC_1_ROW_1 = 0.55 0.66
-SIGNAL_GAIN_CORRECTION_UNC_1_ROW_2 = 0.11 0.22
-SIGNAL_GAIN_CORRECTION_UNC_1_ROW_3 = 0.93 0.94
+SIGNAL_GAIN_CORRECTION_UNC_1_ROW_0 = 0.91 0.92 0.55 0.66
+SIGNAL_GAIN_CORRECTION_UNC_1_ROW_1 = 0.11 0.22 0.93 0.94
+SIGNAL_GAIN_CORRECTION_UNC_1_ROW_2 = 0.95 0.96 0.33 0.44
diff --git a/self-extractors/extract-lists.txt b/self-extractors/extract-lists.txt
index 5bcef9e..a08a5b2 100644
--- a/self-extractors/extract-lists.txt
+++ b/self-extractors/extract-lists.txt
@@ -10,6 +10,8 @@
             system_ext/etc/permissions/com.qualcomm.qcrilmsgtunnel.xml \
             system_ext/etc/permissions/org_codeaurora_ims.xml \
             system_ext/etc/permissions/qcrilhook.xml \
+            system_ext/etc/permissions/qti_telephony_hidl_wrapper.xml \
+            system_ext/etc/permissions/qti_telephony_utils.xml \
             system_ext/etc/permissions/telephonyservice.xml \
             system_ext/framework/com.qualcomm.qti.imscmservice-V2.0-java.jar \
             system_ext/framework/com.qualcomm.qti.imscmservice-V2.1-java.jar \
diff --git a/self-extractors/qcom/staging/device-partial.mk b/self-extractors/qcom/staging/device-partial.mk
index 1677e71..0c4603b 100644
--- a/self-extractors/qcom/staging/device-partial.mk
+++ b/self-extractors/qcom/staging/device-partial.mk
@@ -37,6 +37,8 @@
      vendor/qcom/bramble/proprietary/com.qualcomm.qcrilmsgtunnel.xml:system_ext/etc/permissions/com.qualcomm.qcrilmsgtunnel.xml \
      vendor/qcom/bramble/proprietary/org_codeaurora_ims.xml:system_ext/etc/permissions/org_codeaurora_ims.xml \
      vendor/qcom/bramble/proprietary/qcrilhook.xml:system_ext/etc/permissions/qcrilhook.xml \
+     vendor/qcom/bramble/proprietary/qti_telephony_hidl_wrapper.xml:system_ext/etc/permissions/qti_telephony_hidl_wrapper.xml \
+     vendor/qcom/bramble/proprietary/qti_telephony_utils.xml:system_ext/etc/permissions/qti_telephony_utils.xml \
      vendor/qcom/bramble/proprietary/telephonyservice.xml:system_ext/etc/permissions/telephonyservice.xml \
      vendor/qcom/bramble/proprietary/com.qualcomm.qti.imscmservice-V2.0-java.jar:system_ext/framework/com.qualcomm.qti.imscmservice-V2.0-java.jar \
      vendor/qcom/bramble/proprietary/com.qualcomm.qti.imscmservice-V2.1-java.jar:system_ext/framework/com.qualcomm.qti.imscmservice-V2.1-java.jar \
diff --git a/thermal_info_config_bramble_m.json b/thermal_info_config_bramble_m.json
deleted file mode 100644
index ae7e2da..0000000
--- a/thermal_info_config_bramble_m.json
+++ /dev/null
@@ -1,297 +0,0 @@
-{
-    "Sensors":[
-        {
-            "Name":"cpu-0-0-usr",
-            "Type":"CPU",
-            "HotThreshold":[
-                "NAN",
-                "NAN",
-                "NAN",
-                95.0,
-                "NAN",
-                "NAN",
-                125.0
-            ],
-            "VrThreshold":"NAN",
-            "Multiplier":0.001
-        },
-        {
-            "Name":"cpu-0-1-usr",
-            "Type":"CPU",
-            "HotThreshold":[
-                "NAN",
-                "NAN",
-                "NAN",
-                95.0,
-                "NAN",
-                "NAN",
-                125.0
-            ],
-            "VrThreshold":"NAN",
-            "Multiplier":0.001
-        },
-        {
-            "Name":"cpu-0-2-usr",
-            "Type":"CPU",
-            "HotThreshold":[
-                "NAN",
-                "NAN",
-                "NAN",
-                95.0,
-                "NAN",
-                "NAN",
-                125.0
-            ],
-            "VrThreshold":"NAN",
-            "Multiplier":0.001
-        },
-        {
-            "Name":"cpu-0-3-usr",
-            "Type":"CPU",
-            "HotThreshold":[
-                "NAN",
-                "NAN",
-                "NAN",
-                95.0,
-                "NAN",
-                "NAN",
-                125.0
-            ],
-            "VrThreshold":"NAN",
-            "Multiplier":0.001
-        },
-        {
-            "Name":"cpu-0-4-usr",
-            "Type":"CPU",
-            "HotThreshold":[
-                "NAN",
-                "NAN",
-                "NAN",
-                95.0,
-                "NAN",
-                "NAN",
-                125.0
-            ],
-            "VrThreshold":"NAN",
-            "Multiplier":0.001
-        },
-        {
-            "Name":"cpu-0-5-usr",
-            "Type":"CPU",
-            "HotThreshold":[
-                "NAN",
-                "NAN",
-                "NAN",
-                95.0,
-                "NAN",
-                "NAN",
-                125.0
-            ],
-            "VrThreshold":"NAN",
-            "Multiplier":0.001
-        },
-        {
-            "Name":"cpu-1-0-usr",
-            "Type":"CPU",
-            "HotThreshold":[
-                "NAN",
-                "NAN",
-                "NAN",
-                95.0,
-                "NAN",
-                "NAN",
-                125.0
-            ],
-            "VrThreshold":"NAN",
-            "Multiplier":0.001
-        },
-        {
-            "Name":"cpu-1-1-usr",
-            "Type":"CPU",
-            "HotThreshold":[
-                "NAN",
-                "NAN",
-                "NAN",
-                95.0,
-                "NAN",
-                "NAN",
-                125.0
-            ],
-            "VrThreshold":"NAN",
-            "Multiplier":0.001
-        },
-        {
-            "Name":"cpu-1-2-usr",
-            "Type":"CPU",
-            "HotThreshold":[
-                "NAN",
-                "NAN",
-                "NAN",
-                95.0,
-                "NAN",
-                "NAN",
-                125.0
-            ],
-            "VrThreshold":"NAN",
-            "Multiplier":0.001
-        },
-        {
-            "Name":"cpu-1-3-usr",
-            "Type":"CPU",
-            "HotThreshold":[
-                "NAN",
-                "NAN",
-                "NAN",
-                95.0,
-                "NAN",
-                "NAN",
-                125.0
-            ],
-            "VrThreshold":"NAN",
-            "Multiplier":0.001
-        },
-        {
-            "Name":"gpuss-0-usr",
-            "Type":"GPU",
-            "HotThreshold":[
-                "NAN",
-                "NAN",
-                "NAN",
-                95.0,
-                "NAN",
-                "NAN",
-                125.0
-            ],
-            "VrThreshold":"NAN",
-            "Multiplier":0.001
-        },
-        {
-            "Name":"gpuss-1-usr",
-            "Type":"GPU",
-            "HotThreshold":[
-                "NAN",
-                "NAN",
-                "NAN",
-                95.0,
-                "NAN",
-                "NAN",
-                125.0
-            ],
-            "VrThreshold":"NAN",
-            "Multiplier":0.001
-        },
-        {
-            "Name":"battery",
-            "Type":"BATTERY",
-            "HotThreshold":[
-                "NAN",
-                "NAN",
-                "NAN",
-                "NAN",
-                "NAN",
-                "NAN",
-                60.0
-            ],
-            "VrThreshold":"NAN",
-            "Multiplier":0.001
-        },
-        {
-            "Name":"skin-therm-monitor",
-            "Type":"SKIN",
-            "HotThreshold":[
-                "NAN",
-                37.0,
-                41.0,
-                43.0,
-                45.0,
-                49.0,
-                53.0
-            ],
-            "HotHysteresis":[
-                0.0,
-                1.9,
-                1.9,
-                1.9,
-                1.9,
-                1.9,
-                1.9
-            ],
-            "VrThreshold":"NAN",
-            "Multiplier":0.001,
-            "Monitor":true,
-            "SendPowerHint":true
-        },
-        {
-            "Name":"cellular-emergency",
-            "Type":"POWER_AMPLIFIER",
-            "HotThreshold":[
-                "NAN",
-                "NAN",
-                "NAN",
-                "NAN",
-                "NAN",
-                "51.0",
-                "NAN"
-            ],
-            "HotHysteresis":[
-                0.0,
-                0.0,
-                0.0,
-                0.0,
-                0.0,
-                1.9,
-                0.0
-            ],
-            "VrThreshold":"NAN",
-            "Multiplier":0.001,
-            "Monitor":true
-        },
-        {
-            "Name":"usbc-therm-monitor",
-            "Type":"USB_PORT",
-            "HotThreshold":[
-                "NAN",
-                "NAN",
-                "NAN",
-                "NAN",
-                "NAN",
-                "70.0",
-                "NAN"
-            ],
-            "HotHysteresis":[
-                0.0,
-                0.0,
-                0.0,
-                0.0,
-                0.0,
-                5.0,
-                0.0
-            ],
-            "VrThreshold":"NAN",
-            "Multiplier":0.001,
-            "Monitor":true
-        }
-    ],
-    "CoolingDevices":[
-        {
-            "Name":"thermal-cpufreq-0",
-            "Type":"CPU"
-        },
-        {
-            "Name":"thermal-cpufreq-6",
-            "Type":"CPU"
-        },
-        {
-            "Name":"thermal-cpufreq-7",
-            "Type":"CPU"
-        },
-        {
-            "Name":"thermal-devfreq-0",
-            "Type":"GPU"
-        },
-        {
-            "Name":"fcc",
-            "Type":"BATTERY"
-        }
-    ]
-}