Merge "Allow edgetpu_tachyon_service to access GXP device & Dmabuf." into main
diff --git a/OWNERS b/OWNERS
index 2f454e4..262b161 100644
--- a/OWNERS
+++ b/OWNERS
@@ -1,19 +1,6 @@
-aaronding@google.com
-rurumihong@google.com
-adamshih@google.com
-wilsonsung@google.com
-lucaswei@google.com
-cyanhsieh@google.com
-cyuanjen@google.com
-robinpeng@google.com
-achant@google.com
-etam@google.com
-pattjin@google.com
-bkhalife@google.com
-lokeshgoel@google.com
-jainne@google.com
-pscovanner@google.com
 
 per-file *.te,*_contexts,te_macros,global_macros=set noparent
 per-file *.te,*_contexts,te_macros,global_macros=file:/sepolicy/OWNERS
+per-file *.mk=set noparent
+per-file *.mk=aaronding@google.com,rurumihong@google.com,adamshih@google.com,wilsonsung@google.com,cyanhsieh@google.com,cyuanjen@google.com,robinpeng@google.com,achant@google.com,etam@google.com,pattjin@google.com,bkhalife@google.com,lokeshgoel@google.com,jainne@google.com,pscovanner@google.com
 
diff --git a/aoc/sepolicy/aocd.te b/aoc/sepolicy/aocd.te
index 69b0af0..b2bfd13 100644
--- a/aoc/sepolicy/aocd.te
+++ b/aoc/sepolicy/aocd.te
@@ -10,6 +10,7 @@
 # sysfs operations
 allow aocd sysfs_aoc:dir search;
 allow aocd sysfs_aoc_firmware:file w_file_perms;
+allow aocd sysfs_aoc_notifytimeout:file r_file_perms;
 
 # dev operations
 allow aocd aoc_device:chr_file rw_file_perms;
@@ -19,3 +20,4 @@
 
 # set properties
 set_prop(aocd, vendor_aoc_prop)
+set_prop(aocd, vendor_timeout_aoc_prop)
\ No newline at end of file
diff --git a/aoc/sepolicy/file.te b/aoc/sepolicy/file.te
index 602c5fe..0b853db 100644
--- a/aoc/sepolicy/file.te
+++ b/aoc/sepolicy/file.te
@@ -4,6 +4,7 @@
 type sysfs_aoc_firmware, sysfs_type, fs_type;
 type sysfs_aoc, sysfs_type, fs_type;
 type sysfs_aoc_reset, sysfs_type, fs_type;
+type sysfs_aoc_notifytimeout, sysfs_type, fs_type;
 
 # persist
 type persist_aoc_file, file_type, vendor_persist_type;
diff --git a/aoc/sepolicy/file_contexts b/aoc/sepolicy/file_contexts
index c3a4754..58edf2f 100644
--- a/aoc/sepolicy/file_contexts
+++ b/aoc/sepolicy/file_contexts
@@ -20,6 +20,8 @@
 /dev/acd-com.google.usf.non_wake_up u:object_r:aoc_device:s0
 /dev/acd-com.google.chre             u:object_r:aoc_device:s0
 /dev/acd-com.google.chre.non_wake_up u:object_r:aoc_device:s0
+/dev/acd-com.google.bt              u:object_r:aoc_device:s0
+/dev/acd-com.google.bt.non_wake_up  u:object_r:aoc_device:s0
 /dev/acd-logging                    u:object_r:aoc_device:s0
 /dev/aoc                            u:object_r:aoc_device:s0
 /dev/acd-audio_ap_offload_rx        u:object_r:aoc_device:s0
diff --git a/aoc/sepolicy/property.te b/aoc/sepolicy/property.te
index e6f9ddb..c2f5695 100644
--- a/aoc/sepolicy/property.te
+++ b/aoc/sepolicy/property.te
@@ -1,2 +1,3 @@
 # AoC
 vendor_internal_prop(vendor_aoc_prop)
+vendor_internal_prop(vendor_timeout_aoc_prop)
\ No newline at end of file
diff --git a/aoc/sepolicy/property_contexts b/aoc/sepolicy/property_contexts
index 0838873..3c2acb6 100644
--- a/aoc/sepolicy/property_contexts
+++ b/aoc/sepolicy/property_contexts
@@ -1,2 +1,3 @@
 # AoC
 vendor.aoc.firmware.version                     u:object_r:vendor_aoc_prop:s0
+persist.vendor.aoc.status_request_timed_out     u:object_r:vendor_timeout_aoc_prop:s0
\ No newline at end of file
diff --git a/audio/common.mk b/audio/common.mk
index 7f3375b..4157970 100644
--- a/audio/common.mk
+++ b/audio/common.mk
@@ -6,6 +6,7 @@
 	libmahalcontroller \
 	libAlgFx_HiFi3z
 
+ifneq ($(RELEASE_PIXEL_AIDL_AUDIO_HAL),true)
 ## AudioHAL Configurations
 PRODUCT_COPY_FILES += \
 	frameworks/av/services/audiopolicy/config/a2dp_audio_policy_configuration_7_0.xml:$(TARGET_COPY_OUT_VENDOR)/etc/a2dp_audio_policy_configuration_7_0.xml \
@@ -13,10 +14,12 @@
 	frameworks/av/services/audiopolicy/config/hearing_aid_audio_policy_configuration_7_0.xml:$(TARGET_COPY_OUT_VENDOR)/etc/hearing_aid_audio_policy_configuration_7_0.xml \
 	frameworks/av/services/audiopolicy/config/r_submix_audio_policy_configuration.xml:$(TARGET_COPY_OUT_VENDOR)/etc/r_submix_audio_policy_configuration.xml \
 	frameworks/av/services/audiopolicy/config/usb_audio_policy_configuration.xml:$(TARGET_COPY_OUT_VENDOR)/etc/usb_audio_policy_configuration.xml \
-    frameworks/av/services/audiopolicy/config/audio_policy_volumes.xml:$(TARGET_COPY_OUT_VENDOR)/etc/audio_policy_volumes.xml \
+	frameworks/av/services/audiopolicy/config/audio_policy_volumes.xml:$(TARGET_COPY_OUT_VENDOR)/etc/audio_policy_volumes.xml \
 	frameworks/av/services/audiopolicy/config/default_volume_tables.xml:$(TARGET_COPY_OUT_VENDOR)/etc/default_volume_tables.xml \
 	frameworks/av/services/audiopolicy/config/bluetooth_audio_policy_configuration_7_0.xml:$(TARGET_COPY_OUT_VENDOR)/etc/bluetooth_audio_policy_configuration_7_0.xml
 
+endif
+
 ## TODO(b/271958194): separate for hidl and aidl.
 PRODUCT_SOONG_NAMESPACES += \
 	vendor/google/whitechapel/audio/hal \
diff --git a/audio/hidl_zuma.mk b/audio/hidl_zuma.mk
index 3a5c211..d671f46 100644
--- a/audio/hidl_zuma.mk
+++ b/audio/hidl_zuma.mk
@@ -23,6 +23,7 @@
 	audio_bluenote_aoc \
 	audio_usb_aoc \
 	audio_cca_aoc \
+	audio_compensation_aoc \
 	libamcsextfile \
 	audio_amcs_ext \
 	audio.usb.default \
diff --git a/audio/sepolicy/common/genfs_contexts b/audio/sepolicy/common/genfs_contexts
index 013b913..eaa0c71 100644
--- a/audio/sepolicy/common/genfs_contexts
+++ b/audio/sepolicy/common/genfs_contexts
@@ -18,3 +18,6 @@
 genfscon sysfs /devices/platform/audiometrics/pcm_count                     u:object_r:sysfs_pixelstats:s0
 genfscon sysfs /devices/platform/audiometrics/pcm_latency                   u:object_r:sysfs_pixelstats:s0
 genfscon sysfs /devices/platform/audiometrics/call_count                    u:object_r:sysfs_pixelstats:s0
+genfscon sysfs /devices/platform/audiometrics/offload_effects_id            u:object_r:sysfs_pixelstats:s0
+genfscon sysfs /devices/platform/audiometrics/offload_effects_duration      u:object_r:sysfs_pixelstats:s0
+genfscon sysfs /devices/platform/audiometrics/bt_usage                      u:object_r:sysfs_pixelstats:s0
diff --git a/battery_mitigation/battery_mitigation.cpp b/battery_mitigation/battery_mitigation.cpp
index 2443226..18bb63d 100644
--- a/battery_mitigation/battery_mitigation.cpp
+++ b/battery_mitigation/battery_mitigation.cpp
@@ -16,15 +16,20 @@
 
 #define LOG_TAG "battery-mitigation"
 
-#include <battery_mitigation/BatteryMitigation.h>
 #include <android/binder_process.h>
+#include <battery_mitigation/BatteryMitigation.h>
+#include <battery_mitigation/BatteryMitigationService.h>
+#include <sys/resource.h>
+#include <system/thread_defs.h>
 
 #define COUNT_LIMIT 10
 
 using android::hardware::google::pixel::BatteryMitigation;
+using android::hardware::google::pixel::BatteryMitigationService;
 using android::hardware::google::pixel::MitigationConfig;
 
 android::sp<BatteryMitigation> bmSp;
+android::sp<BatteryMitigationService> batteryMitigationService;
 
 const struct MitigationConfig::Config cfg = {
     .SystemPath = {
@@ -67,32 +72,150 @@
     .TimestampFormat = "%Y-%m-%d %H:%M:%S",
 };
 
+const struct MitigationConfig::EventThreadConfig eventThreadCfg = {
+    .NumericSysfsStatPaths = {
+        {"cpu0_freq", "/sys/devices/system/cpu/cpu0/cpufreq/scaling_cur_freq"},
+        {"cpu1_freq", "/sys/devices/system/cpu/cpu1/cpufreq/scaling_cur_freq"},
+        {"cpu2_freq", "/sys/devices/system/cpu/cpu2/cpufreq/scaling_cur_freq"},
+        {"gpu_freq", "/sys/devices/platform/1f000000.mali/cur_freq"},
+        {"battery_temp", "/dev/thermal/tz-by-name/battery/temp"},
+        {"battery_cycle", "/dev/thermal/tz-by-name/battery_cycle/temp"},
+        {"voltage_now", "/sys/class/power_supply/battery/voltage_now"},
+        {"current_now", "/sys/class/power_supply/battery/current_now"},
+    },
+    .TriggeredIdxPath = "/sys/devices/virtual/pmic/mitigation/br_stats/triggered_idx",
+    .triggeredStatePath[android::hardware::google::pixel::UVLO1] =
+        "/sys/devices/virtual/pmic/mitigation/triggered_state/uvlo1_triggered",
+    .triggeredStatePath[android::hardware::google::pixel::UVLO2] =
+        "/sys/devices/virtual/pmic/mitigation/triggered_state/uvlo2_triggered",
+    .triggeredStatePath[android::hardware::google::pixel::OILO1] =
+        "/sys/devices/virtual/pmic/mitigation/triggered_state/oilo1_triggered",
+    .triggeredStatePath[android::hardware::google::pixel::OILO2] =
+        "/sys/devices/virtual/pmic/mitigation/triggered_state/oilo2_triggered",
+    .triggeredStatePath[android::hardware::google::pixel::SMPL] =
+        "/sys/devices/virtual/pmic/mitigation/triggered_state/smpl_triggered",
+    .BrownoutStatsPath = "/sys/devices/virtual/pmic/mitigation/br_stats/stats",
+    .StoringPath = "/data/vendor/mitigation/thismeal.bin",
+    .ParsedThismealPath = "/data/vendor/mitigation/thismeal.txt",
+    .ParsedLastmealPath = "/data/vendor/mitigation/lastmeal.txt",
+    .ParsedLastmealCSVPath = "/data/vendor/mitigation/lastmeal.csv",
+    .FvpStatsPath = "/sys/devices/platform/acpm_stats/fvp_stats",
+    .PmicCommon = {
+                /* Main Pmic */
+                {
+                    .OdpmDir = "/sys/bus/iio/devices/iio:device0",
+                    .OdpmEnabledRailsPath = "/sys/bus/iio/devices/iio:device0/enabled_rails",
+                    .PmicNamePath = "/sys/bus/iio/devices/iio:device0/name",
+                },
+                /* Sub Pmic */
+                {
+                    .OdpmDir = "/sys/bus/iio/devices/iio:device1",
+                    .OdpmEnabledRailsPath = "/sys/bus/iio/devices/iio:device1/enabled_rails",
+                    .PmicNamePath = "/sys/bus/iio/devices/iio:device1/name",
+                },
+    },
+    .PlatformSpecific = {
+                /* MIN_SUPPORTED_PLATFORM */
+                {
+                    .MainPmicName = "s2mpg10-odpm\n",
+                    .SubPmicName = "s2mpg11-odpm\n",
+                    .NumericSysfsStatPaths = {
+                        {"battery_soc", "/sys/class/power_supply/max77759fg/capacity"},
+                    },
+                },
+                {
+                    .MainPmicName = "s2mpg12-odpm\n",
+                    .SubPmicName = "s2mpg13-odpm\n",
+                    .NumericSysfsStatPaths = {
+                        {"battery_soc", "/sys/class/power_supply/max77759fg/capacity"},
+                    },
+                },
+                {
+                    .MainPmicName = "s2mpg14-odpm\n",
+                    .SubPmicName = "s2mpg15-odpm\n",
+                    .NumericSysfsStatPaths = {
+                        {"battery_soc", "/sys/class/power_supply/max77779fg/capacity"},
+                    },
+                },
+                /* MAX_SUPPORTED_PLATFORM */
+                {
+                    .MainPmicName = "s2mpg14-odpm\n",
+                    .SubPmicName = "s2mpg15-odpm\n",
+                    .NumericSysfsStatPaths = {
+                        {"battery_soc", "/sys/class/power_supply/max77779fg/capacity"},
+                    },
+                },
+
+    },
+};
+
 const char kReadyFilePath[] = "/sys/devices/virtual/pmic/mitigation/instruction/ready";
 const char kReadyProperty[] = "vendor.brownout.mitigation.ready";
 const char kLastMealPath[] = "/data/vendor/mitigation/lastmeal.txt";
 const char kBRRequestedProperty[] = "vendor.brownout_reason";
 const char kLastMealProperty[] = "vendor.brownout.br.feasible";
+const char kCDTProperty[] = "ro.boot.cdt_hwid";
 const std::regex kTimestampRegex("^\\S+\\s[0-9]+:[0-9]+:[0-9]+\\S+$");
 
-int main(int /*argc*/, char ** /*argv*/) {
+std::string GetSystemProperty(std::string property) {
+    char value[PROP_VALUE_MAX];
+    __system_property_get(property.c_str(), value);
+    return std::string(value);
+}
+
+int main(int argc, char **argv) {
+    std::string cdt = GetSystemProperty(kCDTProperty);
+    int platformNum  = atoi(cdt.substr(5, 1).c_str());
+    batteryMitigationService = new BatteryMitigationService(eventThreadCfg,
+                                                            platformNum);
+    if (!batteryMitigationService) {
+        return 0;
+    }
+    bool platformSupported = batteryMitigationService->isPlatformSupported();
+    bool brownoutStatsBinarySupported = batteryMitigationService->isBrownoutStatsBinarySupported();
+    if (argc == 2) {
+        if(strcmp(argv[1], "-d") == 0 &&
+           brownoutStatsBinarySupported &&
+           platformSupported) {
+            /* Create thismeal.txt from thismeal.bin */
+            batteryMitigationService->genParsedMeal(eventThreadCfg.ParsedThismealPath);
+        }
+        return 0;
+    }
+
+    setpriority(PRIO_PROCESS, 0, ANDROID_PRIORITY_AUDIO);
     auto batteryMitigationStartTime = std::chrono::system_clock::now();
     ABinderProcess_setThreadPoolMaxThreadCount(1);
     ABinderProcess_startThreadPool();
-    bmSp = new BatteryMitigation(cfg);
-    if (!bmSp) {
-        return 0;
-    }
-    bool mitigationLogTimeValid = bmSp->isMitigationLogTimeValid(batteryMitigationStartTime,
-                                                                 cfg.LogFilePath,
-                                                                 cfg.TimestampFormat,
-                                                                 kTimestampRegex);
+
+    bool mitigationLogTimeValid;
     std::string reason = android::base::GetProperty(kBRRequestedProperty, "");
-    if (!reason.empty() && mitigationLogTimeValid) {
-        std::ifstream src(cfg.LogFilePath, std::ios::in);
-        std::ofstream dst(kLastMealPath, std::ios::out);
-        dst << src.rdbuf();
-        android::base::SetProperty(kLastMealProperty, "1");
+    if (brownoutStatsBinarySupported) {
+        /* Create lastmeal.txt if the dump time in thismeal.bin are valid */
+        mitigationLogTimeValid = batteryMitigationService->isTimeValid(eventThreadCfg.StoringPath,
+                                                                       batteryMitigationStartTime);
+        if (!reason.empty() && mitigationLogTimeValid &&
+            batteryMitigationService->genParsedMeal(eventThreadCfg.ParsedLastmealPath) &&
+            batteryMitigationService->genLastmealCSV(eventThreadCfg.ParsedLastmealCSVPath)) {
+            android::base::SetProperty(kLastMealProperty, "1");
+        }
+    } else{
+        bmSp = new BatteryMitigation(cfg);
+        if (!bmSp) {
+            return 0;
+        }
+        mitigationLogTimeValid = bmSp->isMitigationLogTimeValid(batteryMitigationStartTime,
+                                                                cfg.LogFilePath,
+                                                                cfg.TimestampFormat,
+                                                                kTimestampRegex);
+        if (!reason.empty() && mitigationLogTimeValid) {
+            std::ifstream src(cfg.LogFilePath, std::ios::in);
+            std::ofstream dst(kLastMealPath, std::ios::out);
+            dst << src.rdbuf();
+            android::base::SetProperty(kLastMealProperty, "1");
+        }
     }
+
     bool isBatteryMitigationReady = false;
     std::string ready_str;
     int val = 0;
@@ -112,6 +235,10 @@
     if (isBatteryMitigationReady) {
         android::base::SetProperty(kReadyProperty, "1");
     }
+    if (isBatteryMitigationReady && brownoutStatsBinarySupported) {
+        /* Start BrownoutEventThread to poll brownout event from kernel */
+        batteryMitigationService->startBrownoutEventThread();
+    }
     while (true) {
         pause();
     }
diff --git a/battery_mitigation/sepolicy/vendor/battery_mitigation.te b/battery_mitigation/sepolicy/vendor/battery_mitigation.te
index 4b83c28..4b5bc48 100644
--- a/battery_mitigation/sepolicy/vendor/battery_mitigation.te
+++ b/battery_mitigation/sepolicy/vendor/battery_mitigation.te
@@ -10,11 +10,14 @@
 hal_client_domain(battery_mitigation, hal_thermal);
 hal_client_domain(battery_mitigation, hal_health);
 
+r_dir_file(battery_mitigation, sysfs_acpm_stats)
 r_dir_file(battery_mitigation, sysfs_batteryinfo)
 r_dir_file(battery_mitigation, sysfs_iio_devices)
+r_dir_file(battery_mitigation, sysfs_gpu)
 r_dir_file(battery_mitigation, sysfs_thermal)
 r_dir_file(battery_mitigation, thermal_link_device)
 r_dir_file(battery_mitigation, sysfs_odpm)
+r_dir_file(battery_mitigation, sysfs_power_stats)
 allow battery_mitigation sysfs_bcl:dir r_dir_perms;
 allow battery_mitigation sysfs_bcl:file r_file_perms;
 allow battery_mitigation sysfs_bcl:lnk_file r_file_perms;
@@ -24,3 +27,5 @@
 
 # Allow battery_mitigation to use Binder IPC so that service manager can notify it for callbacks
 binder_use(battery_mitigation)
+# Allow battery_mitigation to listen brownout event by epoll_wait
+wakelock_use(battery_mitigation)
diff --git a/bcmbt/dump/dump_bcmbt.cpp b/bcmbt/dump/dump_bcmbt.cpp
index 91dd7fa..0135198 100644
--- a/bcmbt/dump/dump_bcmbt.cpp
+++ b/bcmbt/dump/dump_bcmbt.cpp
@@ -17,11 +17,13 @@
 //#include <android-base/properties.h>
 #include <android-base/file.h>
 
+#define BCMBT_ACTIVITY_LOG_DIRECTORY "/data/vendor/bluetooth"
 #define BCMBT_SNOOP_LOG_DIRECTORY "/data/vendor/bluetooth"
 #define BCMBT_FW_LOG_DIRECTORY "/data/vendor/ssrdump/coredump"
 #define BCMBT_SNOOP_LOG_PREFIX "btsnoop_hci_vnd"
 #define BCMBT_FW_DUMP_LOG_PREFIX "coredump_bt_socdump_"
 #define BCMBT_CHRE_DUMP_LOG_PREFIX "coredump_bt_chredump_"
+#define BCMBT_ACTIVITY_LOG_PREFIX "bt_activity_"
 
 int main() {
     std::string outputDir = concatenatePath(BUGREPORT_PACKING_DIR, "bcmbt");
@@ -33,5 +35,6 @@
     dumpLogs(BCMBT_SNOOP_LOG_DIRECTORY, outputDir.c_str(), 2, BCMBT_SNOOP_LOG_PREFIX);
     dumpLogs(BCMBT_FW_LOG_DIRECTORY, outputDir.c_str(), 10, BCMBT_FW_DUMP_LOG_PREFIX);
     dumpLogs(BCMBT_FW_LOG_DIRECTORY, outputDir.c_str(), 10, BCMBT_CHRE_DUMP_LOG_PREFIX);
+    dumpLogs(BCMBT_ACTIVITY_LOG_DIRECTORY, outputDir.c_str(), 10, BCMBT_ACTIVITY_LOG_PREFIX);
     return 0;
 }
diff --git a/camera/sepolicy/product/private/service_contexts b/camera/sepolicy/product/private/service_contexts
new file mode 100644
index 0000000..fed03af
--- /dev/null
+++ b/camera/sepolicy/product/private/service_contexts
@@ -0,0 +1 @@
+com.google.pixel.camera.services.binder.IServiceBinder/default u:object_r:camera_binder_service:s0
\ No newline at end of file
diff --git a/camera/sepolicy/product/private/vendor_pbcs_app.te b/camera/sepolicy/product/private/vendor_pbcs_app.te
index d77162e..54bc0c0 100644
--- a/camera/sepolicy/product/private/vendor_pbcs_app.te
+++ b/camera/sepolicy/product/private/vendor_pbcs_app.te
@@ -7,3 +7,6 @@
 allow vendor_pbcs_app app_api_service:service_manager find;
 # Allow PBCS to find Camera Service.
 allow vendor_pbcs_app cameraserver_service:service_manager find;
+
+# Allow PBCS to add the ServiceBinder service to ServiceManager.
+add_service(vendor_pbcs_app, camera_binder_service);
\ No newline at end of file
diff --git a/camera/sepolicy/product/public/service.te b/camera/sepolicy/product/public/service.te
new file mode 100644
index 0000000..f94fd9f
--- /dev/null
+++ b/camera/sepolicy/product/public/service.te
@@ -0,0 +1 @@
+type camera_binder_service, hal_service_type, protected_service, service_manager_type;
\ No newline at end of file
diff --git a/camera/sepolicy/vendor/hal_camera_default.te b/camera/sepolicy/vendor/hal_camera_default.te
index dd00cc3..4c9aa05 100644
--- a/camera/sepolicy/vendor/hal_camera_default.te
+++ b/camera/sepolicy/vendor/hal_camera_default.te
@@ -1,4 +1,4 @@
-allow hal_camera_default vendor_camera_binder_service:service_manager find;
+allow hal_camera_default camera_binder_service:service_manager find;
 # Allow Lyric Hal to find the LyricConfigProvider service through ServiceManager.
 allow hal_camera_default vendor_camera_lyricconfigprovider_service:service_manager find;
 
diff --git a/camera/sepolicy/vendor/service.te b/camera/sepolicy/vendor/service.te
index 877dbc1..87a1d93 100644
--- a/camera/sepolicy/vendor/service.te
+++ b/camera/sepolicy/vendor/service.te
@@ -1,5 +1,3 @@
-type vendor_camera_binder_service, hal_service_type, protected_service, service_manager_type;
-
 type hal_pixel_remote_camera_service, hal_service_type, protected_service, service_manager_type;
 
 type vendor_camera_lyricconfigprovider_service, hal_service_type, protected_service, service_manager_type;
diff --git a/camera/sepolicy/vendor/service_contexts b/camera/sepolicy/vendor/service_contexts
index e6eaa64..1bcaab8 100644
--- a/camera/sepolicy/vendor/service_contexts
+++ b/camera/sepolicy/vendor/service_contexts
@@ -1,5 +1,3 @@
-com.google.pixel.camera.services.binder.IServiceBinder/default u:object_r:vendor_camera_binder_service:s0
-
 com.google.pixel.camera.connectivity.hal.provider.ICameraProvider/default u:object_r:hal_pixel_remote_camera_service:s0
 
 com.google.pixel.camera.services.lyricconfigprovider.ILyricConfigProvider/default u:object_r:vendor_camera_lyricconfigprovider_service:s0
diff --git a/camera/sepolicy/vendor/vendor_pbcs_app.te b/camera/sepolicy/vendor/vendor_pbcs_app.te
index 7b9c5e2..b25c9a2 100644
--- a/camera/sepolicy/vendor/vendor_pbcs_app.te
+++ b/camera/sepolicy/vendor/vendor_pbcs_app.te
@@ -1,5 +1,5 @@
 # Allow PBCS to add the ServiceBinder service to ServiceManager.
-add_service(vendor_pbcs_app, vendor_camera_binder_service);
+add_service(vendor_pbcs_app, camera_binder_service);
 # Allow PBCS to add the LyricConfigProvider service to ServiceManager.
 add_service(vendor_pbcs_app, vendor_camera_lyricconfigprovider_service);
 # Allow PBCS to add the CameraIdRemapper service to ServiceManager.
diff --git a/device.mk b/device.mk
index f686621..4787315 100644
--- a/device.mk
+++ b/device.mk
@@ -14,6 +14,8 @@
 # limitations under the License.
 #
 
+include device/google/gs-common/tts/voice_packs.mk
+
 PRODUCT_SOONG_NAMESPACES += \
 	device/google/gs-common/powerstats
 
diff --git a/diagnosticstool/diagnosticstool.mk b/diagnosticstool/diagnosticstool.mk
new file mode 100644
index 0000000..67fbd88
--- /dev/null
+++ b/diagnosticstool/diagnosticstool.mk
@@ -0,0 +1 @@
+PRODUCT_PRIVATE_SEPOLICY_DIRS += device/google/gs-common/diagnosticstool/sepolicy
diff --git a/diagnosticstool/sepolicy/diagnosticstool_app.te b/diagnosticstool/sepolicy/diagnosticstool_app.te
new file mode 100644
index 0000000..d1874e6
--- /dev/null
+++ b/diagnosticstool/sepolicy/diagnosticstool_app.te
@@ -0,0 +1,4 @@
+type diagnosticstool_app, domain;
+app_domain(diagnosticstool_app)
+
+allow diagnosticstool_app app_api_service:service_manager find;
diff --git a/diagnosticstool/sepolicy/seapp_contexts b/diagnosticstool/sepolicy/seapp_contexts
new file mode 100644
index 0000000..3c601cd
--- /dev/null
+++ b/diagnosticstool/sepolicy/seapp_contexts
@@ -0,0 +1,2 @@
+# Diagnostics Tool
+user=_app seinfo=platform name=com.google.android.apps.diagnosticstool domain=diagnosticstool_app isPrivApp=true levelFrom=user
diff --git a/display/dump_display.cpp b/display/dump_display.cpp
index d78a91a..b811889 100644
--- a/display/dump_display.cpp
+++ b/display/dump_display.cpp
@@ -24,6 +24,7 @@
     runCommand("libdisplaycolor", "/vendor/bin/dumpsys displaycolor -v");
     dumpFileContent("Primary panel name", "/sys/devices/platform/exynos-drm/primary-panel/panel_name");
     dumpFileContent("Primary panel extra info", "/sys/devices/platform/exynos-drm/primary-panel/panel_extinfo");
+    dumpFileContent("Primary panel power Vreg", "/sys/devices/platform/exynos-drm/primary-panel/panel_pwr_vreg");
     return 0;
 }
 
diff --git a/display/sepolicy/genfs_contexts b/display/sepolicy/genfs_contexts
index 9eaf5fb..7c46278 100644
--- a/display/sepolicy/genfs_contexts
+++ b/display/sepolicy/genfs_contexts
@@ -1,3 +1,3 @@
 
 genfscon debugfs /dri/0/crtc-                                           u:object_r:vendor_dri_debugfs:s0
-
+genfscon sysfs /module/drm/parameters/debug                             u:object_r:sysfs_display:s0
diff --git a/edgetpu/sepolicy/edgetpu_dba_service.te b/edgetpu/sepolicy/edgetpu_dba_service.te
index 1c30b76..f6ecd09 100644
--- a/edgetpu/sepolicy/edgetpu_dba_service.te
+++ b/edgetpu/sepolicy/edgetpu_dba_service.te
@@ -49,3 +49,7 @@
 get_prop(edgetpu_dba_server, vendor_hetero_runtime_prop)
 # Allow EdgeTPU DBA service to read EdgeTPU CPU scheduler properties
 get_prop(edgetpu_dba_server, vendor_edgetpu_cpu_scheduler_prop)
+
+# Allow DMA Buf access.
+allow edgetpu_dba_server dmabuf_system_heap_device:chr_file r_file_perms;
+
diff --git a/edgetpu/sepolicy/hal_audio_default.te b/edgetpu/sepolicy/hal_audio_default.te
new file mode 100644
index 0000000..2646fcc
--- /dev/null
+++ b/edgetpu/sepolicy/hal_audio_default.te
@@ -0,0 +1,14 @@
+# Allow the audio hal to access the EdgeTPU service and the
+# Android shared memory allocated by the EdgeTPU service for
+# on-device compilation.
+allow hal_audio_default edgetpu_device:chr_file rw_file_perms;
+allow hal_audio_default edgetpu_vendor_service:service_manager find;
+binder_call(hal_audio_default, edgetpu_vendor_server)
+
+# Allow edgetpu_app_service as well, due to the EdgeTpu metrics logging
+# library has a dependency on edgetpu_app_service, see b/275016466.
+allow hal_audio_default edgetpu_app_service:service_manager find;
+binder_call(hal_audio_default, edgetpu_app_server)
+
+# Allow audio HAL to read tflite Darwinn delegate properties
+get_prop(hal_audio_default, vendor_tflite_delegate_prop)
diff --git a/edgetpu/sepolicy/hal_neuralnetworks_darwinn.te b/edgetpu/sepolicy/hal_neuralnetworks_darwinn.te
index b65a30e..3b2cd4f 100644
--- a/edgetpu/sepolicy/hal_neuralnetworks_darwinn.te
+++ b/edgetpu/sepolicy/hal_neuralnetworks_darwinn.te
@@ -58,3 +58,7 @@
 get_prop(hal_neuralnetworks_darwinn, vendor_edgetpu_runtime_prop)
 # Allow NNAPI HAL to read hetero runtime properties
 get_prop(hal_neuralnetworks_darwinn, vendor_hetero_runtime_prop)
+
+# Allow DMA Buf access.
+allow hal_neuralnetworks_darwinn dmabuf_system_heap_device:chr_file r_file_perms;
+
diff --git a/gear/dumpstate/Android.bp b/gear/dumpstate/Android.bp
index 590ba10..b230f34 100644
--- a/gear/dumpstate/Android.bp
+++ b/gear/dumpstate/Android.bp
@@ -27,3 +27,23 @@
     vendor: true,
     relative_install_path: "hw",
 }
+
+cc_library {
+    name: "libdump",
+    srcs: ["pixel_dump.cpp"],
+    vendor_available: true,
+    vendor_ramdisk_available: true,
+    shared_libs: [
+        "libbase",
+        "liblog",
+    ],
+    cflags: [
+        "-Wall",
+        "-Werror",
+    ],
+
+    export_include_dirs: [
+        "include",
+    ],
+}
+
diff --git a/insmod/include/dump/pixel_dump.h b/gear/dumpstate/include/dump/pixel_dump.h
similarity index 100%
rename from insmod/include/dump/pixel_dump.h
rename to gear/dumpstate/include/dump/pixel_dump.h
diff --git a/insmod/pixel_dump.cpp b/gear/dumpstate/pixel_dump.cpp
similarity index 100%
rename from insmod/pixel_dump.cpp
rename to gear/dumpstate/pixel_dump.cpp
diff --git a/gps/brcm/device.mk b/gps/brcm/device.mk
index dd64dd3..3065542 100644
--- a/gps/brcm/device.mk
+++ b/gps/brcm/device.mk
@@ -2,9 +2,13 @@
 
 PRODUCT_SOONG_NAMESPACES += vendor/broadcom/gps/bcm47765
 
-$(call soong_config_set, gpssdk, sdkv1, False)
+SOONG_CONFIG_NAMESPACES += gpssdk
+SOONG_CONFIG_gpssdk += sdkv1
+SOONG_CONFIG_gpssdk_sdkv1 ?= false
 
-$(call soong_config_set, gpssdk, gpsmcuversion, gpsv2_$(TARGET_BUILD_VARIANT))
+SOONG_CONFIG_NAMESPACES += gpssdk
+SOONG_CONFIG_gpssdk += gpsmcuversion
+SOONG_CONFIG_gpssdk_gpsmcuversion ?= gpsv2_$(TARGET_BUILD_VARIANT)
 
 PRODUCT_PACKAGES += \
 	bcm47765_gps_package \
diff --git a/gyotaku_app/sepolicy/gyotaku_app.te b/gyotaku_app/sepolicy/gyotaku_app.te
index 80123cf..867ec4c 100644
--- a/gyotaku_app/sepolicy/gyotaku_app.te
+++ b/gyotaku_app/sepolicy/gyotaku_app.te
@@ -22,4 +22,7 @@
 
   # For persistent property use
   get_prop(gyotaku_app, logpersistd_logging_prop);
+
+  # For access hal_power_stats
+  hal_client_domain(gyotaku_app, hal_power_stats);
 ')
diff --git a/insmod/Android.bp b/insmod/Android.bp
index 3b956e7..eed35ec 100644
--- a/insmod/Android.bp
+++ b/insmod/Android.bp
@@ -15,22 +15,4 @@
     vendor: true,
 }
 
-cc_library {
-    name: "libdump",
-    srcs: ["pixel_dump.cpp"],
-    vendor_available: true,
-    vendor_ramdisk_available: true,
-    shared_libs: [
-        "libbase",
-        "liblog",
-    ],
-    cflags: [
-        "-Wall",
-        "-Werror",
-    ],
-
-    export_include_dirs: [
-        "include",
-    ],
-}
 
diff --git a/mediacodec/bigwave/mediacodec_bigwave.mk b/mediacodec/bigwave/mediacodec_bigwave.mk
new file mode 100644
index 0000000..4268e53
--- /dev/null
+++ b/mediacodec/bigwave/mediacodec_bigwave.mk
@@ -0,0 +1,14 @@
+PRODUCT_SOONG_NAMESPACES += vendor/google/media/bigwave
+
+PRODUCT_PACKAGES += \
+	google.hardware.media.c2@2.0-service \
+	libgc2_bw_store \
+	libgc2_bw_base \
+	libgc2_bw_av1_dec \
+	libgc2_bw_av1_enc \
+	libbw_av1dec \
+	libbw_av1enc \
+	libgc2_bw_cwl \
+	libgc2_bw_log \
+	libgc2_bw_utils
+
diff --git a/modem/radio_ext/compatibility_matrix.xml b/modem/radio_ext/compatibility_matrix.xml
new file mode 100644
index 0000000..1e4def5
--- /dev/null
+++ b/modem/radio_ext/compatibility_matrix.xml
@@ -0,0 +1,10 @@
+<compatibility-matrix version="1.0" type="framework">
+    <hal format="aidl" optional="true">
+        <name>vendor.google.radio_ext</name>
+        <version>1</version>
+        <interface>
+            <name>IRadioExt</name>
+            <instance>default</instance>
+        </interface>
+    </hal>
+</compatibility-matrix>
diff --git a/modem/radio_ext/radio_ext.mk b/modem/radio_ext/radio_ext.mk
new file mode 100644
index 0000000..6750fdd
--- /dev/null
+++ b/modem/radio_ext/radio_ext.mk
@@ -0,0 +1,5 @@
+PRODUCT_SOONG_NAMESPACES += vendor/google/interfaces
+PRODUCT_PACKAGES += vendor.google.radio_ext-service
+DEVICE_PRODUCT_COMPATIBILITY_MATRIX_FILE += device/google/gs-common/modem/radio_ext/compatibility_matrix.xml
+
+BOARD_VENDOR_SEPOLICY_DIRS += device/google/gs-common/modem/radio_ext/sepolicy
diff --git a/modem/radio_ext/sepolicy/file_contexts b/modem/radio_ext/sepolicy/file_contexts
new file mode 100644
index 0000000..cd4172c
--- /dev/null
+++ b/modem/radio_ext/sepolicy/file_contexts
@@ -0,0 +1 @@
+/vendor/bin/hw/vendor\.google\.radio_ext-service              u:object_r:hal_radio_ext_exec:s0
diff --git a/modem/radio_ext/sepolicy/hal_radio_ext.te b/modem/radio_ext/sepolicy/hal_radio_ext.te
new file mode 100644
index 0000000..203ae3b
--- /dev/null
+++ b/modem/radio_ext/sepolicy/hal_radio_ext.te
@@ -0,0 +1,11 @@
+type hal_radio_ext, domain;
+type hal_radio_ext_exec, exec_type, vendor_file_type, file_type;
+
+init_daemon_domain(hal_radio_ext)
+
+binder_call(hal_radio_ext, servicemanager)
+add_service(hal_radio_ext, hal_radio_ext_service)
+
+# Allow access to the backlight driver to set ssc_mode
+allow hal_radio_ext sysfs_leds:dir search;
+allow hal_radio_ext sysfs_leds:file rw_file_perms;
diff --git a/modem/radio_ext/sepolicy/service.te b/modem/radio_ext/sepolicy/service.te
new file mode 100644
index 0000000..7288ef1
--- /dev/null
+++ b/modem/radio_ext/sepolicy/service.te
@@ -0,0 +1,2 @@
+# Radio Ext AIDL service
+type hal_radio_ext_service, hal_service_type, protected_service, service_manager_type;
diff --git a/modem/radio_ext/sepolicy/service_contexts b/modem/radio_ext/sepolicy/service_contexts
new file mode 100644
index 0000000..7e50c2e
--- /dev/null
+++ b/modem/radio_ext/sepolicy/service_contexts
@@ -0,0 +1 @@
+vendor.google.radio_ext.IRadioExt/default                 u:object_r:hal_radio_ext_service:s0
diff --git a/pixel_metrics/dump_pixel_metrics.cpp b/pixel_metrics/dump_pixel_metrics.cpp
index 2dd5553..597d765 100644
--- a/pixel_metrics/dump_pixel_metrics.cpp
+++ b/pixel_metrics/dump_pixel_metrics.cpp
@@ -21,6 +21,7 @@
     setbuf(stdout, NULL);
     dumpFileContent("Long running IRQ metrics", "/sys/kernel/metrics/irq/long_irq_metrics");
     dumpFileContent("Storm IRQ metrics", "/sys/kernel/metrics/irq/storm_irq_metrics");
+    dumpFileContent("Long RT Runnable metrics", "/sys/kernel/metrics/runnable/stats");
     dumpFileContent("Resume latency metrics", "/sys/kernel/metrics/resume_latency/resume_latency_metrics");
     return 0;
 }
diff --git a/pixel_metrics/sepolicy/genfs_contexts b/pixel_metrics/sepolicy/genfs_contexts
index 45ba566..c58fbe7 100644
--- a/pixel_metrics/sepolicy/genfs_contexts
+++ b/pixel_metrics/sepolicy/genfs_contexts
@@ -3,5 +3,7 @@
 genfscon sysfs /kernel/metrics/irq/long_irq_metrics                       u:object_r:sysfs_vendor_metrics:s0
 genfscon sysfs /kernel/metrics/irq/stats_reset                            u:object_r:sysfs_vendor_metrics:s0
 genfscon sysfs /kernel/metrics/irq/storm_irq_metrics                      u:object_r:sysfs_vendor_metrics:s0
+genfscon sysfs /kernel/metrics/runnable/stats_reset                       u:object_r:sysfs_vendor_metrics:s0
+genfscon sysfs /kernel/metrics/runnable/stats                             u:object_r:sysfs_vendor_metrics:s0
 genfscon sysfs /kernel/metrics/thermal/tr_by_group/tmu/stats              u:object_r:sysfs_vendor_metrics:s0
 genfscon sysfs /kernel/metrics/thermal/tr_by_group/spmic/stats            u:object_r:sysfs_vendor_metrics:s0
diff --git a/sensors/sepolicy/file.te b/sensors/sepolicy/file.te
index 97084b6..f59381b 100644
--- a/sensors/sepolicy/file.te
+++ b/sensors/sepolicy/file.te
@@ -1,2 +1,18 @@
+#
+# USF file SELinux type enforcements.
+#
+
 type vendor_usf_stats, vendor_file_type, file_type;
 type vendor_usf_reg_edit, vendor_file_type, file_type;
+
+# Declare the sensor registry persist file type. By convention, persist file
+# types begin with "persist_".
+type persist_sensor_reg_file, file_type, vendor_persist_type;
+
+# Declare the sensor registry data file type. By convention, data file types
+# end with "data_file".
+type sensor_reg_data_file, file_type, data_file_type;
+
+# Declare the sensor debug data file type. By convention, data file types
+# end with "data_file".
+type sensor_debug_data_file, file_type, data_file_type;
diff --git a/sensors/sepolicy/file_contexts b/sensors/sepolicy/file_contexts
index 0fbbdf2..d41b33e 100644
--- a/sensors/sepolicy/file_contexts
+++ b/sensors/sepolicy/file_contexts
@@ -1,3 +1,16 @@
+#
+# USF SELinux file security contexts.
+#
+
 /vendor/bin/dump/dump_sensors      u:object_r:dump_sensors_exec:s0
 /vendor/bin/usf_stats              u:object_r:vendor_usf_stats:s0
 /vendor/bin/usf_reg_edit           u:object_r:vendor_usf_reg_edit:s0
+
+# Sensor registry persist files.
+/mnt/vendor/persist/sensors/registry(/.*)? u:object_r:persist_sensor_reg_file:s0
+
+# Sensor registry data files.
+/data/vendor/sensors/registry(/.*)? u:object_r:sensor_reg_data_file:s0
+
+# Sensor debug data files.
+/data/vendor/sensors/debug(/.*)? u:object_r:sensor_debug_data_file:s0
diff --git a/sensors/sepolicy/hal_sensors_default.te b/sensors/sepolicy/hal_sensors_default.te
new file mode 100644
index 0000000..1d152d4
--- /dev/null
+++ b/sensors/sepolicy/hal_sensors_default.te
@@ -0,0 +1,65 @@
+#
+# USF sensor HAL SELinux type enforcements.
+#
+
+# Allow reading of sensor registry persist files.
+allow hal_sensors_default mnt_vendor_file:dir search;
+allow hal_sensors_default persist_file:dir search;
+allow hal_sensors_default persist_file:file r_file_perms;
+r_dir_file(hal_sensors_default, persist_sensor_reg_file)
+
+# Allow creation and writing of sensor registry data files.
+allow hal_sensors_default sensor_reg_data_file:dir rw_dir_perms;
+allow hal_sensors_default sensor_reg_data_file:file create_file_perms;
+
+userdebug_or_eng(`
+    # Allow creation and writing of sensor debug data files.
+    allow hal_sensors_default sensor_debug_data_file:dir rw_dir_perms;
+    allow hal_sensors_default sensor_debug_data_file:file create_file_perms;
+')
+
+# Allow access to the AoC communication driver.
+allow hal_sensors_default aoc_device:chr_file rw_file_perms;
+
+# Allow access to the AoC clock and kernel boot time sys FS node. This is needed
+# to synchronize the AP and AoC clock timestamps.
+allow hal_sensors_default sysfs_aoc_boottime:file rw_file_perms;
+
+# Allow access to the sysfs_aoc.
+allow hal_sensors_default sysfs_aoc:dir search;
+allow hal_sensors_default sysfs_aoc:file r_file_perms;
+
+# Allow sensor HAL to reset AOC.
+allow hal_sensors_default sysfs_aoc_reset:file rw_file_perms;
+
+# Allow sensor HAL to read AoC dumpstate.
+allow hal_sensors_default sysfs_aoc_dumpstate:file r_file_perms;
+
+# Allow access for AoC properties.
+get_prop(hal_sensors_default, vendor_aoc_prop)
+
+# Allow create thread to watch AOC's device.
+allow hal_sensors_default device:dir r_dir_perms;
+
+# Allow access to sensor service for sensor_listener.
+binder_call(hal_sensors_default, system_server);
+
+# Allow use of the USF low latency transport.
+usf_low_latency_transport(hal_sensors_default)
+
+# Allow sensor HAL to access to display sysfs.
+allow hal_sensors_default sysfs_display:file r_file_perms;
+
+# Allow display_info_service access to the backlight driver.
+allow hal_sensors_default sysfs_leds:dir search;
+allow hal_sensors_default sysfs_leds:file rw_file_perms;
+
+# Allow SensorSuez to connect AIDL stats.
+binder_use(hal_sensors_default);
+allow hal_sensors_default fwk_stats_service:service_manager find;
+
+# Allow access to CHRE socket to connect to nanoapps.
+unix_socket_connect(hal_sensors_default, chre, chre)
+
+# Allow access to the power supply files for MagCC.
+r_dir_file(hal_sensors_default, sysfs_batteryinfo)
diff --git a/sensors/sepolicy/te_macros b/sensors/sepolicy/te_macros
new file mode 100644
index 0000000..01ac13c
--- /dev/null
+++ b/sensors/sepolicy/te_macros
@@ -0,0 +1,14 @@
+#
+# USF SELinux type enforcement macros.
+#
+
+#
+# usf_low_latency_transport(domain)
+#
+# Allows domain use of the USF low latency transport.
+#
+define(`usf_low_latency_transport', `
+  allow $1 hal_graphics_mapper_hwservice:hwservice_manager find;
+  hal_client_domain($1, hal_graphics_allocator)
+')
+
diff --git a/storage/dump_storage.cpp b/storage/dump_storage.cpp
index bba1071..e6b3e4c 100644
--- a/storage/dump_storage.cpp
+++ b/storage/dump_storage.cpp
@@ -16,16 +16,47 @@
 
 #include <dump/pixel_dump.h>
 #include <android-base/file.h>
+#include <android-base/stringprintf.h>
 #include <android-base/properties.h>
 #include <string.h>
 #include <stdio.h>
 #include <log/log.h>
 #include <regex>
 #include <fstream>
+#include <map>
 
 #define F2FS_FSCK_TIME_PROPERTY "ro.boottime.init.fsck.data"
 #define F2FS_MNT_TIME_PROPERTY "ro.boottime.init.mount.data"
 #define BOOTDEVICE_PROPERTY "ro.boot.bootdevice"
+#define BUILD_TYPE_PROPERTY "ro.build.type"
+
+void read_buffer(int buf_id, int total_len, const char* path)
+{
+    int i, len;
+    system("mkdir -m 0770 -p /data/vendor/storage/");
+    auto cmd = android::base::StringPrintf("rm -f /data/vendor/storage/%s\n", path);
+    system(cmd.c_str());
+
+    for (i=0;i<=total_len;i+=524288) {
+        if (total_len-i < 524288) {
+            len = total_len-i;
+            printf("/vendor/bin/sg_read_buffer -m 0x1c -i %d -l %d -o %d -r /dev/sg3 >> /data/vendor/storage/%s\n",
+                buf_id, len, i, path);
+            auto cmd = android::base::StringPrintf(
+                "/vendor/bin/sg_read_buffer -m 0x1c -i %d -l %d -o %d -r /dev/sg3 >> /data/vendor/storage/%s\n",
+                buf_id, len, i, path);
+            system(cmd.c_str());
+            break;
+        }
+        len = 524288;
+        printf("/vendor/bin/sg_read_buffer -m 0x1c -i %d -l %d -o %d -r /dev/sg3 >> /data/vendor/storage/%s\n",
+            buf_id, len, i, path);
+        auto cmd = android::base::StringPrintf(
+            "/vendor/bin/sg_read_buffer -m 0x1c -i %d -l %d -o %d -r /dev/sg3 >> /data/vendor/storage/%s\n",
+            buf_id, len, i, path);
+        system(cmd.c_str());
+    }
+}
 
 int main() {
     //F2FS
@@ -146,5 +177,68 @@
             "",
             "/dev/sys/block/bootdevice/health_descriptor/life_time_estimation_c");
 
+    printf("\n------ UFS error history ------\n");
+    std::string build_type = android::base::GetProperty(BUILD_TYPE_PROPERTY, "");
+    if (build_type == "userdebug") {
+        std::string sg_read_buffer = "/vendor/bin/sg_read_buffer";
+        std::ifstream sg_read_buffer_file(sg_read_buffer.c_str());
+        if (sg_read_buffer_file.is_open()) {
+            const std::string ufs_ver_path(
+                "/dev/sys/block/bootdevice/device_descriptor/specification_version");
+            std::ifstream ufs_ver_file(ufs_ver_path);
+            std::string ufs_ver;
+            if (ufs_ver_file.is_open()) {
+                ufs_ver_file >> ufs_ver;
+                ufs_ver_file.close();
+            }
+            if (strcmp(ufs_ver.c_str(), "0x0210")) {
+                const std::string ufs_brand_path("/sys/block/sda/device/vendor");
+                std::ifstream ufs_brand_file(ufs_brand_path);
+                std::string ufs_brand;
+                if (ufs_brand_file.is_open()) {
+                    ufs_brand_file >> ufs_brand;
+                    ufs_brand_file.close();
+                }
+
+                std::map<std::string, int> const table =
+                    {
+                    {"MICRON", 0x12C},
+                    {"KIOXIA", 0x198},
+                    {"SKhynix", 0x1AD},
+                    {"SAMSUNG", 0x1CE}
+                    };
+                auto ufs_vendor_id = table.find(ufs_brand);
+                if (ufs_vendor_id != table.end()) {
+                    switch(ufs_vendor_id->second){
+                      case 0x12C: //MICRON
+                        read_buffer(16, 2097152, "micron_10_ufs_err_history.dat");
+                        read_buffer(18, 10485760, "micron_12_ufs_err_history.dat");
+                        read_buffer(19, 10485760, "micron_13_ufs_err_history.dat");
+                        break;
+                      case 0x198: //KIOXIA
+                        read_buffer(16, 16773120, "kioxia_10_ufs_err_history.dat");
+                        read_buffer(17, 2097152, "kioxia_11_ufs_err_history.dat");
+                        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");
+                        break;
+                      case 0x1CE: //SAMSUNG
+                        read_buffer(16, 8404992, "samsung_10_ufs_err_history.dat");
+                        break;
+                      default:
+                        break;
+                    }
+                }
+                sg_read_buffer_file.close();
+            }
+        } else
+          printf("sg_read_buffer does not exist\n");
+    }
+
     return 0;
 }
diff --git a/storage/init.storage.rc b/storage/init.storage.rc
index 445f74b..56e8e4f 100644
--- a/storage/init.storage.rc
+++ b/storage/init.storage.rc
@@ -1,2 +1,3 @@
 on property:ro.build.type=userdebug
     write /dev/sys/block/bootdevice/pixel/enable_pixel_ufs_logging 1
+    chown system /dev/sg3
diff --git a/storage/sepolicy/dump_storage.te b/storage/sepolicy/dump_storage.te
index a404ee2..5324c17 100644
--- a/storage/sepolicy/dump_storage.te
+++ b/storage/sepolicy/dump_storage.te
@@ -6,6 +6,15 @@
 userdebug_or_eng(`
   allow dump_storage debugfs_f2fs:dir r_dir_perms;
   allow dump_storage debugfs_f2fs:file r_file_perms;
+  allow dump_storage sg_device:chr_file rw_file_perms;
+  allow dump_storage proc:file r_file_perms;
+  allow dump_storage vendor_shell_exec:file execute_no_trans;
+  allow dump_storage vendor_toolbox_exec:file execute_no_trans;
+  allow dump_storage sg_util_exec:file execute_no_trans;
+  allow dump_storage vendor_data_file:dir create_dir_perms;
+  allow dump_storage vendor_data_file:file create_file_perms;
+  allow dump_storage dump_storage_data_file:dir rw_dir_perms;
+  allow dump_storage dump_storage_data_file:file create_file_perms;
 ')
 
 get_prop(dump_storage, boottime_public_prop)
diff --git a/storage/sepolicy/file.te b/storage/sepolicy/file.te
index 64b6b4e..ed4f925 100644
--- a/storage/sepolicy/file.te
+++ b/storage/sepolicy/file.te
@@ -1 +1,4 @@
 type debugfs_f2fs, debugfs_type, fs_type;
+type dump_storage_data_file, file_type, data_file_type;
+type sg_device, dev_type;
+type sg_util_exec, exec_type, vendor_file_type, file_type;
diff --git a/storage/sepolicy/file_contexts b/storage/sepolicy/file_contexts
index bc10bc8..ecca954 100644
--- a/storage/sepolicy/file_contexts
+++ b/storage/sepolicy/file_contexts
@@ -1,2 +1,5 @@
 /vendor/bin/dump/dump_storage      u:object_r:dump_storage_exec:s0
 /sys/devices/platform/[0-9]+\.ufs/pixel/enable_pixel_ufs_logging  u:object_r:sysfs_scsi_devices_0000:s0
+/dev/sg[0-9]                       u:object_r:sg_device:s0
+/data/vendor/storage(/.*)?         u:object_r:dump_storage_data_file:s0
+/vendor/bin/sg_read_buffer         u:object_r:sg_util_exec:s0
diff --git a/storage/sepolicy/vendor_init.te b/storage/sepolicy/vendor_init.te
new file mode 100644
index 0000000..da4fcba
--- /dev/null
+++ b/storage/sepolicy/vendor_init.te
@@ -0,0 +1 @@
+allow vendor_init sg_device:chr_file r_file_perms;
diff --git a/thermal/thermal_hal/thermal_config_schemas/Android.bp b/thermal/thermal_hal/thermal_config_schemas/Android.bp
new file mode 100644
index 0000000..ed66305
--- /dev/null
+++ b/thermal/thermal_hal/thermal_config_schemas/Android.bp
@@ -0,0 +1,17 @@
+cc_library_static {
+    name: "thermal_HAL_info_config_proto",
+    host_supported: true,
+    srcs: [
+        "thermal_info_config.proto",
+    ],
+    proto: {
+        type: "full",
+        export_proto_headers: true,
+        include_dirs: ["external/protobuf/src"],
+    },
+    cflags: [
+        "-Wall",
+        "-Werror",
+        "-Wno-unused-parameter",
+    ],
+}
\ No newline at end of file
diff --git a/thermal/thermal_hal/thermal_config_schemas/thermal_info_config.proto b/thermal/thermal_hal/thermal_config_schemas/thermal_info_config.proto
new file mode 100644
index 0000000..c97fa7f
--- /dev/null
+++ b/thermal/thermal_hal/thermal_config_schemas/thermal_info_config.proto
@@ -0,0 +1,154 @@
+/*
+ * Copyright (C) 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.
+ */
+
+syntax = "proto3";
+
+package devices.shusky;
+
+message ThermalConfig {
+  repeated Sensor sensors = 1 [ json_name = "Sensors" ];
+  repeated CoolingDevice coolingdevices = 2 [ json_name = "CoolingDevices" ];
+  repeated PowerRails powerrails = 3 [ json_name = "PowerRails" ];
+  Stats stats = 4 [ json_name = "Stats" ];
+}
+
+message Sensor {
+  string name = 1 [ json_name = "Name" ];
+  string type = 2 [ json_name = "Type" ];
+  repeated float hotthreshold = 3 [ json_name = "HotThreshold" ];
+  repeated float hothysteresis = 4 [ json_name = "HotHysteresis" ];
+  string temppath = 5 [ json_name = "TempPath" ];
+  float multiplier = 6 [ json_name = "Multiplier" ];
+  int32 pollingdelay = 7 [ json_name = "PollingDelay" ];
+  int32 passivedelay = 8 [ json_name = "PassiveDelay" ];
+  bool hidden = 9 [ json_name = "Hidden" ];
+  bool virtualsensor = 10 [ json_name = "VirtualSensor" ];
+  repeated string triggersensor = 11 [ json_name = "TriggerSensor" ];
+  string formula = 12 [ json_name = "Formula" ];
+  repeated string combination = 13 [ json_name = "Combination" ];
+  repeated float Coefficient = 14 [ json_name = "Coefficient" ];
+  bool sendpowerhint = 15 [ json_name = "SendPowerHint" ];
+  bool sendcallback = 16 [ json_name = "SendCallback" ];
+  PIDInfo pidinfo = 17 [ json_name = "PIDInfo" ];
+  repeated ExcludedPowerInfo excludedpowerinfo = 18
+      [ json_name = "ExcludedPowerInfo" ];
+  repeated BindedCdevInfo bindedcdevinfos = 19 [ json_name = "BindedCdevInfo" ];
+  repeated string combinationtype = 20 [ json_name = "CombinationType" ];
+  string version = 21 [ json_name = "Version" ];
+  int32 offset = 22 [ json_name = "Offset" ];
+  repeated Profile profile = 23 [ json_name = "Profile" ];
+  float vrthreshold = 24 [ json_name = "VrThreshold" ];
+  bool monitor = 25 [ json_name = "Monitor" ];
+}
+
+message Profile {
+  string mode = 1 [ json_name = "Mode" ];
+  repeated BindedCdevInfo bindedcdevinfo = 2 [ json_name = "BindedCdevInfo" ];
+}
+
+message ExcludedPowerInfo {
+  string powerrail = 1 [ json_name = "PowerRail" ];
+  repeated float powerweight = 2 [ json_name = "PowerWeight" ];
+}
+
+message BindedCdevInfo {
+  string cdevrequest = 1 [ json_name = "CdevRequest" ];
+  repeated float cdevweightforpid = 2 [ json_name = "CdevWeightForPID" ];
+  int32 maxreleasestep = 3 [ json_name = "MaxReleaseStep" ];
+  int32 maxthrottlestep = 4 [ json_name = "MaxThrottleStep" ];
+  repeated int32 cdevceiling = 5 [ json_name = "CdevCeiling" ];
+  repeated int32 limitinfo = 6 [ json_name = "LimitInfo" ];
+  string bindedpowerrail = 7 [ json_name = "BindedPowerRail" ];
+  bool disabled = 8 [ json_name = "Disabled" ];
+}
+
+message PIDInfo {
+  repeated float k_po = 1 [ json_name = "K_Po" ];
+  repeated float k_pu = 2 [ json_name = "K_Pu" ];
+  repeated float k_i = 3 [ json_name = "K_I" ];
+  repeated float k_d = 4 [ json_name = "K_D" ];
+  repeated float i_max = 5 [ json_name = "I_Max" ];
+  repeated float s_power = 6 [ json_name = "S_Power" ];
+  repeated float minallocpower = 7 [ json_name = "MinAllocPower" ];
+  repeated float maxallocpower = 8 [ json_name = "MaxAllocPower" ];
+  repeated float i_cutoff = 9 [ json_name = "I_Cutoff" ];
+  int32 i_default = 10 [ json_name = "I_Default" ];
+}
+
+message CoolingDevice {
+  string name = 1 [ json_name = "Name" ];
+  string type = 2 [ json_name = "Type" ];
+  string writepath = 3 [ json_name = "WritePath" ];
+  repeated int32 state2power = 4 [ json_name = "State2Power" ];
+}
+
+message PowerRails {
+  string name = 1 [ json_name = "Name" ];
+  int32 powersampledelay = 2 [ json_name = "PowerSampleDelay" ];
+  int32 powersamplecount = 3 [ json_name = "PowerSampleCount" ];
+  bool virtualrails = 4 [ json_name = "VirtualRails" ];
+  string formula = 5 [ json_name = "Formula" ];
+  repeated string combination = 6 [ json_name = "Combination" ];
+  repeated float coefficient = 7 [ json_name = "Coefficient" ];
+}
+
+message Stats {
+  SensorStats sensorstats = 1 [ json_name = "Sensors" ];
+  CoolingDeviceStats coolingdevicestats = 2 [ json_name = "CoolingDevices" ];
+}
+
+message SensorStats {
+  repeated string recordwithdefaultthreshold = 1
+      [ json_name = "RecordWithDefaultThreshold" ];
+  repeated SensorStat recordwiththreshold = 2
+      [ json_name = "RecordWithThreshold" ];
+  Abnormality abnormality = 3 [ json_name = "Abnormality" ];
+}
+
+message CoolingDeviceStats {
+  RecordVotePerSensor recordvotepersensor = 1
+      [ json_name = "RecordVotePerSensor" ];
+}
+
+message RecordVotePerSensor {
+  bool defaultthresholdenableall = 1
+      [ json_name = "DefaultThresholdEnableAll" ];
+}
+
+message SensorStat {
+  string name = 1 [ json_name = "Name" ];
+  repeated int32 thresholds = 2 [ json_name = "Thresholds" ];
+}
+
+message Abnormality {
+  Outlier outlier = 1 [ json_name = "Outlier" ];
+  Stuck stuck = 2 [ json_name = "Stuck" ];
+}
+
+message Outlier { repeated Config configs = 1 [ json_name = "Configs" ]; }
+
+message Stuck { repeated Config configs = 1 [ json_name = "Configs" ]; }
+
+message Config {
+  repeated string monitor = 1 [ json_name = "Monitor" ];
+  TempStuck tempstuck = 2 [ json_name = "TempStuck" ];
+  repeated float temprange = 3 [ json_name = "TempRange" ];
+}
+
+message TempStuck {
+  int32 minpollingcount = 1 [ json_name = "MinPollingCount" ];
+  int32 minstuckduration = 2 [ json_name = "MinStuckDuration" ];
+}
diff --git a/trusty/sepolicy/tee.te b/trusty/sepolicy/tee.te
new file mode 100644
index 0000000..50aab69
--- /dev/null
+++ b/trusty/sepolicy/tee.te
@@ -0,0 +1 @@
+allow tee sg_device:chr_file rw_file_perms;
diff --git a/tts/de-de/de-de-x-multi-r45.zvoice b/tts/de-de/de-de-x-multi-r45.zvoice
new file mode 100644
index 0000000..9fca341
--- /dev/null
+++ b/tts/de-de/de-de-x-multi-r45.zvoice
Binary files differ
diff --git a/tts/es-es/es-es-x-multi-r45.zvoice b/tts/es-es/es-es-x-multi-r45.zvoice
new file mode 100644
index 0000000..2e7cb61
--- /dev/null
+++ b/tts/es-es/es-es-x-multi-r45.zvoice
Binary files differ
diff --git a/tts/fr-fr/fr-fr-x-multi-r46.zvoice b/tts/fr-fr/fr-fr-x-multi-r46.zvoice
new file mode 100644
index 0000000..9287d91
--- /dev/null
+++ b/tts/fr-fr/fr-fr-x-multi-r46.zvoice
Binary files differ
diff --git a/tts/it-it/it-it-x-multi-r42.zvoice b/tts/it-it/it-it-x-multi-r42.zvoice
new file mode 100644
index 0000000..a794804
--- /dev/null
+++ b/tts/it-it/it-it-x-multi-r42.zvoice
Binary files differ
diff --git a/tts/ja-jp/ja-jp-x-multi-r44.zvoice b/tts/ja-jp/ja-jp-x-multi-r44.zvoice
new file mode 100644
index 0000000..0d562b2
--- /dev/null
+++ b/tts/ja-jp/ja-jp-x-multi-r44.zvoice
Binary files differ
diff --git a/tts/voice_packs.mk b/tts/voice_packs.mk
new file mode 100644
index 0000000..0bb6d1a
--- /dev/null
+++ b/tts/voice_packs.mk
@@ -0,0 +1,22 @@
+#
+# Copyright (C) 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.
+
+# Voice packs for Text-To-Speech
+PRODUCT_COPY_FILES += \
+	device/google/gs-common/tts/ja-jp/ja-jp-x-multi-r44.zvoice:product/tts/google/ja-jp/ja-jp-x-multi-r44.zvoice\
+	device/google/gs-common/tts/fr-fr/fr-fr-x-multi-r46.zvoice:product/tts/google/fr-fr/fr-fr-x-multi-r46.zvoice\
+	device/google/gs-common/tts/de-de/de-de-x-multi-r45.zvoice:product/tts/google/de-de/de-de-x-multi-r45.zvoice\
+	device/google/gs-common/tts/it-it/it-it-x-multi-r42.zvoice:product/tts/google/it-it/it-it-x-multi-r42.zvoice\
+	device/google/gs-common/tts/es-es/es-es-x-multi-r45.zvoice:product/tts/google/es-es/es-es-x-multi-r45.zvoice
diff --git a/widevine/widevine.mk b/widevine/widevine.mk
index c59c7b9..420806e 100644
--- a/widevine/widevine.mk
+++ b/widevine/widevine.mk
@@ -1,4 +1,13 @@
 PRODUCT_PACKAGES += \
 	android.hardware.drm-service.clearkey \
 
--include vendor/widevine/libwvdrmengine/apex/device/device.mk
\ No newline at end of file
+ifdef RELEASE_PACKAGE_WIDEVINE
+  PRODUCT_PACKAGES += $(RELEASE_PACKAGE_WIDEVINE)
+  ifneq ($(wildcard vendor/google/dev-keystore),)
+    $(call soong_config_set,widevine,use_devkey,true)
+  endif
+  PRODUCT_VENDOR_LINKER_CONFIG_FRAGMENTS += \
+	vendor/widevine/libwvdrmengine/apex/device/linker.config.json
+else
+  -include vendor/widevine/libwvdrmengine/apex/device/device.mk
+endif
\ No newline at end of file
diff --git a/wireless_charger/compatibility_matrix.xml b/wireless_charger/compatibility_matrix.xml
index 85ee65a..7d18cd9 100644
--- a/wireless_charger/compatibility_matrix.xml
+++ b/wireless_charger/compatibility_matrix.xml
@@ -1,7 +1,7 @@
 <compatibility-matrix version="1.0" type="framework">
     <hal format="aidl" optional="true">
         <name>vendor.google.wireless_charger</name>
-        <version>1</version>
+        <version>1-2</version>
         <interface>
             <name>IWirelessCharger</name>
             <instance>default</instance>