From 7c30487eff576de561e0ead9cac427eca454d50e Mon Sep 17 00:00:00 2001 From: Leo Chen Date: Thu, 23 May 2024 06:42:16 +0000 Subject: [PATCH 01/17] 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 48e1f2418a5b9f9713247713c49815eb0fcf3244 Mon Sep 17 00:00:00 2001 From: chenkris Date: Mon, 10 Jun 2024 17:22:27 +0000 Subject: [PATCH 02/17] 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 03/17] 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 04/17] 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 05/17] 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 06/17] 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 07/17] 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 08/17] 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 2c8e3651e4ecc356a3e84fb67f5ae6881f750594 Mon Sep 17 00:00:00 2001 From: Herbert Xue Date: Mon, 17 Jun 2024 13:48:03 +0800 Subject: [PATCH 09/17] Remove unused device/google/zuma/Android.mk There is no other Android.mk under subdirectory of device/google/zuma. Bug: 347619275 Test: NA Change-Id: I7a5e9afb1ccb75ed66e947a3fa1e0bda2c2223b6 --- Android.mk | 30 ------------------------------ 1 file changed, 30 deletions(-) delete mode 100644 Android.mk diff --git a/Android.mk b/Android.mk deleted file mode 100644 index 370f6f37..00000000 --- a/Android.mk +++ /dev/null @@ -1,30 +0,0 @@ -# -# Copyright (C) 2011 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. -# - -# WARNING: Everything listed here will be built on ALL platforms, -# including x86, the universal, and the SDK. Modules must be uniquely -# named (liblights.panda), and must build everywhere, or limit themselves -# to only building on ARM if they include assembly. Individual makefiles -# are responsible for having their own logic, for fine-grained control. - -LOCAL_PATH := $(call my-dir) - -# if some modules are built directly from this directory (not subdirectories), -# their rules should be written here. - -ifeq ($(USES_DEVICE_GOOGLE_ZUMA),true) - include $(call first-makefiles-under,$(LOCAL_PATH)) -endif From cf0619c40d0ae4cf7d768bafa294a1bc4b4de5ab Mon Sep 17 00:00:00 2001 From: Kelvin Zhang Date: Mon, 17 Jun 2024 11:13:53 -0700 Subject: [PATCH 10/17] 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" - } - ] -} - From 579a541f268f8a7b2baa553ed66bd11118151bc9 Mon Sep 17 00:00:00 2001 From: YiKai Peng Date: Thu, 20 Jun 2024 02:31:16 +0000 Subject: [PATCH 11/17] zuma: wlc: add authstart permission Bug: 348272247 Test: Build/Flash Flag: EXEMPT bugfix Change-Id: I881dd032c7dbcc8bca55c1346e02d21b1f2c0145 Signed-off-by: YiKai Peng --- conf/init.zuma.rc | 1 + 1 file changed, 1 insertion(+) diff --git a/conf/init.zuma.rc b/conf/init.zuma.rc index f0cbf01c..3e0a2e76 100644 --- a/conf/init.zuma.rc +++ b/conf/init.zuma.rc @@ -257,6 +257,7 @@ on init chown system system /sys/class/power_supply/wireless/device/version chown system system /sys/class/power_supply/wireless/device/features chown system system /sys/class/power_supply/wireless/device/authtype + chown system system /sys/class/power_supply/wireless/device/authstart # Adaptive charge chown system system /sys/class/power_supply/battery/charge_deadline From 763984677a0630a2100b150c057c3d128a8f6c3d Mon Sep 17 00:00:00 2001 From: Kelvin Zhang Date: Tue, 18 Jun 2024 15:55:03 -0700 Subject: [PATCH 12/17] Only copy efs files to /data if device is 16K page size Test: Boot device, test dev options Bug: 341216848 Change-Id: I0bf328b8ff90e125dcbca5261fb8dd4e0ad458d8 --- conf/init.efs.16k.rc | 9 ++------- conf/init.efs.4k.rc | 2 +- conf/init.persist.rc | 1 + 3 files changed, 4 insertions(+), 8 deletions(-) diff --git a/conf/init.efs.16k.rc b/conf/init.efs.16k.rc index 72ae9894..89e2b57f 100644 --- a/conf/init.efs.16k.rc +++ b/conf/init.efs.16k.rc @@ -6,7 +6,7 @@ service copy_efs_files_to_data /vendor/bin/copy_efs_files_to_data oneshot disabled -on post-fs-data && property:ro.boot.flash.locked=0 && property:ro.fstype.data=ext4 +on post-fs-data && property:ro.boot.hardware.cpu.pagesize=16384 mkdir /data/vendor/copied 0775 radio system restorecon_recursive /data/vendor/copied exec_start copy_efs_files_to_data @@ -15,12 +15,7 @@ on post-fs-data && property:ro.boot.flash.locked=0 && property:ro.fstype.data=ex restorecon_recursive /data/vendor/ss setprop ro.vendor.persist.status mounted -on post-fs-data && property:ro.boot.flash.locked=0 && property:ro.fstype.data=f2fs - mount_all /vendor/etc/fstab.efs - mount_all /vendor/etc/fstab.persist - setprop ro.vendor.persist.status mounted - -on post-fs-data && property:ro.boot.flash.locked=1 +on late-fs && property:ro.boot.hardware.cpu.pagesize=4096 mount_all /vendor/etc/fstab.efs mount_all /vendor/etc/fstab.persist setprop ro.vendor.persist.status mounted diff --git a/conf/init.efs.4k.rc b/conf/init.efs.4k.rc index 506c7220..60a07a9c 100644 --- a/conf/init.efs.4k.rc +++ b/conf/init.efs.4k.rc @@ -1,4 +1,4 @@ -on post-fs-data +on late-fs mount_all /vendor/etc/fstab.efs mount_all /vendor/etc/fstab.persist setprop ro.vendor.persist.status mounted diff --git a/conf/init.persist.rc b/conf/init.persist.rc index 7852c78e..4a4c3ff3 100644 --- a/conf/init.persist.rc +++ b/conf/init.persist.rc @@ -31,6 +31,7 @@ on property:ro.vendor.persist.status=mounted mkdir /mnt/vendor/persist/data/tz 0700 system system mkdir /mnt/vendor/persist/touch 0770 system system +on property:ro.fstype.data=* && property:ro.vendor.persist.status=mounted # Proxy for Secure Storage mkdir /data/vendor/rebootescrow 0770 hsm hsm mkdir /data/vendor/ss 0770 root system From 73a68dd6d3794ed8a4e791f2c86c4e55a61ea2aa Mon Sep 17 00:00:00 2001 From: Kelvin Zhang Date: Thu, 20 Jun 2024 21:04:40 -0700 Subject: [PATCH 13/17] Mount persist partition in early-init The graphics hal might need to access /persist early in the boot process. So mount persist early for 4K devices. Test: boot 4K device Bug: 338504890 Change-Id: I4b2a0a61ebaff5d85a4daac445d81ae3d21aa9c3 --- conf/init.efs.16k.rc | 8 +++++--- conf/init.efs.4k.rc | 8 +++++--- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/conf/init.efs.16k.rc b/conf/init.efs.16k.rc index 89e2b57f..e39ac23f 100644 --- a/conf/init.efs.16k.rc +++ b/conf/init.efs.16k.rc @@ -15,8 +15,10 @@ on post-fs-data && property:ro.boot.hardware.cpu.pagesize=16384 restorecon_recursive /data/vendor/ss setprop ro.vendor.persist.status mounted -on late-fs && property:ro.boot.hardware.cpu.pagesize=4096 - mount_all /vendor/etc/fstab.efs - mount_all /vendor/etc/fstab.persist +on early-init && property:ro.boot.hardware.cpu.pagesize=4096 + mount_all /vendor/etc/fstab.persist --early setprop ro.vendor.persist.status mounted +on late-fs && property:ro.boot.hardware.cpu.pagesize=4096 + mount_all /vendor/etc/fstab.efs --early + diff --git a/conf/init.efs.4k.rc b/conf/init.efs.4k.rc index 60a07a9c..8b48bdfb 100644 --- a/conf/init.efs.4k.rc +++ b/conf/init.efs.4k.rc @@ -1,4 +1,6 @@ -on late-fs - mount_all /vendor/etc/fstab.efs - mount_all /vendor/etc/fstab.persist +on early-init + mount_all /vendor/etc/fstab.persist --early setprop ro.vendor.persist.status mounted + +on late-fs + mount_all /vendor/etc/fstab.efs --early From 3319a13fee54590f80c66c116a579322dc99b2d6 Mon Sep 17 00:00:00 2001 From: Daniel Rosenberg Date: Fri, 21 Jun 2024 18:43:45 -0700 Subject: [PATCH 14/17] Change CopyEfsTest to test contents 4k mode devices no longer set up redirection, so the old test would fail now. Instead, this tests that the contents of the copied partitions will match. Since the partitions are mounted and could change, we work off of a copy. Change-Id: Ia98517bb4ede9cb3416132e815da9b87728423a6 Signed-off-by: Daniel Rosenberg Flag: TEST_ONLY Bug: 347744178 Test: atest CopyEfsTest --- .../src/com/android/test/CopyEfsTest.java | 83 ++++++++----------- 1 file changed, 35 insertions(+), 48 deletions(-) diff --git a/CopyEfsTest/src/com/android/test/CopyEfsTest.java b/CopyEfsTest/src/com/android/test/CopyEfsTest.java index b00ef2fc..290ac24e 100644 --- a/CopyEfsTest/src/com/android/test/CopyEfsTest.java +++ b/CopyEfsTest/src/com/android/test/CopyEfsTest.java @@ -19,12 +19,15 @@ package com.android.test; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertTrue; import static org.junit.Assume.assumeTrue; +import org.junit.Before; +import org.junit.After; 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.CommandResult; import com.android.tradefed.util.RunUtil; import org.junit.Test; @@ -36,62 +39,46 @@ import java.io.StringReader; @RunWith(DeviceJUnit4ClassRunner.class) public class CopyEfsTest extends BaseHostJUnit4Test { + @Before + public void setUp() throws Exception { + getDevice().enableAdbRoot(); - + getDevice().executeShellCommand("rm -rf /data/local/tmp/efs_test"); + getDevice().executeShellCommand("mkdir -p /data/local/tmp/efs_test/mnt"); + getDevice().executeShellCommand("mkdir -p /data/local/tmp/efs_test/dump"); + } @Test @AppModeFull public void copyEfsTest() throws Exception { + assumeTrue(getDevice().executeShellCommand("getconf PAGESIZE").trim().equals("4096")); - 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")); + testDumpF2FS("efs"); + testDumpF2FS("efs_backup"); + testDumpF2FS("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 void testDumpF2FS(String name) throws Exception { + getDevice().executeShellV2Command(String.format("cp /dev/block/by-name/%s /data/local/tmp/efs_test/%s.img", name, name)); + CommandResult r = getDevice().executeShellV2Command(String.format("dump.f2fs -rfPo /data/local/tmp/efs_test/dump /data/local/tmp/efs_test/%s.img", name)); + assertEquals(r.getExitCode().intValue(), 0); + r = getDevice().executeShellV2Command(String.format("mount -r /data/local/tmp/efs_test/%s.img /data/local/tmp/efs_test/mnt", name)); + assertEquals(r.getExitCode().intValue(), 0); + assertEquals("", getDevice().executeShellCommand("diff -rq /data/local/tmp/efs_test/mnt /data/local/tmp/efs_test/dump")); + // Remove timestamps at positions 6 and 7, because ls on device does not support --time-style + // Remove totals because on disk block usage may change depending on filesystem + String ls_cmd = "ls -alLnR /data/local/tmp/efs_test/%s | awk {\'$6=\"\";$7=\"\";if ($1 != \"total\"){print $0'}"; + String mnt_ls = getDevice().executeShellCommand(String.format(ls_cmd, "mnt")); + String dump_ls = getDevice().executeShellCommand(String.format(ls_cmd, "dump")); + assertEquals(mnt_ls, dump_ls); + getDevice().executeShellCommand("umount -r /data/local/tmp/efs_test/mnt"); + getDevice().executeShellCommand("rm -rf /data/local/tmp/efs_test/dump/*"); + getDevice().executeShellCommand("rm /data/local/tmp/efs_test/" + name + ".img"); } - 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]; + + @After + public void tearDown() throws Exception { + getDevice().executeShellCommand("umount -r /data/local/tmp/efs_test/mnt"); + getDevice().executeShellCommand("rm -rf /data/local/tmp/efs_test"); } } From dca09aa056490ed25d96111eee419c29da5c1e77 Mon Sep 17 00:00:00 2001 From: Julien Desprez Date: Tue, 25 Jun 2024 02:58:28 +0000 Subject: [PATCH 15/17] Tag CopyEfsTest as device-pixel-tests This will allow to run the tests out of the pixel tests set rather than the super large device-tests set. Which will save build resources. Flag: TEST_ONLY Change-Id: I7d902662dff05dfdc88808c5647793ff5bde6107 Test: presubmit Bug: 342232954 --- CopyEfsTest/Android.bp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/CopyEfsTest/Android.bp b/CopyEfsTest/Android.bp index 52c5de4e..9b7a4592 100644 --- a/CopyEfsTest/Android.bp +++ b/CopyEfsTest/Android.bp @@ -30,6 +30,9 @@ java_test_host { "compatibility-host-util", "compatibility-tradefed", ], - test_suites: ["device-tests"], + test_suites: [ + "device-tests", + "device-pixel-tests" + ], test_config: "AndroidTest.xml", } From 48c79683bcac4b697cfa08949dfa4c4c7daed683 Mon Sep 17 00:00:00 2001 From: liangjlee Date: Thu, 27 Jun 2024 02:01:10 +0800 Subject: [PATCH 16/17] zuma: Include power/power.mk Bug: 331612600 Flag: EXEMPT (bug 337358613) Change-Id: I370cd115855b43d890dd488de65572593b238efb Signed-off-by: liangjlee --- device.mk | 1 + 1 file changed, 1 insertion(+) diff --git a/device.mk b/device.mk index 542fdc9e..7814d623 100644 --- a/device.mk +++ b/device.mk @@ -26,6 +26,7 @@ include device/google/gs-common/storage/storage.mk include device/google/gs-common/thermal/dump/thermal.mk include device/google/gs-common/thermal/thermal_hal/device.mk include device/google/gs-common/performance/perf.mk +include device/google/gs-common/power/power.mk include device/google/gs-common/pixel_metrics/pixel_metrics.mk include device/google/gs-common/soc/freq.mk include device/google/gs-common/gps/dump/log.mk From 98f2222e27fc6a57b3731107050757192d5788ff Mon Sep 17 00:00:00 2001 From: Juan Yescas Date: Wed, 26 Jun 2024 21:34:18 -0700 Subject: [PATCH 17/17] 16kb: Use PRODUCT_BOOTS_16K to select the proper rc file and fstab The build flag PRODUCT_BOOTS_16K will be used to select the proper efs rc file and fstab: - When PRODUCT_BOOTS_16K := true, 16k rc files and fstab will be used. - When PRODUCT_BOOTS_16K := false, 4k rc files and fstab will be used. Bug: 346868433 Test: Built Pixel 8 targets $ source build/envsetup.sh $ lunch husky_pgagnostic-trunk_staging-userdebug $ get_build_var DEVICE_PAGE_AGNOSTIC $ get_build_var TARGET_KERNEL_DIR device/google/shusky-kernels/6.1/trunk-12010727/16kb $ get_build_var TARGET_BOARD_KERNEL_HEADERS device/google/shusky-kernels/6.1/trunk-12010727/kernel-headers $ get_build_var PRODUCT_BOOTS_16K true $ get_build_var TARGET_RW_FILE_SYSTEM_TYPE ext4 $ get_build_var TARGET_USERDATAIMAGE_FILE_SYSTEM_TYPE ext4 Flag: EXEMPT bugfix Change-Id: I4dba20518925a176f1e1e66596e2bb1e8ade7c26 --- device.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/device.mk b/device.mk index 542fdc9e..fde03f30 100644 --- a/device.mk +++ b/device.mk @@ -361,7 +361,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,$(filter $(DEVICE_PAGE_AGNOSTIC) $(PRODUCT_16K_DEVELOPER_OPTION),true)) +ifeq (true,$(filter $(PRODUCT_BOOTS_16K) $(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 \