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 diff --git a/CopyEfsTest/Android.bp b/CopyEfsTest/Android.bp new file mode 100644 index 00000000..9b7a4592 --- /dev/null +++ b/CopyEfsTest/Android.bp @@ -0,0 +1,38 @@ +// 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", + "device-pixel-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..290ac24e --- /dev/null +++ b/CopyEfsTest/src/com/android/test/CopyEfsTest.java @@ -0,0 +1,84 @@ +/* + * 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 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; +import org.junit.runner.RunWith; + +import java.io.BufferedReader; +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")); + + testDumpF2FS("efs"); + testDumpF2FS("efs_backup"); + testDumpF2FS("modem_userdata"); + } + + 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"); + } + + @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"); + } +} diff --git a/conf/init.efs.16k.rc b/conf/init.efs.16k.rc index c3434bfd..e39ac23f 100644 --- a/conf/init.efs.16k.rc +++ b/conf/init.efs.16k.rc @@ -6,25 +6,19 @@ 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 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 -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 +on early-init && property:ro.boot.hardware.cpu.pagesize=4096 + mount_all /vendor/etc/fstab.persist --early setprop ro.vendor.persist.status mounted -on post-fs-data && property:ro.boot.flash.locked=1 - mount_all /vendor/etc/fstab.efs - mount_all /vendor/etc/fstab.persist - 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 506c7220..8b48bdfb 100644 --- a/conf/init.efs.4k.rc +++ b/conf/init.efs.4k.rc @@ -1,4 +1,6 @@ -on post-fs-data - 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 diff --git a/conf/init.persist.rc b/conf/init.persist.rc index 26a9c4d7..4a4c3ff3 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 @@ -23,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 diff --git a/conf/init.zuma.rc b/conf/init.zuma.rc index f98001b3..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 @@ -605,12 +606,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/device.mk b/device.mk index 53b73393..15c20c8e 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 @@ -43,6 +44,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,7 +362,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 $(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 \ 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/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"