Merge "Disable bootstrap for UGS devices (sold in Canada)" into main
diff --git a/aoc/aoc.mk b/aoc/aoc.mk
index 136bb42..9ee4517 100644
--- a/aoc/aoc.mk
+++ b/aoc/aoc.mk
@@ -4,12 +4,6 @@
 		    aocd \
 		    aocxd
 
-ifeq (,$(filter aosp_%,$(TARGET_PRODUCT)))
-# IAudioMetricExt HIDL
-PRODUCT_PACKAGES += \
-    vendor.google.audiometricext@1.0-service-vendor
-endif
-
 # If AoC Daemon is not present on this build, load firmware at boot via rc
 ifeq ($(wildcard vendor/google/whitechapel/aoc/aocd),)
 PRODUCT_COPY_FILES += \
diff --git a/audio/aidl/device_framework_matrix_product.xml b/audio/aidl/device_framework_matrix_product.xml
index 11f01c7..570c5d4 100644
--- a/audio/aidl/device_framework_matrix_product.xml
+++ b/audio/aidl/device_framework_matrix_product.xml
@@ -1,12 +1,4 @@
 <compatibility-matrix version="1.0" type="framework">
-    <hal format="hidl">
-       <name>vendor.google.audiometricext</name>
-       <version>1.0</version>
-       <interface>
-           <name>IAudioMetricExt</name>
-           <instance>default</instance>
-       </interface>
-    </hal>
     <hal format="aidl">
         <name>vendor.google.whitechapel.audio.extension</name>
         <version>4</version>
diff --git a/audio/aidl/manifest.xml b/audio/aidl/manifest.xml
index 237aa4a..daeb1c4 100644
--- a/audio/aidl/manifest.xml
+++ b/audio/aidl/manifest.xml
@@ -1,11 +1,2 @@
 <manifest version="1.0" type="device">
-    <hal format="hidl">
-       <name>vendor.google.audiometricext</name>
-       <transport>hwbinder</transport>
-       <version>1.0</version>
-       <interface>
-           <name>IAudioMetricExt</name>
-           <instance>default</instance>
-       </interface>
-    </hal>
 </manifest>
diff --git a/audio/hidl_gs101.mk b/audio/hidl_gs101.mk
index f764e7a..4ccbbfb 100644
--- a/audio/hidl_gs101.mk
+++ b/audio/hidl_gs101.mk
@@ -32,8 +32,14 @@
 	libamcsextfile \
 	audio_amcs_ext \
 
+ifeq (,$(filter aosp_%,$(TARGET_PRODUCT)))
+# IAudioMetricExt HIDL
+PRODUCT_PACKAGES += \
+	vendor.google.audiometricext@1.0-service-vendor
+endif
+
 BOARD_VENDOR_SEPOLICY_DIRS += device/google/gs-common/audio/sepolicy/hidl
 
 include device/google/gs-common/audio/common.mk
 
-DEVICE_PRODUCT_COMPATIBILITY_MATRIX_FILE += device/google/gs-common/audio/hidl/device_framework_matrix_product_gs101.xml
+DEVICE_PRODUCT_COMPATIBILITY_MATRIX_FILE += device/google/gs-common/audio/hidl/device_framework_matrix_product_gs101.xml
\ No newline at end of file
diff --git a/audio/hidl_gs201.mk b/audio/hidl_gs201.mk
index 1438b27..c183b9a 100644
--- a/audio/hidl_gs201.mk
+++ b/audio/hidl_gs201.mk
@@ -32,6 +32,12 @@
 	audio_spk_35l41 \
 	sound_trigger.primary.$(TARGET_BOARD_PLATFORM)
 
+ifeq (,$(filter aosp_%,$(TARGET_PRODUCT)))
+# IAudioMetricExt HIDL
+PRODUCT_PACKAGES += \
+	vendor.google.audiometricext@1.0-service-vendor
+endif
+
 BOARD_VENDOR_SEPOLICY_DIRS += device/google/gs-common/audio/sepolicy/hidl
 
 include device/google/gs-common/audio/common.mk
diff --git a/audio/hidl_zuma.mk b/audio/hidl_zuma.mk
index 41dd02a..6fb3449 100644
--- a/audio/hidl_zuma.mk
+++ b/audio/hidl_zuma.mk
@@ -35,6 +35,12 @@
 	audio_hdmi_aoc \
 	sound_trigger.primary.$(TARGET_BOARD_PLATFORM)
 
+ifeq (,$(filter aosp_%,$(TARGET_PRODUCT)))
+# IAudioMetricExt HIDL
+PRODUCT_PACKAGES += \
+	vendor.google.audiometricext@1.0-service-vendor
+endif
+
 BOARD_VENDOR_SEPOLICY_DIRS += device/google/gs-common/audio/sepolicy/hidl
 BOARD_VENDOR_SEPOLICY_DIRS += device/google/gs-common/audio/sepolicy/hdmi_audio
 
diff --git a/bluetooth/bluetooth.mk b/bluetooth/bluetooth.mk
new file mode 100644
index 0000000..29ddb9c
--- /dev/null
+++ b/bluetooth/bluetooth.mk
@@ -0,0 +1,16 @@
+PRODUCT_SOONG_NAMESPACES += vendor/google/connectivity/bluetooth/common
+PRODUCT_PACKAGES += \
+       android.hardware.bluetooth-V1-ndk.so \
+       android.hardware.bluetooth.finder-V1-ndk.so \
+       android.hardware.bluetooth.ranging-V1-ndk.so \
+       android.hardware.bluetooth-service.pixel \
+       vendor.google.bluetooth_ext-V1-ndk.so \
+       bt_vendor.conf \
+       android.hardware.bluetooth.prebuilt.xml \
+       android.hardware.bluetooth_le.prebuilt.xml
+
+BOARD_SEPOLICY_DIRS += device/google/gs-common/bluetooth/sepolicy
+BOARD_SEPOLICY_DIRS += hardware/google/pixel-sepolicy/powerstats
+
+DEVICE_MANIFEST_FILE += device/google/gs-common/bluetooth/manifest_bluetooth.xml
+DEVICE_PRODUCT_COMPATIBILITY_MATRIX_FILE += device/google/gs-common/bluetooth/compatibility_matrix.xml
diff --git a/bluetooth/compatibility_matrix.xml b/bluetooth/compatibility_matrix.xml
new file mode 100644
index 0000000..65b0c6d
--- /dev/null
+++ b/bluetooth/compatibility_matrix.xml
@@ -0,0 +1,30 @@
+<compatibility-matrix version="1.0" type="framework">
+    <hal format="aidl" optional="true">
+        <name>vendor.google.bluetooth_ext</name>
+        <version>1</version>
+        <interface>
+            <name>IBluetoothFinder</name>
+            <instance>default</instance>
+        </interface>
+        <interface>
+            <name>IBluetoothCcc</name>
+            <instance>default</instance>
+        </interface>
+        <interface>
+            <name>IBTChannelAvoidance</name>
+            <instance>default</instance>
+        </interface>
+        <interface>
+            <name>IBluetoothSar</name>
+            <instance>default</instance>
+        </interface>
+        <interface>
+            <name>IBluetoothExt</name>
+            <instance>default</instance>
+        </interface>
+        <interface>
+            <name>IBluetoothEwp</name>
+            <instance>default</instance>
+        </interface>
+    </hal>
+</compatibility-matrix>
diff --git a/bluetooth/dump/Android.bp b/bluetooth/dump/Android.bp
new file mode 100644
index 0000000..72e83b4
--- /dev/null
+++ b/bluetooth/dump/Android.bp
@@ -0,0 +1,20 @@
+package {
+    default_applicable_licenses: ["Android-Apache-2.0"],
+}
+
+cc_binary {
+    name: "dump_bt",
+    srcs: ["dump.cpp"],
+    cflags: [
+        "-Wall",
+        "-Wextra",
+        "-Werror",
+    ],
+    shared_libs: [
+        "libbase",
+        "libdump",
+        "liblog",
+    ],
+    vendor: true,
+    relative_install_path: "dump",
+}
diff --git a/bluetooth/dump/dump.cpp b/bluetooth/dump/dump.cpp
new file mode 100644
index 0000000..db92c3c
--- /dev/null
+++ b/bluetooth/dump/dump.cpp
@@ -0,0 +1,44 @@
+/*
+ * Copyright 2023 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+#include <dump/pixel_dump.h>
+#include <android-base/file.h>
+
+#define PIXELBT_ACTIVITY_LOG_DIRECTORY "/data/vendor/bluetooth"
+#define PIXELBT_SNOOP_LOG_DIRECTORY "/data/vendor/bluetooth"
+#define PIXELBT_FW_LOG_DIRECTORY "/data/vendor/ssrdump/coredump"
+#define PIXELBT_SNOOP_LOG_PREFIX "btsnoop_hci_vnd"
+#define PIXELBT_BACKUP_SNOOP_LOG_PREFIX "backup_btsnoop_hci_vnd"
+#define PIXELBT_FW_DUMP_LOG_PREFIX "coredump_bt_socdump_"
+#define PIXELBT_CHRE_DUMP_LOG_PREFIX "coredump_bt_chredump_"
+#define PIXELBT_HAL_DUMP_LOG_PREFIX "coredump_bt_"
+#define PIXELBT_ACTIVITY_LOG_PREFIX "bt_activity_"
+
+int main() {
+    std::string outputDir = concatenatePath(BUGREPORT_PACKING_DIR, "bt");
+    if (mkdir(outputDir.c_str(), 0777) == -1) {
+        printf("Unable to create folder: %s\n", outputDir.c_str());
+        return 0;
+    }
+
+    dumpLogs(PIXELBT_SNOOP_LOG_DIRECTORY, outputDir.c_str(), 4,
+             PIXELBT_SNOOP_LOG_PREFIX);
+    dumpLogs(PIXELBT_SNOOP_LOG_DIRECTORY, outputDir.c_str(), 2, PIXELBT_BACKUP_SNOOP_LOG_PREFIX);
+    dumpLogs(PIXELBT_FW_LOG_DIRECTORY, outputDir.c_str(), 10, PIXELBT_FW_DUMP_LOG_PREFIX);
+    dumpLogs(PIXELBT_FW_LOG_DIRECTORY, outputDir.c_str(), 10, PIXELBT_CHRE_DUMP_LOG_PREFIX);
+    dumpLogs(PIXELBT_FW_LOG_DIRECTORY, outputDir.c_str(), 10, PIXELBT_HAL_DUMP_LOG_PREFIX);
+    dumpLogs(PIXELBT_ACTIVITY_LOG_DIRECTORY, outputDir.c_str(), 10, PIXELBT_ACTIVITY_LOG_PREFIX);
+    return 0;
+}
diff --git a/bluetooth/dump/dumplog.mk b/bluetooth/dump/dumplog.mk
new file mode 100644
index 0000000..51c3b3c
--- /dev/null
+++ b/bluetooth/dump/dumplog.mk
@@ -0,0 +1,3 @@
+BOARD_VENDOR_SEPOLICY_DIRS += device/google/gs-common/bluetooth/dump/sepolicy/
+
+PRODUCT_PACKAGES_DEBUG += dump_bt
diff --git a/bluetooth/dump/sepolicy/dump.te b/bluetooth/dump/sepolicy/dump.te
new file mode 100644
index 0000000..fdd123e
--- /dev/null
+++ b/bluetooth/dump/sepolicy/dump.te
@@ -0,0 +1,12 @@
+# pixel bluetooth common hal service
+pixel_bugreport(dump_bt)
+
+allow hal_dumpstate_default vendor_bt_data_file:dir { open read search };
+allow hal_dumpstate_default vendor_bt_data_file:file read;
+allow dump_bt radio_vendor_data_file:dir create_dir_perms;
+allow dump_bt radio_vendor_data_file:file create_file_perms;
+allow dump_bt vendor_bt_data_file:dir r_dir_perms;
+allow dump_bt vendor_bt_data_file:file r_file_perms;
+allow dump_bt sscoredump_vendor_data_crashinfo_file:dir search;
+allow dump_bt sscoredump_vendor_data_coredump_file:dir r_dir_perms;
+allow dump_bt sscoredump_vendor_data_coredump_file:file r_file_perms;
diff --git a/bluetooth/dump/sepolicy/file_contexts b/bluetooth/dump/sepolicy/file_contexts
new file mode 100644
index 0000000..da28d10
--- /dev/null
+++ b/bluetooth/dump/sepolicy/file_contexts
@@ -0,0 +1,2 @@
+# bt common hal dump_bt service
+/vendor/bin/dump/dump_bt           u:object_r:dump_bt_exec:s0
diff --git a/bluetooth/manifest_bluetooth.xml b/bluetooth/manifest_bluetooth.xml
new file mode 100644
index 0000000..a72f1c9
--- /dev/null
+++ b/bluetooth/manifest_bluetooth.xml
@@ -0,0 +1,27 @@
+<manifest version="1.0" type="device">
+    <hal format="aidl">
+        <name>android.hardware.bluetooth</name>
+        <version>1</version>
+        <fqname>IBluetoothHci/default</fqname>
+    </hal>
+    <hal format="aidl">
+        <name>android.hardware.bluetooth.finder</name>
+        <version>1</version>
+        <fqname>IBluetoothFinder/default</fqname>
+    </hal>
+    <hal format="aidl">
+        <name>android.hardware.bluetooth.ranging</name>
+        <version>1</version>
+        <fqname>IBluetoothChannelSounding/default</fqname>
+    </hal>
+    <hal format="aidl">
+        <name>vendor.google.bluetooth_ext</name>
+        <version>1</version>
+        <fqname>IBTChannelAvoidance/default</fqname>
+        <fqname>IBluetoothCcc/default</fqname>
+        <fqname>IBluetoothEwp/default</fqname>
+        <fqname>IBluetoothExt/default</fqname>
+        <fqname>IBluetoothFinder/default</fqname>
+        <fqname>IBluetoothSar/default</fqname>
+    </hal>
+</manifest>
diff --git a/bluetooth/sepolicy/device.te b/bluetooth/sepolicy/device.te
new file mode 100644
index 0000000..a256332
--- /dev/null
+++ b/bluetooth/sepolicy/device.te
@@ -0,0 +1,3 @@
+# Bt Wifi Coexistence device
+type wb_coexistence_dev, dev_type;
+
diff --git a/bluetooth/sepolicy/file_contexts b/bluetooth/sepolicy/file_contexts
new file mode 100644
index 0000000..e7c2617
--- /dev/null
+++ b/bluetooth/sepolicy/file_contexts
@@ -0,0 +1,6 @@
+# Bluetooth
+/vendor/bin/hw/android\.hardware\.bluetooth-service\.pixel    u:object_r:hal_bluetooth_btlinux_exec:s0
+
+/dev/wbrc                           u:object_r:wb_coexistence_dev:s0
+/dev/ttySAC16                       u:object_r:hci_attach_dev:s0
+
diff --git a/bluetooth/sepolicy/genfs_contexts b/bluetooth/sepolicy/genfs_contexts
new file mode 100644
index 0000000..899041b
--- /dev/null
+++ b/bluetooth/sepolicy/genfs_contexts
@@ -0,0 +1,8 @@
+# Bluetooth pin control device node
+genfscon sysfs /devices/platform/odm/odm:btbcm/rfkill/rfkill0/state                             u:object_r:sysfs_bluetooth_writable:s0
+genfscon sysfs /devices/platform/odm/odm:btbcm/rfkill/rfkill2/state                             u:object_r:sysfs_bluetooth_writable:s0
+genfscon proc /bluetooth/sleep/lpm                                                              u:object_r:proc_bluetooth_writable:s0
+genfscon proc /bluetooth/sleep/btwrite                                                          u:object_r:proc_bluetooth_writable:s0
+genfscon proc /bluetooth/sleep/btwake                                                           u:object_r:proc_bluetooth_writable:s0
+genfscon proc /bluetooth/timesync                                                               u:object_r:proc_bluetooth_writable:s0
+
diff --git a/bluetooth/sepolicy/hal_bluetooth_btlinux.te b/bluetooth/sepolicy/hal_bluetooth_btlinux.te
new file mode 100644
index 0000000..0c85cb0
--- /dev/null
+++ b/bluetooth/sepolicy/hal_bluetooth_btlinux.te
@@ -0,0 +1,19 @@
+# coexistence device file node
+add_hwservice(hal_bluetooth_btlinux, hal_bluetooth_coexistence_hwservice);
+add_service(hal_bluetooth_btlinux, hal_bluetooth_coexistence_service);
+allow hal_bluetooth_btlinux wb_coexistence_dev:chr_file rw_file_perms;
+
+# power stats
+allow hal_bluetooth_btlinux hal_power_stats_vendor_service:service_manager find;
+binder_call(hal_bluetooth_btlinux, hal_power_stats_default)
+
+# bt firmware dump
+allow hal_bluetooth_btlinux aconfig_storage_metadata_file:dir search;
+allow hal_bluetooth_btlinux sscoredump_vendor_data_crashinfo_file:dir rw_dir_perms;
+allow hal_bluetooth_btlinux sscoredump_vendor_data_crashinfo_file:file rw_file_perms;
+
+userdebug_or_eng(`
+  allow hal_bluetooth_btlinux sscoredump_vendor_data_coredump_file:dir create_dir_perms;
+  allow hal_bluetooth_btlinux sscoredump_vendor_data_coredump_file:file create_file_perms;
+  allow hal_bluetooth_btlinux logbuffer_device:chr_file r_file_perms;
+')
diff --git a/bluetooth/sepolicy/hwservice.te b/bluetooth/sepolicy/hwservice.te
new file mode 100644
index 0000000..5e36cd0
--- /dev/null
+++ b/bluetooth/sepolicy/hwservice.te
@@ -0,0 +1,3 @@
+# Bluetooth HAL extension
+type hal_bluetooth_coexistence_hwservice, hwservice_manager_type, vendor_hwservice_type;
+
diff --git a/bluetooth/sepolicy/hwservice_contexts b/bluetooth/sepolicy/hwservice_contexts
new file mode 100644
index 0000000..8480b4e
--- /dev/null
+++ b/bluetooth/sepolicy/hwservice_contexts
@@ -0,0 +1,6 @@
+# Bluetooth HAL extension
+hardware.google.bluetooth.bt_channel_avoidance::IBTChannelAvoidance   u:object_r:hal_bluetooth_coexistence_hwservice:s0
+hardware.google.bluetooth.sar::IBluetoothSar                          u:object_r:hal_bluetooth_coexistence_hwservice:s0
+hardware.google.bluetooth.ccc::IBluetoothCcc                          u:object_r:hal_bluetooth_coexistence_hwservice:s0
+hardware.google.bluetooth.ewp::IBluetoothEwp                          u:object_r:hal_bluetooth_coexistence_hwservice:s0
+hardware.google.bluetooth.ext::IBluetoothExt                          u:object_r:hal_bluetooth_coexistence_hwservice:s0
diff --git a/bluetooth/sepolicy/service.te b/bluetooth/sepolicy/service.te
new file mode 100644
index 0000000..b8403da
--- /dev/null
+++ b/bluetooth/sepolicy/service.te
@@ -0,0 +1,2 @@
+# Bluetooth HAL extension
+type hal_bluetooth_coexistence_service, hal_service_type, service_manager_type;
diff --git a/bluetooth/sepolicy/service_contexts b/bluetooth/sepolicy/service_contexts
new file mode 100644
index 0000000..4aecc90
--- /dev/null
+++ b/bluetooth/sepolicy/service_contexts
@@ -0,0 +1,7 @@
+# Bluetooth HAL extension
+vendor.google.bluetooth_ext.IBTChannelAvoidance/default                      u:object_r:hal_bluetooth_coexistence_service:s0
+vendor.google.bluetooth_ext.IBluetoothSar/default                            u:object_r:hal_bluetooth_coexistence_service:s0
+vendor.google.bluetooth_ext.IBluetoothCcc/default                            u:object_r:hal_bluetooth_coexistence_service:s0
+vendor.google.bluetooth_ext.IBluetoothEwp/default                            u:object_r:hal_bluetooth_coexistence_service:s0
+vendor.google.bluetooth_ext.IBluetoothExt/default                            u:object_r:hal_bluetooth_coexistence_service:s0
+vendor.google.bluetooth_ext.IBluetoothFinder/default                         u:object_r:hal_bluetooth_coexistence_service:s0
diff --git a/dauntless/gsc.mk b/dauntless/gsc.mk
index c1cf0e0..b563cc4 100644
--- a/dauntless/gsc.mk
+++ b/dauntless/gsc.mk
@@ -1,6 +1,6 @@
 # Dauntless
 BOARD_VENDOR_SEPOLICY_DIRS += device/google/gs-common/dauntless/sepolicy
-ifneq ($(wildcard vendor),)
+ifneq ($(wildcard vendor/google_nos),)
 PRODUCT_SOONG_NAMESPACES += vendor/google_nos/init/dauntless
 
 PRODUCT_PACKAGES += \
@@ -92,4 +92,4 @@
 $(call dist-for-goals,droid,vendor/google_nos/prebuilts/dauntless/intermediate_images/d3m2_intermediate.ec.bin)
 endif
 
-endif # $(wildcard vendor)
+endif # $(wildcard vendor/google_nos)
diff --git a/edgetpu/edgetpu.mk b/edgetpu/edgetpu.mk
index feb728f..9f7e1de 100644
--- a/edgetpu/edgetpu.mk
+++ b/edgetpu/edgetpu.mk
@@ -19,10 +19,6 @@
 # TPU TFlite Delegate
 PRODUCT_PACKAGES += \
         libedgetpu_util
-# TPU DBA AIDL HAL service
-PRODUCT_PACKAGES += com.google.edgetpu.dba-service
-# TPU DBA C API library
-PRODUCT_PACKAGES += libedgetpu_dba.google
 # TPU Tachyon HAL service
 PRODUCT_PACKAGES += com.google.edgetpu.tachyon-service
 # TPU Tachyon C API library
diff --git a/gcam_app/sepolicy/product/public/debug_camera_app.te b/gcam_app/sepolicy/product/public/debug_camera_app.te
deleted file mode 100644
index 0572eee..0000000
--- a/gcam_app/sepolicy/product/public/debug_camera_app.te
+++ /dev/null
@@ -1,2 +0,0 @@
-# GCA-Eng and GCA-Next
-type debug_camera_app, domain;
diff --git a/gcam_app/sepolicy/product/public/google_camera_app.te b/gcam_app/sepolicy/product/public/google_camera_app.te
deleted file mode 100644
index a8d6512..0000000
--- a/gcam_app/sepolicy/product/public/google_camera_app.te
+++ /dev/null
@@ -1,2 +0,0 @@
-# GCA-Release and GCA-Dogfood
-type google_camera_app, domain;
diff --git a/gps/dump/dump_gps.cpp b/gps/dump/dump_gps.cpp
index 62f69f8..e073732 100644
--- a/gps/dump/dump_gps.cpp
+++ b/gps/dump/dump_gps.cpp
@@ -13,13 +13,16 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-#include <unistd.h>
-#include <dump/pixel_dump.h>
-#include <android-base/properties.h>
 #include <android-base/file.h>
+#include <android-base/properties.h>
+#include <dirent.h>
+#include <dump/pixel_dump.h>
+#include <sys/stat.h>
+#include <unistd.h>
 
 #define GPS_LOG_NUMBER_PROPERTY "persist.vendor.gps.aol.log_num"
 #define GPS_LOG_DIRECTORY "/data/vendor/gps/logs"
+#define GPS_RESOURCE_DIRECTORY "/data/vendor/gps/resource"
 #define GPS_TMP_LOG_DIRECTORY "/data/vendor/gps/logs/.tmp"
 #define GPS_LOG_PREFIX "gl-"
 #define GPS_MCU_LOG_PREFIX "esw-"
@@ -29,6 +32,40 @@
 #define GPS_RAWLOG_PREFIX "rawbin"
 #define GPS_MEMDUMP_LOG_PREFIX "memdump_"
 
+static void copyDirectory(const std::string &source,
+                          const std::string &outputDir) {
+  DIR *dir = opendir(source.c_str());
+  if (dir == nullptr) {
+    return;
+  }
+
+  if (mkdir(outputDir.c_str(), 0777) == -1) {
+    closedir(dir);
+    return;
+  }
+
+  struct dirent *entry;
+  while ((entry = readdir(dir)) != nullptr) {
+    std::string entryName = entry->d_name;
+    if (entryName == "." || entryName == "..") {
+      continue;
+    }
+
+    std::string sourcePath = source + "/" + entryName;
+    std::string destPath = outputDir + "/" + entryName;
+
+    struct stat st;
+    if (stat(sourcePath.c_str(), &st) == 0) {
+      if (S_ISDIR(st.st_mode))
+        copyDirectory(sourcePath, destPath);
+      else
+        copyFile(sourcePath.c_str(), destPath.c_str());
+    }
+  }
+  closedir(dir);
+  return;
+}
+
 int main() {
     if(!::android::base::GetBoolProperty("vendor.gps.aol.enabled", false)) {
         printf("vendor.gps.aol.enabled is false. gps logging is not running.\n");
@@ -50,6 +87,7 @@
     }
     dumpLogs(GPS_LOG_DIRECTORY, outputDir.c_str(), maxFileNum, GPS_RAWLOG_PREFIX);
     dumpLogs(GPS_LOG_DIRECTORY, outputDir.c_str(), 18, GPS_MEMDUMP_LOG_PREFIX);
+    copyDirectory(GPS_RESOURCE_DIRECTORY, concatenatePath(outputDir.c_str(), "resource"));
     return 0;
 }
 
diff --git a/gxp/sepolicy/dump_gxp.te b/gxp/sepolicy/dump_gxp.te
index 8d285c5..322a01f 100644
--- a/gxp/sepolicy/dump_gxp.te
+++ b/gxp/sepolicy/dump_gxp.te
@@ -1,3 +1,4 @@
+# Dump GXP logs to bugreport.
 pixel_bugreport(dump_gxp)
 
 userdebug_or_eng(`
@@ -7,7 +8,5 @@
   allow dump_gxp sscoredump_vendor_data_coredump_file:file r_file_perms;
   allow dump_gxp sscoredump_vendor_data_crashinfo_file:dir r_dir_perms;
   allow dump_gxp sscoredump_vendor_data_crashinfo_file:file r_file_perms;
-  # Allow dump_gxp to access gxp properties.
-  get_prop(google_camera_app, vendor_gxp_prop)
 ')
 
diff --git a/insmod/insmod.sh b/insmod/insmod.sh
index 8cac37e..dfc4fdd 100755
--- a/insmod/insmod.sh
+++ b/insmod/insmod.sh
@@ -1,11 +1,11 @@
 #!/vendor/bin/sh
 
-#############################################################
-### init.insmod.cfg format:                               ###
-### ----------------------------------------------------- ###
-### [insmod|setprop|enable/moprobe|wait] [path|prop name] ###
-### ...                                                   ###
-#############################################################
+###################################################################
+### init.insmod.cfg format:                                     ###
+### ----------------------------------------------------------- ###
+### [insmod|setprop|enable|moprobe|rmmod|wait] [path|prop name] ###
+### ...                                                         ###
+###################################################################
 
 modules_dir=
 system_modules_dir=
@@ -96,6 +96,7 @@
           modprobe -a -d "${modules_dir}" $arg
         fi
         ;;
+      "rmmod") rmmod $arg ;;
       "wait") wait_for_file $arg ;;
     esac
   done < $cfg_file
diff --git a/mte/OWNERS b/mte/OWNERS
index 929e941..57da09d 100644
--- a/mte/OWNERS
+++ b/mte/OWNERS
@@ -1,4 +1,4 @@
 eugenis@google.com
 pcc@google.com
-mitchp@google.com
 fmayer@google.com
+nnk@google.com
diff --git a/storage/dump_storage.cpp b/storage/dump_storage.cpp
index e6b3e4c..272b1ee 100644
--- a/storage/dump_storage.cpp
+++ b/storage/dump_storage.cpp
@@ -221,14 +221,23 @@
                         read_buffer(18, 131072, "kioxia_12_ufs_err_history.dat");
                         break;
                       case 0x1AD: //SKhynix
-                        read_buffer(0, 4096, "hynix_00_ufs_err_history.dat");
-                        read_buffer(16, 131072, "skhynix_10_ufs_err_history.dat");
-                        read_buffer(17, 131072, "skhynix_11_ufs_err_history.dat");
-                        read_buffer(18, 131072, "skhynix_12_ufs_err_history.dat");
-                        read_buffer(19, 131072, "skhynix_13_ufs_err_history.dat");
+                        if (!strcmp(ufs_ver.c_str(), "0x0310")) {
+                            read_buffer(0, 4096, "skhynix_00_ufs_err_history.dat");
+                            read_buffer(16, 131072, "skhynix_10_ufs_err_history.dat");
+                            read_buffer(17, 131072, "skhynix_11_ufs_err_history.dat");
+                            read_buffer(18, 131072, "skhynix_12_ufs_err_history.dat");
+                            read_buffer(19, 131072, "skhynix_13_ufs_err_history.dat");
+                        } else {
+                            read_buffer(0, 4096, "skhynix_00_ufs_err_history.dat");
+                            read_buffer(16, 8388608, "skhynix_10_ufs_err_history.dat");
+                            read_buffer(17, 8388608, "skhynix_11_ufs_err_history.dat");
+                        }
                         break;
                       case 0x1CE: //SAMSUNG
-                        read_buffer(16, 8404992, "samsung_10_ufs_err_history.dat");
+                        if (!strcmp(ufs_ver.c_str(), "0x0310"))
+                            read_buffer(16, 8404992, "samsung_10_ufs_err_history.dat");
+                        else
+                            read_buffer(16, 12599296, "samsung_10_ufs_err_history.dat");
                         break;
                       default:
                         break;
diff --git a/touch/gti/sepolicy/hal_sensors_default.te b/touch/gti/sepolicy/hal_sensors_default.te
new file mode 100644
index 0000000..37b93fd
--- /dev/null
+++ b/touch/gti/sepolicy/hal_sensors_default.te
@@ -0,0 +1,2 @@
+# Support SW_LID event from SensorHAL to configure touch input and gesture
+set_prop(hal_sensors_default, vendor_gti_prop)
diff --git a/vibrator/flags/VibratorFlags.aconfig b/vibrator/flags/VibratorFlags.aconfig
index ec6e2d4..3e0a6fd 100644
--- a/vibrator/flags/VibratorFlags.aconfig
+++ b/vibrator/flags/VibratorFlags.aconfig
@@ -8,3 +8,11 @@
   description: "This flag controls the removal of utilizing Capo at the HAL level"
   bug: "290223630"
 }
+
+flag {
+  name: "enable_pwle_v2"
+  namespace: "vibrator"
+  is_exported: true
+  description: "This flag enables the PWLE V2 APIs guarded by the CAP_COMPOSE_PWLE_EFFECTS_V2 compatability"
+  bug: "346570576"
+}
\ No newline at end of file