1 Commits
bka ... vic

Author SHA1 Message Date
4156521654 zuma: Initialize for Evolution X 10.x
Signed-off-by: AnierinB <anierin@evolution-x.org>
2025-05-12 03:51:46 +00:00
73 changed files with 2344 additions and 336 deletions

View File

@@ -41,3 +41,14 @@ sh_binary {
vendor: true,
sub_dir: "hw",
}
// Filesystem: Copy efs/efs_backup/modem_userdata to /data partition
// so that they can be accessed under 16K mode. By default, these partitions
// are 4K F2FS , which can't be mounted under 16K mode.
// (b/293313353)
sh_binary {
name: "copy_efs_files_to_data",
src: "copy_efs_files_to_data.sh",
vendor: true,
}

View File

@@ -14,6 +14,8 @@
# limitations under the License.
#
ifneq ($(wildcard $(TARGET_KERNEL_DIR)/16kb/),)
ifeq ($(TARGET_BOOTS_16K),true)
# Configures the 16kb kernel directory.
TARGET_KERNEL_DIR := $(TARGET_KERNEL_DIR)/16kb
@@ -46,3 +48,5 @@ BOARD_KERNEL_MODULES_LOAD_16K := $(foreach module,$(BOARD_KERNEL_MODULES_16K),$(
BOARD_16K_OTA_USE_INCREMENTAL := true
BOARD_16K_OTA_MOVE_VENDOR := true
endif
endif

View File

@@ -17,9 +17,7 @@ include build/make/target/board/BoardConfigMainlineCommon.mk
include build/make/target/board/BoardConfigPixelCommon.mk
# Include settings for 16k developer option, if enabled
ifneq ($(wildcard $(TARGET_KERNEL_DIR)/16kb/),)
include device/google/zuma/BoardConfig-16k-common.mk
endif
# HACK : To fix up after bring up multimedia devices.
TARGET_SOC := zuma
@@ -35,6 +33,7 @@ TARGET_CPU_VARIANT := cortex-a55
BOARD_KERNEL_CMDLINE += earlycon=exynos4210,0x10870000 console=ttySAC0,115200 androidboot.console=ttySAC0 printk.devkmsg=on
BOARD_KERNEL_CMDLINE += cma_sysfs.experimental=Y
BOARD_KERNEL_CMDLINE += cgroup_disable=memory
BOARD_KERNEL_CMDLINE += rcupdate.rcu_expedited=1 rcu_nocbs=all rcutree.enable_rcu_lazy
BOARD_KERNEL_CMDLINE += swiotlb=1024
BOARD_KERNEL_CMDLINE += cgroup.memory=nokmem
@@ -45,6 +44,17 @@ ifeq (,$(filter %_fullmte,$(TARGET_PRODUCT)))
BOARD_KERNEL_CMDLINE += kasan=off
endif
# Enable a limited subset of MTE for "normal" (non-_fullmte) eng builds.
# Don't touch any settings for _fullmte builds. They are set somewhere else.
ifeq (,$(filter %_fullmte,$(TARGET_PRODUCT)))
ifeq ($(TARGET_BUILD_VARIANT),eng)
BOARD_KERNEL_CMDLINE += bootloader.pixel.MTE_FORCE_ON
ifeq ($(filter memtag_heap,$(SANITIZE_TARGET)),)
SANITIZE_TARGET := $(strip $(SANITIZE_TARGET) memtag_heap)
endif
endif
endif
BOARD_BOOTCONFIG += androidboot.boot_devices=13200000.ufs
TARGET_NO_BOOTLOADER := true
@@ -251,6 +261,12 @@ BOARD_USES_GENERIC_AUDIO := true
$(call soong_config_set,aoc_audio_func,ext_hidl,true)
ifneq (,$(filter eng, $(TARGET_BUILD_VARIANT)))
$(call soong_config_set,aoc_audio_func,dump_usecase_data,true)
$(call soong_config_set,aoc_audio_func,hal_socket_control,true)
$(call soong_config_set,aoc_audio_func,record_tuning_keys,true)
endif
ifneq (,$(filter aosp_%,$(TARGET_PRODUCT)))
$(call soong_config_set,aoc_audio_func,aosp_build,true)
endif
@@ -440,5 +456,8 @@ BOARD_KERNEL_CMDLINE += log_buf_len=1024K
# Protected VM firmware
BOARD_PVMFWIMAGE_PARTITION_SIZE := 0x00100000
# pick up library for cleaning digital car keys on factory reset
-include vendor/google_devices/gs-common/proprietary/BoardConfigVendor.mk
include device/google/zuma/BoardConfigLineage.mk
include device/google/zuma/BoardConfigEvolution.mk

View File

@@ -5,6 +5,7 @@
#
# Manifests
DEVICE_FRAMEWORK_COMPATIBILITY_MATRIX_FILE += vendor/lineage/config/device_framework_matrix.xml
DEVICE_MANIFEST_FILE += \
device/google/zuma/android.hardware.security.rkp-service.citadel.xml \
device/google/zuma/manifest_radio_ds.xml

85
CleanSpec.mk Normal file
View File

@@ -0,0 +1,85 @@
# Copyright (C) 2012 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.
#
# If you don't need to do a full clean build but would like to touch
# a file or delete some intermediate files, add a clean step to the end
# of the list. These steps will only be run once, if they haven't been
# run before.
#
# E.g.:
# $(call add-clean-step, touch -c external/sqlite/sqlite3.h)
# $(call add-clean-step, rm -rf $(PRODUCT_OUT)/obj/STATIC_LIBRARIES/libz_intermediates)
#
# Always use "touch -c" and "rm -f" or "rm -rf" to gracefully deal with
# files that are missing or have been moved.
#
# Use $(PRODUCT_OUT) to get to the "out/target/product/blah/" directory.
# Use $(OUT_DIR) to refer to the "out" directory.
#
# If you need to re-do something that's already mentioned, just copy
# the command and add it to the bottom of the list. E.g., if a change
# that you made last week required touching a file and a change you
# made today requires touching the same file, just copy the old
# touch step and add it to the end of the list.
#
# ************************************************
# NEWER CLEAN STEPS MUST BE AT THE END OF THE LIST
# ************************************************
# For example:
#$(call add-clean-step, rm -rf $(OUT_DIR)/target/common/obj/APPS/AndroidTests_intermediates)
#$(call add-clean-step, rm -rf $(OUT_DIR)/target/common/obj/JAVA_LIBRARIES/core_intermediates)
#$(call add-clean-step, find $(OUT_DIR) -type f -name "IGTalkSession*" -print0 | xargs -0 rm -f)
#$(call add-clean-step, rm -rf $(PRODUCT_OUT)/data/*)
$(call add-clean-step, find $(PRODUCT_OUT) -name "*.apk" | xargs rm)
# ************************************************
# NEWER CLEAN STEPS MUST BE AT THE END OF THE LIST
# ************************************************
$(call add-clean-step, rm -rf $(PRODUCT_OUT)/obj/SHARED_LIBRARIES/libsurfaceflinger_intermediates)
$(call add-clean-step, rm -rf $(PRODUCT_OUT)/obj/SHARED_LIBRARIES/libui_intermediates)
$(call add-clean-step, rm -f $(PRODUCT_OUT)/root/default.prop)
$(call add-clean-step, rm -f $(TARGET_OUT)/build.prop)
$(call add-clean-step, rm -f $(PRODUCT_OUT)/system/etc/mixer_paths_lb.xml)
$(call add-clean-step, rm -f $(PRODUCT_OUT)/system/etc/permissions/android.hardware.camera.xml)
$(call add-clean-step, rm -f $(PRODUCT_OUT)/root/*)
# Power HAL 1.0
$(call add-clean-step, rm -f $(PRODUCT_OUT)/vendor/init/android.hardware.power@1.0-service.rc)
$(call add-clean-step, rm -f $(PRODUCT_OUT)/vendor/bin/hw/android.hardware.power@1.0-service)
# Power HAL HIDL
$(call add-clean-step, rm -f $(PRODUCT_OUT)/vendor/etc/init/android.hardware.power@1.3-service.pixel-libperfmgr.rc)
# Health storage HAL
$(call add-clean-step, find $(PRODUCT_OUT) -type f -name "*android.hardware.health.storage@1.0*" -print0 | xargs -0 rm -f)
# Update to USB HAL 1.3
$(call add-clean-step, rm -rf $(PRODUCT_OUT)/vendor/bin/hw/android.hardware.usb@1.2-service.slider)
$(call add-clean-step, rm -rf $(PRODUCT_OUT)/vendor/etc/init/android.hardware.usb@1.2-service.slider.rc)
$(call add-clean-step, rm -rf $(PRODUCT_OUT)/vendor/etc/vintf/manifest/android.hardware.usb@1.2-service.slider.xml)
$(call add-clean-step, rm -rf $(PRODUCT_OUT)/vendor/bin/hw/android.hardware.usb@1.3-service.slider)
$(call add-clean-step, rm -rf $(PRODUCT_OUT)/vendor/etc/init/android.hardware.usb@1.3-service.slider.rc)
$(call add-clean-step, rm -rf $(PRODUCT_OUT)/vendor/etc/vintf/manifest/android.hardware.usb@1.3-service.slider.xml)
# Power Stats HAL 1.0 to AIDL
$(call add-clean-step, rm -f $(PRODUCT_OUT)/vendor/bin/hw/android.hardware.power.stats@1.0-service.zuma)
$(call add-clean-step, rm -f $(PRODUCT_OUT)/vendor/etc/init/android.hardware.power.stats@1.0-service.zuma.rc)
$(call add-clean-step, rm -f $(PRODUCT_OUT)/vendor/etc/vintf/manifest/android.hardware.power.stats@1.0-service.zuma.xml)
# Health HAL to AIDL
$(call add-clean-step, find $(PRODUCT_OUT)/system -type f -name "*charger*" -print0 | xargs -0 rm -f)
$(call add-clean-step, find $(PRODUCT_OUT)/vendor -type f -name "*health@*" -print0 | xargs -0 rm -f)
$(call add-clean-step, find $(PRODUCT_OUT)/recovery/root -type f -name "*charger*" -print0 | xargs -0 rm -f)
$(call add-clean-step, find $(PRODUCT_OUT)/recovery/root -type f -name "*health@*" -print0 | xargs -0 rm -f)

38
CopyEfsTest/Android.bp Normal file
View File

@@ -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",
}

View File

@@ -0,0 +1,40 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
~ 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.
-->
<configuration description="Runs 16K developer option test.">
<option name="test-suite-tag" value="apct"/>
<target_preparer class="com.android.tradefed.targetprep.RootTargetPreparer">
<option name="force-root" value="true" />
</target_preparer>
<test class="com.android.compatibility.common.tradefed.testtype.JarHostTest" >
<option name="jar" value="CopyEfsTest.jar" />
</test>
<target_preparer class="com.android.tradefed.targetprep.RunCommandTargetPreparer">
<!-- Unlock screen -->
<option name="run-command" value="input keyevent KEYCODE_WAKEUP" />
<!-- Dismiss keyguard, in case it's set as "Swipe to unlock" -->
<option name="run-command" value="wm dismiss-keyguard" />
<!-- Collapse notifications -->
<option name="run-command" value="cmd statusbar collapse" />
<!-- dismiss all system dialogs before launch test -->
<option name="run-command" value="am broadcast -a android.intent.action.CLOSE_SYSTEM_DIALOGS" />
</target_preparer>
</configuration>

View File

@@ -0,0 +1,130 @@
/*
* 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.device.DeviceNotAvailableException;
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");
testDumpF2FS("persist");
}
private CommandResult RunAndCheckAdbCmd(String cmd) throws DeviceNotAvailableException {
CommandResult r = getDevice().executeShellV2Command(cmd);
assertEquals("Failed to run " + cmd, Integer.valueOf(0), r.getExitCode());
return r;
}
// Remove timestamps because ls on device does not support --time-style.
// Format is [permissions] [links] [uid] [gid] [size] time [name/symlink]
// time may vary greatly in formatting
// symlinks will be of the form a -> b
// So we can check for -> in the second to last spot to determine what position the timestamp ends at
// Remove totals because on disk block usage may change depending on filesystem
private String removeTimestamps(String input) {
StringBuilder output = new StringBuilder();
for (String line : input.split("\n")) {
String[] tokens = line.split("(?<![\\\\])\s+");
if (tokens[0].equals("total"))
continue;
if (tokens.length < 3) {
output.append(line + "\n");
continue;
}
int name_offset = 1;
if (tokens[tokens.length - 2].equals("->"))
name_offset = 3;
for (int i=0; i<tokens.length; i++) {
if (i >= 5 && i < tokens.length - name_offset)
continue;
if (i != 0)
output.append(" ");
output.append(tokens[i]);
}
output.append("\n");
}
return output.toString();
}
private void testDumpF2FS(String name) throws Exception {
RunAndCheckAdbCmd(String.format("cp /dev/block/by-name/%s /data/local/tmp/efs_test/%s.img", name, name));
// The device was mounted r/w. To get a clean image, we run fsck, and then mount to allow mount time fixes to happen.
// We can then dump and mount read only to ensure the contents should be the same.
RunAndCheckAdbCmd(String.format("fsck.f2fs -f /data/local/tmp/efs_test/%s.img", name));
RunAndCheckAdbCmd(String.format("mount /data/local/tmp/efs_test/%s.img /data/local/tmp/efs_test/mnt", name));
RunAndCheckAdbCmd("umount /data/local/tmp/efs_test/mnt");
RunAndCheckAdbCmd(String.format("dump.f2fs -rfPLo /data/local/tmp/efs_test/dump /data/local/tmp/efs_test/%s.img", name));
RunAndCheckAdbCmd(String.format("mount -r /data/local/tmp/efs_test/%s.img /data/local/tmp/efs_test/mnt", name));
CommandResult r = RunAndCheckAdbCmd("diff -rq --no-dereference /data/local/tmp/efs_test/mnt /data/local/tmp/efs_test/dump");
assertEquals(r.getStdout(), "");
String ls_cmd = "cd /data/local/tmp/efs_test/%s;ls -AlnR .";
CommandResult mnt_ls = RunAndCheckAdbCmd(String.format(ls_cmd, "mnt"));
CommandResult dump_ls = RunAndCheckAdbCmd(String.format(ls_cmd, "dump"));
assertEquals(removeTimestamps(mnt_ls.getStdout()), removeTimestamps(dump_ls.getStdout()));
getDevice().executeShellCommand("umount /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 /data/local/tmp/efs_test/mnt");
getDevice().executeShellCommand("rm -rf /data/local/tmp/efs_test");
}
}

2
OWNERS Normal file
View File

@@ -0,0 +1,2 @@
# per-file for Pixel device makefiles, see go/pixel-device-mk-owner-checklist for details.
per-file *.mk,{**/,}Android.bp=file:device/google/gs-common:main:/MK_OWNERS

2
PREUPLOAD.cfg Normal file
View File

@@ -0,0 +1,2 @@
[Builtin Hooks]
jsonlint = true

View File

@@ -42,6 +42,7 @@ $(call inherit-product, $(SRC_TARGET_DIR)/product/handheld_vendor.mk)
$(call inherit-product, $(SRC_TARGET_DIR)/product/telephony_vendor.mk)
#$(call inherit-product, device/google/zuma/device.mk)
#$(call inherit-product-if-exists, vendor/google_devices/zuma/proprietary/device-vendor.mk)
# TODO: fix
# PRODUCT_RESTRICT_VENDOR_FILES := all

2
conf/OWNERS Normal file
View File

@@ -0,0 +1,2 @@
# per-file for Pixel fstab
per-file fstab.*=file:device/google/gs-common:main:/FSTAB_OWNERS

52
conf/init.debug.rc Normal file
View File

@@ -0,0 +1,52 @@
# SJTAG
on init
chown system system /sys/devices/platform/sjtag_ap/interface/access_lvl
chown system system /sys/devices/platform/sjtag_ap/interface/auth
chown system system /sys/devices/platform/sjtag_ap/interface/begin
chown system system /sys/devices/platform/sjtag_ap/interface/dbg_domain
chown system system /sys/devices/platform/sjtag_ap/interface/dbg_itvl
chown system system /sys/devices/platform/sjtag_ap/interface/end
chown system system /sys/devices/platform/sjtag_ap/interface/pubkey
chown system system /sys/devices/platform/sjtag_gsa/interface/access_lvl
chown system system /sys/devices/platform/sjtag_gsa/interface/auth
chown system system /sys/devices/platform/sjtag_gsa/interface/begin
chown system system /sys/devices/platform/sjtag_gsa/interface/dbg_domain
chown system system /sys/devices/platform/sjtag_gsa/interface/dbg_itvl
chown system system /sys/devices/platform/sjtag_gsa/interface/end
chown system system /sys/devices/platform/sjtag_gsa/interface/pubkey
on property:vendor.debug.ramdump.force_crash=true
write /sys/kernel/pixel_debug/trigger "null"
on property:power.battery_input.suspended=true
write /sys/kernel/debug/google_charger/input_suspend 1
on property:power.battery_input.suspended=false
write /sys/kernel/debug/google_charger/input_suspend 0
# Bluetooth
on post-fs-data
chown bluetooth system /dev/logbuffer_btlpm
chown bluetooth system /dev/logbuffer_tty18
# pKVM performance is different on A0 and B0 chips.
# Add extra tag to metrics collected on A0 to separate the results.
on property:ro.revision=PROTO1.0
setprop debug.hypervisor.metrics_tag "hwrev_a0"
on property:ro.revision=PROTO1.1
setprop debug.hypervisor.metrics_tag "hwrev_a0"
on property:ro.revision=EVT1.0
setprop debug.hypervisor.metrics_tag "hwrev_a0"
# A0 chips require pKVM for a hardware issue workaround. Set pKVM to 'enabled'
# in /misc partition on first boot to signal to tests that this device should
# not be booted with pKVM disabled.
service vendor.force_pkvm /vendor/bin/misc_writer --set-enable-pkvm
disabled
oneshot
on property:persist.sys.device_provisioned=1 && property:ro.revision=PROTO1.0
start vendor.force_pkvm
on property:persist.sys.device_provisioned=1 && property:ro.revision=PROTO1.1
start vendor.force_pkvm
on property:persist.sys.device_provisioned=1 && property:ro.revision=EVT1.0
start vendor.force_pkvm

16
conf/init.eng.memtag.rc Normal file
View File

@@ -0,0 +1,16 @@
# MTE in -eng build: litle and mid cores in Sync mode
# Big core in Asymm mode to work around a performance issue (b/266613799)
on init
# Per-core mode overrides.
# Little Cores: sync
write /sys/devices/system/cpu/cpu0/mte_tcf_preferred sync
write /sys/devices/system/cpu/cpu1/mte_tcf_preferred sync
write /sys/devices/system/cpu/cpu2/mte_tcf_preferred sync
write /sys/devices/system/cpu/cpu3/mte_tcf_preferred sync
# Mid Cores: sync
write /sys/devices/system/cpu/cpu4/mte_tcf_preferred sync
write /sys/devices/system/cpu/cpu5/mte_tcf_preferred sync
write /sys/devices/system/cpu/cpu6/mte_tcf_preferred sync
write /sys/devices/system/cpu/cpu7/mte_tcf_preferred sync
# Big Core: asymm
write /sys/devices/system/cpu/cpu8/mte_tcf_preferred asymm

View File

@@ -16,6 +16,36 @@ on init
# Disable util-awareness for mids and bigs
write /proc/vendor_sched/teo_util_threshold "2 1024 1024"
chown system system /proc/vendor_sched/groups/bg/set_task_group
chown system system /proc/vendor_sched/groups/cam/set_task_group
chown system system /proc/vendor_sched/groups/fg/set_task_group
chown system system /proc/vendor_sched/groups/nnapi/set_task_group
chown system system /proc/vendor_sched/groups/sys/set_task_group
chown system system /proc/vendor_sched/groups/sys_bg/set_task_group
chown system system /proc/vendor_sched/groups/ta/set_task_group
chown system system /proc/vendor_sched/groups/rt/set_task_group
chown system system /proc/vendor_sched/groups/sf/set_task_group
chown system system /proc/vendor_sched/groups/dex2oat/set_task_group
chown system system /proc/vendor_sched/groups/cam_power/set_task_group
chown system system /proc/vendor_sched/groups/ota/set_task_group
chown system system /proc/vendor_sched/groups/bg/set_proc_group
chown system system /proc/vendor_sched/groups/cam/set_proc_group
chown system system /proc/vendor_sched/groups/fg/set_proc_group
chown system system /proc/vendor_sched/groups/nnapi/set_proc_group
chown system system /proc/vendor_sched/groups/sys/set_proc_group
chown system system /proc/vendor_sched/groups/sys_bg/set_proc_group
chown system system /proc/vendor_sched/groups/ta/set_proc_group
chown system system /proc/vendor_sched/groups/rt/set_proc_group
chown system system /proc/vendor_sched/groups/sf/set_proc_group
chown system system /proc/vendor_sched/groups/dex2oat/set_proc_group
chown system system /proc/vendor_sched/groups/cam_power/set_proc_group
chown system system /proc/vendor_sched/groups/ota/set_proc_group
chown system system /proc/vendor_sched/prefer_idle_set
chown system system /proc/vendor_sched/prefer_idle_clear
chown system system /proc/vendor_sched/pmu_poll_enable
chown system system /proc/vendor_sched/pmu_poll_time
chown system system /proc/vendor_sched/uclamp_fork_reset_clear
chown system system /proc/vendor_sched/uclamp_fork_reset_set
chown system system /sys/devices/system/cpu/cpufreq/policy0/sched_pixel/lcpi_threshold
chown system system /sys/devices/system/cpu/cpufreq/policy0/sched_pixel/spc_threshold
chown system system /sys/devices/system/cpu/cpufreq/policy0/sched_pixel/limit_frequency
@@ -39,8 +69,116 @@ on init
chown system system /sys/class/devfreq/gs_memlat_devfreq:devfreq_mif_cpu7_memlat@17000010/memlat_cpuidle_state_aware
chown system system /sys/class/devfreq/gs_memlat_devfreq:devfreq_mif_cpu8_memlat@17000010/memlat_cpuidle_state_aware
chmod 0220 /proc/vendor_sched/groups/bg/set_task_group
chmod 0220 /proc/vendor_sched/groups/cam/set_task_group
chmod 0220 /proc/vendor_sched/groups/fg/set_task_group
chmod 0220 /proc/vendor_sched/groups/nnapi/set_task_group
chmod 0220 /proc/vendor_sched/groups/sys/set_task_group
chmod 0220 /proc/vendor_sched/groups/sys_bg/set_task_group
chmod 0220 /proc/vendor_sched/groups/ta/set_task_group
chmod 0220 /proc/vendor_sched/groups/rt/set_task_group
chmod 0220 /proc/vendor_sched/groups/sf/set_task_group
chmod 0220 /proc/vendor_sched/groups/dex2oat/set_task_group
chmod 0220 /proc/vendor_sched/groups/cam_power/set_task_group
chmod 0220 /proc/vendor_sched/groups/ota/set_task_group
chmod 0220 /proc/vendor_sched/groups/bg/set_proc_group
chmod 0220 /proc/vendor_sched/groups/cam/set_proc_group
chmod 0220 /proc/vendor_sched/groups/fg/set_proc_group
chmod 0220 /proc/vendor_sched/groups/nnapi/set_proc_group
chmod 0220 /proc/vendor_sched/groups/sys/set_proc_group
chmod 0220 /proc/vendor_sched/groups/sys_bg/set_proc_group
chmod 0220 /proc/vendor_sched/groups/ta/set_proc_group
chmod 0220 /proc/vendor_sched/groups/rt/set_proc_group
chmod 0220 /proc/vendor_sched/groups/sf/set_proc_group
chmod 0220 /proc/vendor_sched/groups/dex2oat/set_proc_group
chmod 0220 /proc/vendor_sched/groups/cam_power/set_proc_group
chmod 0220 /proc/vendor_sched/groups/ota/set_proc_group
chmod 0220 /proc/vendor_sched/prefer_idle_set
chmod 0220 /proc/vendor_sched/prefer_idle_clear
chmod 0660 /proc/vendor_sched/pmu_poll_enable
chmod 0220 /proc/vendor_sched/pmu_poll_time
chmod 0220 /proc/vendor_sched/uclamp_fork_reset_clear
chmod 0220 /proc/vendor_sched/uclamp_fork_reset_set
start vendor.keymaster-4-0
# Change permission of sched qos nodes
chown system system /proc/vendor_sched/sched_qos/adpf_set
chown system system /proc/vendor_sched/sched_qos/adpf_clear
chown system system /proc/vendor_sched/sched_qos/auto_uclamp_max_set
chown system system /proc/vendor_sched/sched_qos/auto_uclamp_max_clear
chown system system /proc/vendor_sched/sched_qos/boost_prio_set
chown system system /proc/vendor_sched/sched_qos/boost_prio_clear
chown system system /proc/vendor_sched/sched_qos/preempt_wakeup_set
chown system system /proc/vendor_sched/sched_qos/preempt_wakeup_clear
chown system system /proc/vendor_sched/sched_qos/prefer_fit_set
chown system system /proc/vendor_sched/sched_qos/prefer_fit_clear
chown system system /proc/vendor_sched/sched_qos/prefer_high_cap_set
chown system system /proc/vendor_sched/sched_qos/prefer_high_cap_clear
chown system system /proc/vendor_sched/sched_qos/prefer_idle_set
chown system system /proc/vendor_sched/sched_qos/prefer_idle_clear
chown system system /proc/vendor_sched/sched_qos/rampup_multiplier_set
chown system system /proc/vendor_sched/sched_qos/rampup_multiplier_clear
chmod 0220 /proc/vendor_sched/sched_qos/adpf_set
chmod 0220 /proc/vendor_sched/sched_qos/adpf_clear
chmod 0220 /proc/vendor_sched/sched_qos/auto_uclamp_max_set
chmod 0220 /proc/vendor_sched/sched_qos/auto_uclamp_max_clear
chmod 0220 /proc/vendor_sched/sched_qos/boost_prio_set
chmod 0220 /proc/vendor_sched/sched_qos/boost_prio_clear
chmod 0220 /proc/vendor_sched/sched_qos/preempt_wakeup_set
chmod 0220 /proc/vendor_sched/sched_qos/preempt_wakeup_clear
chmod 0220 /proc/vendor_sched/sched_qos/prefer_fit_set
chmod 0220 /proc/vendor_sched/sched_qos/prefer_fit_clear
chmod 0220 /proc/vendor_sched/sched_qos/prefer_high_cap_set
chmod 0220 /proc/vendor_sched/sched_qos/prefer_high_cap_clear
chmod 0220 /proc/vendor_sched/sched_qos/prefer_idle_set
chmod 0220 /proc/vendor_sched/sched_qos/prefer_idle_clear
chmod 0220 /proc/vendor_sched/sched_qos/rampup_multiplier_set
chmod 0220 /proc/vendor_sched/sched_qos/rampup_multiplier_clear
# Enable sched_qos for some groups
write /proc/vendor_sched/groups/ta/qos_adpf_enable 1
write /proc/vendor_sched/groups/ta/qos_auto_uclamp_max_enable 1
write /proc/vendor_sched/groups/ta/qos_boost_prio_enable 1
write /proc/vendor_sched/groups/ta/qos_preempt_wakeup_enable 1
write /proc/vendor_sched/groups/ta/qos_prefer_fit_enable 1
write /proc/vendor_sched/groups/ta/qos_prefer_high_cap_enable 1
write /proc/vendor_sched/groups/ta/qos_prefer_idle_enable 1
write /proc/vendor_sched/groups/ta/qos_rampup_multiplier_enable 1
write /proc/vendor_sched/groups/fg/qos_adpf_enable 1
write /proc/vendor_sched/groups/fg/qos_auto_uclamp_max_enable 1
write /proc/vendor_sched/groups/fg/qos_boost_prio_enable 1
write /proc/vendor_sched/groups/fg/qos_preempt_wakeup_enable 1
write /proc/vendor_sched/groups/fg/qos_prefer_fit_enable 1
write /proc/vendor_sched/groups/fg/qos_prefer_high_cap_enable 1
write /proc/vendor_sched/groups/fg/qos_prefer_idle_enable 1
write /proc/vendor_sched/groups/fg/qos_rampup_multiplier_enable 1
write /proc/vendor_sched/groups/fg_wi/qos_adpf_enable 1
write /proc/vendor_sched/groups/fg_wi/qos_auto_uclamp_max_enable 1
write /proc/vendor_sched/groups/fg_wi/qos_boost_prio_enable 1
write /proc/vendor_sched/groups/fg_wi/qos_preempt_wakeup_enable 1
write /proc/vendor_sched/groups/fg_wi/qos_prefer_fit_enable 1
write /proc/vendor_sched/groups/fg_wi/qos_prefer_high_cap_enable 1
write /proc/vendor_sched/groups/fg_wi/qos_prefer_idle_enable 1
write /proc/vendor_sched/groups/fg_wi/qos_rampup_multiplier_enable 1
write /proc/vendor_sched/groups/cam/qos_adpf_enable 1
write /proc/vendor_sched/groups/cam/qos_auto_uclamp_max_enable 1
write /proc/vendor_sched/groups/cam/qos_prefer_fit_enable 1
write /proc/vendor_sched/groups/cam/qos_prefer_high_cap_enable 1
write /proc/vendor_sched/groups/cam/qos_prefer_idle_enable 1
write /proc/vendor_sched/groups/cam/qos_rampup_multiplier_enable 1
write /proc/vendor_sched/groups/cam_power/qos_adpf_enable 1
write /proc/vendor_sched/groups/cam_power/qos_auto_uclamp_max_enable 1
write /proc/vendor_sched/groups/cam_power/qos_prefer_fit_enable 1
write /proc/vendor_sched/groups/cam_power/qos_prefer_high_cap_enable 1
write /proc/vendor_sched/groups/cam_power/qos_prefer_idle_enable 1
write /proc/vendor_sched/groups/cam_power/qos_rampup_multiplier_enable 1
write /proc/vendor_sched/groups/rt/qos_adpf_enable 1
write /proc/vendor_sched/groups/rt/qos_rampup_multiplier_enable 1
write /proc/vendor_sched/groups/sf/qos_adpf_enable 1
write /proc/vendor_sched/groups/sf/qos_rampup_multiplier_enable 1
# ZRAM setup
write /proc/sys/vm/page-cluster 0
@@ -86,6 +224,15 @@ on init
write /proc/vendor_sched/groups/sys/uclamp_min 221
write /proc/vendor_sched/groups/sys/prefer_idle 1
# governor setting
write /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor sched_pixel
write /sys/devices/system/cpu/cpu0/cpufreq/sched_pixel/up_rate_limit_us 500
write /sys/devices/system/cpu/cpu0/cpufreq/sched_pixel/down_rate_limit_scale_pow 2
write /sys/devices/system/cpu/cpu4/cpufreq/scaling_governor sched_pixel
write /sys/devices/system/cpu/cpu4/cpufreq/sched_pixel/up_rate_limit_us 500
write /sys/devices/system/cpu/cpu8/cpufreq/scaling_governor sched_pixel
write /sys/devices/system/cpu/cpu8/cpufreq/sched_pixel/up_rate_limit_us 500
# memlat cpuidle awareness setting
write /sys/class/devfreq/gs_memlat_devfreq:devfreq_mif_cpu0_memlat@17000010/memlat_cpuidle_state_aware 2
@@ -98,6 +245,15 @@ on init
write /sys/class/devfreq/gs_memlat_devfreq:devfreq_mif_cpu7_memlat@17000010/memlat_cpuidle_state_aware 2
write /sys/class/devfreq/gs_memlat_devfreq:devfreq_mif_cpu8_memlat@17000010/memlat_cpuidle_state_aware 2
# RT uclamp setting
write /proc/sys/kernel/sched_util_clamp_min_rt_default 0
# change permissions and default values for camera-daemon cpu controller
chown system system /dev/cpuctl/camera-daemon/cpu.uclamp.min
chown system system /dev/cpuctl/camera-daemon/cpu.uclamp.max
chown root root /dev/cpuctl/camera-daemon/cpu.uclamp.latency_sensitive
chown system system /dev/cpuctl/camera-daemon/cgroup.procs
mkdir /dev/cpuset/camera-daemon-high-group
write /dev/cpuset/camera-daemon-high-group/cpus 0-8
write /dev/cpuset/camera-daemon-high-group/mems 0
@@ -116,6 +272,11 @@ on init
chown system system /dev/cpuset/camera-daemon-mid-high-group/tasks
chmod 0664 /dev/cpuset/camera-daemon-mid-high-group/tasks
write /proc/vendor_sched/groups/cam/prefer_idle 1
write /proc/vendor_sched/groups/cam/uclamp_min 1
chown system system /dev/cpuset/cgroup.procs
# nanohub sensor
chmod 0664 /dev/nanohub
chmod 0664 /dev/nanohub_comms
@@ -202,6 +363,10 @@ on init
# Power Stats HAL
chown system system /dev/bbd_pwrstat
# Add a boost for NNAPI HAL
write /proc/vendor_sched/groups/nnapi/prefer_idle 0
write /proc/vendor_sched/groups/nnapi/uclamp_min 512
# Add memlat governor settings
write /sys/class/devfreq/gs_memlat_devfreq:devfreq_mif_cpu0_memlat@17000010/polling_interval 10
write /sys/class/devfreq/gs_memlat_devfreq:devfreq_mif_cpu1_memlat@17000010/polling_interval 10
@@ -354,7 +519,7 @@ on post-fs-data
chmod 0660 /dev/ispolin_ranging
# Audio dump and debug
mkdir /data/vendor/audio 0770 system audio
mkdir /data/vendor/audio 0770 audio audio
# Create the directories for Darwinn HAL.
mkdir /data/vendor/hal_neuralnetworks_darwinn 0770 system system
@@ -538,7 +703,6 @@ on fs
chown system system /sys/devices/platform/exynos-drm/primary-panel/op_hz
chown system system /sys/devices/platform/exynos-drm/primary-panel/refresh_ctrl
chown system system /sys/devices/platform/exynos-drm/primary-panel/power_state
chown system system /sys/devices/platform/exynos-drm/displayport/drm-displayport/hdcp_negotiation
chown system system /sys/module/drm/parameters/vblankoffdelay
chown system system /sys/module/drm/parameters/debug
chown system system /sys/class/dqe0/atc/ambient_light
@@ -671,13 +835,33 @@ on property:sys.boot_completed=1
# Setup final cpuset
write /dev/cpuset/top-app/cpus 0-8
write /dev/cpuset/foreground/cpus 0-7
write /dev/cpuset/foreground_window/cpus 0-7
write /dev/cpuset/background/cpus 0-3
write /dev/cpuset/system-background/cpus 0-3
write /dev/cpuset/restricted/cpus 0-3
write /dev/cpuset/camera-daemon/cpus 0-8
setprop vendor.powerhal.init 1
# Setup scheduler parameters
write /proc/vendor_sched/min_granularity_ns 1000000
write /proc/vendor_sched/latency_ns 8000000
write /proc/vendor_sched/max_load_balance_interval 1
write /proc/vendor_sched/enable_hrtick 1
# Setup final cpu.uclamp
write /proc/vendor_sched/groups/ta/uclamp_min 1
write /proc/vendor_sched/groups/fg/uclamp_min 0
write /proc/vendor_sched/groups/sys/prefer_idle 0
# Set ug group
write /proc/vendor_sched/groups/bg/ug 0
write /proc/vendor_sched/groups/sys_bg/ug 0
write /proc/vendor_sched/groups/ota/ug 0
write /proc/vendor_sched/groups/dex2oat/ug 1
write /proc/vendor_sched/groups/ta/ug 1
# Set bg group throttle
write /proc/vendor_sched/ug_bg_group_throttle ${persist.device_config.vendor_system_native.ug_bg_group_throttle:-308}
# Set uclamp.max for some groups, which could indicate cpu importance used in scheduling
write /proc/vendor_sched/auto_uclamp_max "130 130 130 130 512 512 512 512 670"
write /proc/vendor_sched/groups/bg/uclamp_max 130
@@ -701,6 +885,12 @@ on property:sys.boot_completed=1
write /sys/devices/system/cpu/cpufreq/policy8/sched_pixel/limit_frequency 2363000
write /proc/vendor_sched/pmu_poll_time 10
# Disable PMU freq limit
write /sys/devices/system/cpu/cpufreq/policy0/sched_pixel/pmu_limit_enable 1
write /sys/devices/system/cpu/cpufreq/policy4/sched_pixel/pmu_limit_enable 1
write /sys/devices/system/cpu/cpufreq/policy8/sched_pixel/pmu_limit_enable 1
write /proc/vendor_sched/pmu_poll_enable 0
# Make devices on the critical path for suspend/resume asynchronous
write /sys/devices/platform/fixedregulator@0/regulator/regulator.2/power/async "enabled"
write /sys/devices/platform/fixedregulator@0/power/async "enabled"
@@ -708,6 +898,18 @@ on property:sys.boot_completed=1
write /sys/devices/platform/10840000.pinctrl/power/async "enabled"
write /sys/devices/platform/13060000.pinctrl/power/async "enabled"
# Setup cpu.shares to throttle background groups (bg ~ 5% sysbg ~ 5% dex2oat ~2.5%)
write /dev/cpuctl/background/cpu.shares 1024
write /dev/cpuctl/system-background/cpu.shares 1024
write /dev/cpuctl/dex2oat/cpu.shares 512
write /dev/cpuctl/system/cpu.shares 20480
# We only have system and background groups holding tasks and the groups below are empty
write /dev/cpuctl/camera-daemon/cpu.shares 20480
write /dev/cpuctl/foreground/cpu.shares 20480
write /dev/cpuctl/nnapi-hal/cpu.shares 20480
write /dev/cpuctl/rt/cpu.shares 20480
write /dev/cpuctl/top-app/cpu.shares 20480
# gvotables for dumpstate
chown system system /sys/kernel/debug/gvotables
@@ -735,6 +937,9 @@ on property:sys.boot_completed=1
# Enable SICD
write /sys/devices/system/cpu/cpupm/cpupm/sicd 1
# To be removed after InputDispatche and InputReader become ADPF
write /proc/vendor_sched/prefer_idle_task_name "InputDispatcher,InputReader"
on property:sys.boot_completed=1 && property:persist.sys.device_provisioned=1
write /sys/class/power_supply/battery/first_usage_date 0
@@ -972,14 +1177,3 @@ on property:persist.device_config.runtime_native_boot.mode_override=asymm
write /sys/devices/system/cpu/cpu6/mte_tcf_preferred asymm
write /sys/devices/system/cpu/cpu7/mte_tcf_preferred asymm
write /sys/devices/system/cpu/cpu8/mte_tcf_preferred asymm
# Battery health
on property:persist.vendor.pulsar.opt_out=1
write /sys/class/power_supply/battery/aacp_opt_out 1
on property:persist.vendor.pulsar.opt_out=0
write /sys/class/power_supply/battery/aacp_opt_out 0
# NFC
on post-fs-data
mkdir /data/vendor/nfc 0770 nfc nfc

View File

@@ -75,7 +75,7 @@ on early-boot
mkdir /config/usb_gadget/g1/functions/uvc.0
write /config/usb_gadget/g1/functions/uvc.0/function_name "Android Webcam"
write /config/usb_gadget/g1/functions/uvc.0/streaming_maxpacket 3072
write /config/usb_gadget/g1/functions/uvc.0/streaming_maxburst 1
# write /config/usb_gadget/g1/functions/uvc.0/streaming_maxburst 5
# write /config/usb_gadget/g1/functions/uvc.0/streaming_interval 2
# setup control params
mkdir /config/usb_gadget/g1/functions/uvc.0/control/header/h

40
copy_efs_files_to_data.sh Normal file
View File

@@ -0,0 +1,40 @@
#!/vendor/bin/sh
CHECKPOINT_DIR=/data/vendor/copied
export BIN_DIR=/vendor/bin
$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/mkdir -p $tmpdir
$BIN_DIR/dump.f2fs -rfPLo $tmpdir $block_device
if [ $? -ne 0 ]; then
echo "Failed to $BIN_DIR/dump.f2fs -rfPLo $tmpdir $block_device"
return
fi
$BIN_DIR/mv $tmpdir $build_checkpoint
if [ $? -ne 0 ]; then
echo "mv $tmpdir $build_checkpoint"
return
fi
$BIN_DIR/fsync `dirname $build_checkpoint`
fi
echo "Successfully copied $mount_point to $build_checkpoint"
}
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"
copy_files_to_data "/dev/block/by-name/persist" "/mnt/vendor/persist"
$BIN_DIR/fsync /data/vendor/copied

View File

@@ -14,6 +14,7 @@
# limitations under the License.
#
-include vendor/google_devices/zuma/proprietary/telephony/device-vendor.mk
include device/google/zuma/device.mk
# Telephony
@@ -46,3 +47,26 @@ PRODUCT_PRODUCT_PROPERTIES += \
# Trigger fsck on upgrade (305658663)
PRODUCT_PRODUCT_PROPERTIES += \
ro.preventative_fsck = 1
# Indicate that the bootloader supports the MTE developer option switch
# (MISC_MEMTAG_MODE_MEMTAG_ONCE), with the exception of _fullmte products and
# eng products that force enable MTE
ifeq (,$(filter %_fullmte,$(TARGET_PRODUCT)))
ifeq (,$(filter eng,$(TARGET_BUILD_VARIANT)))
PRODUCT_PRODUCT_PROPERTIES += ro.arm64.memtag.bootctl_supported=1
# N.B. persist properties in product Makefiles aren't actually persisted to the data
# partition, so they will actually go away if we remove them here, or if the user
# flashes from a normal build to a fullmte build.
PRODUCT_PRODUCT_PROPERTIES += persist.arm64.memtag.app.com.android.se=off
PRODUCT_PRODUCT_PROPERTIES += persist.arm64.memtag.app.com.google.android.bluetooth=off
PRODUCT_PRODUCT_PROPERTIES += persist.arm64.memtag.app.com.android.nfc=off
PRODUCT_PRODUCT_PROPERTIES += persist.arm64.memtag.system_server=off
endif
endif
ifeq (,$(filter %_fullmte,$(TARGET_PRODUCT)))
ifneq (,$(filter eng,$(TARGET_BUILD_VARIANT)))
PRODUCT_COPY_FILES += \
device/google/zuma/conf/init.eng.memtag.rc:$(TARGET_COPY_OUT_VENDOR)/etc/init/init.eng.memtag.rc
endif
endif

245
device.mk
View File

@@ -31,7 +31,7 @@ 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
include device/google/gs-common/bcmbt/dump/dumplog.mk
include device/google/gs-common/display/dump_exynos_display.mk
include device/google/gs-common/display/dump.mk
include device/google/gs-common/display_logbuffer/dump.mk
include device/google/gs-common/gxp/gxp.mk
include device/google/gs-common/camera/dump.mk
@@ -41,12 +41,10 @@ include device/google/gs-common/umfw_stat/umfw_stat.mk
include device/google/gs-common/widevine/widevine.mk
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/gs-common/recorder/recorder.mk
include device/google/gs-common/fingerprint/fingerprint.mk
include device/google/gs-common/nfc/nfc.mk
include device/google/gs-common/16kb/16kb.mk
include device/google/zuma/dumpstate/item.mk
@@ -60,10 +58,10 @@ AB_OTA_POSTINSTALL_CONFIG += \
POSTINSTALL_OPTIONAL_system=true
# Set Vendor SPL to match platform
VENDOR_SECURITY_PATCH := 2025-08-05
VENDOR_SECURITY_PATCH = $(PLATFORM_SECURITY_PATCH)
# Set boot SPL
BOOT_SECURITY_PATCH := 2025-08-05
BOOT_SECURITY_PATCH = $(PLATFORM_SECURITY_PATCH)
# TODO(b/207450311): Remove this flag once implemented
USE_PIXEL_GRALLOC := false
@@ -73,10 +71,24 @@ endif
PRODUCT_SOONG_NAMESPACES += \
hardware/google/av \
hardware/google/gchips \
hardware/google/gchips/gralloc4 \
hardware/google/graphics/common \
hardware/google/graphics/zuma \
hardware/google/graphics/zuma/libhwc2.1 \
hardware/google/interfaces \
hardware/google/pixel \
device/google/zuma \
device/google/zuma/powerstats
device/google/zuma/powerstats \
vendor/google_devices/common/chre/host/hal \
vendor/google_devices/zuma/proprietary/debugpolicy \
vendor/google/whitechapel/tools \
vendor/google/interfaces \
vendor/google_nos/host/android \
vendor/google_nos/test/system-test-harness \
vendor/google/camera
LOCAL_KERNEL := $(TARGET_KERNEL_DIR)/Image.lz4
# Set the environment variable to switch the Keymint HAL service to Rust
TRUSTY_KEYMINT_IMPL := rust
@@ -90,6 +102,43 @@ endif
PRODUCT_DEFAULT_PROPERTY_OVERRIDES += \
ro.oem_unlock_supported=1
# Include vendor telephony soong namespace
PRODUCT_SOONG_NAMESPACES += \
vendor/samsung_slsi/telephony/$(BOARD_USES_SHARED_VENDOR_TELEPHONY)
ifneq (,$(filter eng, $(TARGET_BUILD_VARIANT)))
#Set IKE logs to verbose for WFC
PRODUCT_PROPERTY_OVERRIDES += log.tag.IKE=VERBOSE
#Set Shannon IMS logs to debug
PRODUCT_PROPERTY_OVERRIDES += log.tag.SHANNON_IMS=DEBUG
#Set Shannon QNS logs to debug
PRODUCT_PROPERTY_OVERRIDES += log.tag.ShannonQNS=DEBUG
PRODUCT_PROPERTY_OVERRIDES += log.tag.ShannonQNS-ims=DEBUG
PRODUCT_PROPERTY_OVERRIDES += log.tag.ShannonQNS-emergency=DEBUG
PRODUCT_PROPERTY_OVERRIDES += log.tag.ShannonQNS-mms=DEBUG
PRODUCT_PROPERTY_OVERRIDES += log.tag.ShannonQNS-xcap=DEBUG
PRODUCT_PROPERTY_OVERRIDES += log.tag.ShannonQNS-HC=DEBUG
# Modem userdebug
include device/google/zuma/modem/userdebug.mk
endif
ifneq (,$(filter eng, $(TARGET_BUILD_VARIANT)))
# b/36703476: Set default log size to 1M
PRODUCT_PROPERTY_OVERRIDES += \
ro.logd.size=1M
# b/114766334: persist all logs by default rotating on 30 files of 1MiB
# change to 60 files for zuma
PRODUCT_PROPERTY_OVERRIDES += \
logd.logpersistd=logcatd \
logd.logpersistd.size=60
PRODUCT_PRODUCT_PROPERTIES += \
ro.logcat.compress=true
endif
# From system.property
PRODUCT_PROPERTY_OVERRIDES += \
ro.telephony.default_network=27 \
@@ -163,12 +212,13 @@ PRODUCT_PROPERTY_OVERRIDES += \
PRODUCT_PROPERTY_OVERRIDES += \
telephony.active_modems.max_count=2
ifneq (,$(filter eng, $(TARGET_BUILD_VARIANT)))
PRODUCT_PROPERTY_OVERRIDES += \
persist.vendor.usb.displayport.enabled=1
# Enable Settings 2-pane optimization for devices supporting display ports.
PRODUCT_SYSTEM_PROPERTIES += \
persist.settings.large_screen_opt_for_dp.enabled=true
else
PRODUCT_PROPERTY_OVERRIDES += \
persist.vendor.usb.displayport.enabled=1
endif
PRODUCT_PROPERTY_OVERRIDES += \
persist.sys.hdcp_checking=drm-only
@@ -178,6 +228,7 @@ USE_LASSEN_OEMHOOK := true
# $(USE_LASSEN_OEMHOOK) is true and $(BOARD_WITHOUT_RADIO) is not true.
ifneq ($(BOARD_WITHOUT_RADIO),true)
$(call soong_config_set,sitril,use_lassen_oemhook_with_radio,true)
PRODUCT_SOONG_NAMESPACES += vendor/google/tools/power-anomaly-sitril
endif
# Use for GRIL
@@ -190,6 +241,8 @@ endif
ifeq ($(USES_GOOGLE_DIALER_CARRIER_SETTINGS),true)
USE_GOOGLE_DIALER := true
USE_GOOGLE_CARRIER_SETTINGS := true
# GoogleDialer in PDK build with "USES_GOOGLE_DIALER_CARRIER_SETTINGS=true"
PRODUCT_SOONG_NAMESPACES += vendor/google_devices/zuma/proprietary/GoogleDialer
endif
ifeq ($(USES_GOOGLE_PREBUILT_MODEM_SVC),true)
@@ -208,6 +261,16 @@ USE_SWIFTSHADER := false
# HWUI
TARGET_USES_VULKAN = true
# "vendor/arm" doesn't exist in PDK build
ifeq (,$(realpath $(TOPDIR)vendor/arm/mali/valhall/Android.bp))
PRODUCT_SOONG_NAMESPACES += \
vendor/google_devices/zuma/prebuilts/firmware/gpu \
vendor/google_devices/zuma/prebuilts/gpu
else
PRODUCT_SOONG_NAMESPACES += \
vendor/arm/mali/valhall
endif
$(call soong_config_set,pixel_mali,soc,$(TARGET_BOARD_PLATFORM))
$(call soong_config_set,arm_gralloc,soc,$(TARGET_BOARD_PLATFORM))
@@ -257,8 +320,8 @@ 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.vulkan.deqp.level-2025-03-01.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.software.vulkan.deqp.level.xml \
frameworks/native/data/etc/android.software.opengles.deqp.level-2025-03-01.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.software.opengles.deqp.level.xml
frameworks/native/data/etc/android.software.vulkan.deqp.level-2024-03-01.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.software.vulkan.deqp.level.xml \
frameworks/native/data/etc/android.software.opengles.deqp.level-2024-03-01.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.software.opengles.deqp.level.xml
#endif
@@ -305,12 +368,16 @@ DEVICE_PACKAGE_OVERLAYS += device/google/zuma/overlay
# This device is shipped with 34 (Android U)
PRODUCT_SHIPPING_API_LEVEL := 34
# RKP VINTF
-include vendor/google_nos/host/android/hals/keymaster/aidl/strongbox/RemotelyProvisionedComponent-citadel.mk
# Enforce the Product interface
PRODUCT_PRODUCT_VNDK_VERSION := current
PRODUCT_ENFORCE_PRODUCT_PARTITION_INTERFACE := true
# Init files
PRODUCT_COPY_FILES += \
$(LOCAL_KERNEL):kernel \
device/google/zuma/conf/init.zuma.usb.rc:$(TARGET_COPY_OUT_VENDOR)/etc/init/hw/init.zuma.usb.rc \
device/google/zuma/conf/ueventd.zuma.rc:$(TARGET_COPY_OUT_VENDOR)/etc/ueventd.rc
@@ -323,12 +390,20 @@ 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
endif
ifneq (,$(filter eng, $(TARGET_BUILD_VARIANT)))
PRODUCT_COPY_FILES += \
device/google/zuma/conf/init.debug.rc:$(TARGET_COPY_OUT_VENDOR)/etc/init/init.debug.rc
PRODUCT_COPY_FILES += \
device/google/zuma/conf/init.freq.userdebug.rc:$(TARGET_COPY_OUT_VENDOR)/etc/init/init.freq.userdebug.rc
endif
ifneq (,$(filter 5.%, $(TARGET_LINUX_KERNEL_VERSION)))
PRODUCT_COPY_FILES += \
device/google/zuma/storage/5.15/init.zuma.storage.rc:$(TARGET_COPY_OUT_VENDOR)/etc/init/hw/init.zuma.storage.rc
@@ -377,6 +452,14 @@ PRODUCT_HOST_PACKAGES += \
mkdtimg
# CHRE
## Tools
ifneq (,$(filter eng, $(TARGET_BUILD_VARIANT)))
PRODUCT_PACKAGES += \
chre_power_test_client \
chre_test_client \
chre_aidl_hal_client
endif
## HAL
include device/google/gs-common/chre/hal.mk
PRODUCT_COPY_FILES += \
@@ -397,8 +480,13 @@ PRODUCT_PACKAGES += \
checkpoint_gc
# Vendor verbose logging default property
ifneq (,$(filter eng, $(TARGET_BUILD_VARIANT)))
PRODUCT_PROPERTY_OVERRIDES += \
persist.vendor.verbose_logging_enabled=true
else
PRODUCT_PROPERTY_OVERRIDES += \
persist.vendor.verbose_logging_enabled=false
endif
# Vendor modem extensive logging default property
PRODUCT_PROPERTY_OVERRIDES += \
@@ -414,8 +502,13 @@ PRODUCT_PROPERTY_OVERRIDES += \
persist.vendor.sys.modem.logging.enable=true
# Enable silent CP crash handling
ifneq (,$(filter eng, $(TARGET_BUILD_VARIANT)))
PRODUCT_PROPERTY_OVERRIDES += \
persist.vendor.ril.crash_handling_mode=1
else
PRODUCT_PROPERTY_OVERRIDES += \
persist.vendor.ril.crash_handling_mode=2
endif
# Add support dual SIM mode
PRODUCT_PROPERTY_OVERRIDES += \
@@ -458,6 +551,12 @@ PRODUCT_PACKAGES += \
PRODUCT_COPY_FILES += \
frameworks/native/data/etc/android.software.midi.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.software.midi.xml
# default usb debug functions
ifneq (,$(filter eng, $(TARGET_BUILD_VARIANT)))
PRODUCT_PROPERTY_OVERRIDES += \
persist.vendor.usb.usbradio.config=dm
endif
# adpf 16ms update rate
PRODUCT_PRODUCT_PROPERTIES += \
vendor.powerhal.adpf.rate=16666666
@@ -555,6 +654,12 @@ PRODUCT_PACKAGES += \
PRODUCT_PACKAGES += \
ConnectivityOverlay
PRODUCT_PACKAGES_ENG += \
f2fs_io \
check_f2fs \
f2fs.fibmap \
dump.f2fs
# Storage health HAL
PRODUCT_PACKAGES += \
android.hardware.health.storage-service.default
@@ -577,6 +682,9 @@ ifeq (,$(filter true, $(BOARD_WITHOUT_DTLS)))
include device/google/gs-common/dauntless/gsc.mk
endif
PRODUCT_PACKAGES_ENG += \
WvInstallKeybox
# Copy Camera HFD Setfiles
#PRODUCT_COPY_FILES += \
device/google/zuma/firmware/camera/libhfd/default_configuration.hfd.cfg.json:$(TARGET_COPY_OUT_VENDOR)/firmware/default_configuration.hfd.cfg.json \
@@ -620,6 +728,10 @@ PRODUCT_PROPERTY_OVERRIDES += \
debug.slsi_platform=1 \
debug.hwc.winupdate=1
ifneq (,$(filter eng, $(TARGET_BUILD_VARIANT)))
PRODUCT_PACKAGES += displaycolor_service
endif
PRODUCT_PROPERTY_OVERRIDES += \
debug.sf.disable_backpressure=0 \
debug.sf.enable_gl_backpressure=1 \
@@ -635,8 +747,8 @@ PRODUCT_DEFAULT_PROPERTY_OVERRIDES += debug.sf.earlyGl.sf.duration=16600000
PRODUCT_DEFAULT_PROPERTY_OVERRIDES += debug.sf.earlyGl.app.duration=16600000
PRODUCT_DEFAULT_PROPERTY_OVERRIDES += debug.sf.frame_rate_multiple_threshold=120
PRODUCT_DEFAULT_PROPERTY_OVERRIDES += debug.sf.treat_170m_as_sRGB=1
PRODUCT_DEFAULT_PROPERTY_OVERRIDES += debug.sf.hdcp_negotiation=1
PRODUCT_DEFAULT_PROPERTY_OVERRIDES += debug.sf.hdcp_support=1
PRODUCT_DEFAULT_PROPERTY_OVERRIDES += debug.sf.hwc_hotplug_error_via_neg_vsync=1
PRODUCT_DEFAULT_PROPERTY_OVERRIDES += debug.sf.hwc_hdcp_via_neg_vsync=1
PRODUCT_DEFAULT_PROPERTY_OVERRIDES += ro.surface_flinger.enable_layer_caching=true
PRODUCT_DEFAULT_PROPERTY_OVERRIDES += ro.surface_flinger.set_idle_timer_ms?=80
@@ -662,7 +774,8 @@ PRODUCT_DEFAULT_PROPERTY_OVERRIDES += ro.surface_flinger.display_update_imminent
PRODUCT_PROPERTY_OVERRIDES += \
persist.sys.sf.native_mode=2
PRODUCT_COPY_FILES += \
device/google/zuma/display/display_colordata_cal0.pb:$(TARGET_COPY_OUT_VENDOR)/etc/display_colordata_cal0.pb
device/google/zuma/display/display_colordata_cal0.pb:$(TARGET_COPY_OUT_VENDOR)/etc/display_colordata_cal0.pb \
device/google/zuma/display/display_colordata_cal2.pb:$(TARGET_COPY_OUT_VENDOR)/etc/display_colordata_cal2.pb
# limit DPP downscale ratio
PRODUCT_DEFAULT_PROPERTY_OVERRIDES += vendor.hwc.dpp.downscale=4
@@ -691,11 +804,18 @@ PRODUCT_PACKAGES += wpa_supplicant.conf
WIFI_PRIV_CMD_UPDATE_MBO_CELL_STATUS := enabled
ifneq (,$(filter eng, $(TARGET_BUILD_VARIANT)))
PRODUCT_PACKAGES += wpa_cli
PRODUCT_PACKAGES += hostapd_cli
endif
####################################
## VIDEO
####################################
# Video
PRODUCT_SOONG_NAMESPACES += vendor/google/media/bigwave
$(call soong_config_set,bigw,soc,$(TARGET_BOARD_PLATFORM))
PRODUCT_PACKAGES += \
@@ -771,7 +891,17 @@ endif
$(call inherit-product, system/core/trusty/trusty-storage.mk)
$(call inherit-product, system/core/trusty/trusty-base.mk)
# Trusty unit test tool and code coverage tool
PRODUCT_PACKAGES_ENG += \
trusty-ut-ctrl \
tipc-test \
trusty_stats_test \
trusty-coverage-controller \
# Trusty Metrics Daemon
PRODUCT_SOONG_NAMESPACES += \
vendor/google/trusty/common
PRODUCT_PACKAGES += \
trusty_metricsd
@@ -785,9 +915,15 @@ PRODUCT_PROPERTY_OVERRIDES += \
ro.frp.pst=/dev/block/by-name/frp
# System props to enable Bluetooth Quality Report (BQR) feature
ifneq (,$(filter eng, $(TARGET_BUILD_VARIANT)))
PRODUCT_PRODUCT_PROPERTIES += \
persist.bluetooth.bqr.event_mask?=262174 \
persist.bluetooth.bqr.min_interval_ms=500
else
PRODUCT_PRODUCT_PROPERTIES += \
persist.bluetooth.bqr.event_mask?=30 \
persist.bluetooth.bqr.min_interval_ms=500
endif
#VNDK
PRODUCT_PACKAGES += \
@@ -819,6 +955,12 @@ PRODUCT_PACKAGES += \
PRODUCT_PACKAGES += \
Iwlan
#Iwlan test app for eng builds
ifneq (,$(filter eng, $(TARGET_BUILD_VARIANT)))
PRODUCT_PACKAGES += \
IwlanTestApp
endif
PRODUCT_PACKAGES += \
whitelist \
libstagefright_hdcp \
@@ -831,6 +973,9 @@ PRODUCT_PACKAGES += \
calliope_iva.bin \
vts.bin
# This will be called only if IMSService is building with source code for dev branches.
$(call inherit-product-if-exists, vendor/samsung_slsi/telephony/$(BOARD_USES_SHARED_VENDOR_TELEPHONY)/shannon-ims/device-vendor.mk)
PRODUCT_PACKAGES += ShannonIms
PRODUCT_PACKAGES += ShannonRcs
@@ -850,8 +995,18 @@ USE_RADIO_HAL_2_1 := true
# Using Early Send Device Info
USE_EARLY_SEND_DEVICE_INFO := true
$(call inherit-product, $(SRC_TARGET_DIR)/product/core_64_bit_only.mk)
#$(call inherit-product, vendor/google_devices/telephony/common/device-vendor.mk)
#$(call inherit-product, vendor/google_devices/zuma/proprietary/device-vendor.mk)
ifneq ($(BOARD_WITHOUT_RADIO),true)
$(call inherit-product-if-exists, vendor/samsung_slsi/telephony/$(BOARD_USES_SHARED_VENDOR_TELEPHONY)/common/device-vendor.mk)
endif
$(call inherit-product, $(SRC_TARGET_DIR)/product/core_64_bit_only.mk)
#$(call inherit-product, hardware/google_devices/exynos5/exynos5.mk)
#$(call inherit-product-if-exists, hardware/google_devices/zuma/zuma.mk)
#$(call inherit-product-if-exists, vendor/google_devices/common/exynos-vendor.mk)
#$(call inherit-product-if-exists, hardware/broadcom/wlan/bcmdhd/firmware/bcm4375/device-bcm.mk)
include device/google/gs-common/sensors/sensors.mk
$(call soong_config_set,usf,target_soc,zuma)
@@ -872,8 +1027,13 @@ include device/google/gs-common/modem/modem_svc_sit/shared_modem_platform.mk
PRODUCT_PACKAGES += modem_ml_svc_sit
# modem ML models configs
ifneq (,$(filter eng, $(TARGET_BUILD_VARIANT)))
PRODUCT_COPY_FILES += \
device/google/zuma/modem_ml/modem_ml_models_userdebug.conf:$(TARGET_COPY_OUT_VENDOR)/etc/modem_ml_models.conf
else
PRODUCT_COPY_FILES += \
device/google/zuma/modem_ml/modem_ml_models_user.conf:$(TARGET_COPY_OUT_VENDOR)/etc/modem_ml_models.conf
endif
# modem logging binary/configs
PRODUCT_PACKAGES += modem_logging_control
@@ -915,15 +1075,29 @@ PRODUCT_PACKAGES += \
endif
# Vibrator Diag
PRODUCT_PACKAGES_ENG += \
diag-vibrator \
diag-vibrator-cs40l25a \
diag-vibrator-drv2624 \
$(NULL)
PRODUCT_PACKAGES += \
android.hardware.health-service.zuma \
android.hardware.health-service.zuma_recovery \
# Audio
# Audio HAL Server & Default Implementations
ifeq ($(USE_AUDIO_HAL_AIDL),true)
include device/google/gs-common/audio/aidl.mk
else
include device/google/gs-common/audio/hidl_zuma.mk
endif
## AoC soong
PRODUCT_SOONG_NAMESPACES += \
vendor/google/whitechapel/aoc
$(call soong_config_set,aoc,target_soc,$(TARGET_BOARD_PLATFORM))
$(call soong_config_set,aoc,target_product,$(TARGET_PRODUCT))
@@ -944,6 +1118,22 @@ PRODUCT_PROPERTY_OVERRIDES += \
PRODUCT_PACKAGES += vndservicemanager
PRODUCT_PACKAGES += vndservice
## TinyTools, debug tool and cs35l41 speaker calibration tool for Audio
ifneq (,$(filter eng, $(TARGET_BUILD_VARIANT)))
PRODUCT_PACKAGES += \
tinyplay \
tinycap \
tinymix \
tinypcminfo \
tinyhostless \
cplay \
aoc_hal \
aoc_tuning_inft \
mahal_test \
ma_aoc_tuning_test \
crus_sp_cal
endif
PRODUCT_PACKAGES += \
google.hardware.media.c2@1.0-service \
libgc2_store \
@@ -954,7 +1144,7 @@ PRODUCT_PACKAGES += \
libgc2_utils
## Start packet router
include device/google/gs-common/telephony/pktrouter.mk
include device/google/gs101/telephony/pktrouter.mk
# Thermal HAL
PRODUCT_PROPERTY_OVERRIDES += persist.vendor.enable.thermal.genl=true
@@ -963,7 +1153,16 @@ PRODUCT_PROPERTY_OVERRIDES += persist.vendor.enable.thermal.genl=true
include device/google/gs-common/edgetpu/edgetpu.mk
# Config variables for TPU chip on device.
$(call soong_config_set,edgetpu_config,chip,rio)
# Include the edgetpu targets defined the namespaces below into the final image.
PRODUCT_SOONG_NAMESPACES += \
vendor/google_devices/zuma/proprietary/gchips/tpu/metrics \
vendor/google_devices/zuma/proprietary/gchips/tpu/tflite_delegate \
vendor/google_devices/zuma/proprietary/gchips/tpu/darwinn_logging_service \
vendor/google_devices/zuma/proprietary/gchips/tpu/nnapi_stable_aidl \
vendor/google_devices/zuma/proprietary/gchips/tpu/aidl \
vendor/google_devices/zuma/proprietary/gchips/tpu/hal \
vendor/google_devices/zuma/proprietary/gchips/tpu/tachyon/tachyon_apis \
vendor/google_devices/zuma/proprietary/gchips/tpu/tachyon/service
# TPU firmware
PRODUCT_PACKAGES += edgetpu-rio.fw
@@ -1021,6 +1220,9 @@ USES_RADIOEXT_V1_6 = true
# Wifi ext
include hardware/google/pixel/wifi_ext/device.mk
# Battery Stats Viewer
PRODUCT_PACKAGES_ENG += BatteryStatsViewer
# Install product specific framework compatibility matrix
# (TODO: b/169535506) This includes the FCM for system_ext and product partition.
# It must be split into the FCM of each partition.
@@ -1041,8 +1243,11 @@ PRODUCT_PROPERTY_OVERRIDES += \
# Hardware Info Collection
include hardware/google/pixel/HardwareInfo/HardwareInfo.mk
# UFS: the script is used to select the corresponding firmware to run FFU.
PRODUCT_PACKAGES_ENG += ufs_firmware_update.sh
# RIL extension service
ifeq (,$(filter aosp_%,$(TARGET_PRODUCT)))
ifeq (,$(filter aosp_% factory_%,$(TARGET_PRODUCT)))
include device/google/gs-common/pixel_ril/ril.mk
endif

View File

@@ -114,7 +114,7 @@
</hal>
<hal format="aidl" optional="true">
<name>com.google.hardware.pixel.display</name>
<version>13-15</version>
<version>13</version>
<interface>
<name>IDisplay</name>
<instance>default</instance>

Binary file not shown.

9
dumpstate/OWNERS Normal file
View File

@@ -0,0 +1,9 @@
aaronding@google.com
rurumihong@google.com
adamshih@google.com
wilsonsung@google.com
lucaswei@google.com
cyanhsieh@google.com
rogerliao@google.com
cyuanjen@google.com
robinpeng@google.com

View File

@@ -1,2 +1,4 @@
PRODUCT_PACKAGES += dump_wlan.sh \
dump_power
PRODUCT_PACKAGES_ENG += dump_gsa.sh

View File

@@ -1,10 +1,6 @@
[
{
"repository": "device_google_gs-common",
"target_path": "device/google/gs-common"
},
{
"repository": "packages_apps_PixelParts",
"target_path": "packages/apps/PixelParts"
"repository": "device_google_gs101",
"target_path": "device/google/gs101"
}
]

View File

@@ -5,7 +5,7 @@
#
# PixelParts
#include packages/apps/PixelParts/device.mk
include packages/apps/PixelParts/device.mk
# UDFPS
TARGET_HAS_UDFPS += true

View File

@@ -0,0 +1,25 @@
//
// Copyright (C) 2022 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: ["Android-Apache-2.0"],
}
sh_binary {
name: "factory_post_boot",
src: "factory_post_boot.sh",
vendor: true,
sub_dir: "factory",
}

View File

@@ -0,0 +1,4 @@
#!/vendor/bin/sh
# Add adbd to nnapi vendor cgroup. (b/222226268)
echo `pidof adbd` > /proc/vendor_sched/set_task_group_nnapi

View File

@@ -0,0 +1,15 @@
package {
// See: http://go/android-license-faq
// A large-scale-change added 'default_applicable_licenses' to import
// all of the 'license_kinds' from "//device/google/zuma:device_google_zuma_license"
// to get the below license kinds:
// SPDX-license-identifier-Apache-2.0
default_applicable_licenses: [
"//device/google/zuma:device_google_zuma_license",
],
}
runtime_resource_overlay {
name: "FactoryOverlayFrameworkRes",
product_specific: true,
}

View File

@@ -0,0 +1,24 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (C) 2020 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.
-->
<!-- Pixel specific factory overlays -->
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.android.frameworkres.overlay.factory">
<application android:hasCode="false" />
<overlay
android:targetPackage="android"
android:isStatic="true"
android:priority="2"/>
</manifest>

Binary file not shown.

After

Width:  |  Height:  |  Size: 22 KiB

View File

@@ -0,0 +1,33 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
/*
** Copyright 2023, 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.
*/
-->
<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
<!-- Type of the tap sensor. Empty if tap is not supported. False to disable the tap sensor -->
<string name="config_dozeTapSensorType" translatable="false">false</string>
<!-- Control whether the pickup gesture is enabled by default. This value will be used
during initialization when the setting is still null. -->
<bool name="config_dozePickupGestureEnabled">false</bool>
<!-- Is the lock-screen disabled for new users by default -->
<bool name="config_disableLockscreenByDefault">true</bool>
</resources>

View File

@@ -0,0 +1,15 @@
package {
// See: http://go/android-license-faq
// A large-scale-change added 'default_applicable_licenses' to import
// all of the 'license_kinds' from "//device/google/zuma:device_google_zuma_license"
// to get the below license kinds:
// SPDX-license-identifier-Apache-2.0
default_applicable_licenses: [
"//device/google/zuma:device_google_zuma_license",
],
}
runtime_resource_overlay {
name: "FactoryOverlayLauncher3",
product_specific: true,
}

View File

@@ -0,0 +1,25 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (C) 2020 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.
-->
<!-- Pixel specific factory overlays -->
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.android.launcher3.overlay.factory">
<application android:hasCode="false" />
<overlay
android:targetPackage="com.android.launcher3"
android:targetName="favorites"
android:isStatic="true"
android:priority="2"/>
</manifest>

View File

@@ -0,0 +1,41 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (C) 2009 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.
-->
<favorites xmlns:launcher="http://schemas.android.com/apk/res-auto/com.android.launcher3">
<!-- Hotseat (We use the screen as the position of the item in the hotseat) -->
<!-- Dialer, Capacity, ELabel, Language, Barcode -->
<resolve
launcher:container="-101"
launcher:screen="0"
launcher:x="0"
launcher:y="0" >
<favorite launcher:uri="#Intent;action=android.intent.action.DIAL;end" />
<favorite launcher:uri="tel:123" />
<favorite launcher:uri="#Intent;action=android.intent.action.CALL_BUTTON;end" />
</resolve>
<resolve
launcher:container="-101"
launcher:screen="4"
launcher:x="4"
launcher:y="0" >
<favorite
launcher:packageName="com.google_cte.barcodescanner"
launcher:className="com.google_cte.barcodescanner.MainActivity" />
</resolve>
</favorites>

View File

@@ -0,0 +1,15 @@
package {
// See: http://go/android-license-faq
// A large-scale-change added 'default_applicable_licenses' to import
// all of the 'license_kinds' from "//device/google/zuma:device_google_zuma_license"
// to get the below license kinds:
// SPDX-license-identifier-Apache-2.0
default_applicable_licenses: [
"//device/google/zuma:device_google_zuma_license",
],
}
runtime_resource_overlay {
name: "FactoryOverlaySettings",
product_specific: true,
}

View File

@@ -0,0 +1,25 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (C) 2020 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.
-->
<!-- Pixel specific factory overlays -->
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.android.providers.settings.overlay.factory">
<application android:hasCode="false" />
<overlay
android:targetPackage="com.android.providers.settings"
android:targetName="resources"
android:isStatic="true"
android:priority="2"/>
</manifest>

View File

@@ -0,0 +1,26 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
/**
* Copyright (c) 2009, 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.
*/
-->
<resources>
<integer name="def_lockscreen_sounds_enabled">0</integer>
<bool name="def_lockscreen_disabled">true</bool>
<bool name="def_dtmf_tones_enabled">false</bool>
<bool name="def_sound_effects_enabled">false</bool>
<bool name="def_charging_sounds_enabled">false</bool>
<string name="def_immersive_mode_confirmations" translatable="false">confirmed</string>
</resources>

97
factory_common.mk Normal file
View File

@@ -0,0 +1,97 @@
#
# Copyright 2020 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.
#
$(call inherit-product, device/google/zuma/aosp_common.mk)
$(call inherit-product-if-exists, vendor/google_devices/zuma/factory/pixel/device-factory.mk)
PRODUCT_PROPERTY_OVERRIDES += service.adb.root=1 \
vendor.disable.thermal.control=1 \
ro.vendor.factory=1
# Factory Libraries of Audio
PRODUCT_PACKAGES += audioroute libaudioroutelite
# Enable fatp by default for factory builds
PRODUCT_SYSTEM_DEFAULT_PROPERTIES += \
persist.vendor.camera.fatp.enable=1
# Disable camera related features for factory builds
PRODUCT_PROPERTY_OVERRIDES += \
persist.vendor.camera.af.ignore_gyro=1 \
persist.vendor.camera.multicam.framesync=0 \
vendor.camera.debug.bypass_face_ssd_processor=1 \
vendor.camera.debug.csi_ebuf_enable=0 \
vendor.camera.debug.enable_face_detection=0 \
vendor.camera.debug.force_dpm_on=0 \
vendor.camera.debug.force_eis_on=0 \
vendor.camera.debug.force_eaf_on=0 \
vendor.camera.debug.force_mesh_warp_on=0 \
vendor.camera.debug.force_rectiface_node_on=0 \
vendor.camera.debug.force_steadiface_on=0 \
vendor.camera.debug.force_tnr_on=0 \
vendor.camera.debug.force_segmentation_node_on=0 \
vendor.camera.debug.enable_saliency=0 \
vendor.camera.debug.force_local_tone_mapping_on=0 \
vendor.camera.debug.local_tone_mapping_controller_v1.mode=0 \
vendor.camera.debug.enable_scene_detection=0
# Disable ScreenDecorations for factory builds
PRODUCT_PROPERTY_OVERRIDES += \
debug.disable_screen_decorations=true
PRODUCT_DEFAULT_PROPERTY_OVERRIDES += ro.surface_flinger.set_idle_timer_ms?=80
PRODUCT_DEFAULT_PROPERTY_OVERRIDES += ro.surface_flinger.set_touch_timer_ms=200
PRODUCT_DEFAULT_PROPERTY_OVERRIDES += ro.surface_flinger.set_display_power_timer_ms=1000
PRODUCT_DEFAULT_PROPERTY_OVERRIDES += ro.surface_flinger.use_content_detection_for_refresh_rate=true
# Disable dimming in factory
PRODUCT_DEFAULT_PROPERTY_OVERRIDES += vendor.display.0.brightness.dimming.usage=2
# factory should always has SELinux permissive
BOARD_BOOTCONFIG += androidboot.selinux=permissive
BOARD_KERNEL_CMDLINE += androidboot.selinux=permissive
# Disable DebugFS restrictions in factory builds
PRODUCT_SET_DEBUGFS_RESTRICTIONS := false
# Disable Bluetooth as default in factory build
DEVICE_PACKAGE_OVERLAYS += device/google/zuma/overlay-factory
PRODUCT_COPY_FILES += \
device/google/zuma/conf/init.factory.rc:$(TARGET_COPY_OUT_VENDOR)/etc/init/hw/init.factory.rc
BOARD_SEPOLICY_DIRS += hardware/google/pixel-sepolicy/factory_boost
# Add factory-friendly changes
PRODUCT_PACKAGES += \
FactoryOverlaySettings \
FactoryOverlayLauncher3 \
FactoryOverlayFrameworkRes \
factory_post_boot
# To prevent rebooting due to crashing services
PRODUCT_SYSTEM_DEFAULT_PROPERTIES += \
init.svc_debug.no_fatal.zygote=true \
persist.device_config.configuration.disable_rescue_party=true
# PixelLogger for RF testing
PRODUCT_PACKAGES_DEBUG += \
PixelLogger \
# ModemDiagnosticSystem for desense tool
PRODUCT_PACKAGES += \
ModemDiagnosticSystem \

View File

@@ -0,0 +1,18 @@
# ----------------------------
# Add feature flags below
# ----------------------------
FPC_CONFIG_BUILD_VERSION=33
FPC_CONFIG_CAPACITIVE=1
FPC_CONFIG_MAX_NR_TEMPLATES=5
FPC_CONFIG_SENSE_TOUCH_CALIBRATION_PATH=/data/fpc/calibration_sense_touch.dat
FPC_CONFIG_TA_FS=1
FPC_DEFECTIVE_PIXEL_LIST_SIZE=5000
FPC_SENSOR_SDK_LOG_LEVEL=3
FPC_TEE_RUNTIME=TRUSTY
LIBFPC_NAME=libfpc1541_S_nav_debug.a
FPC_CONFIG_DEBUG=1
FPC_CONFIG_PRODUCT_DEFAULT=FPC_PRODUCT_TYPE1541_S
#
# File included from device/<manufacture>/<>/<device>.mk
# Packages to include into the build

View File

@@ -0,0 +1,21 @@
# ----------------------------
# Add feature flags below
# ----------------------------
FPC_CONFIG_BUILD_VERSION=33
FPC_CONFIG_CAPACITIVE=1
FPC_CONFIG_MAX_NR_TEMPLATES=5
FPC_CONFIG_NAVIGATION=0
FPC_CONFIG_SENSE_TOUCH_CALIBRATION_PATH=/data/fpc/calibration_sense_touch.dat
FPC_CONFIG_SENSORTEST=1
FPC_CONFIG_TA_FS=1
FPC_DEFECTIVE_PIXEL_LIST_SIZE=5000
FPC_SENSOR_SDK_LOG_LEVEL=3
FPC_TEE_RUNTIME=TRUSTY
LIBFPC_NAME=libfpc1541_S_nav_debug.a
FPC_CONFIG_DEBUG=1
FPC_CONFIG_ENGINEERING=1
FPC_CONFIG_PRODUCT_DEFAULT=FPC_PRODUCT_TYPE1541_S
#
# File included from device/<manufacture>/<>/<device>.mk
# Packages to include into the build

View File

@@ -0,0 +1,8 @@
# Fingerprint
include device/google/zuma/fingerprint/fpc1540/fingerprint_config.mk
PRODUCT_PACKAGES += \
android.hardware.biometrics.fingerprint@2.1-service.fpc \
PRODUCT_COPY_FILES += \
frameworks/native/data/etc/android.hardware.fingerprint.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.fingerprint.xml

View File

@@ -0,0 +1,10 @@
# Fingerprint
include device/google/zuma/fingerprint/fpc1540/fingerprint_config_factory.mk
PRODUCT_PACKAGES += \
fpc_tee_test\
SensorTestTool \
PRODUCT_PACKAGES += \
com.fingerprints.extension.xml \
com.fingerprints.extension \

View File

@@ -0,0 +1,24 @@
#
# Copyright (C) 2018 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.
#
on property:sys.boot_completed=1 && property:persist.vendor.limit.wlc.current=1
write /sys/class/power_supply/dc/current_max 75000
on property:sys.boot_completed=1 && property:persist.vendor.limit.wlc.current=0
write /sys/class/power_supply/dc/current_max 1100000
on property:vendor.disable.wlc=1
write /sys/class/power_supply/wireless/online 0

View File

@@ -37,8 +37,8 @@
<Limit name="measured-frame-rate-1920x1088" range="409-411" /> <!-- v90%=1.0 -->
</MediaCodec>
<MediaCodec name="c2.exynos.hevc.decoder" type="video/hevc" update="true">
<!-- b/385249512 -->
<Limit name="measured-frame-rate-352x288" range="420-521" /> <!-- v90%=1.0 -->
<!-- measured 90%:529-530 med:529 N=2 -->
<Limit name="measured-frame-rate-352x288" range="1150-1250" /> <!-- v90%=1.0 -->
<!-- measured 90%:528-530 med:529 N=2 -->
<Limit name="measured-frame-rate-640x360" range="528-529" /> <!-- v90%=1.0 -->
<!-- measured 90%:546-549 med:546 N=2 -->
@@ -51,8 +51,8 @@
<Limit name="measured-frame-rate-3840x2160" range="159-159" /> <!-- v90%=1.0 -->
</MediaCodec>
<MediaCodec name="c2.exynos.hevc.decoder.secure" type="video/hevc" update="true">
<!-- b/385249512 -->
<Limit name="measured-frame-rate-352x288" range="420-521" /> <!-- v90%=1.0 -->
<!-- measured 90%:529-530 med:529 N=2 -->
<Limit name="measured-frame-rate-352x288" range="1150-1250" /> <!-- v90%=1.0 -->
<!-- measured 90%:528-530 med:529 N=2 -->
<Limit name="measured-frame-rate-640x360" range="528-529" /> <!-- v90%=1.0 -->
<!-- measured 90%:546-549 med:546 N=2 -->

1
modem/userdebug.mk Normal file
View File

@@ -0,0 +1 @@
PRODUCT_PACKAGES += vcd

View File

@@ -0,0 +1,4 @@
#name,version,ml_type,compute_enable,compute_timer,train_enable,train_timer,monitor_enable_monitor_timer,execution_type,execution_timer
fr2_bps_ml_model,0,LEGACY,true,0,false,0,false,0,SYNCHRONOUS_REGULAR,5000
sample_linear_reg,0,LEGACY,false,0,false,0,false,0,SYNCHRONOUS_REGULAR,5000
sample_fully_conn,88,LEGACY,false,0,false,0,false,0,SYNCHRONOUS_REGULAR,5000

View File

@@ -0,0 +1,23 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
/**
* Copyright (c) 2009, 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.
*/
-->
<resources>
<!-- Don't enable BT until user wants it -->
<bool name="def_bluetooth_on">false</bool>
</resources>

View File

@@ -0,0 +1,7 @@
<resources>
<string-array name="logger_entries">
<item>shannondm</item>
<item>cnss_diag</item>
<item>brcm_gps</item>
</string-array>
</resources>

View File

@@ -0,0 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="config_logger_default_value" translatable="false">shannondm</string>
<string name="config_cfg_default_value" translatable="false">Built-in Mask #1</string>
<!-- default config file for cnss_diag logger -->
<string name="config_cfg_default_value_cnss_diag" translatable="false">cnss_diag.conf</string>
<!-- config file to enable brcm gps logger -->
<bool name="config_brcm_gps_enabled" translatable="false">true</bool>
</resources>

View File

@@ -0,0 +1,19 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string-array name="config_message_no_message">
<item></item>
</string-array>
<string-array name="config_message_audio_warning">
<item>This will collect audio from your voice calls. Would you like to proceed?</item>
</string-array>
<string-array name="config_message_possible_audio_warning">
<item>This may collect audio from your voice calls. Would you like to proceed?</item>
<item>Pixel_Default.nprf</item>
<item>Built-in Mask #0</item>
<item>Built-in Mask #1</item>
<item>Built-in Mask #2</item>
<item>Built-in Mask #3</item>
</string-array>
<string name="config_privacy_warning_title">Privacy Warning</string>
<string name="default_config_selection_message">You are loading a user defined logging config. This may collect audio from your voice calls. Would you like to proceed?</string>
</resources>

View File

@@ -31,38 +31,6 @@
<!-- B y-intercept --> <item>-0.349361641294833436</item>
</string-array>
<!-- The fixed keyboard vibration strength in [0,1], or -1 to indicate the strength not fixed
and should depend on the touch feedback intensity user setting -->
<item name="config_keyboardHapticFeedbackFixedAmplitude" type="dimen">0.62</item>
<!-- Indicating if keyboard vibration settings supported or not. -->
<bool name="config_keyboardVibrationSettingsSupported">true</bool>
<!-- Indicating if ringtone vibration settings supported or not. -->
<bool name="config_ringtoneVibrationSettingsSupported">true</bool>
<!-- External display peak refresh rate for the given device. Change this value if you want to
prevent the framework from using higher refresh rates, even if display modes with higher
refresh rates are available from hardware composer. Only has an effect if this value and
config_externalDisplayPeakWidth and config_externalDisplayPeakHeight are non-zero. -->
<integer name="config_externalDisplayPeakRefreshRate">61</integer>
<!-- External display peak width for the given device. Change this value if you want
to prevent the framework from using higher resolution, even if display modes with higher
resolutions are available from hardware composer. Only has an effect if this value and
config_externalDisplayPeakRefreshRate and config_externalDisplayPeakHeight are non-zero.-->
<integer name="config_externalDisplayPeakWidth">1920</integer>
<!-- External display peak height for the given device. Change this value if you want
to prevent the framework from using higher resolution, even if display modes with higher
resolutions are available from hardware composer. Only has an effect if this value and
config_externalDisplayPeakRefreshRate and config_externalDisplayPeakWidth are non-zero. -->
<integer name="config_externalDisplayPeakHeight">1080</integer>
<!-- Enable synchronization of the displays refresh rates by applying the default low refresh
rate. -->
<bool name="config_refreshRateSynchronizationEnabled">true</bool>
<!-- List of comma separated package names for which we the system will not show crash, ANR,
etc. dialogs. -->
<string translatable="false" name="config_appsNotReportingCrashes">com.google.android.euicc</string>

View File

@@ -244,6 +244,12 @@
<item>"/system_ext/priv-app/SystemUI/SystemUI.apk"</item>
</string-array>
<!-- Bytes that the PinnerService will pin for Home app -->
<integer name="config_pinnerHomePinBytes">6291456</integer>
<!-- Bytes that the PinnerService will pin for WebView -->
<integer name="config_pinnerWebviewPinBytes">20971520</integer>
<!-- The default intensity level for alarm vibrations. See
Settings.System.ALARM_VIBRATION_INTENSITY more details on the constant values and
meanings. -->
@@ -310,8 +316,4 @@
<!-- Whether to enable usb state update via udc sysfs. -->
<bool name="config_enableUdcSysfsUsbStateUpdate">true</bool>
<!-- Whether desktop mode is supported on the current device -->
<bool name="config_isDesktopModeSupported">true</bool>
</resources>

42
pixelstats/Android.bp Normal file
View File

@@ -0,0 +1,42 @@
//
// Copyright (C) 2017 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 {
// See: http://go/android-license-faq
// A large-scale-change added 'default_applicable_licenses' to import
// all of the 'license_kinds' from "//device/google/zuma:device_google_zuma_license"
// to get the below license kinds:
// SPDX-license-identifier-Apache-2.0
default_applicable_licenses: [
"//device/google/zuma:device_google_zuma_license",
],
}
cc_binary {
name: "pixelstats-vendor",
init_rc: ["pixelstats-vendor.zuma.rc"],
srcs: [
"service.cpp",
],
shared_libs: [
"libbase",
"liblog",
"libutils",
"libpixelstats",
],
proprietary: true,
static_libs: ["chre_client"],
header_libs: ["chre_api"],
}

View File

@@ -0,0 +1,11 @@
on property:sys.boot_completed=1
chown system system /sys/class/power_supply/maxfg_base/fg_learning_events
chown system system /sys/class/power_supply/maxfg/fg_learning_events
start vendor.pixelstats_vendor
on post-fs-data
chown system system /sys/kernel/metrics/irq/stats_reset
service vendor.pixelstats_vendor /vendor/bin/pixelstats-vendor
class hal
user system
group system context_hub readproc
disabled

171
pixelstats/service.cpp Normal file
View File

@@ -0,0 +1,171 @@
/*
* Copyright (C) 2018 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.
*/
#define LOG_TAG "pixelstats"
#include <android-base/logging.h>
#include <pixelstats/SysfsCollector.h>
#include <pixelstats/UeventListener.h>
#include <thread>
#include <pixelstats/SysfsCollector.h>
#include <pixelstats/UeventListener.h>
using android::hardware::google::pixel::SysfsCollector;
using android::hardware::google::pixel::UeventListener;
#define UFSHC_PATH(filename) "/dev/sys/block/bootdevice/" #filename
#define UFS_ERR_PATH(err_type) UFSHC_PATH(err_stats/) #err_type
const struct SysfsCollector::SysfsPaths sysfs_paths = {
.SlowioReadCntPath = UFSHC_PATH(slowio_read_cnt),
.SlowioWriteCntPath = UFSHC_PATH(slowio_write_cnt),
.SlowioUnmapCntPath = UFSHC_PATH(slowio_unmap_cnt),
.SlowioSyncCntPath = UFSHC_PATH(slowio_sync_cnt),
.CycleCountBinsPath = "/sys/class/power_supply/battery/cycle_counts",
.UFSLifetimeA = UFSHC_PATH(health_descriptor/life_time_estimation_a),
.UFSLifetimeB = UFSHC_PATH(health_descriptor/life_time_estimation_b),
.UFSLifetimeC = UFSHC_PATH(health_descriptor/life_time_estimation_c),
.F2fsStatsPath = "/sys/fs/f2fs/",
.ImpedancePath = "/sys/devices/platform/audiometrics/speaker_impedance",
.CodecPath = "/sys/devices/platform/audiometrics/codec_state",
.EEPROMPath = "/dev/battery_history",
.MitigationPath = "/sys/devices/virtual/pmic/mitigation",
.MitigationDurationPath = "/sys/devices/virtual/pmic/mitigation/irq_dur_cnt",
.BrownoutReasonProp = "vendor.brownout_reason",
.BrownoutLogPath = "/data/vendor/mitigation/lastmeal.txt",
.SpeakerTemperaturePath = "/sys/devices/platform/audiometrics/speaker_temp",
.SpeakerExcursionPath = "/sys/devices/platform/audiometrics/speaker_excursion",
.SpeakerHeartBeatPath = "/sys/devices/platform/audiometrics/speaker_heartbeat",
.UFSErrStatsPath = {
UFS_ERR_PATH(pa_err_count),
UFS_ERR_PATH(dl_err_count),
UFS_ERR_PATH(nl_err_count),
UFS_ERR_PATH(tl_err_count),
UFS_ERR_PATH(dme_err_count),
UFS_ERR_PATH(fatal_err_count),
UFS_ERR_PATH(auto_hibern8_err_count)
},
.AmsRatePath = "/sys/devices/platform/audiometrics/ams_rate_read_once",
.ThermalStatsPaths = {
"/sys/devices/platform/100a0000.BIG/trip_counter",
"/sys/devices/platform/100a0000.MID/trip_counter",
"/sys/devices/platform/100a0000.LITTLE/trip_counter",
"/sys/devices/platform/100b0000.G3D/trip_counter",
"/sys/devices/platform/100b0000.TPU/trip_counter",
"/sys/devices/platform/100b0000.AUR/trip_counter",
},
.ResumeLatencyMetricsPath = "/sys/kernel/metrics/resume_latency/resume_latency_metrics",
.LongIRQMetricsPath = "/sys/kernel/metrics/irq/long_irq_metrics",
.StormIRQMetricsPath = "/sys/kernel/metrics/irq/storm_irq_metrics",
.IRQStatsResetPath = "/sys/kernel/metrics/irq/stats_reset",
.TempResidencyAndResetPaths = {
{
"/sys/kernel/metrics/thermal/tr_by_group/tmu/stats",
"/sys/kernel/metrics/thermal/tr_by_group/tmu/stats_reset"
},
{
"/sys/kernel/metrics/thermal/tr_by_group/spmic/stats",
"/sys/kernel/metrics/thermal/tr_by_group/spmic/stats_reset"
}
},
.ModemPcieLinkStatsPath = "/sys/devices/platform/12100000.pcie/link_stats",
.WifiPcieLinkStatsPath = "/sys/devices/platform/13120000.pcie/link_stats",
.DisplayStatsPaths = {
"/sys/devices/platform/exynos-drm/primary-panel/error_count_te",
"/sys/devices/platform/exynos-drm/primary-panel/error_count_unknown",
"/sys/devices/platform/exynos-drm/secondary-panel/error_count_te",
"/sys/devices/platform/exynos-drm/secondary-panel/error_count_unknown",
},
.PDMStatePath = "/sys/devices/platform/audiometrics/pdm_state",
.WavesPath = "/sys/devices/platform/audiometrics/waves",
.AdaptedInfoCountPath = "/sys/devices/platform/audiometrics/adapted_info_active_count",
.AdaptedInfoDurationPath = "/sys/devices/platform/audiometrics/adapted_info_active_duration",
.CCARatePath = "/sys/devices/platform/audiometrics/cca_count_read_once",
.PcmLatencyPath = "/sys/devices/platform/audiometrics/pcm_latency",
.PcmCountPath = "/sys/devices/platform/audiometrics/pcm_count",
.TotalCallCountPath = "/sys/devices/platform/audiometrics/call_count",
.OffloadEffectsIdPath = "/sys/devices/platform/audiometrics/offload_effects_id",
.OffloadEffectsDurationPath = "/sys/devices/platform/audiometrics/offload_effects_duration",
.BluetoothAudioUsagePath = "/sys/devices/platform/audiometrics/bt_usage",
.GMSRPath = {
"/sys/class/power_supply/maxfg/gmsr",
"/sys/class/power_supply/maxfg_base/gmsr",
},
.FGModelLoadingPath = {
"/sys/class/power_supply/maxfg/m5_model_state",
"/sys/class/power_supply/maxfg_base/m5_model_state"
},
.FGLogBufferPath = {
"/dev/logbuffer_maxfg_monitor",
"/dev/logbuffer_max77779fg_monitor",
"/dev/logbuffer_maxfg_base_monitor",
"/dev/logbuffer_maxfg_secondary_monitor"
},
.DisplayPortStatsPaths = {
"/sys/devices/platform/exynos-drm/displayport/drm-displayport-stats/link_negotiation_failures",
"/sys/devices/platform/exynos-drm/displayport/drm-displayport-stats/edid_read_failures",
"/sys/devices/platform/exynos-drm/displayport/drm-displayport-stats/dpcd_read_failures",
"/sys/devices/platform/exynos-drm/displayport/drm-displayport-stats/edid_invalid_failures",
"/sys/devices/platform/exynos-drm/displayport/drm-displayport-stats/sink_count_invalid_failures",
"/sys/devices/platform/exynos-drm/displayport/drm-displayport-stats/link_unstable_failures",
},
.DisplayPortDSCStatsPaths = {
"/sys/devices/platform/exynos-drm/displayport/drm-displayport-stats/fec_dsc_supported",
"/sys/devices/platform/exynos-drm/displayport/drm-displayport-stats/fec_dsc_not_supported",
},
.DisplayPortMaxResolutionStatsPaths = {
"/sys/devices/platform/exynos-drm/displayport/drm-displayport-stats/max_res_other",
"/sys/devices/platform/exynos-drm/displayport/drm-displayport-stats/max_res_1366_768",
"/sys/devices/platform/exynos-drm/displayport/drm-displayport-stats/max_res_1440_900",
"/sys/devices/platform/exynos-drm/displayport/drm-displayport-stats/max_res_1600_900",
"/sys/devices/platform/exynos-drm/displayport/drm-displayport-stats/max_res_1920_1080",
"/sys/devices/platform/exynos-drm/displayport/drm-displayport-stats/max_res_2560_1080",
"/sys/devices/platform/exynos-drm/displayport/drm-displayport-stats/max_res_2560_1440",
"/sys/devices/platform/exynos-drm/displayport/drm-displayport-stats/max_res_3440_1440",
"/sys/devices/platform/exynos-drm/displayport/drm-displayport-stats/max_res_3840_2160",
"/sys/devices/platform/exynos-drm/displayport/drm-displayport-stats/max_res_5120_2880",
"/sys/devices/platform/exynos-drm/displayport/drm-displayport-stats/max_res_7680_4320",
},
.HDCPStatsPaths = {
"/sys/devices/platform/hdcp/hdcp2_success_count",
"/sys/devices/platform/hdcp/hdcp2_fallback_count",
"/sys/devices/platform/hdcp/hdcp2_fail_count",
"/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 = {
.AudioUevent = "/devices/virtual/amcs/amcs",
.TypeCPartnerUevent = "PRODUCT_TYPE=",
.FwUpdatePath = ""
};
int main() {
LOG(INFO) << "starting PixelStats";
UeventListener ueventListener(ueventPaths);
std::thread listenThread(&UeventListener::ListenForever, &ueventListener);
listenThread.detach();
SysfsCollector collector(sysfs_paths);
collector.collect(); // This blocks forever.
return 0;
}

View File

@@ -3,6 +3,7 @@
/vendor/bin/bipchmgr u:object_r:bipchmgr_exec:s0
/vendor/bin/vcd u:object_r:vcd_exec:s0
/vendor/bin/dmd u:object_r:dmd_exec:s0
/vendor/bin/sced u:object_r:sced_exec:s0
/vendor/bin/rfsd u:object_r:rfsd_exec:s0
/vendor/bin/modem_logging_control u:object_r:modem_logging_control_exec:s0
/vendor/bin/modem_ml_svc_sit u:object_r:modem_ml_svc_sit_exec:s0

View File

@@ -48,5 +48,6 @@ allow modem_svc_sit modem_img_file:file r_file_perms;
allow modem_svc_sit modem_img_file:lnk_file r_file_perms;
# Allow modem_svc_sit to access socket for UMI
allow modem_svc_sit radio_vendor_data_file:sock_file { create unlink write };
userdebug_or_eng(`
allow modem_svc_sit radio_vendor_data_file:sock_file { create unlink };
')

23
sepolicy/radio/sced.te Normal file
View File

@@ -0,0 +1,23 @@
type sced, domain;
type sced_exec, vendor_file_type, exec_type, file_type;
userdebug_or_eng(`
init_daemon_domain(sced)
typeattribute sced vendor_executes_system_violators;
hwbinder_use(sced)
binder_call(sced, dmd)
binder_call(sced, vendor_telephony_silentlogging_app)
get_prop(sced, hwservicemanager_prop)
allow sced self:packet_socket create_socket_perms_no_ioctl;
allow sced self:capability net_raw;
allow sced shell_exec:file rx_file_perms;
allow sced tcpdump_exec:file rx_file_perms;
allow sced vendor_shell_exec:file x_file_perms;
allow sced vendor_slog_file:dir create_dir_perms;
allow sced vendor_slog_file:file create_file_perms;
allow sced hidl_base_hwservice:hwservice_manager add;
allow sced hal_vendor_oem_hwservice:hwservice_manager { add find };
')

View File

@@ -10,6 +10,7 @@ allow vendor_telephony_silentlogging_app vendor_slog_file:file create_file_perms
allow vendor_telephony_silentlogging_app app_api_service:service_manager find;
allow vendor_telephony_silentlogging_app hal_vendor_oem_hwservice:hwservice_manager find;
binder_call(vendor_telephony_silentlogging_app, dmd)
binder_call(vendor_telephony_silentlogging_app, sced)
userdebug_or_eng(`
# Silent Logging

View File

@@ -5,18 +5,13 @@ dump_modem sscoredump_vendor_data_logcat_file dir b/361725982
dumpstate app_zygote process b/288049050
edgetpu_vendor_server shell_data_file dir b/369475225
edgetpu_vendor_server shell_data_file dir b/369475363
hal_bluetooth_btlinux proc file b/390293495
hal_bluetooth_btlinux vendor_default_prop property_service b/350832030
hal_camera_default aconfig_storage_metadata_file dir b/383013471
hal_contexthub_default hal_bluetooth_service service_manager b/396572958
hal_drm_widevine system_userdir_file dir b/393955151
hal_radioext_default radio_vendor_data_file file b/312590044
incidentd debugfs_wakeup_sources file b/288049561
incidentd incidentd anon_inode b/288049561
init init capability b/379207041
insmod-sh insmod-sh key b/274374722
insmod-sh kmsg_device chr_file b/388949246
insmod-sh vendor_edgetpu_debugfs dir b/385858993
kernel dm_device blk_file b/319403445
modem_svc_sit hal_radioext_default process b/364446415
modem_svc_sit modem_ml_svc_sit file b/360060606
@@ -24,16 +19,12 @@ modem_svc_sit modem_ml_svc_sit file b/360060992
mtectrl unlabeled dir b/264483752
pixelstats_vendor block_device dir b/369540673
pixelstats_vendor block_device dir b/369540836
pixelstats_vendor chre_socket sock_file b/400297422
platform_app radio_vendor_data_file dir b/380756119
platform_app vendor_fw_file dir b/372121912
platform_app vendor_rild_prop file b/372121912
priv_app audio_config_prop file b/379246064
radio audio_config_prop file b/379245771
ramdump ramdump capability b/369475700
ramdump_app default_prop file b/386149375
shell idmap_exec file b/398697849
shell qemu_sf_lcd_density_prop file b/398697849
shell sysfs_net file b/330081782
ssr_detector_app default_prop file b/340722729
system_server sysfs_batteryinfo file b/294967729
@@ -48,5 +39,4 @@ vendor_init default_prop file b/323087490
vendor_init default_prop property_service b/315104235
vendor_init default_prop property_service b/359428180
vendor_init vendor_volte_mif_off property_service b/316816642
zygote aconfig_storage_metadata_file dir b/383949325
zygote zygote capability b/379207101

View File

@@ -54,3 +54,4 @@ type sysfs_ospm, sysfs_type, fs_type;
# GSA
type sysfs_gsa_log, sysfs_type, fs_type;
type sysfs_faceauth_rawimage_heap, sysfs_type, fs_type;

View File

@@ -102,7 +102,6 @@ is_flag_disabled(RELEASE_AVF_ENABLE_DEVICE_ASSIGNMENT, `
/dev/gxp u:object_r:gxp_device:s0
/dev/mali0 u:object_r:gpu_device:s0
/dev/goodix_fp u:object_r:fingerprint_device:s0
/dev/fth_fd u:object_r:fingerprint_device:s0
/dev/logbuffer_tcpm u:object_r:logbuffer_device:s0
/dev/logbuffer_usbpd u:object_r:logbuffer_device:s0
/dev/logbuffer_ssoc u:object_r:logbuffer_device:s0

View File

@@ -94,7 +94,6 @@ genfscon sysfs /devices/platform/19440000.drmdsim/19440000.drmdsim.0/backlight/p
genfscon sysfs /devices/platform/19440000.drmdsim/19440000.drmdsim.0/error_count_te u:object_r:sysfs_display:s0
genfscon sysfs /devices/platform/19440000.drmdsim/19440000.drmdsim.0/error_count_unknown u:object_r:sysfs_display:s0
genfscon sysfs /devices/platform/110f0000.drmdp/drm-displayport/dp_hotplug_error_code u:object_r:sysfs_display:s0
genfscon sysfs /devices/platform/110f0000.drmdp/drm-displayport/hdcp_negotiation u:object_r:sysfs_display:s0
genfscon sysfs /devices/platform/110f0000.drmdp/drm-displayport-stats/link_negotiation_failures u:object_r:sysfs_display:s0
genfscon sysfs /devices/platform/110f0000.drmdp/drm-displayport-stats/edid_read_failures u:object_r:sysfs_display:s0
genfscon sysfs /devices/platform/110f0000.drmdp/drm-displayport-stats/dpcd_read_failures u:object_r:sysfs_display:s0
@@ -291,8 +290,6 @@ genfscon sysfs /devices/platform/odm/odm:btbcm/wakeup
genfscon sysfs /devices/platform/19440000.drmdsim/19440000.drmdsim.0/wakeup/ u:object_r:sysfs_wakeup:s0
genfscon sysfs /devices/platform/19450000.drmdsim/19450000.drmdsim.0/wakeup/ u:object_r:sysfs_wakeup:s0
genfscon sysfs /devices/platform/110f0000.drmdp/wakeup u:object_r:sysfs_wakeup:s0
genfscon sysfs /devices/platform/odm/odm:fps_touch_handler/power/wakeup u:object_r:sysfs_wakeup:s0
genfscon sysfs /devices/platform/odm/odm:fps_touch_handler/wakeup u:object_r:sysfs_wakeup:s0
# Trusty
genfscon sysfs /module/trusty_virtio/parameters/use_high_wq u:object_r:sysfs_trusty:s0
@@ -337,6 +334,9 @@ genfscon sysfs /devices/platform/17000000.aoc/control/udfps_get_osc_freq
genfscon sysfs /devices/platform/17000000.aoc/control/udfps_get_disp_freq u:object_r:sysfs_aoc_udfps:s0
genfscon sysfs /devices/platform/17000000.aoc/notify_timeout_aoc_status u:object_r:sysfs_aoc_notifytimeout:s0
# Faceauth
genfscon sysfs /sys/kernel/vendor_mm/gcma_heap/trusty:faceauth_rawimage_heap/max_usage_kb u:object_r:sysfs_faceauth_rawimage_heap:s0
# Bluetooth
genfscon sysfs /devices/platform/155d0000.serial/uart_dbg u:object_r:sysfs_bt_uart:s0

View File

@@ -1,10 +0,0 @@
# Policy to enable only production gpu ioctls.
is_flag_enabled(RELEASE_PIXEL_MALI_SEPOLICY_ENABLED, `
# Allow gpu ioctls used in production.
allowxperm appdomain gpu_device:chr_file ioctl { unpriv_gpu_ioctls instrumentation_gpu_ioctls };
# Audit gpu ioctl commands which have been deprecated,
# or are intended for development of the GPU.
auditallow appdomain gpu_device:chr_file ioctl;
allowxperm appdomain gpu_device:chr_file ioctl { debug_gpu_ioctls deprecated_gpu_ioctls };
auditallowxperm appdomain gpu_device:chr_file ioctl { debug_gpu_ioctls deprecated_gpu_ioctls };
')

View File

@@ -1,73 +0,0 @@
define(`KBASE_IOCTL_VERSION_CHECK_JM', `0x8000')
define(`KBASE_IOCTL_SET_FLAGS', `0x8001')
define(`KBASE_IOCTL_JOB_SUBMIT', `0x8002')
define(`KBASE_IOCTL_GET_GPUPROPS', `0x8003')
define(`KBASE_IOCTL_POST_TERM', `0x8004')
define(`KBASE_IOCTL_MEM_ALLOC', `0x8005')
define(`KBASE_IOCTL_MEM_QUERY', `0x8006')
define(`KBASE_IOCTL_MEM_FREE', `0x8007')
define(`KBASE_IOCTL_HWCNT_READER_SETUP', `0x8008')
define(`KBASE_IOCTL_DISJOINT_QUERY', `0x800c')
define(`KBASE_IOCTL_GET_DDK_VERSION', `0x800d')
define(`KBASE_IOCTL_MEM_JIT_INIT', `0x800e')
define(`KBASE_IOCTL_MEM_SYNC', `0x800f')
define(`KBASE_IOCTL_MEM_FIND_CPU_OFFSET', `0x8010')
define(`KBASE_IOCTL_GET_CONTEXT_ID', `0x8011')
define(`KBASE_IOCTL_TLSTREAM_ACQUIRE', `0x8012')
define(`KBASE_IOCTL_TLSTREAM_FLUSH', `0x8013')
define(`KBASE_IOCTL_MEM_COMMIT', `0x8014')
define(`KBASE_IOCTL_MEM_ALIAS', `0x8015')
define(`KBASE_IOCTL_MEM_IMPORT', `0x8016')
define(`KBASE_IOCTL_MEM_FLAGS_CHANGE', `0x8017')
define(`KBASE_IOCTL_STREAM_CREATE', `0x8018')
define(`KBASE_IOCTL_FENCE_VALIDATE', `0x8019')
define(`KBASE_IOCTL_MEM_PROFILE_ADD', `0x801b')
define(`KBASE_IOCTL_SOFT_EVENT_UPDATE', `0x801c')
define(`KBASE_IOCTL_STICKY_RESOURCE_MAP', `0x801d')
define(`KBASE_IOCTL_STICKY_RESOURCE_UNMAP', `0x801e')
define(`KBASE_IOCTL_MEM_FIND_GPU_START_AND_OFFSET', `0x801f')
define(`KBASE_IOCTL_HWCNT_SET', `0x8020')
define(`KBASE_IOCTL_CINSTR_GWT_START', `0x8021')
define(`KBASE_IOCTL_CINSTR_GWT_STOP', `0x8022')
define(`KBASE_IOCTL_CINSTR_GWT_DUMP', `0x8023')
define(`KBASE_IOCTL_CS_QUEUE_REGISTER', `0x8024')
define(`KBASE_IOCTL_CS_QUEUE_KICK', `0x8025')
define(`KBASE_IOCTL_MEM_EXEC_INIT', `0x8026')
define(`KBASE_IOCTL_CS_QUEUE_BIND', `0x8027')
define(`KBASE_IOCTL_CS_QUEUE_REGISTER_EX', `0x8028')
define(`KBASE_IOCTL_CS_QUEUE_TERMINATE', `0x8029')
define(`KBASE_IOCTL_CS_QUEUE_GROUP_CREATE_1_6', `0x802a')
define(`KBASE_IOCTL_CS_QUEUE_GROUP_TERMINATE', `0x802b')
define(`KBASE_IOCTL_CS_EVENT_SIGNAL', `0x802c')
define(`KBASE_IOCTL_KCPU_QUEUE_CREATE', `0x802d')
define(`KBASE_IOCTL_KCPU_QUEUE_DELETE', `0x802e')
define(`KBASE_IOCTL_KCPU_QUEUE_ENQUEUE', `0x802f')
define(`KBASE_IOCTL_CS_TILER_HEAP_INIT', `0x8030')
define(`KBASE_IOCTL_CS_TILER_HEAP_TERM', `0x8031')
define(`KBASE_IOCTL_GET_CPU_GPU_TIMEINFO', `0x8032')
define(`KBASE_IOCTL_CS_GET_GLB_IFACE', `0x8033')
define(`KBASE_IOCTL_VERSION_CHECK_CSF', `0x8034')
define(`KBASE_IOCTL_CS_CPU_QUEUE_DUMP', `0x8035')
define(`KBASE_IOCTL_CONTEXT_PRIORITY_CHECK', `0x8036')
define(`KBASE_IOCTL_SET_LIMITED_CORE_COUNT', `0x8037')
define(`KBASE_IOCTL_KINSTR_PRFCNT_ENUM_INFO', `0x8038')
define(`KBASE_IOCTL_KINSTR_PRFCNT_SETUP', `0x8039')
define(`KBASE_IOCTL_CS_QUEUE_GROUP_CREATE', `0x803a')
define(`KBASE_IOCTL_MEM_ALLOC_EX', `0x803b')
define(`KBASE_IOCTL_READ_USER_PAGE', `0x803c')
define(`KBASE_IOCTL_QUEUE_GROUP_CLEAR_FAULTS', `0x803d')
define(`KBASE_IOCTL_APC_REQUEST', `0x8042')
define(`KBASE_IOCTL_BUFFER_LIVENESS_UPDATE', `0x8043')
define(`KBASE_HWCNT_READER_GET_HWVER', `0xBE00')
define(`KBASE_HWCNT_READER_GET_BUFFER_SIZE', `0xBE01')
define(`KBASE_HWCNT_READER_DUMP', `0xBE10')
define(`KBASE_HWCNT_READER_CLEAR', `0xBE11')
define(`KBASE_HWCNT_READER_GET_BUFFER', `0xBE20')
define(`KBASE_HWCNT_READER_PUT_BUFFER', `0xBE21')
define(`KBASE_HWCNT_READER_SET_INTERVAL', `0xBE30')
define(`KBASE_HWCNT_READER_ENABLE_EVENT', `0xBE40')
define(`KBASE_HWCNT_READER_DISABLE_EVENT', `0xBE41')
define(`KBASE_HWCNT_READER_GET_API_VERSION', `0xBEFF')
define(`KBASE_IOCTL_KINSTR_PRFCNT_CMD', `0xBF00')
define(`KBASE_IOCTL_KINSTR_PRFCNT_GET_SAMPLE', `0xBF01')
define(`KBASE_IOCTL_KINSTR_PRFCNT_PUT_SAMPLE', `0xBF10')

View File

@@ -1,83 +0,0 @@
define(`unpriv_gpu_ioctls', `{
KBASE_IOCTL_VERSION_CHECK_JM
KBASE_IOCTL_SET_FLAGS
KBASE_IOCTL_JOB_SUBMIT
KBASE_IOCTL_GET_GPUPROPS
KBASE_IOCTL_POST_TERM
KBASE_IOCTL_MEM_ALLOC
KBASE_IOCTL_MEM_QUERY
KBASE_IOCTL_MEM_FREE
KBASE_IOCTL_DISJOINT_QUERY
KBASE_IOCTL_GET_DDK_VERSION
KBASE_IOCTL_MEM_JIT_INIT
KBASE_IOCTL_MEM_SYNC
KBASE_IOCTL_MEM_FIND_CPU_OFFSET
KBASE_IOCTL_GET_CONTEXT_ID
KBASE_IOCTL_MEM_COMMIT
KBASE_IOCTL_MEM_ALIAS
KBASE_IOCTL_MEM_IMPORT
KBASE_IOCTL_MEM_FLAGS_CHANGE
KBASE_IOCTL_STREAM_CREATE
KBASE_IOCTL_FENCE_VALIDATE
KBASE_IOCTL_MEM_PROFILE_ADD
KBASE_IOCTL_SOFT_EVENT_UPDATE
KBASE_IOCTL_STICKY_RESOURCE_MAP
KBASE_IOCTL_STICKY_RESOURCE_UNMAP
KBASE_IOCTL_MEM_FIND_GPU_START_AND_OFFSET
KBASE_IOCTL_CS_QUEUE_REGISTER
KBASE_IOCTL_CS_QUEUE_KICK
KBASE_IOCTL_MEM_EXEC_INIT
KBASE_IOCTL_CS_QUEUE_BIND
KBASE_IOCTL_CS_QUEUE_REGISTER_EX
KBASE_IOCTL_CS_QUEUE_TERMINATE
KBASE_IOCTL_CS_QUEUE_GROUP_TERMINATE
KBASE_IOCTL_CS_EVENT_SIGNAL
KBASE_IOCTL_KCPU_QUEUE_CREATE
KBASE_IOCTL_KCPU_QUEUE_DELETE
KBASE_IOCTL_KCPU_QUEUE_ENQUEUE
KBASE_IOCTL_CS_TILER_HEAP_INIT
KBASE_IOCTL_CS_TILER_HEAP_TERM
KBASE_IOCTL_GET_CPU_GPU_TIMEINFO
KBASE_IOCTL_CS_GET_GLB_IFACE
KBASE_IOCTL_VERSION_CHECK_CSF
KBASE_IOCTL_CS_CPU_QUEUE_DUMP
KBASE_IOCTL_CONTEXT_PRIORITY_CHECK
KBASE_IOCTL_SET_LIMITED_CORE_COUNT
KBASE_IOCTL_CS_QUEUE_GROUP_CREATE
KBASE_IOCTL_MEM_ALLOC_EX
KBASE_IOCTL_READ_USER_PAGE
KBASE_IOCTL_QUEUE_GROUP_CLEAR_FAULTS
KBASE_IOCTL_APC_REQUEST
KBASE_IOCTL_BUFFER_LIVENESS_UPDATE
}')
define(`instrumentation_gpu_ioctls', `{
KBASE_IOCTL_KINSTR_PRFCNT_ENUM_INFO
KBASE_IOCTL_KINSTR_PRFCNT_SETUP
KBASE_IOCTL_TLSTREAM_ACQUIRE
KBASE_IOCTL_TLSTREAM_FLUSH
KBASE_IOCTL_KINSTR_PRFCNT_CMD
KBASE_IOCTL_KINSTR_PRFCNT_GET_SAMPLE
KBASE_IOCTL_KINSTR_PRFCNT_PUT_SAMPLE
}')
define(`debug_gpu_ioctls', `{
KBASE_IOCTL_HWCNT_SET
KBASE_IOCTL_CINSTR_GWT_START
KBASE_IOCTL_CINSTR_GWT_STOP
KBASE_IOCTL_CINSTR_GWT_DUMP
}')
define(`deprecated_gpu_ioctls', `{
KBASE_HWCNT_READER_GET_HWVER
KBASE_HWCNT_READER_GET_BUFFER_SIZE
KBASE_HWCNT_READER_DUMP
KBASE_HWCNT_READER_CLEAR
KBASE_HWCNT_READER_GET_BUFFER
KBASE_HWCNT_READER_PUT_BUFFER
KBASE_HWCNT_READER_SET_INTERVAL
KBASE_HWCNT_READER_ENABLE_EVENT
KBASE_HWCNT_READER_DISABLE_EVENT
KBASE_HWCNT_READER_GET_API_VERSION
KBASE_IOCTL_CS_QUEUE_GROUP_CREATE_1_6
}')

View File

@@ -1,3 +1,5 @@
com.google.hardware.pixel.display.IDisplay/default u:object_r:hal_pixel_display_service:s0
vendor.google.wireless_charger.IWirelessCharger/default u:object_r:hal_wireless_charger_service:s0
arm.mali.platform.ICompression/default u:object_r:arm_mali_platform_service:s0

View File

@@ -462,13 +462,13 @@
]
},
{
"Name": "SCHED_QOS_NONE",
"Name": "ResetUclampGrp",
"Actions": [
{
"Name": "WriteFile",
"Params":
{
"FilePath": "/proc/vendor_sched/sched_qos/sched_qos_none",
"FilePath": "/proc/vendor_sched/uclamp_fork_reset_set",
"Value": "<pid>",
"LogFailures": "false"
}
@@ -476,73 +476,18 @@
]
},
{
"Name": "SCHED_QOS_POWER_EFFICIENCY",
"Name": "NoResetUclampGrp",
"Actions": [
{
"Name": "WriteFile",
"Params":
{
"FilePath": "/proc/vendor_sched/sched_qos/sched_qos_power_efficiency",
"FilePath": "/proc/vendor_sched/uclamp_fork_reset_clear",
"Value": "<pid>",
"LogFailures": "false"
}
}
]
},
{
"Name": "SCHED_QOS_SENSITIVE_EXTREME",
"Actions": [
{
"Name": "WriteFile",
"Params":
{
"FilePath": "/proc/vendor_sched/sched_qos/sched_qos_sensitive_extreme",
"Value": "<pid>",
"LogFailures": "false"
}
}
]
},
{
"Name": "SCHED_QOS_SENSITIVE_HIGH",
"Actions": [
{
"Name": "WriteFile",
"Params":
{
"FilePath": "/proc/vendor_sched/sched_qos/sched_qos_sensitive_high",
"Value": "<pid>",
"LogFailures": "false"
}
}
]
},
{
"Name": "SCHED_QOS_SENSITIVE_STANDARD",
"Actions": [
{
"Name": "WriteFile",
"Params":
{
"FilePath": "/proc/vendor_sched/sched_qos/sched_qos_sensitive_standard",
"Value": "<pid>",
"LogFailures": "false"
}
}
]
},
{
"Name": "HighestCfsPrioScheduling",
"Actions": [
{
"Name": "SetSchedulerPolicy",
"Params":
{
"Policy": "SCHED_OTHER",
"Nice": "-20"
}
}
]
}
],
@@ -555,9 +500,33 @@
"Name": "OtaProfiles",
"Profiles": [ "OtaPerformance", "ServiceCapacityLow", "LowIoPriority", "TimerSlackHigh" ]
},
{
"Name": "SCHED_QOS_SENSITIVE_EXTREME_SET",
"Profiles": [ "AdpfSet", "PreferIdleSet", "PreferFitSet", "BoostPrioSet", "PreemptWakeupSet" ]
},
{
"Name": "SCHED_QOS_SENSITIVE_EXTREME_CLEAR",
"Profiles": [ "AdpfClear", "PreferIdleClear", "PreferFitClear", "BoostPrioClear", "PreemptWakeupClear" ]
},
{
"Name": "SCHED_QOS_SENSITIVE_STANDARD_SET",
"Profiles": [ "AdpfSet", "PreferIdleSet", "PreferFitSet" ]
},
{
"Name": "SCHED_QOS_SENSITIVE_STANDARD_CLEAR",
"Profiles": [ "AdpfClear", "PreferIdleClear", "PreferFitClear" ]
},
{
"Name": "SCHED_QOS_POWER_EFFICIENCY_SET",
"Profiles": [ "AutoUclampMaxSet" ]
},
{
"Name": "SCHED_QOS_POWER_EFFICIENCY_CLEAR",
"Profiles": [ "AutoUclampMaxClear" ]
},
{
"Name": "InputPolicy",
"Profiles": [ "MaxPerformance", "SCHED_QOS_SENSITIVE_EXTREME" ]
"Profiles": [ "MaxPerformance", "SCHED_QOS_SENSITIVE_EXTREME_SET" ]
}
]
}

View File

@@ -34,6 +34,7 @@ cc_binary {
srcs: [
"service.cpp",
"Usb.cpp",
"UsbDataSessionMonitor.cpp",
],
shared_libs: [
"libbase",
@@ -58,13 +59,18 @@ cc_binary {
],
static_libs: [
"libpixelusb-aidl",
"libpixelusb-datasession",
"libpixelstats",
"libthermalutils",
"android.hardware.usb.flags-aconfig-cc-lib",
"android.hardware.usb.flags-aconfig-c-lib",
],
export_shared_lib_headers: [
"android.frameworks.stats-V2-ndk",
"pixelatoms-cpp",
],
}
cc_aconfig_library {
name: "android.hardware.usb.flags-aconfig-c-lib",
vendor: true,
aconfig_declarations: "android.hardware.usb.flags-aconfig",
}

View File

@@ -521,9 +521,9 @@ Usb::Usb()
mRoleSwitchLock(PTHREAD_MUTEX_INITIALIZER),
mPartnerLock(PTHREAD_MUTEX_INITIALIZER),
mPartnerUp(false),
mUsbDataSessionMonitor(new UsbDataSessionMonitor(kUdcUeventRegex, kUdcStatePath,
kHost1UeventRegex, kHost1StatePath, kHost2UeventRegex,
kHost2StatePath, kDataRolePath, std::bind(&updatePortStatus, this))),
mUsbDataSessionMonitor(kUdcUeventRegex, kUdcStatePath, kHost1UeventRegex, kHost1StatePath,
kHost2UeventRegex, kHost2StatePath, kDataRolePath,
std::bind(&updatePortStatus, this)),
mOverheat(ZoneInfo(TemperatureType::USB_PORT, kThermalZoneForTrip,
ThrottlingSeverity::CRITICAL),
{ZoneInfo(TemperatureType::UNKNOWN, kThermalZoneForTempReadPrimary,
@@ -1075,7 +1075,7 @@ void queryUsbDataSession(android::hardware::usb::Usb *usb,
std::vector<PortStatus> *currentPortStatus) {
std::vector<ComplianceWarning> warnings;
usb->mUsbDataSessionMonitor->getComplianceWarnings(
usb->mUsbDataSessionMonitor.getComplianceWarnings(
(*currentPortStatus)[0].currentDataRole, &warnings);
(*currentPortStatus)[0].complianceWarnings.insert(
(*currentPortStatus)[0].complianceWarnings.end(),

View File

@@ -19,10 +19,10 @@
#include <android-base/file.h>
#include <aidl/android/hardware/usb/BnUsb.h>
#include <aidl/android/hardware/usb/BnUsbCallback.h>
#include <pixelusb/UsbDataSessionMonitor.h>
#include <pixelusb/UsbOverheatEvent.h>
#include <sys/eventfd.h>
#include <utils/Log.h>
#include <UsbDataSessionMonitor.h>
#define UEVENT_MSG_LEN 2048
// The type-c stack waits for 4.5 - 5.5 secs before declaring a port non-pd.
@@ -50,7 +50,6 @@ using ::aidl::android::hardware::usb::PortRole;
using ::android::base::ReadFileToString;
using ::android::base::WriteStringToFile;
using ::android::base::unique_fd;
using ::android::hardware::google::pixel::usb::UsbDataSessionMonitor;
using ::android::hardware::google::pixel::usb::UsbOverheatEvent;
using ::android::hardware::google::pixel::usb::ZoneInfo;
using ::android::hardware::thermal::V2_0::TemperatureType;
@@ -124,7 +123,7 @@ struct Usb : public BnUsb {
bool mPartnerUp;
// Report usb data session event and data incompliance warnings
std::unique_ptr<UsbDataSessionMonitor> mUsbDataSessionMonitor;
UsbDataSessionMonitor mUsbDataSessionMonitor;
// Usb Overheat object for push suez event
UsbOverheatEvent mOverheat;
// Temperature when connected

View File

@@ -0,0 +1,508 @@
/*
* Copyright (C) 2023 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.
*/
#define LOG_TAG "android.hardware.usb.aidl-service.UsbDataSessionMonitor"
#include "UsbDataSessionMonitor.h"
#include <aidl/android/frameworks/stats/IStats.h>
#include <android-base/file.h>
#include <android-base/logging.h>
#include <android_hardware_usb_flags.h>
#include <cutils/uevent.h>
#include <pixelstats/StatsHelper.h>
#include <pixelusb/CommonUtils.h>
#include <sys/epoll.h>
#include <sys/timerfd.h>
#include <utils/Log.h>
#include <regex>
namespace usb_flags = android::hardware::usb::flags;
using aidl::android::frameworks::stats::IStats;
using android::base::ReadFileToString;
using android::hardware::google::pixel::getStatsService;
using android::hardware::google::pixel::reportUsbDataSessionEvent;
using android::hardware::google::pixel::PixelAtoms::VendorUsbDataSessionEvent;
using android::hardware::google::pixel::usb::addEpollFd;
using android::hardware::google::pixel::usb::BuildVendorUsbDataSessionEvent;
namespace aidl {
namespace android {
namespace hardware {
namespace usb {
#define UEVENT_MSG_LEN 2048
#define USB_STATE_MAX_LEN 20
#define DATA_ROLE_MAX_LEN 10
#define WARNING_SURFACE_DELAY_SEC 5
#define ENUM_FAIL_DEFAULT_COUNT_THRESHOLD 3
#define DEVICE_FLAKY_CONNECTION_CONFIGURED_COUNT_THRESHOLD 5
constexpr char kUdcConfigfsPath[] = "/config/usb_gadget/g1/UDC";
constexpr char kNotAttachedState[] = "not attached\n";
constexpr char kAttachedState[] = "attached\n";
constexpr char kPoweredState[] = "powered\n";
constexpr char kDefaultState[] = "default\n";
constexpr char kAddressedState[] = "addressed\n";
constexpr char kConfiguredState[] = "configured\n";
constexpr char kSuspendedState[] = "suspended\n";
const std::set<std::string> kValidStates = {kNotAttachedState, kAttachedState, kPoweredState,
kDefaultState, kAddressedState, kConfiguredState,
kSuspendedState};
static int addEpollFile(const int &epollFd, const std::string &filePath, unique_fd &fileFd) {
struct epoll_event ev;
unique_fd fd(open(filePath.c_str(), O_RDONLY));
if (fd.get() == -1) {
ALOGI("Cannot open %s", filePath.c_str());
return -1;
}
ev.data.fd = fd.get();
ev.events = EPOLLPRI;
if (epoll_ctl(epollFd, EPOLL_CTL_ADD, fd.get(), &ev) != 0) {
ALOGE("epoll_ctl failed; errno=%d", errno);
return -1;
}
fileFd = std::move(fd);
ALOGI("epoll registered %s", filePath.c_str());
return 0;
}
static void removeEpollFile(const int &epollFd, const std::string &filePath, unique_fd &fileFd) {
epoll_ctl(epollFd, EPOLL_CTL_DEL, fileFd.get(), NULL);
fileFd.release();
ALOGI("epoll unregistered %s", filePath.c_str());
}
UsbDataSessionMonitor::UsbDataSessionMonitor(
const std::string &deviceUeventRegex, const std::string &deviceStatePath,
const std::string &host1UeventRegex, const std::string &host1StatePath,
const std::string &host2UeventRegex, const std::string &host2StatePath,
const std::string &dataRolePath, std::function<void()> updatePortStatusCb) {
struct epoll_event ev;
std::string udc;
unique_fd epollFd(epoll_create(8));
if (epollFd.get() == -1) {
ALOGE("epoll_create failed; errno=%d", errno);
abort();
}
unique_fd ueventFd(uevent_open_socket(64 * 1024, true));
if (ueventFd.get() == -1) {
ALOGE("uevent_open_socket failed");
abort();
}
fcntl(ueventFd, F_SETFL, O_NONBLOCK);
if (addEpollFd(epollFd, ueventFd))
abort();
unique_fd timerFd(timerfd_create(CLOCK_BOOTTIME, TFD_NONBLOCK));
if (timerFd.get() == -1) {
ALOGE("create timerFd failed");
abort();
}
if (addEpollFd(epollFd, timerFd))
abort();
if (addEpollFile(epollFd.get(), dataRolePath, mDataRoleFd) != 0) {
ALOGE("monitor data role failed");
abort();
}
/*
* The device state file could be absent depending on the current data role
* and driver architecture. It's ok for addEpollFile to fail here, the file
* will be monitored later when its presence is detected by uevent.
*/
mDeviceState.filePath = deviceStatePath;
mDeviceState.ueventRegex = deviceUeventRegex;
addEpollFile(epollFd.get(), mDeviceState.filePath, mDeviceState.fd);
mHost1State.filePath = host1StatePath;
mHost1State.ueventRegex = host1UeventRegex;
addEpollFile(epollFd.get(), mHost1State.filePath, mHost1State.fd);
mHost2State.filePath = host2StatePath;
mHost2State.ueventRegex = host2UeventRegex;
addEpollFile(epollFd.get(), mHost2State.filePath, mHost2State.fd);
mEpollFd = std::move(epollFd);
mUeventFd = std::move(ueventFd);
mTimerFd = std::move(timerFd);
mUpdatePortStatusCb = updatePortStatusCb;
if (ReadFileToString(kUdcConfigfsPath, &udc) && !udc.empty())
mUdcBind = true;
else
mUdcBind = false;
if (pthread_create(&mMonitor, NULL, this->monitorThread, this)) {
ALOGE("pthread creation failed %d", errno);
abort();
}
ALOGI("feature flag enable_report_usb_data_compliance_warning: %d",
usb_flags::enable_report_usb_data_compliance_warning());
}
UsbDataSessionMonitor::~UsbDataSessionMonitor() {}
void UsbDataSessionMonitor::reportUsbDataSessionMetrics() {
std::vector<VendorUsbDataSessionEvent> events;
if (mDataRole == PortDataRole::DEVICE) {
VendorUsbDataSessionEvent event;
BuildVendorUsbDataSessionEvent(false /* is_host */, boot_clock::now(), mDataSessionStart,
&mDeviceState.states, &mDeviceState.timestamps, &event);
events.push_back(event);
} else if (mDataRole == PortDataRole::HOST) {
bool empty = true;
for (auto e : {&mHost1State, &mHost2State}) {
/*
* Host port will at least get an not_attached event after enablement,
* skip upload if no additional state is added.
*/
if (e->states.size() > 1) {
VendorUsbDataSessionEvent event;
BuildVendorUsbDataSessionEvent(true /* is_host */, boot_clock::now(),
mDataSessionStart, &e->states, &e->timestamps,
&event);
events.push_back(event);
empty = false;
}
}
// All host ports have no state update, upload an event to reflect it
if (empty) {
VendorUsbDataSessionEvent event;
BuildVendorUsbDataSessionEvent(true /* is_host */, boot_clock::now(), mDataSessionStart,
&mHost1State.states, &mHost1State.timestamps, &event);
events.push_back(event);
}
} else {
return;
}
const std::shared_ptr<IStats> stats_client = getStatsService();
if (!stats_client) {
ALOGE("Unable to get AIDL Stats service");
return;
}
for (auto &event : events) {
reportUsbDataSessionEvent(stats_client, event);
}
}
void UsbDataSessionMonitor::getComplianceWarnings(const PortDataRole &role,
std::vector<ComplianceWarning> *warnings) {
if (!usb_flags::enable_report_usb_data_compliance_warning())
return;
if (role != mDataRole || role == PortDataRole::NONE)
return;
for (auto w : mWarningSet) {
warnings->push_back(w);
}
}
void UsbDataSessionMonitor::notifyComplianceWarning() {
if (!usb_flags::enable_report_usb_data_compliance_warning())
return;
if (mUpdatePortStatusCb)
mUpdatePortStatusCb();
}
void UsbDataSessionMonitor::evaluateComplianceWarning() {
std::set<ComplianceWarning> newWarningSet;
int elapsedTimeSec;
elapsedTimeSec =
std::chrono::duration_cast<std::chrono::seconds>(boot_clock::now() - mDataSessionStart)
.count();
if (elapsedTimeSec >= WARNING_SURFACE_DELAY_SEC) {
if (mDataRole == PortDataRole::DEVICE && mUdcBind) {
int configuredCount = std::count(mDeviceState.states.begin(),
mDeviceState.states.end(), kConfiguredState);
int defaultCount =
std::count(mDeviceState.states.begin(), mDeviceState.states.end(), kDefaultState);
if (configuredCount == 0 && defaultCount > ENUM_FAIL_DEFAULT_COUNT_THRESHOLD)
newWarningSet.insert(ComplianceWarning::ENUMERATION_FAIL);
if (configuredCount > DEVICE_FLAKY_CONNECTION_CONFIGURED_COUNT_THRESHOLD)
newWarningSet.insert(ComplianceWarning::FLAKY_CONNECTION);
} else if (mDataRole == PortDataRole::HOST) {
int host1StateCount = mHost1State.states.size();
int host1ConfiguredCount =
std::count(mHost1State.states.begin(), mHost1State.states.end(), kConfiguredState);
int host1DefaultCount =
std::count(mHost1State.states.begin(), mHost1State.states.end(), kDefaultState);
int host2StateCount = mHost2State.states.size();
int host2ConfiguredCount =
std::count(mHost2State.states.begin(), mHost2State.states.end(), kConfiguredState);
int host2DefaultCount =
std::count(mHost2State.states.begin(), mHost2State.states.end(), kDefaultState);
if (host1ConfiguredCount == 0 && host2ConfiguredCount == 0 &&
(host1DefaultCount > ENUM_FAIL_DEFAULT_COUNT_THRESHOLD ||
host2DefaultCount > ENUM_FAIL_DEFAULT_COUNT_THRESHOLD))
newWarningSet.insert(ComplianceWarning::ENUMERATION_FAIL);
if (host1StateCount == 1 && mHost1State.states.front() == kNotAttachedState &&
host2StateCount == 1 && mHost2State.states.front() == kNotAttachedState)
newWarningSet.insert(ComplianceWarning::MISSING_DATA_LINES);
}
}
if (newWarningSet != mWarningSet) {
std::string newWarningString;
for (auto e : newWarningSet) {
newWarningString += toString(e) + " ";
}
ALOGI("Usb data compliance warning changed to: %s", newWarningString.c_str());
mWarningSet = newWarningSet;
notifyComplianceWarning();
}
}
void UsbDataSessionMonitor::clearDeviceStateEvents(struct usbDeviceState *deviceState) {
deviceState->states.clear();
deviceState->timestamps.clear();
}
void UsbDataSessionMonitor::handleDeviceStateEvent(struct usbDeviceState *deviceState) {
int n;
char state[USB_STATE_MAX_LEN] = {0};
lseek(deviceState->fd.get(), 0, SEEK_SET);
n = read(deviceState->fd.get(), &state, USB_STATE_MAX_LEN);
if (kValidStates.find(state) == kValidStates.end()) {
ALOGE("Invalid state %s", state);
return;
}
ALOGI("Update USB device state: %s", state);
deviceState->states.push_back(state);
deviceState->timestamps.push_back(boot_clock::now());
evaluateComplianceWarning();
}
void UsbDataSessionMonitor::setupNewSession() {
mWarningSet.clear();
mDataSessionStart = boot_clock::now();
if (mDataRole == PortDataRole::DEVICE) {
clearDeviceStateEvents(&mDeviceState);
} else if (mDataRole == PortDataRole::HOST) {
clearDeviceStateEvents(&mHost1State);
clearDeviceStateEvents(&mHost2State);
}
if (mDataRole != PortDataRole::NONE) {
struct itimerspec delay = itimerspec();
delay.it_value.tv_sec = WARNING_SURFACE_DELAY_SEC;
int ret = timerfd_settime(mTimerFd.get(), 0, &delay, NULL);
if (ret < 0)
ALOGE("timerfd_settime failed err:%d", errno);
}
}
void UsbDataSessionMonitor::handleDataRoleEvent() {
int n;
PortDataRole newDataRole;
char role[DATA_ROLE_MAX_LEN] = {0};
lseek(mDataRoleFd.get(), 0, SEEK_SET);
n = read(mDataRoleFd.get(), &role, DATA_ROLE_MAX_LEN);
ALOGI("Update USB data role %s", role);
if (!std::strcmp(role, "host")) {
newDataRole = PortDataRole::HOST;
} else if (!std::strcmp(role, "device")) {
newDataRole = PortDataRole::DEVICE;
} else {
newDataRole = PortDataRole::NONE;
}
if (newDataRole != mDataRole) {
// Upload metrics for the last data session that has ended
if (mDataRole == PortDataRole::HOST || (mDataRole == PortDataRole::DEVICE && mUdcBind)) {
reportUsbDataSessionMetrics();
}
mDataRole = newDataRole;
setupNewSession();
}
}
void UsbDataSessionMonitor::updateUdcBindStatus(const std::string &devname) {
std::string function;
bool newUdcBind;
/*
* /sys/class/udc/<udc>/function prints out name of currently running USB gadget driver
* Ref: https://www.kernel.org/doc/Documentation/ABI/stable/sysfs-class-udc
* Empty name string means the udc device is not bound and gadget is pulldown.
*/
if (!ReadFileToString("/sys" + devname + "/function", &function))
return;
if (function == "")
newUdcBind = false;
else
newUdcBind = true;
if (newUdcBind == mUdcBind)
return;
if (mDataRole == PortDataRole::DEVICE) {
if (mUdcBind && !newUdcBind) {
/*
* Gadget soft pulldown: report metrics as the end of a data session and
* re-evaluate compliance warnings to clear existing warnings if any.
*/
reportUsbDataSessionMetrics();
evaluateComplianceWarning();
} else if (!mUdcBind && newUdcBind) {
// Gadget soft pullup: reset and start accounting for a new data session.
setupNewSession();
}
}
ALOGI("Udc bind status changes from %b to %b", mUdcBind, newUdcBind);
mUdcBind = newUdcBind;
}
void UsbDataSessionMonitor::handleUevent() {
char msg[UEVENT_MSG_LEN + 2];
char *cp;
int n;
n = uevent_kernel_multicast_recv(mUeventFd.get(), msg, UEVENT_MSG_LEN);
if (n <= 0)
return;
if (n >= UEVENT_MSG_LEN)
return;
msg[n] = '\0';
msg[n + 1] = '\0';
cp = msg;
while (*cp) {
for (auto e : {&mHost1State, &mHost2State}) {
if (std::regex_search(cp, std::regex(e->ueventRegex))) {
if (!strncmp(cp, "bind@", strlen("bind@"))) {
addEpollFile(mEpollFd.get(), e->filePath, e->fd);
} else if (!strncmp(cp, "unbind@", strlen("unbind@"))) {
removeEpollFile(mEpollFd.get(), e->filePath, e->fd);
}
}
}
// TODO: support bind@ unbind@ to detect dynamically allocated udc device
if (std::regex_search(cp, std::regex(mDeviceState.ueventRegex))) {
if (!strncmp(cp, "change@", strlen("change@"))) {
char *devname = cp + strlen("change@");
/*
* Udc device emits a KOBJ_CHANGE event on configfs driver bind and unbind.
* TODO: upstream udc driver emits KOBJ_CHANGE event BEFORE unbind is actually
* executed. Add a short delay to get the correct state while working on a fix
* upstream.
*/
usleep(50000);
updateUdcBindStatus(devname);
}
}
/* advance to after the next \0 */
while (*cp++) {
}
}
}
void UsbDataSessionMonitor::handleTimerEvent() {
int byteRead;
uint64_t numExpiration;
byteRead = read(mTimerFd.get(), &numExpiration, sizeof(numExpiration));
if (byteRead != sizeof(numExpiration)) {
ALOGE("incorrect read size");
}
if (numExpiration != 1) {
ALOGE("incorrect expiration count");
}
evaluateComplianceWarning();
}
void *UsbDataSessionMonitor::monitorThread(void *param) {
UsbDataSessionMonitor *monitor = (UsbDataSessionMonitor *)param;
struct epoll_event events[64];
int nevents = 0;
while (true) {
nevents = epoll_wait(monitor->mEpollFd.get(), events, 64, -1);
if (nevents == -1) {
if (errno == EINTR)
continue;
ALOGE("usb epoll_wait failed; errno=%d", errno);
break;
}
for (int n = 0; n < nevents; ++n) {
if (events[n].data.fd == monitor->mUeventFd.get()) {
monitor->handleUevent();
} else if (events[n].data.fd == monitor->mTimerFd.get()) {
monitor->handleTimerEvent();
} else if (events[n].data.fd == monitor->mDataRoleFd.get()) {
monitor->handleDataRoleEvent();
} else if (events[n].data.fd == monitor->mDeviceState.fd.get()) {
monitor->handleDeviceStateEvent(&monitor->mDeviceState);
} else if (events[n].data.fd == monitor->mHost1State.fd.get()) {
monitor->handleDeviceStateEvent(&monitor->mHost1State);
} else if (events[n].data.fd == monitor->mHost2State.fd.get()) {
monitor->handleDeviceStateEvent(&monitor->mHost2State);
}
}
}
return NULL;
}
} // namespace usb
} // namespace hardware
} // namespace android
} // namespace aidl

View File

@@ -0,0 +1,117 @@
/*
* Copyright (C) 2023 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.
*/
#pragma once
#include <aidl/android/hardware/usb/ComplianceWarning.h>
#include <aidl/android/hardware/usb/PortDataRole.h>
#include <android-base/chrono_utils.h>
#include <android-base/unique_fd.h>
#include <set>
#include <string>
#include <vector>
namespace aidl {
namespace android {
namespace hardware {
namespace usb {
using ::aidl::android::hardware::usb::ComplianceWarning;
using ::aidl::android::hardware::usb::PortDataRole;
using ::android::base::boot_clock;
using ::android::base::unique_fd;
/*
* UsbDataSessionMonitor monitors the usb device state sysfs of 3 different usb devices
* including device mode (udc), host mode high-speed port and host mode super-speed port. It
* reports Suez metrics for each data session and also provides API to query the compliance
* warnings detected in the current usb data session.
*/
class UsbDataSessionMonitor {
public:
/*
* The host mode high-speed port and super-speed port can be assigned to either host1 or
* host2 without affecting functionality.
*
* UeventRegex: name regex of the device that's being monitored. The regex is matched against
* uevent to detect dynamic creation/deletion/change of the device.
* StatePath: usb device state sysfs path of the device, monitored by epoll.
* dataRolePath: path to the usb data role sysfs, monitored by epoll.
* updatePortStatusCb: the callback is invoked when the compliance warings changes.
*/
UsbDataSessionMonitor(const std::string &deviceUeventRegex, const std::string &deviceStatePath,
const std::string &host1UeventRegex, const std::string &host1StatePath,
const std::string &host2UeventRegex, const std::string &host2StatePath,
const std::string &dataRolePath,
std::function<void()> updatePortStatusCb);
~UsbDataSessionMonitor();
// Returns the compliance warnings detected in the current data session.
void getComplianceWarnings(const PortDataRole &role, std::vector<ComplianceWarning> *warnings);
private:
struct usbDeviceState {
unique_fd fd;
std::string filePath;
std::string ueventRegex;
// Usb device states reported by state sysfs
std::vector<std::string> states;
// Timestamps of when the usb device states were captured
std::vector<boot_clock::time_point> timestamps;
};
static void *monitorThread(void *param);
void handleUevent();
void handleTimerEvent();
void handleDataRoleEvent();
void handleDeviceStateEvent(struct usbDeviceState *deviceState);
void clearDeviceStateEvents(struct usbDeviceState *deviceState);
void setupNewSession();
void reportUsbDataSessionMetrics();
void evaluateComplianceWarning();
void notifyComplianceWarning();
void updateUdcBindStatus(const std::string &devname);
pthread_t mMonitor;
unique_fd mEpollFd;
unique_fd mUeventFd;
unique_fd mTimerFd;
unique_fd mDataRoleFd;
struct usbDeviceState mDeviceState;
struct usbDeviceState mHost1State;
struct usbDeviceState mHost2State;
std::set<ComplianceWarning> mWarningSet;
// Callback function to notify the caller when there's a change in compliance warnings.
std::function<void()> mUpdatePortStatusCb;
/*
* Cache relevant info for a USB data session when one starts, including
* the data role and the time when the session starts.
*/
PortDataRole mDataRole;
boot_clock::time_point mDataSessionStart;
/*
* In gadget mode: this indicates whether the udc device is bound to the configfs driver, which
* is done by userspace writing the udc device name to /config/usb_gadget/g1/UDC. When unbound,
* the gadget is in soft pulldown state and is expected not to enumerate. During gadget
* function switch, the udc device usually go through unbind and bind.
*/
bool mUdcBind;
};
} // namespace usb
} // namespace hardware
} // namespace android
} // namespace aidl