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/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]; + } +} diff --git a/conf/init.efs.16k.rc b/conf/init.efs.16k.rc index 9e891680..72ae9894 100644 --- a/conf/init.efs.16k.rc +++ b/conf/init.efs.16k.rc @@ -9,16 +9,8 @@ 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 - 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 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/default-permissions.xml b/default-permissions.xml index 1764bc1a..00959c8f 100644 --- a/default-permissions.xml +++ b/default-permissions.xml @@ -59,7 +59,6 @@ - diff --git a/device.mk b/device.mk index bcf96249..542fdc9e 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 @@ -360,12 +361,13 @@ 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 \ 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 @@ -948,7 +950,9 @@ PRODUCT_PACKAGES += ShannonRcs # 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 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 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 = { 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", diff --git a/usb/usb/Usb.cpp b/usb/usb/Usb.cpp index fcb31ead..4f6d1272 100644 --- a/usb/usb/Usb.cpp +++ b/usb/usb/Usb.cpp @@ -602,6 +602,11 @@ 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) { + 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); if ((ret != EOF) && ReadFileToString(filename, &written)) { written = Trim(written); 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"