DO NOT MERGE - Merge Android R QPR1

Bug: 172690556
Merged-In: If519752201f61bb36d8a96620d07327b3f6f8f02
Change-Id: I6506eb0eaacce92d87e72e52122f615665053522
diff --git a/aosp_bramble.mk b/aosp_bramble.mk
index 6ec72bd..f0aeaf2 100644
--- a/aosp_bramble.mk
+++ b/aosp_bramble.mk
@@ -21,8 +21,7 @@
 $(call inherit-product, $(SRC_TARGET_DIR)/product/mainline_system.mk)
 
 # Enable mainline checking
-# TODO(b/138706293): Enable mainline checking later
-# PRODUCT_ENFORCE_ARTIFACT_PATH_REQUIREMENTS := relaxed
+PRODUCT_ENFORCE_ARTIFACT_PATH_REQUIREMENTS := strict
 
 #
 # All components inherited here go to system_ext image
@@ -50,6 +49,12 @@
 PRODUCT_COPY_FILES += \
     frameworks/native/data/etc/aosp_excluded_hardware.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/aosp_excluded_hardware.xml
 
+# Keep the VNDK APEX in /system partition for REL branches as these branches are
+# expected to have stable API/ABI surfaces.
+ifneq (REL,$(PLATFORM_VERSION_CODENAME))
+  PRODUCT_PACKAGES += com.android.vndk.current.on_vendor
+endif
+
 # Don't build super.img.
 PRODUCT_BUILD_SUPER_PARTITION := false
 
diff --git a/audio/acdbdata/Handset_cal.acdb b/audio/acdbdata/Handset_cal.acdb
index 4b08457..bdd1176 100644
--- a/audio/acdbdata/Handset_cal.acdb
+++ b/audio/acdbdata/Handset_cal.acdb
Binary files differ
diff --git a/bramble/init.bramble.rc b/bramble/init.bramble.rc
index 21fae7c..e6b5830 100644
--- a/bramble/init.bramble.rc
+++ b/bramble/init.bramble.rc
@@ -19,6 +19,21 @@
 on property:vendor.all.modules.ready=1
     chown system system /sys/class/spi_master/spi0/spi0.0/stm_fts_cmd
     chown system system /sys/class/spi_master/spi0/spi0.0/audio_status
+    chown system system /sys/class/spi_master/spi0/spi0.0/glove_mode
+
+# Toggle glove_mode according to touch_sensitivity_mode
+on property:persist.vendor.touch_sensitivity_mode=0 && property:sys.boot_completed=1
+    write /sys/class/spi_master/spi0/spi0.0/glove_mode 00
+
+on property:persist.vendor.touch_sensitivity_mode=1 && property:sys.boot_completed=1
+    write /sys/class/spi_master/spi0/spi0.0/glove_mode 01
+
+# Route touch_sensitivity_mode to persist
+on property:debug.touch_sensitivity_mode=0
+    setprop persist.vendor.touch_sensitivity_mode 0
+
+on property:debug.touch_sensitivity_mode=1
+    setprop persist.vendor.touch_sensitivity_mode 1
 
 service vendor.mdm_helper /vendor/bin/mdm_helper
     class core
diff --git a/bramble/overlay/frameworks/base/core/res/res/xml/power_profile.xml b/bramble/overlay/frameworks/base/core/res/res/xml/power_profile.xml
index ca2ab23..a348de6 100644
--- a/bramble/overlay/frameworks/base/core/res/res/xml/power_profile.xml
+++ b/bramble/overlay/frameworks/base/core/res/res/xml/power_profile.xml
@@ -169,7 +169,7 @@
     <item name="gps.voltage">3700</item>
 
     <!-- Idle Receive current for wifi radio in mA.-->
-    <item name="wifi.controller.idle">106</item>
+    <item name="wifi.controller.idle">79</item>
     <!-- Rx current for wifi radio in mA.-->
     <item name="wifi.controller.rx">118</item>
     <!-- Tx current for wifi radio in mA-->
diff --git a/bramble/overlay/vendor/google_devices/sunfish/proprietary/display/HbmSVManager/res/values/config.xml b/bramble/overlay/vendor/google_devices/sunfish/proprietary/display/HbmSVManager/res/values/config.xml
index 184772f..45c1480 100644
--- a/bramble/overlay/vendor/google_devices/sunfish/proprietary/display/HbmSVManager/res/values/config.xml
+++ b/bramble/overlay/vendor/google_devices/sunfish/proprietary/display/HbmSVManager/res/values/config.xml
@@ -28,5 +28,5 @@
     <item>@drawable/b5_compensation_image_30k</item>
   </array>
 
-  <integer name="config_compensation_filter_horizon">4000</integer>
+  <integer name="config_compensation_filter_horizon">3500</integer>
 </resources>
diff --git a/bramble/overlay_packages/SettingsOverlayG025E/res/drawable/regulatory_info.png b/bramble/overlay_packages/SettingsOverlayG025E/res/drawable/regulatory_info.png
index 085a349..8f74e3b 100644
--- a/bramble/overlay_packages/SettingsOverlayG025E/res/drawable/regulatory_info.png
+++ b/bramble/overlay_packages/SettingsOverlayG025E/res/drawable/regulatory_info.png
Binary files differ
diff --git a/device-bramble.mk b/device-bramble.mk
index 169eaf6..7069eb6 100644
--- a/device-bramble.mk
+++ b/device-bramble.mk
@@ -194,3 +194,6 @@
     SettingsOverlayG025I \
     SettingsOverlayG6QU3 \
     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
diff --git a/dumpstate/DumpstateDevice.cpp b/dumpstate/DumpstateDevice.cpp
index e319993..4b9737b 100755
--- a/dumpstate/DumpstateDevice.cpp
+++ b/dumpstate/DumpstateDevice.cpp
@@ -355,6 +355,12 @@
                 modemLogAllDir.c_str());
         RunCommandToFd(STDOUT_FILENO, "Dump IPA log", {"/vendor/bin/sh", "-c", cmd});
 
+        //Dump QRTR0 log for QMI service state
+        snprintf(cmd, sizeof(cmd),
+                "cat /d/ipc_logging/qrtr_0/log > %s/qrtr_0_log",
+                modemLogAllDir.c_str());
+        RunCommandToFd(STDOUT_FILENO, "Dump QRTR0 log", {"/vendor/bin/sh", "-c", cmd});
+
         dumpLogs(STDOUT_FILENO, extendedLogDir, modemLogAllDir, 100, EXTENDED_LOG_PREFIX);
         android::base::SetProperty(MODEM_EFS_DUMP_PROPERTY, "false");
     }
@@ -670,6 +676,7 @@
     RunCommandToFd(fd, "CPU cpuidle", {"/vendor/bin/sh", "-c", "for cpu in /sys/devices/system/cpu/cpu*; do for d in $cpu/cpuidle/state*; do if [ ! -d $d ]; then continue; fi; echo \"$d: `cat $d/name` `cat $d/desc` `cat $d/time` `cat $d/usage`\"; done; done"});
     RunCommandToFd(fd, "Airbrush debug info", {"/vendor/bin/sh", "-c", "for f in `ls /sys/devices/platform/soc/c84000.i2c/i2c-4/4-0066/@(*curr|temperature|vbat|total_power)`; do echo \"$f: `cat $f`\" ; done; file=/d/airbrush/airbrush_sm/chip_state; echo \"$file: `cat $file`\""});
     DumpFileToFd(fd, "TCPM logs", "/d/usb/tcpm-usbpd0");
+    DumpFileToFd(fd, "TCPM logs", "/dev/logbuffer_tcpm");
     DumpFileToFd(fd, "PD Engine", "/dev/logbuffer_usbpd");
     DumpFileToFd(fd, "PPS", "/dev/logbuffer_pps");
     DumpFileToFd(fd, "BMS", "/dev/logbuffer_ssoc");
@@ -711,6 +718,9 @@
     // Dump camera profiler log
     RunCommandToFd(fd, "Camera Profiler Logs", {"/vendor/bin/sh", "-c", "for f in /data/vendor/camera/profiler/camx_*; do echo [$f]; cat \"$f\";done"});
 
+    // Dump fastrpc dma buffer size
+    DumpFileToFd(fd, "Fastrpc dma buffer", "/sys/kernel/fastrpc/total_dma_kb");
+
     if (modemThreadHandle) {
         pthread_join(modemThreadHandle, NULL);
     }
diff --git a/self-extractors/extract-lists.txt b/self-extractors/extract-lists.txt
index 0f30a0e..5bcef9e 100644
--- a/self-extractors/extract-lists.txt
+++ b/self-extractors/extract-lists.txt
@@ -7,6 +7,7 @@
     ;;
   qcom)
     TO_EXTRACT="\
+            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/telephonyservice.xml \
@@ -49,5 +50,6 @@
             system_ext/lib/libvr_object_engine.so \
             system_ext/app/QtiTelephonyService/QtiTelephonyService.apk \
             system_ext/priv-app/ims/ims.apk \
+            system_ext/priv-app/qcrilmsgtunnel/qcrilmsgtunnel.apk \
             "
     ;;
diff --git a/self-extractors/qcom/staging/Android.mk b/self-extractors/qcom/staging/Android.mk
index 88612b1..8d0a9ea 100644
--- a/self-extractors/qcom/staging/Android.mk
+++ b/self-extractors/qcom/staging/Android.mk
@@ -7,6 +7,20 @@
 LOCAL_MODULE_TAGS := optional
 LOCAL_BUILT_MODULE_STEM := package.apk
 LOCAL_SYSTEM_EXT_MODULE := true
+LOCAL_PRIVILEGED_MODULE := true
+LOCAL_MODULE_OWNER := qcom
+LOCAL_MODULE_CLASS := APPS
+LOCAL_SRC_FILES := $(LOCAL_MODULE).apk
+LOCAL_CERTIFICATE := platform
+include $(BUILD_PREBUILT)
+
+include $(CLEAR_VARS)
+LOCAL_MODULE_SUFFIX := $(COMMON_ANDROID_PACKAGE_SUFFIX)
+LOCAL_MODULE := qcrilmsgtunnel
+LOCAL_MODULE_TAGS := optional
+LOCAL_BUILT_MODULE_STEM := package.apk
+LOCAL_SYSTEM_EXT_MODULE := true
+LOCAL_PRIVILEGED_MODULE := true
 LOCAL_MODULE_OWNER := qcom
 LOCAL_MODULE_CLASS := APPS
 LOCAL_SRC_FILES := $(LOCAL_MODULE).apk
diff --git a/self-extractors/qcom/staging/device-partial.mk b/self-extractors/qcom/staging/device-partial.mk
index 8bb03f5..1677e71 100644
--- a/self-extractors/qcom/staging/device-partial.mk
+++ b/self-extractors/qcom/staging/device-partial.mk
@@ -18,6 +18,7 @@
 # AOSP packages required by the blobs
 PRODUCT_PACKAGES := \
     ims \
+    qcrilmsgtunnel \
     QtiTelephonyService
 
 PRODUCT_PACKAGES += \
@@ -33,6 +34,7 @@
 
 #  blob(s) necessary for bramble hardware
 PRODUCT_COPY_FILES := \
+     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/telephonyservice.xml:system_ext/etc/permissions/telephonyservice.xml \
diff --git a/thermal_info_config_bramble.json b/thermal_info_config_bramble.json
index 729fc31..ae7e2da 100644
--- a/thermal_info_config_bramble.json
+++ b/thermal_info_config_bramble.json
@@ -218,7 +218,8 @@
             ],
             "VrThreshold":"NAN",
             "Multiplier":0.001,
-            "Monitor":true
+            "Monitor":true,
+            "SendPowerHint":true
         },
         {
             "Name":"cellular-emergency",
diff --git a/thermal_info_config_bramble_m.json b/thermal_info_config_bramble_m.json
index 729fc31..ae7e2da 100644
--- a/thermal_info_config_bramble_m.json
+++ b/thermal_info_config_bramble_m.json
@@ -218,7 +218,8 @@
             ],
             "VrThreshold":"NAN",
             "Multiplier":0.001,
-            "Monitor":true
+            "Monitor":true,
+            "SendPowerHint":true
         },
         {
             "Name":"cellular-emergency",