Merge "Adds TTS voice packs in gs-common" into main
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/battery_mitigation/battery_mitigation.cpp b/battery_mitigation/battery_mitigation.cpp
index 2443226..a09b8a4 100644
--- a/battery_mitigation/battery_mitigation.cpp
+++ b/battery_mitigation/battery_mitigation.cpp
@@ -16,8 +16,10 @@
#define LOG_TAG "battery-mitigation"
-#include <battery_mitigation/BatteryMitigation.h>
#include <android/binder_process.h>
+#include <battery_mitigation/BatteryMitigation.h>
+#include <sys/resource.h>
+#include <system/thread_defs.h>
#define COUNT_LIMIT 10
@@ -67,21 +69,57 @@
.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"},
+ },
+ .NumericSysfsStatDirs = {
+ {"last_triggered_mode", "/sys/devices/virtual/pmic/mitigation/last_triggered_mode/"},
+ },
+ .TriggeredIdxPath = "/sys/devices/virtual/pmic/mitigation/br_stats/triggered_idx",
+ .BrownoutStatsPath = "/sys/devices/virtual/pmic/mitigation/br_stats/stats",
+ .StoringPath = "/data/vendor/mitigation/thismeal.bin",
+ .BackupPath = "/data/vendor/mitigation/lastmeal.bin",
+ .FvpStatsPath = "/sys/devices/platform/acpm_stats/fvp_stats",
+ .PcieModemPath = "/sys/devices/platform/12100000.pcie/power_stats",
+ .PcieWifiPath = "/sys/devices/platform/13120000.pcie/power_stats",
+};
+
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+$");
+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*/) {
+ setpriority(PRIO_PROCESS, 0, ANDROID_PRIORITY_AUDIO);
auto batteryMitigationStartTime = std::chrono::system_clock::now();
ABinderProcess_setThreadPoolMaxThreadCount(1);
ABinderProcess_startThreadPool();
- bmSp = new BatteryMitigation(cfg);
+ bmSp = new BatteryMitigation(cfg, eventThreadCfg);
if (!bmSp) {
return 0;
}
+ std::string cdt = GetSystemProperty(kCDTProperty);
+ int platform_num = atoi(cdt.substr(5, 1).c_str());
+ if (platform_num >= MIN_SUPPORTED_PLATFORM) {
+ bmSp->startBrownoutEventThread();
+ }
bool mitigationLogTimeValid = bmSp->isMitigationLogTimeValid(batteryMitigationStartTime,
cfg.LogFilePath,
cfg.TimestampFormat,
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/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/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/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..c1f082d 100644
--- a/storage/sepolicy/file.te
+++ b/storage/sepolicy/file.te
@@ -1 +1,3 @@
type debugfs_f2fs, debugfs_type, fs_type;
+type dump_storage_data_file, file_type, data_file_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