Merge 24Q3 to AOSP main

Bug: 357762254
Merged-In: Id1e1267ab774725d18687193c1e168dc543a1e7d
Change-Id: I2e0f086cb2ebcc02314163c6a91c63040bf2adaf
diff --git a/USI_Stylus.idc b/USI_Stylus.idc
new file mode 100644
index 0000000..58d8d2c
--- /dev/null
+++ b/USI_Stylus.idc
@@ -0,0 +1,4 @@
+touch.orientationAware = 1
+touch.orientation = ORIENTATION_0
+touch.usiVersionMajor = 2
+touch.usiVersionMinor = 0
diff --git a/audio/tangorpro/aidl_config/mixer_paths_aidl.xml b/audio/tangorpro/aidl_config/mixer_paths_aidl.xml
index d89f751..e15a243 100644
--- a/audio/tangorpro/aidl_config/mixer_paths_aidl.xml
+++ b/audio/tangorpro/aidl_config/mixer_paths_aidl.xml
@@ -1410,7 +1410,7 @@
     <path name="bluetooth-sco-headset-microphones" />
   </path>
 
-  <path name="usb-headset-microphones">
+  <path name="usb-microphones">
     <ctl name="BUILDIN MIC ID CAPTURE LIST" id="0" value="0" />
     <ctl name="BUILDIN MIC ID CAPTURE LIST" id="1" value="3" />
     <ctl name="BUILDIN MIC ID CAPTURE LIST" id="2" value="2" />
@@ -1420,6 +1420,14 @@
     <ctl name="MIC Record Soft Gain (dB)" value="0" />
   </path>
 
+  <path name="usb-headset-microphones">
+    <path name="usb-microphones" />
+  </path>
+
+  <path name="usb-device-microphones">
+    <path name="usb-microphones" />
+  </path>
+
   <!-- cs35l41 specific path for rotation start -->
   <path name="cs35l41-rotation-0">
   </path>
diff --git a/audio/tangorpro/config/audio_platform_configuration.xml b/audio/tangorpro/config/audio_platform_configuration.xml
index 959b4c5..8271a90 100644
--- a/audio/tangorpro/config/audio_platform_configuration.xml
+++ b/audio/tangorpro/config/audio_platform_configuration.xml
@@ -254,6 +254,7 @@
         <feature name="SoundTriggerDockTuning"/>
         <feature name="BatteryThrottle=Type:BCL_VOLTAGE,Name:BCL_AUDIO_BAACL,Strategy:WholeSpeaker"/>
         <feature name="Apmg3"/>
+        <!--feature name="Pokebowl"/-->
     </features>
 
     <cfg_attr>
@@ -292,6 +293,7 @@
         <item component="TUNING_COMPONENT_WAVES" id="2"/>
         <item component="TUNING_COMPONENT_FORTEMEDIA" id="3"/>
         <item component="TUNING_COMPONENT_APMG3" id="24"/>
+        <!--item component="TUNING_COMPONENT_POKEBOWL" id="25"/-->
         <item component="TUNING_COMPONENT_CAMCORDER" id="6"/>
         <item component="TUNING_COMPONENT_STEREO_SPATIALIZER" id="26"/>
     </xlate_id>
@@ -312,6 +314,7 @@
         <module libname="audio_amcs_ext.so" argu="SpeakerNum=4" />
         <module libname="audio_bluenote_aoc.so"/>
         <module libname="audio_apmg3_aoc.so"/>
+        <!--module libname="audio_pokebowl_aoc.so"/-->
     </external_module>
 
     <hal_effect>
diff --git a/audio/tangorpro/config/audio_policy_configuration.xml b/audio/tangorpro/config/audio_policy_configuration.xml
index 7378357..2d1b259 100644
--- a/audio/tangorpro/config/audio_policy_configuration.xml
+++ b/audio/tangorpro/config/audio_policy_configuration.xml
@@ -136,10 +136,6 @@
                 </devicePort>
                 <devicePort tagName="Speaker Safe" type="AUDIO_DEVICE_OUT_SPEAKER_SAFE" role="sink">
                 </devicePort>
-                <devicePort tagName="Wired Headset" type="AUDIO_DEVICE_OUT_WIRED_HEADSET" role="sink">
-                </devicePort>
-                <devicePort tagName="Wired Headphones" type="AUDIO_DEVICE_OUT_WIRED_HEADPHONE" role="sink">
-                </devicePort>
                 <devicePort tagName="BT SCO" type="AUDIO_DEVICE_OUT_BLUETOOTH_SCO" role="sink">
                 </devicePort>
                 <devicePort tagName="BT SCO Headset" type="AUDIO_DEVICE_OUT_BLUETOOTH_SCO_HEADSET" role="sink">
@@ -152,8 +148,6 @@
                 </devicePort>
                 <devicePort tagName="USB Dock" type="AUDIO_DEVICE_OUT_DGTL_DOCK_HEADSET" role="sink">
                 </devicePort>
-                <devicePort tagName="Aux Digital" type="AUDIO_DEVICE_OUT_AUX_DIGITAL" role="sink">
-                </devicePort>
                 <devicePort tagName="Telephony Tx" type="AUDIO_DEVICE_OUT_TELEPHONY_TX" role="sink">
                 </devicePort>
                 <!-- Input devices declaration, i.e. Source DEVICE PORT -->
@@ -161,8 +155,6 @@
                 </devicePort>
                 <devicePort tagName="Built-In Back Mic" type="AUDIO_DEVICE_IN_BACK_MIC" role="source">
                 </devicePort>
-                <devicePort tagName="Wired Headset Mic" type="AUDIO_DEVICE_IN_WIRED_HEADSET" role="source">
-                </devicePort>
                 <devicePort tagName="BT SCO Headset Mic" type="AUDIO_DEVICE_IN_BLUETOOTH_SCO_HEADSET" role="source">
                 </devicePort>
                 <devicePort tagName="BT A2DP Out" type="AUDIO_DEVICE_OUT_BLUETOOTH_A2DP" role="sink"
diff --git a/audio/tangorpro/config/audio_policy_configuration_a2dp_offload_disabled.xml b/audio/tangorpro/config/audio_policy_configuration_a2dp_offload_disabled.xml
index 56dce30..6ecf25b 100644
--- a/audio/tangorpro/config/audio_policy_configuration_a2dp_offload_disabled.xml
+++ b/audio/tangorpro/config/audio_policy_configuration_a2dp_offload_disabled.xml
@@ -136,10 +136,6 @@
                 </devicePort>
                 <devicePort tagName="Speaker Safe" type="AUDIO_DEVICE_OUT_SPEAKER_SAFE" role="sink">
                 </devicePort>
-                <devicePort tagName="Wired Headset" type="AUDIO_DEVICE_OUT_WIRED_HEADSET" role="sink">
-                </devicePort>
-                <devicePort tagName="Wired Headphones" type="AUDIO_DEVICE_OUT_WIRED_HEADPHONE" role="sink">
-                </devicePort>
                 <devicePort tagName="BT SCO" type="AUDIO_DEVICE_OUT_BLUETOOTH_SCO" role="sink">
                 </devicePort>
                 <devicePort tagName="BT SCO Headset" type="AUDIO_DEVICE_OUT_BLUETOOTH_SCO_HEADSET" role="sink">
@@ -152,8 +148,6 @@
                 </devicePort>
                 <devicePort tagName="USB Dock" type="AUDIO_DEVICE_OUT_DGTL_DOCK_HEADSET" role="sink">
                 </devicePort>
-                <devicePort tagName="Aux Digital" type="AUDIO_DEVICE_OUT_AUX_DIGITAL" role="sink">
-                </devicePort>
                 <devicePort tagName="Telephony Tx" type="AUDIO_DEVICE_OUT_TELEPHONY_TX" role="sink">
                 </devicePort>
                 <!-- Input devices declaration, i.e. Source DEVICE PORT -->
@@ -161,8 +155,6 @@
                 </devicePort>
                 <devicePort tagName="Built-In Back Mic" type="AUDIO_DEVICE_IN_BACK_MIC" role="source">
                 </devicePort>
-                <devicePort tagName="Wired Headset Mic" type="AUDIO_DEVICE_IN_WIRED_HEADSET" role="source">
-                </devicePort>
                 <devicePort tagName="BT SCO Headset Mic" type="AUDIO_DEVICE_IN_BLUETOOTH_SCO_HEADSET" role="source">
                 </devicePort>
                 <devicePort tagName="USB Device In" type="AUDIO_DEVICE_IN_USB_DEVICE" role="source">
diff --git a/audio/tangorpro/config/audio_policy_configuration_bluetooth_legacy_hal.xml b/audio/tangorpro/config/audio_policy_configuration_bluetooth_legacy_hal.xml
index 47b581c..a510290 100644
--- a/audio/tangorpro/config/audio_policy_configuration_bluetooth_legacy_hal.xml
+++ b/audio/tangorpro/config/audio_policy_configuration_bluetooth_legacy_hal.xml
@@ -132,10 +132,6 @@
                 </devicePort>
                 <devicePort tagName="Speaker Safe" type="AUDIO_DEVICE_OUT_SPEAKER_SAFE" role="sink">
                 </devicePort>
-                <devicePort tagName="Wired Headset" type="AUDIO_DEVICE_OUT_WIRED_HEADSET" role="sink">
-                </devicePort>
-                <devicePort tagName="Wired Headphones" type="AUDIO_DEVICE_OUT_WIRED_HEADPHONE" role="sink">
-                </devicePort>
                 <devicePort tagName="BT SCO" type="AUDIO_DEVICE_OUT_BLUETOOTH_SCO" role="sink">
                 </devicePort>
                 <devicePort tagName="BT SCO Headset" type="AUDIO_DEVICE_OUT_BLUETOOTH_SCO_HEADSET" role="sink">
@@ -146,8 +142,6 @@
                 </devicePort>
                 <devicePort tagName="USB Headset Out" type="AUDIO_DEVICE_OUT_USB_HEADSET" role="sink">
                 </devicePort>
-                <devicePort tagName="Aux Digital" type="AUDIO_DEVICE_OUT_AUX_DIGITAL" role="sink">
-                </devicePort>
                 <devicePort tagName="Telephony Tx" type="AUDIO_DEVICE_OUT_TELEPHONY_TX" role="sink">
                 </devicePort>
                 <!-- Input devices declaration, i.e. Source DEVICE PORT -->
@@ -155,8 +149,6 @@
                 </devicePort>
                 <devicePort tagName="Built-In Back Mic" type="AUDIO_DEVICE_IN_BACK_MIC" role="source">
                 </devicePort>
-                <devicePort tagName="Wired Headset Mic" type="AUDIO_DEVICE_IN_WIRED_HEADSET" role="source">
-                </devicePort>
                 <devicePort tagName="BT SCO Headset Mic" type="AUDIO_DEVICE_IN_BLUETOOTH_SCO_HEADSET" role="source">
                 </devicePort>
                 <devicePort tagName="USB Device In" type="AUDIO_DEVICE_IN_USB_DEVICE" role="source">
diff --git a/audio/tangorpro/prebuilt/libspeechenhancer/arm32/libspeechenhancer.so b/audio/tangorpro/prebuilt/libspeechenhancer/arm32/libspeechenhancer.so
index 34906bf..74d302d 100644
--- a/audio/tangorpro/prebuilt/libspeechenhancer/arm32/libspeechenhancer.so
+++ b/audio/tangorpro/prebuilt/libspeechenhancer/arm32/libspeechenhancer.so
Binary files differ
diff --git a/audio/tangorpro/prebuilt/libspeechenhancer/arm64/libspeechenhancer.so b/audio/tangorpro/prebuilt/libspeechenhancer/arm64/libspeechenhancer.so
index b3afa18..173d82a 100644
--- a/audio/tangorpro/prebuilt/libspeechenhancer/arm64/libspeechenhancer.so
+++ b/audio/tangorpro/prebuilt/libspeechenhancer/arm64/libspeechenhancer.so
Binary files differ
diff --git a/device-tangorpro.mk b/device-tangorpro.mk
index 1584fba..2dcc4bc 100644
--- a/device-tangorpro.mk
+++ b/device-tangorpro.mk
@@ -14,18 +14,12 @@
 # limitations under the License.
 #
 
-TARGET_KERNEL_DIR ?= device/google/tangorpro-kernel
-TARGET_BOARD_KERNEL_HEADERS := device/google/tangorpro-kernel/kernel-headers
 TARGET_RECOVERY_DEFAULT_ROTATION := ROTATION_LEFT
 
-ifdef RELEASE_GOOGLE_TANGORPRO_KERNEL_VERSION
-TARGET_LINUX_KERNEL_VERSION := $(RELEASE_GOOGLE_TANGORPRO_KERNEL_VERSION)
-endif
-
-ifdef RELEASE_GOOGLE_TANGORPRO_KERNEL_DIR
-TARGET_KERNEL_DIR := $(RELEASE_GOOGLE_TANGORPRO_KERNEL_DIR)
-TARGET_BOARD_KERNEL_HEADERS := $(RELEASE_GOOGLE_TANGORPRO_KERNEL_DIR)/kernel-headers
-endif
+TARGET_LINUX_KERNEL_VERSION := $(RELEASE_KERNEL_TANGORPRO_VERSION)
+# Keeps flexibility for kasan and ufs builds
+TARGET_KERNEL_DIR ?= $(RELEASE_KERNEL_TANGORPRO_DIR)
+TARGET_BOARD_KERNEL_HEADERS ?= $(RELEASE_KERNEL_TANGORPRO_DIR)/kernel-headers
 
 BOARD_WITHOUT_RADIO := true
 
@@ -82,7 +76,8 @@
 # Touch files
 PRODUCT_COPY_FILES += \
         device/google/tangorpro/NVTCapacitiveTouchScreen.idc:$(TARGET_COPY_OUT_VENDOR)/usr/idc/NVTCapacitiveTouchScreen.idc \
-        device/google/tangorpro/NVTCapacitivePen.idc:$(TARGET_COPY_OUT_VENDOR)/usr/idc/NVTCapacitivePen.idc
+        device/google/tangorpro/NVTCapacitivePen.idc:$(TARGET_COPY_OUT_VENDOR)/usr/idc/NVTCapacitivePen.idc \
+        device/google/tangorpro/USI_Stylus.idc:$(TARGET_COPY_OUT_VENDOR)/usr/idc/USI_Stylus.idc
 
 # Init files
 PRODUCT_COPY_FILES += \
@@ -132,6 +127,10 @@
 PRODUCT_PRODUCT_PROPERTIES += \
 	persist.bluetooth.opus.enabled=true
 
+# Enable Bluetooth AutoOn feature
+PRODUCT_PRODUCT_PROPERTIES += \
+    bluetooth.server.automatic_turn_on=true
+
 # Keymaster HAL
 #LOCAL_KEYMASTER_PRODUCT_PACKAGE ?= [email protected]
 
@@ -171,13 +170,6 @@
 
 # Trusty liboemcrypto.so
 PRODUCT_SOONG_NAMESPACES += vendor/google_devices/tangorpro/prebuilts
-ifneq (,$(filter AP1%,$(RELEASE_PLATFORM_VERSION)))
-PRODUCT_SOONG_NAMESPACES += vendor/google_devices/tangorpro/prebuilts/trusty/24Q1
-else ifneq (,$(filter AP2% AP3%,$(RELEASE_PLATFORM_VERSION)))
-PRODUCT_SOONG_NAMESPACES += vendor/google_devices/tangorpro/prebuilts/trusty/24Q2
-else
-PRODUCT_SOONG_NAMESPACES += vendor/google_devices/tangorpro/prebuilts/trusty/trunk
-endif
 
 # Wifi SAP Interface Name
 PRODUCT_PROPERTY_OVERRIDES += \
@@ -283,7 +275,8 @@
     persist.vendor.camera.adjust_backend_min_freq_for_1p_front_video_1080p_30fps=1 \
     persist.vendor.camera.bypass_sensor_binning_resolution_condition=1 \
     persist.vendor.camera.extended_launch_boost=1 \
-    persist.vendor.camera.raise_buf_allocation_priority=1
+    persist.vendor.camera.raise_buf_allocation_priority=1 \
+    camera.enable_landscape_to_portrait=true
 
 # Enable camera exif model/make reporting
 PRODUCT_VENDOR_PROPERTIES += \
diff --git a/powerhint.json b/powerhint.json
index 45d5de6..79e1c35 100644
--- a/powerhint.json
+++ b/powerhint.json
@@ -1881,16 +1881,27 @@
       "PID_Du": 0.0,
       "UclampMin_On": true,
       "UclampMin_Init": 182,
+      "UclampMin_LoadUp": 514,
+      "UclampMin_LoadReset": 514,
       "UclampMin_High": 514,
       "UclampMin_Low": 2,
+      "UclampMax_EfficientBase": 500,
+      "UclampMax_EfficientOffset": 200,
       "SamplingWindow_P": 1,
       "SamplingWindow_I": 0,
       "SamplingWindow_D": 1,
       "ReportingRateLimitNs": 166666660,
-      "EarlyBoost_On": false,
-      "EarlyBoost_TimeFactor": 0.0,
       "TargetTimeFactor": 1.0,
-      "StaleTimeFactor": 15.0
+      "StaleTimeFactor": 15.0,
+      "HeuristicBoost_On": true,
+      "HBoostOnMissedCycles": 8,
+      "HBoostOffMaxAvgRatio": 4.0,
+      "HBoostOffMissedCycles": 5,
+      "HBoostPidPuFactor": 0.5,
+      "HBoostUclampMin": 722,
+      "JankCheckTimeFactor": 1.2,
+      "LowFrameRateThreshold": 25,
+      "MaxRecordsNum": 300
     },
     {
       "Name": "UiHighBoostWithoutPid",
@@ -1910,9 +1921,9 @@
       "UclampMin_Init": 250,
       "UclampMin_High": 197,
       "UclampMin_Low": 197,
+      "UclampMax_EfficientBase": 500,
+      "UclampMax_EfficientOffset": 200,
       "ReportingRateLimitNs": 1,
-      "EarlyBoost_On": false,
-      "EarlyBoost_TimeFactor": 0.0,
       "TargetTimeFactor": 1.0,
       "StaleTimeFactor": 5.0
     },
@@ -1934,9 +1945,9 @@
       "UclampMin_Init": 250,
       "UclampMin_High": 53,
       "UclampMin_Low": 53,
+      "UclampMax_EfficientBase": 500,
+      "UclampMax_EfficientOffset": 200,
       "ReportingRateLimitNs": 1,
-      "EarlyBoost_On": false,
-      "EarlyBoost_TimeFactor": 0.0,
       "TargetTimeFactor": 1.0,
       "StaleTimeFactor": 5.0
     },
@@ -1958,9 +1969,9 @@
       "UclampMin_Init": 250,
       "UclampMin_High": 0,
       "UclampMin_Low": 0,
+      "UclampMax_EfficientBase": 500,
+      "UclampMax_EfficientOffset": 200,
       "ReportingRateLimitNs": 1,
-      "EarlyBoost_On": false,
-      "EarlyBoost_TimeFactor": 0.0,
       "TargetTimeFactor": 1.0,
       "StaleTimeFactor": 5.0
     }
diff --git a/rro_overlays/UwbOverlay/res/values/config.xml b/rro_overlays/UwbOverlay/res/values/config.xml
index fcbfa5f..15cfbf4 100644
--- a/rro_overlays/UwbOverlay/res/values/config.xml
+++ b/rro_overlays/UwbOverlay/res/values/config.xml
@@ -63,4 +63,10 @@
     This works best with an FOV primer setting below 90 degrees to ensure that predictions are being
     used across the 90-degree threshold. -->
     <bool name="enable_azimuth_mirroring">false</bool>
+
+    <!-- Whether to use a persistent cache in the algorithm to determine country code or not.
+    If enabled, will fallback to the cache to determine device location for
+    UWB regulatory purposes when  other sources (telephony, wifi, location, etc) is not available.
+    -->
+    <bool name = "persistent_cache_use_for_country_code_enabled">true</bool>
 </resources>
diff --git a/tangorpro/BoardConfig.mk b/tangorpro/BoardConfig.mk
index ec39627..0a83b85 100644
--- a/tangorpro/BoardConfig.mk
+++ b/tangorpro/BoardConfig.mk
@@ -15,18 +15,15 @@
 #
 TARGET_BOARD_INFO_FILE := device/google/tangorpro/board-info.txt
 TARGET_BOOTLOADER_BOARD_NAME := tangorpro
-ifneq (,$(filter AP1%,$(RELEASE_PLATFORM_VERSION)))
-RELEASE_GOOGLE_PRODUCT_BOOTLOADER_DIR := bootloader/24Q1
-else ifneq (,$(filter AP2% AP3%,$(RELEASE_PLATFORM_VERSION)))
-RELEASE_GOOGLE_PRODUCT_BOOTLOADER_DIR := bootloader/24Q2
-else
-RELEASE_GOOGLE_PRODUCT_BOOTLOADER_DIR := bootloader/trunk
-endif
+RELEASE_GOOGLE_BOOTLOADER_TANGORPRO_DIR ?= pdk # Keep this for pdk TODO: b/327119000
+RELEASE_GOOGLE_PRODUCT_BOOTLOADER_DIR := bootloader/$(RELEASE_GOOGLE_BOOTLOADER_TANGORPRO_DIR)
+$(call soong_config_set,tangorpro_bootloader,prebuilt_dir,$(RELEASE_GOOGLE_BOOTLOADER_TANGORPRO_DIR))
 
 # Enable load module in parallel
 BOARD_BOOTCONFIG += androidboot.load_modules_parallel=true
 
 # The modules which need to be loaded in sequential
+BOARD_KERNEL_CMDLINE += fips140.load_sequential=1
 BOARD_KERNEL_CMDLINE += exynos_drm.load_sequential=1
 
 ifdef PHONE_CAR_BOARD_PRODUCT
diff --git a/thermal_info_config_tangorpro.json b/thermal_info_config_tangorpro.json
index 1aa4981..5260a34 100644
--- a/thermal_info_config_tangorpro.json
+++ b/thermal_info_config_tangorpro.json
@@ -630,38 +630,6 @@
             "HotHysteresis":[0.0, 0.0, 0.0, 0.0, 100, 0.0, 0.0],
             "Multiplier":1,
             "Hidden":true
-        },
-        {
-            "Name":"soft_ocp_cpu2",
-            "Type":"BCL_CURRENT",
-            "HotThreshold":["NAN", "NAN", "NAN", "NAN", 12000, "NAN", "NAN"],
-            "HotHysteresis":[0.0, 0.0, 0.0, 0.0, 100, 0.0, 0.0],
-            "Multiplier":1,
-            "Hidden":true
-        },
-        {
-            "Name":"soft_ocp_cpu1",
-            "Type":"BCL_CURRENT",
-            "HotThreshold":["NAN", "NAN", "NAN", "NAN", 8000, "NAN", "NAN"],
-            "HotHysteresis":[0.0, 0.0, 0.0, 0.0, 100, 0.0, 0.0],
-            "Multiplier":1,
-            "Hidden":true
-        },
-        {
-            "Name":"soft_ocp_tpu",
-            "Type":"BCL_CURRENT",
-            "HotThreshold":["NAN", "NAN", "NAN", "NAN", 8500, "NAN", "NAN"],
-            "HotHysteresis":[0.0, 0.0, 0.0, 0.0, 100, 0.0, 0.0],
-            "Multiplier":1,
-            "Hidden":true
-        },
-        {
-            "Name":"soft_ocp_gpu",
-            "Type":"BCL_CURRENT",
-            "HotThreshold":["NAN", "NAN", "NAN", "NAN", 9000, "NAN", "NAN"],
-            "HotHysteresis":[0.0, 0.0, 0.0, 0.0, 100, 0.0, 0.0],
-            "Multiplier":1,
-            "Hidden":true
         }
     ],
     "CoolingDevices":[