From 66b1565ce2d7fd78b94f7bde988f58e27b64639a Mon Sep 17 00:00:00 2001 From: Daniel Chapin Date: Thu, 25 Jan 2024 21:35:37 +0000 Subject: [PATCH 01/18] Revert "dumpstate: Search the path of TCPM psy uevent" Revert submission 25915320-320613177 Reason for revert: Droidfood blocking bug: 322294676 Reverted changes: /q/submissionid:25915320-320613177 (cherry picked from https://googleplex-android-review.googlesource.com/q/commit:ab48b5502ce6a48d13a76442cfc68f066f6e5be7) Merged-In: I5f56d9f97d173b9971e96959b56e39207b901ac7 Change-Id: I5f56d9f97d173b9971e96959b56e39207b901ac7 --- dumpstate/dump_power.cpp | 23 +---------------------- 1 file changed, 1 insertion(+), 22 deletions(-) diff --git a/dumpstate/dump_power.cpp b/dumpstate/dump_power.cpp index 562dc7cc..e6ee5799 100644 --- a/dumpstate/dump_power.cpp +++ b/dumpstate/dump_power.cpp @@ -152,26 +152,6 @@ void dumpAcpmStats() { readContentsOfDir(acpmTitle, acpmDir, statsSubStr, true, true); } -void dumpTcpmPsyUevent() { - const char* tcpmPsy = "tcpm-source-psy-"; - DIR *dir = opendir("/sys/class/power_supply/"); - struct dirent *entry; - - if (dir == NULL) - return; - - while ((entry = readdir(dir)) != NULL) { - if (std::string::npos != std::string(entry->d_name).find(tcpmPsy)) { - std::string fullPath("/sys/class/power_supply/" + (const std::string)entry->d_name + - "/uevent"); - dumpFileContent("Power supply property tcpm", fullPath.c_str()); - break; - } - } - - closedir(dir); -} - void dumpPowerSupplyStats() { const char* dumpList[][2] = { {"CPU PM stats", "/sys/devices/system/cpu/cpupm/cpupm/time_in_state"}, @@ -182,6 +162,7 @@ void dumpPowerSupplyStats() { {"Power supply property gcpm_pps", "/sys/class/power_supply/gcpm_pps/uevent"}, {"Power supply property main-charger", "/sys/class/power_supply/main-charger/uevent"}, {"Power supply property dc-mains", "/sys/class/power_supply/dc-mains/uevent"}, + {"Power supply property tcpm", "/sys/class/power_supply/tcpm-source-psy-11-0025/uevent"}, {"Power supply property usb", "/sys/class/power_supply/usb/uevent"}, {"Power supply property wireless", "/sys/class/power_supply/wireless/uevent"}, }; @@ -189,8 +170,6 @@ void dumpPowerSupplyStats() { for (const auto &row : dumpList) { dumpFileContent(row[0], row[1]); } - - dumpTcpmPsyUevent(); } void dumpMaxFg() { From 9bbe072585bc64cc53e3e320fd0bbdb7f1f1fbbe Mon Sep 17 00:00:00 2001 From: Daniel Chapin Date: Thu, 25 Jan 2024 21:35:37 +0000 Subject: [PATCH 02/18] Revert "dumpstate: Search the path of TCPM psy uevent" Revert submission 25915320-320613177 Reason for revert: Droidfood blocking bug: 322294676 Reverted changes: /q/submissionid:25915320-320613177 (cherry picked from https://googleplex-android-review.googlesource.com/q/commit:ab48b5502ce6a48d13a76442cfc68f066f6e5be7) Merged-In: I5f56d9f97d173b9971e96959b56e39207b901ac7 Change-Id: I5f56d9f97d173b9971e96959b56e39207b901ac7 --- dumpstate/dump_power.cpp | 23 +---------------------- 1 file changed, 1 insertion(+), 22 deletions(-) diff --git a/dumpstate/dump_power.cpp b/dumpstate/dump_power.cpp index 562dc7cc..e6ee5799 100644 --- a/dumpstate/dump_power.cpp +++ b/dumpstate/dump_power.cpp @@ -152,26 +152,6 @@ void dumpAcpmStats() { readContentsOfDir(acpmTitle, acpmDir, statsSubStr, true, true); } -void dumpTcpmPsyUevent() { - const char* tcpmPsy = "tcpm-source-psy-"; - DIR *dir = opendir("/sys/class/power_supply/"); - struct dirent *entry; - - if (dir == NULL) - return; - - while ((entry = readdir(dir)) != NULL) { - if (std::string::npos != std::string(entry->d_name).find(tcpmPsy)) { - std::string fullPath("/sys/class/power_supply/" + (const std::string)entry->d_name + - "/uevent"); - dumpFileContent("Power supply property tcpm", fullPath.c_str()); - break; - } - } - - closedir(dir); -} - void dumpPowerSupplyStats() { const char* dumpList[][2] = { {"CPU PM stats", "/sys/devices/system/cpu/cpupm/cpupm/time_in_state"}, @@ -182,6 +162,7 @@ void dumpPowerSupplyStats() { {"Power supply property gcpm_pps", "/sys/class/power_supply/gcpm_pps/uevent"}, {"Power supply property main-charger", "/sys/class/power_supply/main-charger/uevent"}, {"Power supply property dc-mains", "/sys/class/power_supply/dc-mains/uevent"}, + {"Power supply property tcpm", "/sys/class/power_supply/tcpm-source-psy-11-0025/uevent"}, {"Power supply property usb", "/sys/class/power_supply/usb/uevent"}, {"Power supply property wireless", "/sys/class/power_supply/wireless/uevent"}, }; @@ -189,8 +170,6 @@ void dumpPowerSupplyStats() { for (const auto &row : dumpList) { dumpFileContent(row[0], row[1]); } - - dumpTcpmPsyUevent(); } void dumpMaxFg() { From 07f89b88fc2b6c0c88652bcfd02a5cc15d39d5cf Mon Sep 17 00:00:00 2001 From: Shashwat Razdan Date: Tue, 5 Mar 2024 23:46:52 -0800 Subject: [PATCH 03/18] Adding android.software.contextualsearch to zuma devices. Bug: 326143814 Test: Built and tested on device (cherry picked from https://googleplex-android-review.googlesource.com/q/commit:3ceb5170ce03587387eaf794a4ee5d0c68540664) Merged-In: I4ee1ecd9e292d6e1807ba1f77851e53380db0a07 Change-Id: I4ee1ecd9e292d6e1807ba1f77851e53380db0a07 --- device.mk | 1 + 1 file changed, 1 insertion(+) diff --git a/device.mk b/device.mk index 72a74752..0a3ef25b 100644 --- a/device.mk +++ b/device.mk @@ -287,6 +287,7 @@ PRODUCT_COPY_FILES += \ frameworks/native/data/etc/android.hardware.vulkan.version-1_3.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.vulkan.version.xml \ frameworks/native/data/etc/android.hardware.vulkan.level-1.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.vulkan.level.xml \ frameworks/native/data/etc/android.hardware.vulkan.compute-0.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.vulkan.compute.xml \ + frameworks/native/data/etc/android.software.contextualsearch.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.software.contextualsearch.xml \ frameworks/native/data/etc/android.software.vulkan.deqp.level-2023-03-01.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.software.vulkan.deqp.level.xml \ frameworks/native/data/etc/android.software.opengles.deqp.level-2023-03-01.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.software.opengles.deqp.level.xml From 1e0c02c5ded132b4a1477a60e0ee0d9c2d088bdc Mon Sep 17 00:00:00 2001 From: Daniel Chapin Date: Tue, 5 Mar 2024 00:55:40 +0000 Subject: [PATCH 04/18] Revert "Add betterbug mk to zuma" Revert submission 26348985-bb-sepolicy-poc Reason for revert: Droidfood blocking bug: b/327991669 Bug: b/327991669 Reverted changes: /q/submissionid:26348985-bb-sepolicy-poc (cherry picked from https://googleplex-android-review.googlesource.com/q/commit:fe980182cc8f21d7af154271d58aff971f72132c) Merged-In: I83de6f389e4ce5113afd751871e0e10e67fb0b4f Change-Id: I83de6f389e4ce5113afd751871e0e10e67fb0b4f --- device.mk | 1 - 1 file changed, 1 deletion(-) diff --git a/device.mk b/device.mk index 0a3ef25b..50b872e5 100644 --- a/device.mk +++ b/device.mk @@ -42,7 +42,6 @@ include device/google/gs-common/sota_app/factoryota.mk include device/google/gs-common/misc_writer/misc_writer.mk include device/google/gs-common/gyotaku_app/gyotaku.mk include device/google/gs-common/bootctrl/bootctrl_aidl.mk -include device/google/gs-common/betterbug/betterbug.mk include device/google/zuma/dumpstate/item.mk From 956405c6c0f79e1c228bc348c342020d288f84e3 Mon Sep 17 00:00:00 2001 From: Jack Wu Date: Fri, 22 Mar 2024 21:33:35 +0800 Subject: [PATCH 05/18] Update health AIDL HAL to V3 Bug: 328327545 Test: TH Test: vts-tradefed run vts -m vts_treble_vintf_vendor_test Signed-off-by: Jack Wu (cherry picked from https://android-review.googlesource.com/q/commit:40f89b2d464071389d395f39928ef0e6d99bf2fb) Merged-In: I7582ba278abcb30cebe041f775efe45633a58bad Change-Id: I7582ba278abcb30cebe041f775efe45633a58bad --- health/android.hardware.health-service.zuma.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/health/android.hardware.health-service.zuma.xml b/health/android.hardware.health-service.zuma.xml index 1fe9b8d2..2acaabac 100644 --- a/health/android.hardware.health-service.zuma.xml +++ b/health/android.hardware.health-service.zuma.xml @@ -1,7 +1,7 @@ android.hardware.health - 2 + 3 IHealth/default From 7c30487eff576de561e0ead9cac427eca454d50e Mon Sep 17 00:00:00 2001 From: Leo Chen Date: Thu, 23 May 2024 06:42:16 +0000 Subject: [PATCH 06/18] Update IDisplay to V12 Test: trigger test build Bug: 309897479 Change-Id: I5f6fb353f1096d600ddbe3a985bd30caf1df97b6 Signed-off-by: Leo Chen --- device_framework_matrix_product.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/device_framework_matrix_product.xml b/device_framework_matrix_product.xml index d605c065..895ce99b 100644 --- a/device_framework_matrix_product.xml +++ b/device_framework_matrix_product.xml @@ -114,7 +114,7 @@ com.google.hardware.pixel.display - 11-12 + 12 IDisplay default From e3ed1eabdf56bb1d7ef9b01b45014639ca890f10 Mon Sep 17 00:00:00 2001 From: Kelvin Zhang Date: Tue, 4 Jun 2024 09:56:33 -0700 Subject: [PATCH 07/18] Use dump.f2fs to extract files from efs partitions Previously, we rely on mount points to copy files out of efs partitions. Switch over to dump.f2fs to read directly from block device without mounting. This allows us to copy files out of efs partition in both 4K and 16K mode. Test: Boot dev option enabled ext4 device Bug: 340965747 Change-Id: I9d3f3d5200adc31f13298488b5be068b0fe7c7f4 --- conf/init.efs.16k.rc | 5 ----- copy_efs_files_to_data.sh | 12 ++++-------- device.mk | 1 + 3 files changed, 5 insertions(+), 13 deletions(-) diff --git a/conf/init.efs.16k.rc b/conf/init.efs.16k.rc index 9e891680..c3434bfd 100644 --- a/conf/init.efs.16k.rc +++ b/conf/init.efs.16k.rc @@ -9,12 +9,7 @@ service copy_efs_files_to_data /vendor/bin/copy_efs_files_to_data on post-fs-data && property:ro.boot.flash.locked=0 && property:ro.fstype.data=ext4 mkdir /data/vendor/copied 0775 radio system restorecon_recursive /data/vendor/copied - restorecon_recursive /mnt/vendor - mount_all /vendor/etc/fstab.efs - mount_all /vendor/etc/fstab.persist exec_start copy_efs_files_to_data - umount_all /vendor/etc/fstab.efs - umount_all /vendor/etc/fstab.persist mount_all /vendor/etc/fstab.efs.from_data restorecon_recursive /mnt/vendor/efs restorecon_recursive /mnt/vendor/efs_backup diff --git a/copy_efs_files_to_data.sh b/copy_efs_files_to_data.sh index 898bc8e9..2ac9e462 100644 --- a/copy_efs_files_to_data.sh +++ b/copy_efs_files_to_data.sh @@ -8,19 +8,19 @@ $BIN_DIR/mkdir -p $CHECKPOINT_DIR function copy_files_to_data() { + block_device=$1 partition_name=$(basename $1) mount_point=$2 tmpdir=$CHECKPOINT_DIR/$partition_name.img build_checkpoint=$CHECKPOINT_DIR/$partition_name if [ ! -e $build_checkpoint ]; then $BIN_DIR/rm -rf $tmpdir - $BIN_DIR/rm -rf $build_checkpoint - cp -rp $mount_point $tmpdir + $BIN_DIR/mkdir -p $tmpdir + $BIN_DIR/dump.f2fs -rfPo $tmpdir $block_device if [ $? -ne 0 ]; then - echo "Failed to cp -rp $mount_point $tmpdir" + echo "Failed to $BIN_DIR/dump.f2fs -rfPo $tmpdir $block_device" return fi - fsync `find $tmpdir -type fd` mv $tmpdir $build_checkpoint if [ $? -ne 0 ]; then echo "mv $tmpdir $build_checkpoint" @@ -31,12 +31,8 @@ function copy_files_to_data() echo "Successfully copied $mount_point to $build_checkpoint" } -chmod g+rx -R /mnt/vendor/efs -chmod g+rx -R /mnt/vendor/efs_backup -chmod g+rx -R /mnt/vendor/modem_userdata copy_files_to_data "/dev/block/by-name/efs" "/mnt/vendor/efs" copy_files_to_data "/dev/block/by-name/efs_backup" "/mnt/vendor/efs_backup" copy_files_to_data "/dev/block/by-name/modem_userdata" "/mnt/vendor/modem_userdata" -chmod g+rx -R /mnt/vendor/persist copy_files_to_data "/dev/block/by-name/persist" "/mnt/vendor/persist" diff --git a/device.mk b/device.mk index bcf96249..8d705f32 100644 --- a/device.mk +++ b/device.mk @@ -366,6 +366,7 @@ PRODUCT_COPY_FILES += \ device/google/$(TARGET_BOARD_PLATFORM)/conf/fstab.efs.from_data:$(TARGET_COPY_OUT_VENDOR)/etc/fstab.efs.from_data \ PRODUCT_PACKAGES += copy_efs_files_to_data +PRODUCT_PACKAGES += fsck.f2fs.vendor else PRODUCT_COPY_FILES += \ device/google/zuma/conf/init.efs.4k.rc:$(TARGET_COPY_OUT_VENDOR)/etc/init/init.efs.rc From e2155d5cc4a5e3df8073deae19a35282cba6f83f Mon Sep 17 00:00:00 2001 From: Utku Utkan Date: Wed, 5 Jun 2024 04:51:09 +0000 Subject: [PATCH 08/18] Remove ACCESS_FINE_LOCATION permission pregrant for PCS on Zuma FLAG: EXEMPT Cleanup of obsolete permission pregrant Bug: 345021501 Test: m && flashall Change-Id: Ia59acea79baadb45083adc76f52d62a0fb184762 --- default-permissions.xml | 1 - 1 file changed, 1 deletion(-) diff --git a/default-permissions.xml b/default-permissions.xml index 1764bc1a..00959c8f 100644 --- a/default-permissions.xml +++ b/default-permissions.xml @@ -59,7 +59,6 @@ - From 1f43d128df1b4247c8979e06f4cd4e61edc64f82 Mon Sep 17 00:00:00 2001 From: Jim Tang Date: Wed, 5 Jun 2024 12:10:50 +0800 Subject: [PATCH 09/18] Make SUPPORT_MULTI_SIM recognizable in bp This commit establishes a soong config variable `sim_count` for easier converting Android.mk to Android.bp when dealing with multiple SIMs. Bug: 343823190 Test: presubmit Change-Id: I93d355e30771868f1c4664eebbce579e1e37cdcb --- device.mk | 2 ++ 1 file changed, 2 insertions(+) diff --git a/device.mk b/device.mk index d2fe0a0b..ebc305e9 100644 --- a/device.mk +++ b/device.mk @@ -931,7 +931,9 @@ PRODUCT_PACKAGES += \ # Exynos RIL and telephony # Multi SIM(DSDS) SIM_COUNT := 2 +$(call soong_config_set,sim,sim_count,$(SIM_COUNT)) SUPPORT_MULTI_SIM := true + # Support NR SUPPORT_NR := true # Support 5G on both stacks From 1b3d66a9fbc3ff931acab5caec3ad84d618be3ac Mon Sep 17 00:00:00 2001 From: Dennis Shen Date: Fri, 7 Jun 2024 13:07:42 +0000 Subject: [PATCH 10/18] switch over to use new storage read api instead of server_configurable_flags, this new read api lib will be needed for new codegened aconfig flag lib. Bug: 321077378 Test m and avd Change-Id: I99307a4ad8f133232cfd8b47058f936445cb7cce --- usb/usb/Android.bp | 1 + 1 file changed, 1 insertion(+) diff --git a/usb/usb/Android.bp b/usb/usb/Android.bp index 858fc472..be45393f 100644 --- a/usb/usb/Android.bp +++ b/usb/usb/Android.bp @@ -55,6 +55,7 @@ cc_binary { "libbinder_ndk", "libprotobuf-cpp-lite", "server_configurable_flags", + "libaconfig_storage_read_api_cc", ], static_libs: [ "libpixelusb-aidl", From 48e1f2418a5b9f9713247713c49815eb0fcf3244 Mon Sep 17 00:00:00 2001 From: chenkris Date: Mon, 10 Jun 2024 17:22:27 +0000 Subject: [PATCH 11/18] zuma: build fingerprint dump Bug: 346450599 Test: adb bugreport Change-Id: I83f64cb3aa46007dd41674309a811d5f4c5a52a4 --- device.mk | 1 + 1 file changed, 1 insertion(+) diff --git a/device.mk b/device.mk index 53b73393..3c21ec56 100644 --- a/device.mk +++ b/device.mk @@ -43,6 +43,7 @@ include device/google/gs-common/misc_writer/misc_writer.mk include device/google/gs-common/gyotaku_app/gyotaku.mk include device/google/gs-common/bootctrl/bootctrl_aidl.mk include device/google/gs-common/betterbug/betterbug.mk +include device/google/gs-common/fingerprint/fingerprint.mk include device/google/zuma/dumpstate/item.mk From f3a1a067f1df7cc74641bf47a3d61584aef9b6a0 Mon Sep 17 00:00:00 2001 From: Poomarin Phloyphisut Date: Tue, 11 Jun 2024 05:49:20 +0000 Subject: [PATCH 12/18] pixelstats: add speaker_version sysfs for VendorSpeakerStatsReported Bug: 326342880 Test: Local Test Change-Id: Ib8c93e9297a7afb61005fb523fd664be0a00b459 --- pixelstats/service.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pixelstats/service.cpp b/pixelstats/service.cpp index 57aebfec..eaac5207 100644 --- a/pixelstats/service.cpp +++ b/pixelstats/service.cpp @@ -130,7 +130,8 @@ const struct SysfsCollector::SysfsPaths sysfs_paths = { "/sys/devices/platform/hdcp/hdcp1_success_count", "/sys/devices/platform/hdcp/hdcp1_fail_count", "/sys/devices/platform/hdcp/hdcp0_count", - } + }, + .SpeakerVersionPath = "/sys/devices/platform/audiometrics/speaker_version" }; const struct UeventListener::UeventPaths ueventPaths = { From d3ce2b98735d88de43f9a94b04912121bb18018f Mon Sep 17 00:00:00 2001 From: Kelvin Zhang Date: Tue, 11 Jun 2024 09:13:27 -0700 Subject: [PATCH 13/18] Restore permission of efs/efs_backup/modem_userdata after mount Test: Boot device, erase EFS, check selinux labels Bug: 345803836 Change-Id: Ia511731e001d74409b40b087432e3535ca5cfc8f --- conf/init.efs.16k.rc | 3 --- conf/init.persist.rc | 8 ++++++++ conf/init.zuma.rc | 6 ------ 3 files changed, 8 insertions(+), 9 deletions(-) diff --git a/conf/init.efs.16k.rc b/conf/init.efs.16k.rc index c3434bfd..72ae9894 100644 --- a/conf/init.efs.16k.rc +++ b/conf/init.efs.16k.rc @@ -11,9 +11,6 @@ on post-fs-data && property:ro.boot.flash.locked=0 && property:ro.fstype.data=ex restorecon_recursive /data/vendor/copied exec_start copy_efs_files_to_data mount_all /vendor/etc/fstab.efs.from_data - restorecon_recursive /mnt/vendor/efs - restorecon_recursive /mnt/vendor/efs_backup - restorecon_recursive /mnt/vendor/modem_userdata restorecon_recursive /mnt/vendor/persist restorecon_recursive /data/vendor/ss setprop ro.vendor.persist.status mounted diff --git a/conf/init.persist.rc b/conf/init.persist.rc index 26a9c4d7..7852c78e 100644 --- a/conf/init.persist.rc +++ b/conf/init.persist.rc @@ -1,4 +1,12 @@ on property:ro.vendor.persist.status=mounted + # for modem related functions + restorecon_recursive /mnt/vendor/efs + chown radio system /mnt/vendor/efs + restorecon_recursive /mnt/vendor/efs_backup + chown radio system /mnt/vendor/efs_backup + restorecon_recursive /mnt/vendor/modem_userdata + chown radio system /mnt/vendor/modem_userdata + # for battery defender mkdir /mnt/vendor/persist/battery 0700 system system diff --git a/conf/init.zuma.rc b/conf/init.zuma.rc index f98001b3..f0cbf01c 100644 --- a/conf/init.zuma.rc +++ b/conf/init.zuma.rc @@ -605,12 +605,6 @@ on property:persist.vendor.radio.no_modem_board=1 on fs mount_all --early - restorecon_recursive /mnt/vendor/efs - chown radio system /mnt/vendor/efs - restorecon_recursive /mnt/vendor/efs_backup - chown radio system /mnt/vendor/efs_backup - restorecon_recursive /mnt/vendor/modem_userdata - chown radio system /mnt/vendor/modem_userdata # Mount modem partition mount_all /vendor/etc/fstab.modem --early From d45d697ded5ed10f12c3e6bbee9fc0e6d0e9dadb Mon Sep 17 00:00:00 2001 From: Kelvin Zhang Date: Tue, 11 Jun 2024 10:49:17 -0700 Subject: [PATCH 14/18] Enable copy efs files support on pgagnotic target pgagnotic targets might boot into 16KB directly(w/o dev options), in which case it would need copy efs files support to be enabled. Test: boot device with dev option disabled, check efs Bug: 346275905 Change-Id: If18bfa0b0646da8008c6d92bec094b236273cbfc --- device.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/device.mk b/device.mk index 8d705f32..c7e8979c 100644 --- a/device.mk +++ b/device.mk @@ -360,7 +360,7 @@ PRODUCT_COPY_FILES += \ device/google/zuma/conf/init.zuma.rc:$(TARGET_COPY_OUT_VENDOR)/etc/init/hw/init.zuma.rc \ device/google/zuma/conf/init.persist.rc:$(TARGET_COPY_OUT_VENDOR)/etc/init/init.persist.rc -ifeq (true,$(PRODUCT_16K_DEVELOPER_OPTION)) +ifeq (true,$(filter $(DEVICE_PAGE_AGNOSTIC) $(PRODUCT_16K_DEVELOPER_OPTION),true)) PRODUCT_COPY_FILES += \ device/google/zuma/conf/init.efs.16k.rc:$(TARGET_COPY_OUT_VENDOR)/etc/init/init.efs.rc \ device/google/$(TARGET_BOARD_PLATFORM)/conf/fstab.efs.from_data:$(TARGET_COPY_OUT_VENDOR)/etc/fstab.efs.from_data \ From ef5856a4474002cc35a51377adffddd4cb239796 Mon Sep 17 00:00:00 2001 From: Kyle Tso Date: Wed, 12 Jun 2024 17:14:02 +0800 Subject: [PATCH 15/18] usb: Add retry on role switch Bug: 341996696 Change-Id: I8caa65288af1588d24fea4aa6c5768d45d69bbd5 Signed-off-by: Kyle Tso --- usb/usb/Usb.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/usb/usb/Usb.cpp b/usb/usb/Usb.cpp index fcb31ead..267049b9 100644 --- a/usb/usb/Usb.cpp +++ b/usb/usb/Usb.cpp @@ -602,6 +602,10 @@ ScopedAStatus Usb::switchRole(const string& in_portName, const PortRole& in_role fp = fopen(filename.c_str(), "w"); if (fp != NULL) { int ret = fputs(convertRoletoString(in_role).c_str(), fp); + if (ret == EAGAIN) { + std::this_thread::sleep_for(std::chrono::milliseconds(700)); + ret = fputs(convertRoletoString(in_role).c_str(), fp); + } fclose(fp); if ((ret != EOF) && ReadFileToString(filename, &written)) { written = Trim(written); From d17fdff5f81cff76adaa75d50f26318be8048123 Mon Sep 17 00:00:00 2001 From: Kyle Tso Date: Thu, 13 Jun 2024 16:54:37 +0800 Subject: [PATCH 16/18] usb: Log for retry on role switch Add a log for the retry. Also define the sleep time in the header file. Bug: 341996696 Change-Id: Ib3cc0c6ad576e7cda26b7f50cdc61d52e6349c78 Signed-off-by: Kyle Tso --- usb/usb/Usb.cpp | 3 ++- usb/usb/Usb.h | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/usb/usb/Usb.cpp b/usb/usb/Usb.cpp index 267049b9..4f6d1272 100644 --- a/usb/usb/Usb.cpp +++ b/usb/usb/Usb.cpp @@ -603,7 +603,8 @@ ScopedAStatus Usb::switchRole(const string& in_portName, const PortRole& in_role if (fp != NULL) { int ret = fputs(convertRoletoString(in_role).c_str(), fp); if (ret == EAGAIN) { - std::this_thread::sleep_for(std::chrono::milliseconds(700)); + ALOGI("role switch busy, retry in %d ms", ROLE_SWAP_RETRY_MS); + std::this_thread::sleep_for(std::chrono::milliseconds(ROLE_SWAP_RETRY_MS)); ret = fputs(convertRoletoString(in_role).c_str(), fp); } fclose(fp); diff --git a/usb/usb/Usb.h b/usb/usb/Usb.h index 60064514..4746a88c 100644 --- a/usb/usb/Usb.h +++ b/usb/usb/Usb.h @@ -79,6 +79,7 @@ constexpr char kGadgetName[] = "11210000.dwc3"; #define DISPLAYPORT_IRQ_HPD_COUNT_CHECK 3 #define DISPLAYPORT_POLL_WAIT_MS 100 +#define ROLE_SWAP_RETRY_MS 700 #define SVID_DISPLAYPORT "ff01" #define SVID_THUNDERBOLT "8087" From 120974a4b1a511583dfef1b85056bbc563d89ec9 Mon Sep 17 00:00:00 2001 From: Kelvin Zhang Date: Fri, 14 Jun 2024 13:12:19 -0700 Subject: [PATCH 17/18] Add test for copy_efs_files_to_data script Test: atest CopyEfsTest Bug: 346551655 Change-Id: I38eef1dff949c4275bf0b355582238678a6894a7 --- CopyEfsTest/Android.bp | 35 +++++++ CopyEfsTest/AndroidTest.xml | 40 ++++++++ CopyEfsTest/TEST_MAPPING | 8 ++ .../src/com/android/test/CopyEfsTest.java | 97 +++++++++++++++++++ 4 files changed, 180 insertions(+) create mode 100644 CopyEfsTest/Android.bp create mode 100644 CopyEfsTest/AndroidTest.xml create mode 100644 CopyEfsTest/TEST_MAPPING create mode 100644 CopyEfsTest/src/com/android/test/CopyEfsTest.java diff --git a/CopyEfsTest/Android.bp b/CopyEfsTest/Android.bp new file mode 100644 index 00000000..52c5de4e --- /dev/null +++ b/CopyEfsTest/Android.bp @@ -0,0 +1,35 @@ +// Copyright (C) 2024 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. + +package { + default_applicable_licenses: ["device_google_zuma_license"], +} + +java_test_host { + name: "CopyEfsTest", + // Include all test java files + srcs: ["src/**/*.java"], + static_libs: [ + "junit", + "platform-test-annotations", + "truth", + ], + libs: [ + "tradefed", + "compatibility-host-util", + "compatibility-tradefed", + ], + test_suites: ["device-tests"], + test_config: "AndroidTest.xml", +} diff --git a/CopyEfsTest/AndroidTest.xml b/CopyEfsTest/AndroidTest.xml new file mode 100644 index 00000000..398991f3 --- /dev/null +++ b/CopyEfsTest/AndroidTest.xml @@ -0,0 +1,40 @@ + + + + + diff --git a/CopyEfsTest/TEST_MAPPING b/CopyEfsTest/TEST_MAPPING new file mode 100644 index 00000000..37a720b5 --- /dev/null +++ b/CopyEfsTest/TEST_MAPPING @@ -0,0 +1,8 @@ +{ + "postsubmit": [ + { + "name": "CopyEfsTest" + } + ] +} + diff --git a/CopyEfsTest/src/com/android/test/CopyEfsTest.java b/CopyEfsTest/src/com/android/test/CopyEfsTest.java new file mode 100644 index 00000000..b00ef2fc --- /dev/null +++ b/CopyEfsTest/src/com/android/test/CopyEfsTest.java @@ -0,0 +1,97 @@ +/* + * Copyright (C) 2024 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. + */ + +package com.android.test; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; +import static org.junit.Assume.assumeTrue; + +import android.platform.test.annotations.AppModeFull; + +import com.android.tradefed.testtype.DeviceJUnit4ClassRunner; +import com.android.tradefed.testtype.junit4.BaseHostJUnit4Test; +import com.android.tradefed.testtype.junit4.DeviceTestRunOptions; +import com.android.tradefed.util.RunUtil; + +import org.junit.Test; +import org.junit.runner.RunWith; + +import java.io.BufferedReader; +import java.io.StringReader; + +@RunWith(DeviceJUnit4ClassRunner.class) +public class CopyEfsTest extends BaseHostJUnit4Test { + + + + + @Test + @AppModeFull + public void copyEfsTest() throws Exception { + + getDevice().enableAdbRoot(); + + // This test can be run on OEM unlocked device only as unlocking bootloader requires + // manual intervention. + String result = getDevice().getProperty("ro.boot.flash.locked"); + assumeTrue("0".equals(result)); + final String dataFstype = getFsTypeFor("/data"); + assertTrue(!dataFstype.isEmpty()); + if (!dataFstype.equals("ext4")) { + getDevice().executeShellCommand("cmd recovery wipe ext4"); + RunUtil.getDefault().sleep(10000); + // Wait for 2 mins device to be online againg + getDevice().waitForDeviceOnline(120000); + getDevice().enableAdbRoot(); + } + assertEquals("ext4", getFsTypeFor("/data")); + String dataBlockDev = getBlockDevFor("/data"); + assertEquals(dataBlockDev, getBlockDevFor("/mnt/vendor/efs")); + assertEquals(dataBlockDev, getBlockDevFor("/mnt/vendor/efs_backup")); + assertEquals(dataBlockDev, getBlockDevFor("/mnt/vendor/modem_userdata")); + } + + private String[] getMountInfo(String mountPoint) throws Exception { + String result = getDevice().executeShellCommand("cat /proc/mounts"); + BufferedReader br = new BufferedReader(new StringReader(result)); + String line; + while ((line = br.readLine()) != null) { + final String[] fields = line.split(" "); + final String device = fields[0]; + final String partition = fields[1]; + final String fsType = fields[2]; + if (partition.equals(mountPoint)) { + return fields; + } + } + return null; + } + private String getFsTypeFor(String mountPoint) throws Exception { + String[] result = getMountInfo(mountPoint); + if (result == null) { + return ""; + } + return result[2]; + } + private String getBlockDevFor(String mountPoint) throws Exception { + String[] result = getMountInfo(mountPoint); + if (result == null) { + return ""; + } + return result[0]; + } +} From cf0619c40d0ae4cf7d768bafa294a1bc4b4de5ab Mon Sep 17 00:00:00 2001 From: Kelvin Zhang Date: Mon, 17 Jun 2024 11:13:53 -0700 Subject: [PATCH 18/18] Remove CopyEfsTest from test mapping treehugger does not have any test suite setup for zuma target, and CopyEfsTest should only be run on zuma targets. So remove from test mapping to unbreak tests. Test: th Bug: 347396961 Change-Id: I079d24cae4808d3370c3821412640f7fef1d0cc7 --- CopyEfsTest/TEST_MAPPING | 8 -------- 1 file changed, 8 deletions(-) delete mode 100644 CopyEfsTest/TEST_MAPPING diff --git a/CopyEfsTest/TEST_MAPPING b/CopyEfsTest/TEST_MAPPING deleted file mode 100644 index 37a720b5..00000000 --- a/CopyEfsTest/TEST_MAPPING +++ /dev/null @@ -1,8 +0,0 @@ -{ - "postsubmit": [ - { - "name": "CopyEfsTest" - } - ] -} -