Merge "Deprecate PRODUCT_STATIC_BOOT_CONTROL_HAL."
diff --git a/audio/rt5514_dsp_fw1.bin b/audio/rt5514_dsp_fw1.bin
index 138d47a..1b7ea9f 100644
--- a/audio/rt5514_dsp_fw1.bin
+++ b/audio/rt5514_dsp_fw1.bin
Binary files differ
diff --git a/audio/rt5514_dsp_fw2.bin b/audio/rt5514_dsp_fw2.bin
index ed44abd..bb8b13b 100644
--- a/audio/rt5514_dsp_fw2.bin
+++ b/audio/rt5514_dsp_fw2.bin
Binary files differ
diff --git a/audio/rt5514_dsp_fw3.bin b/audio/rt5514_dsp_fw3.bin
index e068531..0d90a93 100644
--- a/audio/rt5514_dsp_fw3.bin
+++ b/audio/rt5514_dsp_fw3.bin
Binary files differ
diff --git a/audio/rt5514_dsp_fw4.bin b/audio/rt5514_dsp_fw4.bin
new file mode 100644
index 0000000..9e334a1
--- /dev/null
+++ b/audio/rt5514_dsp_fw4.bin
Binary files differ
diff --git a/audio_platform_info_intcodec_b4.xml b/audio_platform_info_intcodec_b4.xml
index 53a82d9..b18b5b3 100644
--- a/audio_platform_info_intcodec_b4.xml
+++ b/audio_platform_info_intcodec_b4.xml
@@ -47,6 +47,7 @@
         <device name="SND_DEVICE_OUT_VOICE_SPEAKER_PROTECTED" acdb_id="14"/>
         <device name="SND_DEVICE_IN_VOICE_SPEAKER_DMIC" acdb_id="19"/>
         <device name="SND_DEVICE_IN_VOICE_SPEAKER_MIC" acdb_id="19"/>
+        <device name="SND_DEVICE_IN_SPEAKER_MIC" acdb_id="117"/>
         <device name="SND_DEVICE_OUT_VOICE_HAC_HANDSET" acdb_id="201"/>
         <device name="SND_DEVICE_IN_HEADSET_MIC" acdb_id="8"/>
         <device name="SND_DEVICE_IN_VOICE_DMIC_TMUS" acdb_id="99"/>
diff --git a/audio_platform_info_intcodec_s4.xml b/audio_platform_info_intcodec_s4.xml
index 0426753..0a31eef 100644
--- a/audio_platform_info_intcodec_s4.xml
+++ b/audio_platform_info_intcodec_s4.xml
@@ -47,6 +47,7 @@
         <device name="SND_DEVICE_OUT_VOICE_SPEAKER_PROTECTED" acdb_id="14"/>
         <device name="SND_DEVICE_IN_VOICE_SPEAKER_DMIC" acdb_id="19"/>
         <device name="SND_DEVICE_IN_VOICE_SPEAKER_MIC" acdb_id="19"/>
+        <device name="SND_DEVICE_IN_SPEAKER_MIC" acdb_id="117"/>
         <device name="SND_DEVICE_OUT_VOICE_HAC_HANDSET" acdb_id="201"/>
         <device name="SND_DEVICE_IN_HEADSET_MIC" acdb_id="8"/>
         <device name="SND_DEVICE_IN_VOICE_DMIC_TMUS" acdb_id="99"/>
diff --git a/device-bonito.mk b/device-bonito.mk
index 9086c03..da2eb08 100644
--- a/device-bonito.mk
+++ b/device-bonito.mk
@@ -46,4 +46,4 @@
 
 # Add white point compensated coefficient
 PRODUCT_PROPERTY_OVERRIDES += \
-    vendor.display.white_point_compensated_coefficient=0.0051,-0.3462,18.964,0.0047,-0.1155,-10.312,0.005,-0.2931,12.301
+    vendor.display.adaptive_white_coefficient=0.0051,-0.3462,18.964,0.0047,-0.1155,-10.312,0.005,-0.2931,12.301
diff --git a/device-sargo.mk b/device-sargo.mk
index f8c185a..2edf645 100644
--- a/device-sargo.mk
+++ b/device-sargo.mk
@@ -48,4 +48,4 @@
 
 # Add white point compensated coefficient
 PRODUCT_PROPERTY_OVERRIDES += \
-    vendor.display.white_point_compensated_coefficient=0.0031,0.5535,-87.498,0.0031,0.5535,-87.498,0.0031,0.5535,-87.498
+    vendor.display.adaptive_white_coefficient=0.0031,0.5535,-87.498,0.0031,0.5535,-87.498,0.0031,0.5535,-87.498
diff --git a/device.mk b/device.mk
index 10d8aa1..b0bcdfb 100644
--- a/device.mk
+++ b/device.mk
@@ -91,6 +91,7 @@
     $(LOCAL_PATH)/init.insmod.sh:$(TARGET_COPY_OUT_VENDOR)/bin/init.insmod.sh \
     $(LOCAL_PATH)/init.insmod.cfg:$(TARGET_COPY_OUT_VENDOR)/etc/init.insmod.cfg \
     $(LOCAL_PATH)/thermal-engine-$(PRODUCT_HARDWARE).conf:$(TARGET_COPY_OUT_VENDOR)/etc/thermal-engine-$(PRODUCT_HARDWARE).conf \
+    $(LOCAL_PATH)/init.firstboot.sh:$(TARGET_COPY_OUT_VENDOR)/bin/init.firstboot.sh \
     $(LOCAL_PATH)/init.ramoops.sh:$(TARGET_COPY_OUT_VENDOR)/bin/init.ramoops.sh
 
 # Edge Sense initialization script.
@@ -242,6 +243,10 @@
     vendor.display.foss.config=1 \
     vendor.display.foss.config_path=/vendor/etc/FOSSConfig.xml
 
+# Add saturation parameters
+PRODUCT_PROPERTY_OVERRIDES += \
+    vendor.display.adaptive_saturation_parameter=1.1574,-0.0426,-0.0426,-0.143,1.057,-0.143,-0.0144,-0.0144,1.1856
+
 # b/73168288
 PRODUCT_PROPERTY_OVERRIDES += \
     vendor.display.disable_rotator_downscale=1
@@ -726,7 +731,8 @@
 PRODUCT_COPY_FILES += \
     device/google/bonito/audio/rt5514_dsp_fw1.bin:$(TARGET_COPY_OUT_VENDOR)/firmware/rt5514_dsp_fw1.bin \
     device/google/bonito/audio/rt5514_dsp_fw2.bin:$(TARGET_COPY_OUT_VENDOR)/firmware/rt5514_dsp_fw2.bin \
-    device/google/bonito/audio/rt5514_dsp_fw3.bin:$(TARGET_COPY_OUT_VENDOR)/firmware/rt5514_dsp_fw3.bin
+    device/google/bonito/audio/rt5514_dsp_fw3.bin:$(TARGET_COPY_OUT_VENDOR)/firmware/rt5514_dsp_fw3.bin \
+    device/google/bonito/audio/rt5514_dsp_fw4.bin:$(TARGET_COPY_OUT_VENDOR)/firmware/rt5514_dsp_fw4.bin
 
 # Keymaster configuration
 PRODUCT_COPY_FILES += \
diff --git a/init.firstboot.sh b/init.firstboot.sh
new file mode 100755
index 0000000..05a1b85
--- /dev/null
+++ b/init.firstboot.sh
@@ -0,0 +1,18 @@
+#!/vendor/bin/sh
+
+# Init starts this script in the factory, to trigger shutdown after
+# setupwizard has started, and USB is removed.
+
+# wait for system to settle down after sys.boot_complete
+sleep 5
+
+# Wait for USB to be removed.
+type=`cat /sys/class/power_supply/usb/typec_mode`
+while [ "x$type" != "xNothing attached" ]; do
+    echo Wait for \"$type\" == \"Nothing attached\"
+    sleep 1;
+    type=`cat /sys/class/power_supply/usb/typec_mode`
+done;
+
+# Shutdown
+setprop sys.powerctl shutdown
diff --git a/init.hardware.rc b/init.hardware.rc
index a1bf654..5a5a146 100644
--- a/init.hardware.rc
+++ b/init.hardware.rc
@@ -503,8 +503,8 @@
     write /dev/stune/top-app/blkio.group_idle 2
     write /dev/stune/rt/blkio.group_idle 2
 
-    write /dev/stune/blkio.weight 10
-    write /dev/stune/foreground/blkio.weight 100
+    write /dev/stune/blkio.weight 1000
+    write /dev/stune/foreground/blkio.weight 1000
     write /dev/stune/background/blkio.weight 10
     write /dev/stune/top-app/blkio.weight 1000
     write /dev/stune/rt/blkio.weight 1000
@@ -842,3 +842,11 @@
     wait /sys/devices/platform/soc/a84000.i2c/i2c-2/2-0020/input/input2/read_report
     chown system system /sys/devices/platform/soc/a84000.i2c/i2c-2/2-0020/input/input2/read_report
     chown system system /sys/devices/platform/soc/a84000.i2c/i2c-2/2-0020/input/input2/suspend
+
+on property:sys.boot_completed=1 && property:ro.boot.mode=firstboot
+    start init-firstboot-sh
+
+service init-firstboot-sh /vendor/bin/init.firstboot.sh
+    user nobody
+    disabled
+    oneshot
diff --git a/nfc/libnfc-nxp.bonito.conf b/nfc/libnfc-nxp.bonito.conf
index 65b63c1..7694786 100644
--- a/nfc/libnfc-nxp.bonito.conf
+++ b/nfc/libnfc-nxp.bonito.conf
@@ -194,7 +194,7 @@
 
 ###############################################################################
 # Core configuration settings
-NXP_CORE_CONF={ 20, 02, 31, 0F,
+NXP_CORE_CONF={ 20, 02, 2D, 0F,
         85, 01, 01,
         28, 01, 00,
         21, 01, 00,
@@ -202,7 +202,7 @@
         31, 01, 03,
         32, 01, 60,
         38, 01, 01,
-        33, 04, 01, 02, 03, 04,
+        33, 00,
         54, 01, 06,
         50, 01, 02,
         5B, 01, 00,
diff --git a/nfc/libnfc-nxp.sargo.conf b/nfc/libnfc-nxp.sargo.conf
index 69b3b40..32cff77 100644
--- a/nfc/libnfc-nxp.sargo.conf
+++ b/nfc/libnfc-nxp.sargo.conf
@@ -194,7 +194,7 @@
 
 ###############################################################################
 # Core configuration settings
-NXP_CORE_CONF={ 20, 02, 31, 0F,
+NXP_CORE_CONF={ 20, 02, 2D, 0F,
         85, 01, 01,
         28, 01, 00,
         21, 01, 00,
@@ -202,7 +202,7 @@
         31, 01, 03,
         32, 01, 60,
         38, 01, 01,
-        33, 04, 01, 02, 03, 04,
+        33, 00,
         54, 01, 06,
         50, 01, 02,
         5B, 01, 00,
diff --git a/overlay/frameworks/base/core/res/res/values/config.xml b/overlay/frameworks/base/core/res/res/values/config.xml
index 74d2e71..3845c0e 100644
--- a/overlay/frameworks/base/core/res/res/values/config.xml
+++ b/overlay/frameworks/base/core/res/res/values/config.xml
@@ -389,6 +389,14 @@
          meanings. -->
     <integer name="config_defaultNotificationVibrationIntensity">3</integer>
 
+    <!-- Boolean indicating whether framework needs to set the tx power limit for meeting SAR
+         requirements -->
+    <bool translatable="false" name="config_wifi_framework_enable_sar_tx_power_limit">true</bool>
+
+    <!-- Boolean indicating whether framework should use detection of softAP mode to set the tx
+         power limit for meeting SAR requirements -->
+    <bool translatable="false" name="config_wifi_framework_enable_soft_ap_sar_tx_power_limit">true</bool>
+
     <!-- Applications which are disabled unless matching a particular sku -->
     <string-array name="config_disableApksUnlessMatchedSku_apk_list" translatable="false">
         <item>com.felicanetworks.mfs</item>
diff --git a/overlay/packages/apps/Settings/res/drawable/regulatory_info_g020b.png b/overlay/packages/apps/Settings/res/drawable/regulatory_info_g020b.png
index 507d0a1..6a481a7 100644
--- a/overlay/packages/apps/Settings/res/drawable/regulatory_info_g020b.png
+++ b/overlay/packages/apps/Settings/res/drawable/regulatory_info_g020b.png
Binary files differ
diff --git a/overlay/packages/apps/Settings/res/drawable/regulatory_info_g020d.png b/overlay/packages/apps/Settings/res/drawable/regulatory_info_g020d.png
index dc68894..dc6d0dc 100644
--- a/overlay/packages/apps/Settings/res/drawable/regulatory_info_g020d.png
+++ b/overlay/packages/apps/Settings/res/drawable/regulatory_info_g020d.png
Binary files differ
diff --git a/powerhint.json b/powerhint.json
index 4b3572c..127a5e3 100644
--- a/powerhint.json
+++ b/powerhint.json
@@ -185,6 +185,15 @@
       "HoldFd": true
     },
     {
+      "Name": "ForegroundCpuset",
+      "Path": "/dev/cpuset/foreground/cpus",
+      "Values": [
+        "0-5",
+        "0-5,7"
+      ],
+      "ResetOnInit": true
+    },
+    {
       "Name": "SchedBoost",
       "Path": "/proc/sys/kernel/sched_boost",
       "Values": [
@@ -257,6 +266,12 @@
     },
     {
       "PowerHint": "LAUNCH",
+      "Node": "ForegroundCpuset",
+      "Duration": 5000,
+      "Value": "0-5"
+    },
+    {
+      "PowerHint": "LAUNCH",
       "Node": "SchedBoost",
       "Duration": 5000,
       "Value": "1"
diff --git a/sargo/overlay/packages/apps/Settings/res/drawable/regulatory_info_g020f.png b/sargo/overlay/packages/apps/Settings/res/drawable/regulatory_info_g020f.png
index 17b7138..861b8ec 100644
--- a/sargo/overlay/packages/apps/Settings/res/drawable/regulatory_info_g020f.png
+++ b/sargo/overlay/packages/apps/Settings/res/drawable/regulatory_info_g020f.png
Binary files differ
diff --git a/sargo/overlay/packages/apps/Settings/res/drawable/regulatory_info_g020h.png b/sargo/overlay/packages/apps/Settings/res/drawable/regulatory_info_g020h.png
index b3aa95c..35c7c4a 100644
--- a/sargo/overlay/packages/apps/Settings/res/drawable/regulatory_info_g020h.png
+++ b/sargo/overlay/packages/apps/Settings/res/drawable/regulatory_info_g020h.png
Binary files differ
diff --git a/self-extractors/extract-lists.txt b/self-extractors/extract-lists.txt
index 1535cbb..de28ec9 100644
--- a/self-extractors/extract-lists.txt
+++ b/self-extractors/extract-lists.txt
@@ -5,6 +5,7 @@
     ;;
   qcom)
     TO_EXTRACT="\
+            system/app/QtiTelephonyService/QtiTelephonyService.apk \
             system/compatibility_matrix.xml \
             system/etc/cne/andsfCne.xml \
             system/etc/cne/Nexus/ATT/ATT_profiles.xml \
@@ -86,7 +87,6 @@
             system/lib/lib-imsvtutils.so \
             system/lib/liblistenjni.so \
             system/lib/liblistensoundmodel2.so \
-            system/lib/liblogwrap.so \
             system/lib/libmdsprpc_system.so \
             system/lib/libminui.so \
             system/lib/libnl.so \
diff --git a/self-extractors/qcom/staging/Android.mk b/self-extractors/qcom/staging/Android.mk
new file mode 100644
index 0000000..b7bee38
--- /dev/null
+++ b/self-extractors/qcom/staging/Android.mk
@@ -0,0 +1,15 @@
+LOCAL_PATH := $(call my-dir)
+
+include $(CLEAR_VARS)
+
+ifneq ($(filter bonito, $(TARGET_DEVICE)),)
+LOCAL_MODULE_SUFFIX := $(COMMON_ANDROID_PACKAGE_SUFFIX)
+LOCAL_MODULE := QtiTelephonyService
+LOCAL_MODULE_TAGS := optional
+LOCAL_BUILT_MODULE_STEM := package.apk
+LOCAL_MODULE_OWNER := qcom
+LOCAL_MODULE_CLASS := APPS
+LOCAL_SRC_FILES := $(LOCAL_MODULE).apk
+LOCAL_CERTIFICATE := platform
+include $(BUILD_PREBUILT)
+endif
diff --git a/self-extractors/qcom/staging/device-partial.mk b/self-extractors/qcom/staging/device-partial.mk
index 7c64490..67e3afb 100644
--- a/self-extractors/qcom/staging/device-partial.mk
+++ b/self-extractors/qcom/staging/device-partial.mk
@@ -15,7 +15,8 @@
 # AOSP packages required by the blobs
 PRODUCT_PACKAGES := \
     com.android.ims.rcsmanager.xml \
-    com.android.ims.rcsmanager
+    com.android.ims.rcsmanager \
+    QtiTelephonyService
 
 #  blob(s) necessary for bonito hardware
 PRODUCT_COPY_FILES := \
@@ -100,7 +101,6 @@
     vendor/qcom/bonito/proprietary/lib-imsvtutils.so:system/lib/lib-imsvtutils.so:qcom \
     vendor/qcom/bonito/proprietary/liblistenjni.so:system/lib/liblistenjni.so:qcom \
     vendor/qcom/bonito/proprietary/liblistensoundmodel2.so:system/lib/liblistensoundmodel2.so:qcom \
-    vendor/qcom/bonito/proprietary/liblogwrap.so:system/lib/liblogwrap.so:qcom \
     vendor/qcom/bonito/proprietary/libmdsprpc_system.so:system/lib/libmdsprpc_system.so:qcom \
     vendor/qcom/bonito/proprietary/libminui.so:system/lib/libminui.so:qcom \
     vendor/qcom/bonito/proprietary/libnl.so:system/lib/libnl.so:qcom \
diff --git a/self-extractors_sargo/extract-lists.txt b/self-extractors_sargo/extract-lists.txt
index 1535cbb..de28ec9 100644
--- a/self-extractors_sargo/extract-lists.txt
+++ b/self-extractors_sargo/extract-lists.txt
@@ -5,6 +5,7 @@
     ;;
   qcom)
     TO_EXTRACT="\
+            system/app/QtiTelephonyService/QtiTelephonyService.apk \
             system/compatibility_matrix.xml \
             system/etc/cne/andsfCne.xml \
             system/etc/cne/Nexus/ATT/ATT_profiles.xml \
@@ -86,7 +87,6 @@
             system/lib/lib-imsvtutils.so \
             system/lib/liblistenjni.so \
             system/lib/liblistensoundmodel2.so \
-            system/lib/liblogwrap.so \
             system/lib/libmdsprpc_system.so \
             system/lib/libminui.so \
             system/lib/libnl.so \
diff --git a/self-extractors_sargo/qcom/staging/Android.mk b/self-extractors_sargo/qcom/staging/Android.mk
new file mode 100644
index 0000000..9d06c02
--- /dev/null
+++ b/self-extractors_sargo/qcom/staging/Android.mk
@@ -0,0 +1,16 @@
+LOCAL_PATH := $(call my-dir)
+
+include $(CLEAR_VARS)
+
+ifneq ($(filter sargo, $(TARGET_DEVICE)),)
+LOCAL_MODULE_SUFFIX := $(COMMON_ANDROID_PACKAGE_SUFFIX)
+LOCAL_MODULE := QtiTelephonyService
+LOCAL_MODULE_TAGS := optional
+LOCAL_BUILT_MODULE_STEM := package.apk
+LOCAL_MODULE_OWNER := qcom
+LOCAL_MODULE_CLASS := APPS
+LOCAL_SRC_FILES := $(LOCAL_MODULE).apk
+LOCAL_CERTIFICATE := platform
+include $(BUILD_PREBUILT)
+endif
+
diff --git a/self-extractors_sargo/qcom/staging/device-partial.mk b/self-extractors_sargo/qcom/staging/device-partial.mk
index 8be5d82..c62a33c 100644
--- a/self-extractors_sargo/qcom/staging/device-partial.mk
+++ b/self-extractors_sargo/qcom/staging/device-partial.mk
@@ -15,7 +15,8 @@
 # AOSP packages required by the blobs
 PRODUCT_PACKAGES := \
     com.android.ims.rcsmanager.xml \
-    com.android.ims.rcsmanager
+    com.android.ims.rcsmanager \
+    QtiTelephonyService
 
 #  blob(s) necessary for sargo hardware
 PRODUCT_COPY_FILES := \
@@ -100,7 +101,6 @@
     vendor/qcom/sargo/proprietary/lib-imsvtutils.so:system/lib/lib-imsvtutils.so:qcom \
     vendor/qcom/sargo/proprietary/liblistenjni.so:system/lib/liblistenjni.so:qcom \
     vendor/qcom/sargo/proprietary/liblistensoundmodel2.so:system/lib/liblistensoundmodel2.so:qcom \
-    vendor/qcom/sargo/proprietary/liblogwrap.so:system/lib/liblogwrap.so:qcom \
     vendor/qcom/sargo/proprietary/libmdsprpc_system.so:system/lib/libmdsprpc_system.so:qcom \
     vendor/qcom/sargo/proprietary/libminui.so:system/lib/libminui.so:qcom \
     vendor/qcom/sargo/proprietary/libnl.so:system/lib/libnl.so:qcom \