diff --git a/BoardConfig-common.mk b/BoardConfig-common.mk
index b95275d0..7c0ed426 100644
--- a/BoardConfig-common.mk
+++ b/BoardConfig-common.mk
@@ -241,7 +241,7 @@ $(call soong_config_set,aoc_audio_func,ext_hidl,true)
ifneq (,$(filter userdebug 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_tunning_keys,true)
+$(call soong_config_set,aoc_audio_func,record_tuning_keys,true)
endif
ifneq (,$(filter aosp_%,$(TARGET_PRODUCT)))
diff --git a/OWNERS b/OWNERS
index 1cbf9196..4bdbb973 100644
--- a/OWNERS
+++ b/OWNERS
@@ -1,2 +1,2 @@
# per-file for Pixel device makefiles, see go/pixel-device-mk-owner-checklist for details.
-per-file *.mk=file:device/google/gs-common:master:/OWNERS
+per-file *.mk=file:device/google/gs-common:main:/OWNERS
diff --git a/PREUPLOAD.cfg b/PREUPLOAD.cfg
new file mode 100644
index 00000000..37ebb5e7
--- /dev/null
+++ b/PREUPLOAD.cfg
@@ -0,0 +1,2 @@
+[Builtin Hooks]
+jsonlint = true
diff --git a/conf/init.zuma.rc b/conf/init.zuma.rc
index fc70b8b4..c7558410 100644
--- a/conf/init.zuma.rc
+++ b/conf/init.zuma.rc
@@ -24,30 +24,30 @@ on init
write /dev/sys/fs/by-name/userdata/data_io_flag 56
write /dev/sys/fs/by-name/userdata/node_io_flag 56
- chown system system /proc/vendor_sched/set_task_group_bg
- chown system system /proc/vendor_sched/set_task_group_cam
- chown system system /proc/vendor_sched/set_task_group_fg
- chown system system /proc/vendor_sched/set_task_group_nnapi
- chown system system /proc/vendor_sched/set_task_group_sys
- chown system system /proc/vendor_sched/set_task_group_sysbg
- chown system system /proc/vendor_sched/set_task_group_ta
- chown system system /proc/vendor_sched/set_task_group_rt
- chown system system /proc/vendor_sched/set_task_group_sf
- chown system system /proc/vendor_sched/set_task_group_dex2oat
- chown system system /proc/vendor_sched/set_task_group_cam_power
- chown system system /proc/vendor_sched/set_task_group_ota
- chown system system /proc/vendor_sched/set_proc_group_bg
- chown system system /proc/vendor_sched/set_proc_group_cam
- chown system system /proc/vendor_sched/set_proc_group_fg
- chown system system /proc/vendor_sched/set_proc_group_nnapi
- chown system system /proc/vendor_sched/set_proc_group_sys
- chown system system /proc/vendor_sched/set_proc_group_sysbg
- chown system system /proc/vendor_sched/set_proc_group_ta
- chown system system /proc/vendor_sched/set_proc_group_rt
- chown system system /proc/vendor_sched/set_proc_group_sf
- chown system system /proc/vendor_sched/set_proc_group_dex2oat
- chown system system /proc/vendor_sched/set_proc_group_cam_power
- chown system system /proc/vendor_sched/set_proc_group_ota
+ 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
@@ -75,30 +75,30 @@ 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/set_task_group_bg
- chmod 0220 /proc/vendor_sched/set_task_group_cam
- chmod 0220 /proc/vendor_sched/set_task_group_fg
- chmod 0220 /proc/vendor_sched/set_task_group_nnapi
- chmod 0220 /proc/vendor_sched/set_task_group_sys
- chmod 0220 /proc/vendor_sched/set_task_group_sysbg
- chmod 0220 /proc/vendor_sched/set_task_group_ta
- chmod 0220 /proc/vendor_sched/set_task_group_rt
- chmod 0220 /proc/vendor_sched/set_task_group_sf
- chmod 0220 /proc/vendor_sched/set_task_group_dex2oat
- chmod 0220 /proc/vendor_sched/set_task_group_cam_power
- chmod 0220 /proc/vendor_sched/set_task_group_ota
- chmod 0220 /proc/vendor_sched/set_proc_group_bg
- chmod 0220 /proc/vendor_sched/set_proc_group_cam
- chmod 0220 /proc/vendor_sched/set_proc_group_fg
- chmod 0220 /proc/vendor_sched/set_proc_group_nnapi
- chmod 0220 /proc/vendor_sched/set_proc_group_sys
- chmod 0220 /proc/vendor_sched/set_proc_group_sysbg
- chmod 0220 /proc/vendor_sched/set_proc_group_ta
- chmod 0220 /proc/vendor_sched/set_proc_group_rt
- chmod 0220 /proc/vendor_sched/set_proc_group_sf
- chmod 0220 /proc/vendor_sched/set_proc_group_dex2oat
- chmod 0220 /proc/vendor_sched/set_proc_group_cam_power
- chmod 0220 /proc/vendor_sched/set_proc_group_ota
+ 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
@@ -119,6 +119,9 @@ on init
write /sys/block/zram0/comp_algorithm lz77eh
write /proc/sys/vm/page-cluster 0
+ # adjust PCP high level
+ write /proc/sys/vm/percpu_pagelist_high_fraction 430
+
# Some user code relies on ro.boot.hardware.revision
setprop ro.boot.hardware.revision ${ro.revision}
@@ -164,12 +167,12 @@ on init
mkdir /dev/socket/pdx/system/vr/sensors 0775 system system
# Boot time 183626384
- write /proc/vendor_sched/ta_uclamp_min 221
- write /proc/vendor_sched/ta_prefer_idle 1
- write /proc/vendor_sched/fg_uclamp_min 221
- write /proc/vendor_sched/fg_prefer_idle 1
- write /proc/vendor_sched/sys_uclamp_min 221
- write /proc/vendor_sched/sys_prefer_idle 1
+ write /proc/vendor_sched/groups/ta/uclamp_min 221
+ write /proc/vendor_sched/groups/ta/prefer_idle 1
+ write /proc/vendor_sched/groups/fg/uclamp_min 221
+ write /proc/vendor_sched/groups/fg/prefer_idle 1
+ 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
@@ -222,8 +225,8 @@ 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/cam_prefer_idle 1
- write /proc/vendor_sched/cam_uclamp_min 1
+ 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
@@ -238,11 +241,7 @@ on init
chown system system /sys/class/power_supply/maxfg_base/m5_model_state
# Dump eeprom
- chown system system /sys/devices/platform/10970000.hsi2c/i2c-5/5-0050/eeprom
- chown system system /sys/devices/platform/10970000.hsi2c/i2c-4/4-0050/eeprom
- chown system system /sys/devices/platform/10da0000.hsi2c/i2c-6/6-0050/eeprom
- chown system system /sys/devices/platform/10c90000.hsi2c/i2c-6/6-0050/eeprom
- chown system system /sys/devices/platform/10c90000.hsi2c/i2c-7/7-0050/eeprom
+ chown system system /sys/devices/platform/10c90000.hsi2c/i2c-9/9-0050/eeprom
chown system system /dev/battery_history
chmod 0644 /dev/battery_history
@@ -315,8 +314,8 @@ on init
chown system system /dev/bbd_pwrstat
# Add a boost for NNAPI HAL
- write /proc/vendor_sched/nnapi_prefer_idle 0
- write /proc/vendor_sched/nnapi_uclamp_min 512
+ 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
@@ -413,6 +412,9 @@ on post-fs-data
# Modem extended log folder
mkdir /data/vendor/radio/extended_logs 0770 radio system
+ # Log Mask Library Mask storage paths
+ mkdir /data/vendor/radio/log_masks 777 system system
+
# Modem MDS log folder
mkdir /data/vendor/radio/mds 0771 radio system
@@ -474,32 +476,32 @@ on post-fs-data
on zygote-start
# For PixelLogger configuration file.
chmod 0771 /data/vendor/wifi
- write /proc/vendor_sched/ta_uclamp_min 1
- write /proc/vendor_sched/fg_uclamp_min 0
- write /proc/vendor_sched/sys_uclamp_min 0
- write /proc/vendor_sched/ta_preferred_idle_mask_low 0x03f
- write /proc/vendor_sched/ta_preferred_idle_mask_mid 0x1f0
- write /proc/vendor_sched/ta_preferred_idle_mask_high 0x1f0
- write /proc/vendor_sched/ta_prefer_idle 1
- write /proc/vendor_sched/fg_preferred_idle_mask_low 0x03f
- write /proc/vendor_sched/fg_preferred_idle_mask_mid 0x1f0
- write /proc/vendor_sched/fg_preferred_idle_mask_high 0x1f0
- write /proc/vendor_sched/fg_prefer_idle 1
- write /proc/vendor_sched/sys_preferred_idle_mask_low 0x03f
- write /proc/vendor_sched/sys_preferred_idle_mask_mid 0x1f0
- write /proc/vendor_sched/sys_preferred_idle_mask_high 0x1f0
- write /proc/vendor_sched/sys_prefer_idle 1
+ write /proc/vendor_sched/groups/ta/uclamp_min 1
+ write /proc/vendor_sched/groups/fg/uclamp_min 0
+ write /proc/vendor_sched/groups/sys/uclamp_min 0
+ write /proc/vendor_sched/groups/ta/preferred_idle_mask_low 0x03f
+ write /proc/vendor_sched/groups/ta/preferred_idle_mask_mid 0x1f0
+ write /proc/vendor_sched/groups/ta/preferred_idle_mask_high 0x1f0
+ write /proc/vendor_sched/groups/ta/prefer_idle 1
+ write /proc/vendor_sched/groups/fg/preferred_idle_mask_low 0x03f
+ write /proc/vendor_sched/groups/fg/preferred_idle_mask_mid 0x1f0
+ write /proc/vendor_sched/groups/fg/preferred_idle_mask_high 0x1f0
+ write /proc/vendor_sched/groups/fg/prefer_idle 1
+ write /proc/vendor_sched/groups/sys/preferred_idle_mask_low 0x03f
+ write /proc/vendor_sched/groups/sys/preferred_idle_mask_mid 0x1f0
+ write /proc/vendor_sched/groups/sys/preferred_idle_mask_high 0x1f0
+ write /proc/vendor_sched/groups/sys/prefer_idle 1
- write /proc/vendor_sched/bg_ug 0
- write /proc/vendor_sched/sysbg_ug 0
- write /proc/vendor_sched/ota_ug 0
- write /proc/vendor_sched/dex2oat_ug 1
- write /proc/vendor_sched/ta_ug 2
- write /proc/vendor_sched/fg_ug 2
- write /proc/vendor_sched/nnapi_ug 2
- write /proc/vendor_sched/rt_ug 2
- write /proc/vendor_sched/sf_ug 2
- write /proc/vendor_sched/sys_ug 2
+ 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 2
+ write /proc/vendor_sched/groups/fg/ug 2
+ write /proc/vendor_sched/groups/nnapi/ug 2
+ write /proc/vendor_sched/groups/rt/ug 2
+ write /proc/vendor_sched/groups/sf/ug 2
+ write /proc/vendor_sched/groups/sys/ug 2
on post-fs-data
@@ -640,6 +642,9 @@ on fs
mount_all /vendor/etc/fstab.modem --early
restorecon_recursive /mnt/vendor/modem_img
+ # for battery defender
+ mkdir /mnt/vendor/persist/battery 0700 system system
+
restorecon_recursive /mnt/vendor/persist
restorecon_recursive /mnt/vendor/persist/aoc
restorecon_recursive /mnt/vendor/persist/audio
@@ -670,7 +675,9 @@ on fs
chown system system /sys/devices/platform/exynos-drm/primary-panel/panel_idle
chown system system /sys/devices/platform/exynos-drm/primary-panel/panel_need_handle_idle_exit
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/module/drm/parameters/vblankoffdelay
+ chown system system /sys/module/drm/parameters/debug
chown system system /sys/class/dqe0/atc/ambient_light
chown system system /sys/class/dqe0/atc/st
chown system system /sys/class/dqe0/atc/en
@@ -693,6 +700,8 @@ on fs
chown system system /sys/class/dqe0/atc/gain_limit
chown system system /sys/class/dqe0/atc/lt_calc_ab_shift
+ chown system system /sys/devices/platform/110f0000.drmdp/drm-displayport/dp_hotplug_error_code
+
chown system system /sys/devices/platform/19470000.drmdecon/early_wakeup
chmod 0660 /sys/devices/platform/19470000.drmdecon/early_wakeup
@@ -806,15 +815,15 @@ on property:sys.boot_completed=1
write /sys/devices/platform/17000010.devfreq_mif/devfreq/17000010.devfreq_mif/exynos_data/cancel_boot_freq 1
# Restore prefer idle
- write /proc/vendor_sched/ta_preferred_idle_mask_low 0x1ff
- write /proc/vendor_sched/ta_preferred_idle_mask_mid 0x1ff
- write /proc/vendor_sched/ta_preferred_idle_mask_high 0x1ff
- write /proc/vendor_sched/fg_preferred_idle_mask_low 0x1ff
- write /proc/vendor_sched/fg_preferred_idle_mask_mid 0x1ff
- write /proc/vendor_sched/fg_preferred_idle_mask_high 0x1ff
- write /proc/vendor_sched/sys_preferred_idle_mask_low 0x1ff
- write /proc/vendor_sched/sys_preferred_idle_mask_mid 0x1ff
- write /proc/vendor_sched/sys_preferred_idle_mask_high 0x1ff
+ write /proc/vendor_sched/groups/ta/preferred_idle_mask_low 0x1ff
+ write /proc/vendor_sched/groups/ta/preferred_idle_mask_mid 0x1ff
+ write /proc/vendor_sched/groups/ta/preferred_idle_mask_high 0x1ff
+ write /proc/vendor_sched/groups/fg/preferred_idle_mask_low 0x1ff
+ write /proc/vendor_sched/groups/fg/preferred_idle_mask_mid 0x1ff
+ write /proc/vendor_sched/groups/fg/preferred_idle_mask_high 0x1ff
+ write /proc/vendor_sched/groups/sys/preferred_idle_mask_low 0x1ff
+ write /proc/vendor_sched/groups/sys/preferred_idle_mask_mid 0x1ff
+ write /proc/vendor_sched/groups/sys/preferred_idle_mask_high 0x1ff
# Setup final cpuset
write /dev/cpuset/top-app/cpus 0-8
@@ -826,26 +835,26 @@ on property:sys.boot_completed=1
setprop vendor.powerhal.init 1
# Setup final cpu.uclamp
- write /proc/vendor_sched/ta_uclamp_min 1
- write /proc/vendor_sched/fg_uclamp_min 0
- write /proc/vendor_sched/sys_prefer_idle 0
+ 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/bg_ug 0
- write /proc/vendor_sched/sysbg_ug 0
- write /proc/vendor_sched/ota_ug 0
- write /proc/vendor_sched/dex2oat_ug 1
- write /proc/vendor_sched/ta_ug 1
+ 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/bg_uclamp_max 130
- write /proc/vendor_sched/sysbg_uclamp_max 512
- write /proc/vendor_sched/ota_uclamp_max 512
- write /proc/vendor_sched/dex2oat_uclamp_max -2
+ write /proc/vendor_sched/groups/bg/uclamp_max 130
+ write /proc/vendor_sched/groups/sys_bg/uclamp_max 512
+ write /proc/vendor_sched/groups/ota/uclamp_max 512
+ write /proc/vendor_sched/groups/dex2oat/uclamp_max -2
write /proc/vendor_sched/uclamp_max_filter_divider 4
write /proc/vendor_sched/uclamp_max_filter_rt 16
@@ -1149,12 +1158,12 @@ on charger
# Cancel boot devfreq and uclamp
write /sys/devices/platform/17000010.devfreq_mif/devfreq/17000010.devfreq_mif/exynos_data/cancel_boot_freq 1
- write /proc/vendor_sched/ta_uclamp_min 0
- write /proc/vendor_sched/ta_prefer_idle 0
- write /proc/vendor_sched/fg_uclamp_min 0
- write /proc/vendor_sched/fg_prefer_idle 0
- write /proc/vendor_sched/sys_uclamp_min 0
- write /proc/vendor_sched/sys_prefer_idle 0
+ write /proc/vendor_sched/groups/ta/uclamp_min 0
+ write /proc/vendor_sched/groups/ta/prefer_idle 0
+ write /proc/vendor_sched/groups/fg/uclamp_min 0
+ write /proc/vendor_sched/groups/fg/prefer_idle 0
+ write /proc/vendor_sched/groups/sys/uclamp_min 0
+ write /proc/vendor_sched/groups/sys/prefer_idle 0
on property:vendor.disable.bcl.control=1
write /sys/devices/virtual/pmic/mitigation/instruction/enable_mitigation 0
diff --git a/conf/init.zuma.usb.rc b/conf/init.zuma.usb.rc
index 4dff012a..2cbb30b5 100644
--- a/conf/init.zuma.usb.rc
+++ b/conf/init.zuma.usb.rc
@@ -370,6 +370,8 @@ on boot
write sys/module/usbcore/parameters/initial_descriptor_timeout 500
# Use USB Gadget HAL
setprop sys.usb.configfs 2
+ # Enable in-kernel media-presence polling for SD cards
+ write /sys/module/block/parameters/events_dfl_poll_msecs 2000
on property:sys.usb.ffs.ready=1 && property:sys.usb.config=adb && property:sys.usb.configfs=1
write /config/usb_gadget/g1/idProduct 0x4EE7
diff --git a/conf/ueventd.zuma.rc b/conf/ueventd.zuma.rc
index 9f4d2b31..8564d994 100644
--- a/conf/ueventd.zuma.rc
+++ b/conf/ueventd.zuma.rc
@@ -155,6 +155,10 @@
/dev/acd-com.google.chre 0660 system system
/dev/acd-com.google.chre.non_wake_up 0660 system system
+# BT
+/dev/acd-com.google.bt 0660 system system
+/dev/acd-com.google.bt.non_wake_up 0660 system system
+
# LWIS
/dev/lwis* 0660 system system
@@ -239,3 +243,6 @@
/sys/bus/aoc/devices/control udfps_set_clock_source 0220 system system
/sys/bus/aoc/devices/control udfps_get_osc_freq 0440 system system
/sys/bus/aoc/devices/control udfps_get_disp_freq 0440 system system
+
+# USB Alt Modes
+/sys/devices/platform/10cb0000.hsi2c/i2c-*/*-0025/typec/port0/port0-partner/port0-partner.* mode1/active 0664 system system
\ No newline at end of file
diff --git a/default-permissions.xml b/default-permissions.xml
index 9175507b..582971c7 100644
--- a/default-permissions.xml
+++ b/default-permissions.xml
@@ -75,6 +75,11 @@
+
+
+
+
+
@@ -145,5 +150,15 @@
+
+
+
+
+
+
+
+
diff --git a/device-common.mk b/device-common.mk
index c875b5a1..1998d96d 100644
--- a/device-common.mk
+++ b/device-common.mk
@@ -56,6 +56,9 @@ PRODUCT_PRODUCT_PROPERTIES += \
# force enable MTE.
ifeq (,$(filter %_fullmte,$(TARGET_PRODUCT)))
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
diff --git a/device.mk b/device.mk
index 32610410..5d976f52 100644
--- a/device.mk
+++ b/device.mk
@@ -23,14 +23,16 @@ include device/google/gs-common/aoc/aoc.mk
include device/google/gs-common/trusty/trusty.mk
include device/google/gs-common/pcie/pcie.mk
include device/google/gs-common/storage/storage.mk
-include device/google/gs-common/thermal/thermal.mk
+include device/google/gs-common/thermal/dump/thermal.mk
+include device/google/gs-common/thermal/thermal_hal/device.mk
include device/google/gs-common/performance/perf.mk
include device/google/gs-common/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.mk
-include device/google/gs-common/gxp/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
include device/google/gs-common/radio/dump.mk
include device/google/gs-common/gear/dumpstate/aidl.mk
@@ -39,6 +41,7 @@ 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/zuma/dumpstate/item.mk
@@ -118,9 +121,13 @@ ifneq (,$(filter userdebug eng, $(TARGET_BUILD_VARIANT)))
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=30
+ logd.logpersistd.size=60
+
+PRODUCT_PRODUCT_PROPERTIES += \
+ ro.logcat.compress=true
endif
# From system.property
@@ -191,11 +198,19 @@ PRODUCT_PRODUCT_PROPERTIES += \
# Carrier configuration default location
PRODUCT_PROPERTY_OVERRIDES += \
- persist.vendor.radio.config.carrier_config_dir=/mnt/vendor/modem_img/images/default/confpack
+ persist.vendor.radio.config.carrier_config_dir=/vendor/firmware/carrierconfig
PRODUCT_PROPERTY_OVERRIDES += \
telephony.active_modems.max_count=2
+ifneq (,$(filter userdebug eng, $(TARGET_BUILD_VARIANT)))
+PRODUCT_PROPERTY_OVERRIDES += \
+ persist.vendor.usb.displayport.enabled=1
+else
+PRODUCT_PROPERTY_OVERRIDES += \
+ persist.vendor.usb.displayport.enabled=0
+endif
+
USE_LASSEN_OEMHOOK := true
# Use for GRIL
@@ -228,6 +243,7 @@ PRODUCT_SOONG_NAMESPACES += \
$(call soong_config_set,pixel_mali,soc,$(TARGET_BOARD_PLATFORM))
$(call soong_config_set,arm_gralloc,soc,$(TARGET_BOARD_PLATFORM))
+include device/google/gs-common/gpu/gpu.mk
PRODUCT_PACKAGES += \
csffw_image_prebuilt__firmware_prebuilt_ttux_mali_csffw.bin \
libGLES_mali \
@@ -256,7 +272,7 @@ endif
PRODUCT_VENDOR_PROPERTIES += \
vendor.mali.platform.config=/vendor/etc/mali/platform.config \
vendor.mali.debug.config=/vendor/etc/mali/debug.config \
- vendor.mali.base_protected_max_core_count=1 \
+ vendor.mali.base_protected_max_core_count=1 \
vendor.mali.base_protected_tls_max=67108864 \
vendor.mali.platform_agt_frequency_khz=24576
@@ -280,6 +296,9 @@ PRODUCT_VENDOR_PROPERTIES += \
graphics.gpu.profiler.support=true \
debug.renderengine.backend=skiaglthreaded \
+# b/295257834 Add HDR shaders to SurfaceFlinger's pre-warming cache
+PRODUCT_VENDOR_PROPERTIES += ro.surface_flinger.prime_shader_cache.ultrahdr=1
+
# GRAPHICS - GPU (end)
# ####################
@@ -405,6 +424,10 @@ PRODUCT_PROPERTY_OVERRIDES += \
persist.vendor.verbose_logging_enabled=false
endif
+# Vendor modem extensive logging default property
+PRODUCT_PROPERTY_OVERRIDES += \
+ persist.vendor.modem.extensive_logging_enabled=false
+
# CP Logging properties
PRODUCT_PROPERTY_OVERRIDES += \
ro.vendor.sys.modem.logging.loc = /data/vendor/slog \
@@ -527,7 +550,7 @@ PRODUCT_PACKAGES += \
PRODUCT_PACKAGES += \
android.hardware.graphics.mapper@4.0-impl \
- android.hardware.graphics.allocator-V1-service
+ android.hardware.graphics.allocator-V2-service
PRODUCT_PACKAGES += \
android.hardware.memtrack-service.pixel \
@@ -588,7 +611,7 @@ include device/google/gs-common/battery_mitigation/bcl.mk
$(call inherit-product, $(SRC_TARGET_DIR)/product/emulated_storage.mk)
$(call inherit-product, $(SRC_TARGET_DIR)/product/virtual_ab_ota/android_t_baseline.mk)
-PRODUCT_VIRTUAL_AB_COMPRESSION_METHOD := gz
+PRODUCT_VIRTUAL_AB_COMPRESSION_METHOD := lz4
# Enforce generic ramdisk allow list
$(call inherit-product, $(SRC_TARGET_DIR)/product/generic_ramdisk.mk)
@@ -663,6 +686,7 @@ 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.hwc_hotplug_error_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
@@ -797,11 +821,12 @@ endif
$(call inherit-product, system/core/trusty/trusty-storage.mk)
$(call inherit-product, system/core/trusty/trusty-base.mk)
-# Trusty unit test tool
+# Trusty unit test tool and code coverage tool
PRODUCT_PACKAGES_DEBUG += \
trusty-ut-ctrl \
tipc-test \
trusty_stats_test \
+ trusty-coverage-controller \
include device/google/gs101/confirmationui/confirmationui.mk
@@ -885,10 +910,6 @@ $(call inherit-product-if-exists, vendor/samsung_slsi/telephony/$(BOARD_USES_SHA
PRODUCT_PACKAGES += ShannonIms
-#RCS Test Messaging App
-PRODUCT_PACKAGES_DEBUG += \
- TestRcsApp
-
PRODUCT_PACKAGES += ShannonRcs
ifeq (,$(filter aosp_% factory_%,$(TARGET_PRODUCT)))
@@ -906,11 +927,6 @@ PRODUCT_PACKAGES += \
ImsMediaService \
libimsmedia
-# Boot Control HAL
-PRODUCT_PACKAGES += \
- android.hardware.boot-service.default-zuma\
- android.hardware.boot-service.default_recovery-zuma
-
# Exynos RIL and telephony
# Multi SIM(DSDS)
SIM_COUNT := 2
@@ -963,20 +979,40 @@ endif
# modem logging binary/configs
PRODUCT_PACKAGES += modem_logging_control
-# modem logging configs
+# PILOT SCENARIOS
+PRODUCT_PACKAGES += \
+ Pixel_stability.cfg \
+ Pixel_stability.nprf
+
+# Default modem log mask for pixel logger
PRODUCT_PACKAGES += \
logging.conf \
default.cfg \
default.nprf \
default_metrics.xml \
- Pixel_stability.cfg \
- Pixel_stability.nprf
+ extensive_logging.conf
+
+# Log Masks for logmasklibrary below
+# default modem log mask
+PRODUCT_PACKAGES += \
+ default_modem_log_mask.conf \
+ default_modem_log_mask.cfg \
+ default_modem_log_mask.nprf \
+ default_modem_log_mask.xml
+
+# Empty modem log mask
+PRODUCT_PACKAGES += \
+ empty_modem_log_mask.conf \
+ empty_modem_log_mask.cfg \
+ empty_modem_log_mask.nprf \
+ empty_modem_log_mask.xml
+
+# Lassen default log mask
+PRODUCT_PACKAGES += \
+ lassen_default.conf
endif
-# ARM NN files
-ARM_COMPUTE_CL_ENABLE := 1
-
# Vibrator Diag
PRODUCT_PACKAGES_DEBUG += \
diag-vibrator \
@@ -990,7 +1026,11 @@ PRODUCT_PACKAGES += \
# Audio
# Audio HAL Server & Default Implementations
+ifeq ($(RELEASE_PIXEL_AIDL_AUDIO_HAL),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 += \
@@ -1045,7 +1085,6 @@ PRODUCT_PACKAGES += \
include device/google/gs101/telephony/pktrouter.mk
# Thermal HAL
-include hardware/google/pixel/thermal/device.mk
PRODUCT_PROPERTY_OVERRIDES += persist.vendor.enable.thermal.genl=true
# EdgeTPU
@@ -1132,10 +1171,6 @@ PRODUCT_VENDOR_PROPERTIES += ro.crypto.metadata_init_delete_all_keys.enabled?=tr
PRODUCT_PROPERTY_OVERRIDES += \
ro.crypto.volume.options=aes-256-xts:aes-256-hctr2
-# Increase lmkd aggressiveness
-PRODUCT_PROPERTY_OVERRIDES += \
- ro.lmk.swap_free_low_percentage=100
-
# Hardware Info Collection
include hardware/google/pixel/HardwareInfo/HardwareInfo.mk
diff --git a/device_framework_matrix_product.xml b/device_framework_matrix_product.xml
index fd21189e..b5128682 100644
--- a/device_framework_matrix_product.xml
+++ b/device_framework_matrix_product.xml
@@ -76,9 +76,9 @@
default
-
+
com.google.face.debug
- 4
+ 3-4
IDebugHost
default
@@ -104,9 +104,17 @@
default
+
+ com.google.edgetpu.tachyon
+ 1
+
+ IComputeService
+ default
+
+
com.google.hardware.pixel.display
- 9
+ 10
IDisplay
default
@@ -122,7 +130,7 @@
com.google.input
- 2
+ 1-2
ITouchContextService
default
@@ -153,7 +161,7 @@
vendor.google.google_battery
- 2
+ 2-3
IGoogleBattery
default
@@ -169,7 +177,7 @@
vendor.google.wifi_ext
- 1
+ 2-3
IWifiExt
default
@@ -185,6 +193,13 @@
sced0
+
+ com.google.pixel.modem.logmasklibrary
+
+ ILiboemserviceProxy
+ default
+
+
vendor.samsung_slsi.telephony.hardware.radioExternal
1.1
diff --git a/dumpstate/Android.bp b/dumpstate/Android.bp
index d5ec7add..8960ac43 100644
--- a/dumpstate/Android.bp
+++ b/dumpstate/Android.bp
@@ -9,18 +9,21 @@ sh_binary {
sub_dir: "dump",
}
-sh_binary {
- name: "dump_power.sh",
- src: "dump_power.sh",
+cc_binary {
+ name: "dump_power",
+ srcs: ["dump_power.cpp"],
+ cflags: [
+ "-Wall",
+ "-Wextra",
+ "-Werror",
+ ],
+ shared_libs: [
+ "libbase",
+ "libdump",
+ "libdumpstateutil",
+ ],
vendor: true,
- sub_dir: "dump",
-}
-
-sh_binary {
- name: "dump_cma.sh",
- src: "dump_cma.sh",
- vendor: true,
- sub_dir: "dump",
+ relative_install_path: "dump",
}
sh_binary {
@@ -29,3 +32,4 @@ sh_binary {
vendor: true,
sub_dir: "dump",
}
+
diff --git a/dumpstate/dump_cma.sh b/dumpstate/dump_cma.sh
deleted file mode 100644
index 63e497e7..00000000
--- a/dumpstate/dump_cma.sh
+++ /dev/null
@@ -1,9 +0,0 @@
-#!/vendor/bin/sh
-echo "------ CMA info ------"
-for d in $(ls -d /d/cma/*); do
- echo --- $d
- echo --- count; cat $d/count
- echo --- used; cat $d/used
- echo --- bitmap; cat $d/bitmap
-done
-
diff --git a/dumpstate/dump_power.cpp b/dumpstate/dump_power.cpp
new file mode 100644
index 00000000..a79921b1
--- /dev/null
+++ b/dumpstate/dump_power.cpp
@@ -0,0 +1,935 @@
+/*
+ * 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.
+ */
+
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+
+#include
+#include
+#include "DumpstateUtil.h"
+
+
+void printTitle(const char *msg) {
+ printf("\n------ %s ------\n", msg);
+}
+
+int getCommandOutput(const char *cmd, std::string *output) {
+ char buffer[1024];
+ FILE *pipe = popen(cmd, "r");
+ if (!pipe) {
+ return -1;
+ }
+
+ while (fgets(buffer, sizeof buffer, pipe) != NULL) {
+ *output += buffer;
+ }
+ pclose(pipe);
+
+ if (output->back() == '\n')
+ output->pop_back();
+
+ return 0;
+}
+
+bool isValidFile(const char *file) {
+ FILE *fp = fopen(file, "r");
+ if (fp != NULL) {
+ fclose(fp);
+ return true;
+ }
+ return false;
+}
+
+bool isValidDir(const char *directory) {
+ DIR *dir = opendir(directory);
+ if (dir == NULL)
+ return false;
+
+ closedir(dir);
+ return true;
+}
+
+bool isUserBuild() {
+ return ::android::os::dumpstate::PropertiesHelper::IsUserBuild();
+}
+
+int getFilesInDir(const char *directory, std::vector *files) {
+ std::string content;
+ struct dirent *entry;
+
+ DIR *dir = opendir(directory);
+ if (dir == NULL)
+ return -1;
+
+ files->clear();
+ while ((entry = readdir(dir)) != NULL)
+ files->push_back(entry->d_name);
+ closedir(dir);
+
+ sort(files->begin(), files->end());
+ return 0;
+}
+
+void dumpPowerStatsTimes() {
+ const char *title = "Power Stats Times";
+ char rBuff[128];
+ struct timespec rTs;
+ struct sysinfo info;
+ int ret;
+
+ printTitle(title);
+
+ sysinfo(&info);
+
+ const time_t boottime = time(NULL) - info.uptime;
+
+ ret = clock_gettime(CLOCK_REALTIME, &rTs);
+ if (ret)
+ return;
+
+ struct tm *nowTime = std::localtime(&rTs.tv_sec);
+
+ std::strftime(rBuff, sizeof(rBuff), "%m/%d/%Y %H:%M:%S", nowTime);
+ printf("Boot: %s", ctime(&boottime));
+ printf("Now: %s\n", rBuff);
+}
+
+int readContentsOfDir(const char* title, const char* directory, const char* strMatch,
+ bool useStrMatch = false, bool printDirectory = false) {
+ std::vector files;
+ std::string content;
+ std::string fileLocation;
+ int ret;
+
+ ret = getFilesInDir(directory, &files);
+ if (ret < 0)
+ return ret;
+
+ printTitle(title);
+ for (auto &file : files) {
+ if (useStrMatch && std::string::npos == std::string(file).find(strMatch)) {
+ continue;
+ }
+
+ fileLocation = std::string(directory) + std::string(file);
+ if (!android::base::ReadFileToString(fileLocation, &content)) {
+ continue;
+ }
+ if (printDirectory) {
+ printf("\n\n%s\n", fileLocation.c_str());
+ }
+ if (content.back() == '\n')
+ content.pop_back();
+ printf("%s\n", content.c_str());
+ }
+ return 0;
+}
+
+void dumpAcpmStats() {
+ const char* acpmDir = "/sys/devices/platform/acpm_stats/";
+ const char* statsSubStr = "_stats";
+ const char* acpmTitle = "ACPM stats";
+ readContentsOfDir(acpmTitle, acpmDir, statsSubStr, true, true);
+}
+
+void dumpPowerSupplyStats() {
+ const char* dumpList[][2] = {
+ {"CPU PM stats", "/sys/devices/system/cpu/cpupm/cpupm/time_in_state"},
+ {"GENPD summary", "/d/pm_genpd/pm_genpd_summary"},
+ {"Power supply property battery", "/sys/class/power_supply/battery/uevent"},
+ {"Power supply property dc", "/sys/class/power_supply/dc/uevent"},
+ {"Power supply property gcpm", "/sys/class/power_supply/gcpm/uevent"},
+ {"Power supply property gcpm_pps", "/sys/class/power_supply/gcpm_pps/uevent"},
+ {"Power supply property main-charger", "/sys/class/power_supply/main-charger/uevent"},
+ {"Power supply property dc-mains", "/sys/class/power_supply/dc-mains/uevent"},
+ {"Power supply property tcpm", "/sys/class/power_supply/tcpm-source-psy-11-0025/uevent"},
+ {"Power supply property usb", "/sys/class/power_supply/usb/uevent"},
+ {"Power supply property wireless", "/sys/class/power_supply/wireless/uevent"},
+ };
+
+ for (const auto &row : dumpList) {
+ dumpFileContent(row[0], row[1]);
+ }
+}
+
+void dumpMaxFg() {
+ const char *maxfgLoc = "/sys/class/power_supply/maxfg";
+
+ const char *maxfg [][2] = {
+ {"Power supply property maxfg", "/sys/class/power_supply/maxfg/uevent"},
+ {"m5_state", "/sys/class/power_supply/maxfg/m5_model_state"},
+ {"maxfg logbuffer", "/dev/logbuffer_maxfg"},
+ {"maxfg_monitor logbuffer", "/dev/logbuffer_maxfg_monitor"},
+ };
+
+ const char *maxfgFlip [][2] = {
+ {"Power supply property maxfg_base", "/sys/class/power_supply/maxfg_base/uevent"},
+ {"Power supply property maxfg_flip", "/sys/class/power_supply/maxfg_flip/uevent"},
+ {"m5_state", "/sys/class/power_supply/maxfg_base/m5_model_state"},
+ {"maxfg_base", "/dev/logbuffer_maxfg_base"},
+ {"maxfg_flip", "/dev/logbuffer_maxfg_flip"},
+ {"maxfg_base", "/dev/logbuffer_maxfg_base_monitor"},
+ {"maxfg_flip", "/dev/logbuffer_maxfg_flip_monitor"},
+ };
+
+ const char *maxfgHistoryName = "Maxim FG History";
+ const char *maxfgHistoryDir = "/dev/maxfg_history";
+
+ std::string content;
+
+
+ if (isValidDir(maxfgLoc)) {
+ for (const auto &row : maxfg) {
+ dumpFileContent(row[0], row[1]);
+ }
+ } else {
+ for (const auto &row : maxfgFlip) {
+ dumpFileContent(row[0], row[1]);
+ }
+ }
+
+ if (isValidFile(maxfgHistoryDir)) {
+ dumpFileContent(maxfgHistoryName, maxfgHistoryDir);
+ }
+}
+
+void dumpPowerSupplyDock() {
+ const char* powerSupplyPropertyDockTitle = "Power supply property dock";
+ const char* powerSupplyPropertyDockFile = "/sys/class/power_supply/dock/uevent";
+ if (isValidFile(powerSupplyPropertyDockFile)) {
+ dumpFileContent(powerSupplyPropertyDockTitle, powerSupplyPropertyDockFile);
+ }
+}
+
+void dumpLogBufferTcpm() {
+ const char* logbufferTcpmTitle = "Logbuffer TCPM";
+ const char* logbufferTcpmFile = "/dev/logbuffer_tcpm";
+ const char* debugTcpmFile = "/sys/kernel/debug/tcpm";
+ const char* tcpmLogTitle = "TCPM logs";
+ const char* tcpmFile = "/sys/kernel/debug/tcpm";
+ const char* tcpmFileAlt = "/sys/kernel/debug/usb/tcpm";
+ int retCode;
+
+ dumpFileContent(logbufferTcpmTitle, logbufferTcpmFile);
+
+ retCode = readContentsOfDir(tcpmLogTitle, isValidFile(debugTcpmFile) ? tcpmFile : tcpmFileAlt,
+ NULL);
+ if (retCode < 0)
+ printTitle(tcpmLogTitle);
+}
+
+void dumpTcpc() {
+ int ret;
+ const char* max77759TcpcHead = "TCPC";
+ const char* i2cSubDirMatch = "i2c-";
+ const char* directory = "/sys/devices/platform/10d60000.hsi2c/";
+ const char* max77759Tcpc [][2] {
+ {"registers:", "/i2c-max77759tcpc/registers"},
+ {"frs:", "/i2c-max77759tcpc/frs"},
+ {"auto_discharge:", "/i2c-max77759tcpc/auto_discharge"},
+ {"bcl2_enabled:", "/i2c-max77759tcpc/bcl2_enabled"},
+ {"cc_toggle_enable:", "/i2c-max77759tcpc/cc_toggle_enable"},
+ {"containment_detection:", "/i2c-max77759tcpc/containment_detection"},
+ {"containment_detection_status:", "/i2c-max77759tcpc/containment_detection_status"},
+ };
+
+ std::vector files;
+ std::string content;
+
+ printTitle(max77759TcpcHead);
+
+ ret = getFilesInDir(directory, &files);
+ if (ret < 0) {
+ for (auto &tcpcVal : max77759Tcpc)
+ printf("%s\n", tcpcVal[0]);
+ return;
+ }
+
+ for (auto &file : files) {
+ for (auto &tcpcVal : max77759Tcpc) {
+ printf("%s ", tcpcVal[0]);
+ if (std::string::npos == std::string(file).find(i2cSubDirMatch)) {
+ continue;
+ }
+
+ std::string fileName = directory + file + "/" + std::string(tcpcVal[1]);
+
+ if (!android::base::ReadFileToString(fileName, &content)) {
+ continue;
+ }
+
+ printf("%s\n", content.c_str());
+ }
+ }
+}
+
+void dumpPdEngine() {
+ const char* pdEngine [][2] {
+ {"PD Engine", "/dev/logbuffer_usbpd"},
+ {"PPS-google_cpm", "/dev/logbuffer_cpm"},
+ {"PPS-dc", "/dev/logbuffer_pca9468"},
+ };
+
+ for (const auto &row : pdEngine) {
+ dumpFileContent(row[0], row[1]);
+ }
+}
+
+void dumpEusbRepeater() {
+ const char* dumpTitle = "registers dump of eUSB repeater";
+ const char* dumpFile = "/d/eusb_repeater/registers";
+
+ if (isValidFile(dumpFile)) {
+ dumpFileContent(dumpTitle, dumpFile);
+ }
+}
+
+void dumpWc68() {
+ const char* wc68Title = "WC68";
+ const char* wc68File = "/dev/logbuffer_wc68";
+
+ if (isValidFile(wc68File)) {
+ dumpFileContent(wc68Title, wc68File);
+ }
+}
+
+void dumpLn8411() {
+ const char* ln8411Title = "LN8411";
+ const char* ln8411File = "/dev/logbuffer_ln8411";
+
+ if (isValidFile(ln8411File)) {
+ dumpFileContent(ln8411Title, ln8411File);
+ }
+}
+
+void dumpBatteryHealth() {
+ const char* batteryHealth [][2] {
+ {"Battery Health", "/sys/class/power_supply/battery/health_index_stats"},
+ {"BMS", "/dev/logbuffer_ssoc"},
+ {"TTF", "/dev/logbuffer_ttf"},
+ {"TTF details", "/sys/class/power_supply/battery/ttf_details"},
+ {"TTF stats", "/sys/class/power_supply/battery/ttf_stats"},
+ {"aacr_state", "/sys/class/power_supply/battery/aacr_state"},
+ {"maxq", "/dev/logbuffer_maxq"},
+ {"TEMP/DOCK-DEFEND", "/dev/logbuffer_bd"},
+ };
+
+ for (const auto &row : batteryHealth) {
+ dumpFileContent(row[0], row[1]);
+ }
+}
+
+void dumpBatteryDefend() {
+ const char* defendConfig [][4] {
+ {"TRICKLE-DEFEND Config",
+ "/sys/devices/platform/google,battery/power_supply/battery/", "bd_"},
+ {"DWELL-DEFEND Config", "/sys/devices/platform/google,charger/", "charge_s"},
+ {"DWELL-DEFEND Time", "/mnt/vendor/persist/battery/", "defender_"},
+ {"TEMP-DEFEND Config", "/sys/devices/platform/google,charger/", "bd_"},
+ };
+
+ std::vector files;
+ struct dirent *entry;
+ std::string content;
+ std::string fileLocation;
+
+ for (auto &config : defendConfig) {
+ DIR *dir = opendir(config[1]);
+ if (dir == NULL)
+ continue;
+
+ printTitle(config[0]);
+ while ((entry = readdir(dir)) != NULL) {
+ if (std::string(entry->d_name).find(config[2]) != std::string::npos &&
+ strncmp(config[2], entry->d_name, strlen(config[2])) == 0) {
+ files.push_back(entry->d_name);
+ }
+ }
+ closedir(dir);
+
+ sort(files.begin(), files.end());
+
+ for (auto &file : files) {
+ fileLocation = std::string(config[1]) + std::string(file);
+ if (!android::base::ReadFileToString(fileLocation, &content) || content.empty()) {
+ content = "\n";
+ }
+
+ printf("%s: %s", file.c_str(), content.c_str());
+
+ if (content.back() != '\n')
+ printf("\n");
+ }
+
+ files.clear();
+ }
+}
+
+void printValuesOfDirectory(const char *directory, std::string debugfs, const char *strMatch) {
+ std::vector files;
+ auto info = directory;
+ std::string content;
+ struct dirent *entry;
+ DIR *dir = opendir(debugfs.c_str());
+ if (dir == NULL)
+ return;
+
+ printTitle((debugfs + std::string(strMatch) + "/" + std::string(info)).c_str());
+ while ((entry = readdir(dir)) != NULL)
+ if (std::string(entry->d_name).find(strMatch) != std::string::npos)
+ files.push_back(entry->d_name);
+ closedir(dir);
+
+ sort(files.begin(), files.end());
+
+ for (auto &file : files) {
+ std::string fileDirectory = debugfs + file;
+ std::string fileLocation = fileDirectory + "/" + std::string(info);
+ if (!android::base::ReadFileToString(fileLocation, &content)) {
+ content = "\n";
+ }
+
+ printf("%s:\n%s", fileDirectory.c_str(), content.c_str());
+
+ if (content.back() != '\n')
+ printf("\n");
+ }
+ files.clear();
+}
+
+void dumpChgUserDebug() {
+ const char *chgDebugMax77759 [][2] {
+ {"max77759_chg registers dump", "/d/max77759_chg/registers"},
+ {"max77729_pmic registers dump", "/d/max77729_pmic/registers"},
+ };
+ const char *chgDebugMax77779 [][2] {
+ {"max77779_chg registers dump", "/d/max77779_chg/registers"},
+ {"max77779_pmic registers dump", "/d/max77779_pmic/registers"},
+ };
+
+ const std::string debugfs = "/d/";
+
+ const char *maxFgDir = "/d/maxfg";
+ const char *maxFgStrMatch = "maxfg";
+ const char *maxFg77779StrMatch = "max77779fg";
+ const char *baseChgDir = "/d/max77759_chg";
+ const char *dcRegName = "DC_registers dump";
+ const char *dcRegDir = "/sys/class/power_supply/dc-mains/device/registers_dump";
+ const char *chgTblName = "Charging table dump";
+ const char *chgTblDir = "/d/google_battery/chg_raw_profile";
+
+ const char *maxFgInfo [] {
+ "fg_model",
+ "algo_ver",
+ "model_ok",
+ "registers",
+ "nv_registers",
+ };
+
+ const char *max77779FgInfo [] {
+ "fg_model",
+ "algo_ver",
+ "model_ok",
+ "registers",
+ "debug_registers",
+ };
+
+ if (isUserBuild())
+ return;
+
+ if (isValidFile(dcRegDir)) {
+ dumpFileContent(dcRegName, dcRegDir);
+ }
+
+ if (isValidDir(baseChgDir)) {
+ for (auto &row : chgDebugMax77759) {
+ dumpFileContent(row[0], row[1]);
+ }
+ } else {
+ for (auto &row : chgDebugMax77779) {
+ dumpFileContent(row[0], row[1]);
+ }
+ }
+
+ dumpFileContent(chgTblName, chgTblDir);
+
+ if (isValidDir(maxFgDir)) {
+ for (auto & directory : maxFgInfo) {
+ printValuesOfDirectory(directory, debugfs, maxFgStrMatch);
+ }
+ } else {
+ for (auto & directory : max77779FgInfo) {
+ printValuesOfDirectory(directory, debugfs, maxFg77779StrMatch);
+ }
+ }
+}
+
+void dumpBatteryEeprom() {
+ const char *title = "Battery EEPROM";
+ const char *files[] {
+ "/sys/devices/platform/10c90000.hsi2c/i2c-9/9-0050/eeprom",
+ };
+ std::string result;
+ std::string xxdCmd;
+
+ printTitle(title);
+ for (auto &file : files) {
+ if (!isValidFile(file))
+ continue;
+
+ xxdCmd = "xxd " + std::string(file);
+
+ int ret = getCommandOutput(xxdCmd.c_str(), &result);
+ if (ret < 0)
+ return;
+
+ printf("%s\n", result.c_str());
+ }
+}
+
+void dumpChargerStats() {
+ const char *chgStatsTitle = "Charger Stats";
+ const char *chgStatsLocation = "/sys/class/power_supply/battery/charge_details";
+ const char *chargerStats [][3] {
+ {"Google Charger", "/sys/kernel/debug/google_charger/", "pps_"},
+ {"Google Battery", "/sys/kernel/debug/google_battery/", "ssoc_"},
+ };
+ std::vector files;
+ std::string content;
+ struct dirent *entry;
+
+ dumpFileContent(chgStatsTitle, chgStatsLocation);
+
+ if (isUserBuild())
+ return;
+
+ for (auto &stat : chargerStats) {
+ DIR *dir = opendir(stat[1]);
+ if (dir == NULL)
+ return;
+
+ printTitle(stat[0]);
+ while ((entry = readdir(dir)) != NULL)
+ if (std::string(entry->d_name).find(stat[2]) != std::string::npos)
+ files.push_back(entry->d_name);
+ closedir(dir);
+
+ sort(files.begin(), files.end());
+
+ for (auto &file : files) {
+ std::string fileLocation = std::string(stat[1]) + file;
+ if (!android::base::ReadFileToString(fileLocation, &content)) {
+ content = "\n";
+ }
+
+ printf("%s: %s", file.c_str(), content.c_str());
+
+ if (content.back() != '\n')
+ printf("\n");
+ }
+ files.clear();
+ }
+}
+
+void dumpWlcLogs() {
+ const char *dumpWlcList [][2] {
+ {"WLC Logs", "/dev/logbuffer_wireless"},
+ {"WLC VER", "/sys/class/power_supply/wireless/device/version"},
+ {"WLC STATUS", "/sys/class/power_supply/wireless/device/status"},
+ {"WLC FW Version", "/sys/class/power_supply/wireless/device/fw_rev"},
+ {"RTX", "/dev/logbuffer_rtx"},
+ };
+
+ for (auto &row : dumpWlcList) {
+ if (!isValidFile(row[1]))
+ printTitle(row[0]);
+ dumpFileContent(row[0], row[1]);
+ }
+}
+
+void dumpGvoteables() {
+ const char *directory = "/sys/kernel/debug/gvotables/";
+ const char *statusName = "/status";
+ const char *title = "gvotables";
+ std::string content;
+ std::vector files;
+ int ret;
+
+ if (isUserBuild())
+ return;
+
+ ret = getFilesInDir(directory, &files);
+ if (ret < 0)
+ return;
+
+ printTitle(title);
+ for (auto &file : files) {
+ std::string fileLocation = std::string(directory) + file + std::string(statusName);
+ if (!android::base::ReadFileToString(fileLocation, &content)) {
+ continue;
+ }
+
+ printf("%s: %s", file.c_str(), content.c_str());
+
+ if (content.back() != '\n')
+ printf("\n");
+ }
+ files.clear();
+}
+
+void dumpMitigation() {
+ const char *mitigationList [][2] {
+ {"Lastmeal" , "/data/vendor/mitigation/lastmeal.txt"},
+ {"Thismeal" , "/data/vendor/mitigation/thismeal.txt"},
+ };
+
+ for (auto &row : mitigationList) {
+ if (!isValidFile(row[1]))
+ printTitle(row[0]);
+ dumpFileContent(row[0], row[1]);
+ }
+}
+
+void dumpMitigationStats() {
+ int ret;
+ const char *directory = "/sys/devices/virtual/pmic/mitigation/last_triggered_count/";
+ const char *capacityDirectory = "/sys/devices/virtual/pmic/mitigation/last_triggered_capacity/";
+ const char *timestampDirectory =
+ "/sys/devices/virtual/pmic/mitigation/last_triggered_timestamp/";
+ const char *voltageDirectory = "/sys/devices/virtual/pmic/mitigation/last_triggered_voltage/";
+ const char *capacitySuffix = "_cap";
+ const char *timeSuffix = "_time";
+ const char *voltageSuffix = "_volt";
+ const char *countSuffix = "_count";
+ const char *title = "Mitigation Stats";
+
+ std::vector files;
+ std::string content;
+ std::string fileLocation;
+ std::string source;
+ std::string subModuleName;
+ int count;
+ int soc;
+ int time;
+ int voltage;
+
+ ret = getFilesInDir(directory, &files);
+ if (ret < 0)
+ return;
+
+ printTitle(title);
+ printf("Source\t\tCount\tSOC\tTime\tVoltage\n");
+
+ for (auto &file : files) {
+ fileLocation = std::string(directory) + std::string(file);
+ if (!android::base::ReadFileToString(fileLocation, &content)) {
+ continue;
+ }
+
+ ret = atoi(android::base::Trim(content).c_str());
+ if (ret == -1)
+ continue;
+ count = ret;
+
+ subModuleName = std::string(file);
+ subModuleName.erase(subModuleName.find(countSuffix), strlen(countSuffix));
+
+ fileLocation = std::string(capacityDirectory) + std::string(subModuleName) +
+ std::string(capacitySuffix);
+ if (!android::base::ReadFileToString(fileLocation, &content)) {
+ continue;
+ }
+ ret = atoi(android::base::Trim(content).c_str());
+ if (ret == -1)
+ continue;
+ soc = ret;
+
+ fileLocation = std::string(timestampDirectory) + std::string(subModuleName) +
+ std::string(timeSuffix);
+ if (!android::base::ReadFileToString(fileLocation, &content)) {
+ continue;
+ }
+ ret = atoi(android::base::Trim(content).c_str());
+ if (ret == -1)
+ continue;
+ time = ret;
+
+ fileLocation = std::string(voltageDirectory) + std::string(subModuleName) +
+ std::string(voltageSuffix);
+ if (!android::base::ReadFileToString(fileLocation, &content)) {
+ continue;
+ }
+ ret = atoi(android::base::Trim(content).c_str());
+ if (ret == -1)
+ continue;
+ voltage = ret;
+ printf("%s \t%i\t%i\t%i\t%i\n", subModuleName.c_str(), count, soc, time, voltage);
+ }
+}
+
+void dumpMitigationDirs() {
+ const int paramCount = 4;
+ const char *titles[] = {
+ "Clock Divider Ratio",
+ "Clock Stats",
+ "Triggered Level",
+ "Instruction",
+ };
+ const char *directories[] = {
+ "/sys/devices/virtual/pmic/mitigation/clock_ratio/",
+ "/sys/devices/virtual/pmic/mitigation/clock_stats/",
+ "/sys/devices/virtual/pmic/mitigation/triggered_lvl/",
+ "/sys/devices/virtual/pmic/mitigation/instruction/",
+ };
+ const char *paramSuffix[] = {"_ratio", "_stats", "_lvl", ""};
+ const char *titleRowVal[] = {
+ "Source\t\tRatio",
+ "Source\t\tStats",
+ "Source\t\tLevel",
+ "",
+ };
+ const int eraseCnt[] = {6, 6, 4, 0};
+ const bool useTitleRow[] = {true, true, true, false};
+
+ std::vector files;
+ std::string content;
+ std::string fileLocation;
+ std::string source;
+ std::string subModuleName;
+ std::string readout;
+
+ for (int i = 0; i < paramCount; i++) {
+ printTitle(titles[i]);
+ if (useTitleRow[i]) {
+ printf("%s\n", titleRowVal[i]);
+ }
+
+ getFilesInDir(directories[i], &files);
+
+ for (auto &file : files) {
+ fileLocation = std::string(directories[i]) + std::string(file);
+ if (!android::base::ReadFileToString(fileLocation, &content)) {
+ continue;
+ }
+
+ readout = android::base::Trim(content);
+
+ subModuleName = std::string(file);
+ subModuleName.erase(subModuleName.find(paramSuffix[i]), eraseCnt[i]);
+
+ if (useTitleRow[i]) {
+ printf("%s \t%s\n", subModuleName.c_str(), readout.c_str());
+ } else {
+ printf("%s=%s\n", subModuleName.c_str(), readout.c_str());
+ }
+ }
+ }
+}
+
+void dumpIrqDurationCounts() {
+ const char *title = "IRQ Duration Counts";
+ const char *colNames = "Source\t\t\t\tlt_5ms_cnt\tbt_5ms_to_10ms_cnt\tgt_10ms_cnt\tCode"
+ "\tCurrent Threshold (uA)\tCurrent Reading (uA)\n";
+ const int nonOdpmChannelCnt = 9;
+ const int odpmChCnt = 12;
+
+ enum Duration {
+ LT_5MS,
+ BT_5MS_10MS,
+ GT_10MS,
+ DUR_MAX,
+ };
+ const char *irqDurDirectories[] = {
+ "/sys/devices/virtual/pmic/mitigation/irq_dur_cnt/less_than_5ms_count",
+ "/sys/devices/virtual/pmic/mitigation/irq_dur_cnt/between_5ms_to_10ms_count",
+ "/sys/devices/virtual/pmic/mitigation/irq_dur_cnt/greater_than_10ms_count",
+ };
+
+ enum PowerWarn {
+ MAIN,
+ SUB,
+ PWRWARN_MAX,
+ };
+ const char *pwrwarnDirectories[] = {
+ "/sys/devices/virtual/pmic/mitigation/main_pwrwarn/",
+ "/sys/devices/virtual/pmic/mitigation/sub_pwrwarn/",
+ };
+
+ const char *lpfCurrentDirs[] = {
+ "/sys/devices/platform/acpm_mfd_bus@15500000/i2c-7/7-001f/s2mpg14-meter/"
+ "s2mpg14-odpm/iio:device1/lpf_current",
+ "/sys/devices/platform/acpm_mfd_bus@15510000/i2c-8/8-002f/s2mpg15-meter/"
+ "s2mpg15-odpm/iio:device0/lpf_current",
+ };
+
+ bool titlesInitialized = false;
+
+ std::vector channelNames;
+ std::vector channelData[DUR_MAX];
+ std::vector pwrwarnThreshold[PWRWARN_MAX];
+ std::vector pwrwarnCode[PWRWARN_MAX];
+ std::vector lpfCurrentVals[PWRWARN_MAX];
+ std::vector files;
+
+ std::string content;
+ std::string token;
+ std::string tokenCh;
+ std::string fileLocation;
+
+ for (int i = 0; i < DUR_MAX; i++) {
+ if (!android::base::ReadFileToString(irqDurDirectories[i], &content)) {
+ return;
+ }
+
+ std::istringstream tokenStream(content);
+
+ while (std::getline(tokenStream, token, '\n')) {
+ if (!titlesInitialized) {
+ tokenCh = token;
+ tokenCh.erase(tokenCh.find(':'), tokenCh.length());
+ channelNames.push_back(tokenCh);
+ }
+
+ // there is a space after the ':' which needs to be removed
+ token.erase(0, token.find(':') + 1);
+ channelData[i].push_back(token);
+
+ }
+ if (!titlesInitialized)
+ titlesInitialized = true;
+ }
+
+ for (int i = 0; i < PWRWARN_MAX; i++) {
+ getFilesInDir(pwrwarnDirectories[i], &files);
+
+ for (auto &file : files) {
+ fileLocation = std::string(pwrwarnDirectories[i]) + std::string(file);
+ if (!android::base::ReadFileToString(fileLocation, &content)) {
+ continue;
+ }
+
+ std::string readout;
+
+ readout = android::base::Trim(content);
+
+ std::string readoutThreshold = readout;
+ readoutThreshold.erase(0, readoutThreshold.find('=') + 1);
+
+ std::string readoutCode = readout;
+ readoutCode.erase(readoutCode.find('='), readoutCode.length());
+
+ pwrwarnThreshold[i].push_back(readoutThreshold);
+ pwrwarnCode[i].push_back(readoutCode);
+ }
+ }
+
+ for (int i = 0; i < PWRWARN_MAX; i++) {
+ if (!android::base::ReadFileToString(lpfCurrentDirs[i], &content)) {
+ continue;
+ }
+
+ std::istringstream tokenStream(content);
+
+ bool first = true;
+ while (std::getline(tokenStream, token, '\n')) {
+ token.erase(0, token.find(' '));
+ if (first) {
+ first = false;
+ continue;
+ }
+ lpfCurrentVals[i].push_back(token);
+ }
+ }
+
+ printTitle(title);
+ printf("%s", colNames);
+
+ for (uint i = 0; i < channelNames.size(); i++) {
+ std::string code = "";
+ std::string threshold = "";
+ std::string current = "";
+ std::string ltDataMsg = "";
+ std::string btDataMsg = "";
+ std::string gtDataMsg = "";
+ int pmicSel = 0;
+ int offset = 0;
+ std::string channelNameSuffix = " \t";
+ if (i >= nonOdpmChannelCnt) {
+ offset = nonOdpmChannelCnt;
+ if (i >= (odpmChCnt + nonOdpmChannelCnt)) {
+ pmicSel = 1;
+ offset = odpmChCnt + nonOdpmChannelCnt;
+ }
+ channelNameSuffix = "";
+
+ code = pwrwarnCode[pmicSel][i - offset];
+ threshold = pwrwarnThreshold[pmicSel][i - offset];
+ current = lpfCurrentVals[pmicSel][i - offset];
+ }
+
+ if (i < channelData[0].size())
+ ltDataMsg = channelData[0][i];
+
+ if (i < channelData[1].size())
+ btDataMsg = channelData[1][i];
+
+ if (i < channelData[2].size())
+ gtDataMsg = channelData[2][i];
+
+ std::string adjustedChannelName = channelNames[i] + channelNameSuffix;
+ printf("%s \t%s\t\t%s\t\t\t%s\t\t%s \t%s \t\t%s\n",
+ adjustedChannelName.c_str(),
+ ltDataMsg.c_str(),
+ btDataMsg.c_str(),
+ gtDataMsg.c_str(),
+ code.c_str(),
+ threshold.c_str(),
+ current.c_str());
+ }
+}
+
+int main() {
+ dumpPowerStatsTimes();
+ dumpAcpmStats();
+ dumpPowerSupplyStats();
+ dumpMaxFg();
+ dumpPowerSupplyDock();
+ dumpLogBufferTcpm();
+ dumpTcpc();
+ dumpPdEngine();
+ dumpEusbRepeater();
+ dumpWc68();
+ dumpLn8411();
+ dumpBatteryHealth();
+ dumpBatteryDefend();
+ dumpChgUserDebug();
+ dumpBatteryEeprom();
+ dumpChargerStats();
+ dumpWlcLogs();
+ dumpGvoteables();
+ dumpMitigation();
+ dumpMitigationStats();
+ dumpMitigationDirs();
+ dumpIrqDurationCounts();
+}
+
diff --git a/dumpstate/dump_power.sh b/dumpstate/dump_power.sh
deleted file mode 100644
index 8bf999c8..00000000
--- a/dumpstate/dump_power.sh
+++ /dev/null
@@ -1,421 +0,0 @@
-#!/vendor/bin/sh
-build_type="$(getprop ro.build.type)"
-echo "\n------ Power Stats Times ------"
-echo -n "Boot: " && /vendor/bin/uptime -s && echo -n "Now: " && date;
-
-echo "\n------ ACPM stats ------"
-for f in /sys/devices/platform/acpm_stats/*_stats ; do
- echo "\n\n$f"
- cat $f
-done
-
-echo "\n------ CPU PM stats ------"
-cat "/sys/devices/system/cpu/cpupm/cpupm/time_in_state"
-
-echo "\n------ GENPD summary ------"
-cat "/d/pm_genpd/pm_genpd_summary"
-
-echo "\n------ Power supply property battery ------"
-cat "/sys/class/power_supply/battery/uevent"
-echo "\n------ Power supply property dc ------"
-cat "/sys/class/power_supply/dc/uevent"
-echo "\n------ Power supply property gcpm ------"
-cat "/sys/class/power_supply/gcpm/uevent"
-echo "\n------ Power supply property gcpm_pps ------"
-cat "/sys/class/power_supply/gcpm_pps/uevent"
-echo "\n------ Power supply property main-charger ------"
-cat "/sys/class/power_supply/main-charger/uevent"
-echo "\n------ Power supply property dc-mains ------"
-cat "/sys/class/power_supply/dc-mains/uevent"
-echo "\n------ Power supply property tcpm ------"
-cat "/sys/class/power_supply/tcpm-source-psy-8-0025/uevent"
-echo "\n------ Power supply property usb ------"
-cat "/sys/class/power_supply/usb/uevent"
-echo "\n------ Power supply property wireless ------"
-cat "/sys/class/power_supply/wireless/uevent"
-
-if [ -d "/sys/class/power_supply/maxfg" ]
-then
- echo "\n------ Power supply property maxfg ------"
- cat "/sys/class/power_supply/maxfg/uevent"
- echo "\n------ m5_state ------"
- cat "/sys/class/power_supply/maxfg/m5_model_state"
- echo "\n------ maxfg ------"
- cat "/dev/logbuffer_maxfg"
- echo "\n------ maxfg ------"
- cat "/dev/logbuffer_maxfg_monitor"
-else
- echo "\n------ Power supply property maxfg_base ------"
- cat "/sys/class/power_supply/maxfg_base/uevent"
- echo "\n------ Power supply property maxfg_flip ------"
- cat "/sys/class/power_supply/maxfg_flip/uevent"
- echo "\n------ m5_state ------"
- cat "/sys/class/power_supply/maxfg_base/m5_model_state"
- echo "\n------ maxfg_base ------"
- cat "/dev/logbuffer_maxfg_base"
- echo "\n------ maxfg_flip ------"
- cat "/dev/logbuffer_maxfg_flip"
- echo "\n------ maxfg_base ------"
- cat "/dev/logbuffer_maxfg_base_monitor"
- echo "\n------ maxfg_flip ------"
- cat "/dev/logbuffer_maxfg_flip_monitor"
-fi
-
-if [ -e "/dev/maxfg_history" ]
-then
- echo "\n------ Maxim FG History ------"
- cat "/dev/maxfg_history"
-fi
-
-if [ -d "/sys/class/power_supply/dock" ]
-then
- echo "\n------ Power supply property dock ------"
- cat "/sys/class/power_supply/dock/uevent"
-fi
-
-if [ -e "/dev/logbuffer_tcpm" ]
-then
- echo "\n------ Logbuffer TCPM ------"
- cat "/dev/logbuffer_tcpm"
- if [ -d "/sys/kernel/debug/tcpm" ]
- then
- echo "\n------ TCPM logs ------"
- cat /sys/kernel/debug/tcpm/*
- else
- echo "\n------ TCPM logs ------"
- cat /sys/kernel/debug/usb/tcpm*
- fi
-fi
-
-echo "\n------ TCPC ------"
-for f in /sys/devices/platform/10d60000.hsi2c/i2c-*/i2c-max77759tcpc
-do
- echo "registers:"
- cat $f/registers
- echo "frs:"
- cat $f/frs
- echo "auto_discharge:"
- cat $f/auto_discharge
- echo "bc12_enabled:"
- cat $f/bc12_enabled
- echo "cc_toggle_enable:"
- cat $f/cc_toggle_enable
- echo "contaminant_detection:"
- cat $f/contaminant_detection
- echo "contaminant_detection_status:"
- cat $f/contaminant_detection_status
-done
-
-echo "\n------ PD Engine ------"
-cat "/dev/logbuffer_usbpd"
-echo "\n------ PPS-google_cpm ------"
-cat "/dev/logbuffer_cpm"
-echo "\n------ PPS-dc ------"
-cat "/dev/logbuffer_pca9468"
-
-if [ -e "/dev/logbuffer_wc68" ]
-then
- echo "\n------ WC68 ------"
- cat "/dev/logbuffer_wc68"
-fi
-
-if [ -e "/dev/logbuffer_ln8411" ]
-then
- echo "\n------ LN8411 ------"
- cat "/dev/logbuffer_ln8411"
-fi
-
-echo "\n------ Battery Health ------"
-cat "/sys/class/power_supply/battery/health_index_stats"
-echo "\n------ BMS ------"
-cat "/dev/logbuffer_ssoc"
-echo "\n------ TTF ------"
-cat "/dev/logbuffer_ttf"
-echo "\n------ TTF details ------"
-cat "/sys/class/power_supply/battery/ttf_details"
-echo "\n------ TTF stats ------"
-cat "/sys/class/power_supply/battery/ttf_stats"
-echo "\n------ aacr_state ------"
-cat "/sys/class/power_supply/battery/aacr_state"
-echo "\n------ maxq ------"
-cat "/dev/logbuffer_maxq"
-echo "\n------ TEMP/DOCK-DEFEND ------"
-cat "/dev/logbuffer_bd"
-
-echo "\n------ TRICKLE-DEFEND Config ------"
-cd /sys/devices/platform/google,battery/power_supply/battery/
-for f in `ls bd_*`
-do
- echo $f: `cat $f`
-done
-
-echo "\n------ DWELL-DEFEND Config ------"
-cd /sys/devices/platform/google,charger/
-for f in `ls charge_s*`
-do
- echo "$f: `cat $f`"
-done
-
-echo "\n------ TEMP-DEFEND Config ------"
-cd /sys/devices/platform/google,charger/
-for f in `ls bd_*`
-do
- echo "$f: `cat $f`"
-done
-
-if [ $build_type = "userdebug" ]
-then
- echo "\n------ DC_registers dump ------"
- cat "/sys/class/power_supply/dc-mains/device/registers_dump"
- echo "\n------ max77759_chg registers dump ------"
- cat "/d/max77759_chg/registers"
- echo "\n------ max77729_pmic registers dump ------"
- cat "/d/max77729_pmic/registers"
- echo "\n------ Charging table dump ------"
- cat "/d/google_battery/chg_raw_profile"
-
- echo "\n------ fg_model ------"
- for f in /d/maxfg*
- do
- regs=`cat $f/fg_model`
- echo $f:
- echo "$regs"
- done
-
- echo "\n------ fg_alo_ver ------"
- for f in /d/maxfg*
- do
- regs=`cat $f/algo_ver`
- echo $f:
- echo "$regs"
- done
-
- echo "\n------ fg_model_ok ------"
- for f in /d/maxfg*
- do
- regs=`cat $f/model_ok`
- echo $f:
- echo "$regs"
- done
-
- echo "\n------ fg registers ------"
- for f in /d/maxfg*
- do
- regs=`cat $f/registers`
- echo $f:
- echo "$regs"
- done
-
- echo "\n------ Maxim FG NV RAM ------"
- for f in /d/maxfg*
- do
- regs=`cat $f/nv_registers`
- echo $f:
- echo "$regs"
- done
-fi
-
-echo "\n------ Battery EEPROM ------"
-if [ -e "/sys/devices/platform/10970000.hsi2c/i2c-4/4-0050/eeprom" ]
-then
- xxd /sys/devices/platform/10970000.hsi2c/i2c-4/4-0050/eeprom
-fi
-
-if [ -e "/sys/devices/platform/10970000.hsi2c/i2c-5/5-0050/eeprom" ]
-then
- xxd /sys/devices/platform/10970000.hsi2c/i2c-5/5-0050/eeprom
-fi
-
-if [ -e "/sys/devices/platform/10da0000.hsi2c/i2c-6/6-0050/eeprom" ]
-then
- xxd /sys/devices/platform/10da0000.hsi2c/i2c-6/6-0050/eeprom
-fi
-
-if [ -e "/sys/devices/platform/10da0000.hsi2c/i2c-7/7-0050/eeprom" ]
-then
- xxd /sys/devices/platform/10da0000.hsi2c/i2c-7/7-0050/eeprom
-fi
-
-if [ -e "/sys/devices/platform/10c90000.hsi2c/i2c-7/7-0050/eeprom" ]
-then
- xxd /sys/devices/platform/10c90000.hsi2c/i2c-7/7-0050/eeprom
-fi
-
-if [ -e "/sys/devices/platform/10c90000.hsi2c/i2c-6/6-0050/eeprom" ]
-then
- xxd /sys/devices/platform/10c90000.hsi2c/i2c-6/6-0050/eeprom
-fi
-
-echo "\n------ Charger Stats ------"
-cat "/sys/class/power_supply/battery/charge_details"
-if [ $build_type = "userdebug" ]
-then
- echo "\n------ Google Charger ------"
- cd /sys/kernel/debug/google_charger/
- for f in `ls pps_*`
- do
- echo "$f: `cat $f`"
- done
- echo "\n------ Google Battery ------"
- cd /sys/kernel/debug/google_battery/
- for f in `ls ssoc_*`
- do
- echo "$f: `cat $f`"
- done
-fi
-
-echo "\n------ WLC logs ------"
-cat "/dev/logbuffer_wireless"
-echo "\n------ WLC VER ------"
-cat "/sys/class/power_supply/wireless/device/version"
-echo "\n------ WLC STATUS ------"
-cat "/sys/class/power_supply/wireless/device/status"
-echo "\n------ WLC FW Version ------"
-cat "/sys/class/power_supply/wireless/device/fw_rev"
-echo "\n------ RTX ------"
-cat "/dev/logbuffer_rtx"
-
-if [ $build_type = "userdebug" ]
-then
- echo "\n------ gvotables ------"
- cat /sys/kernel/debug/gvotables/*/status
-fi
-
-echo "\n------ Lastmeal ------"
-cat "/data/vendor/mitigation/lastmeal.txt"
-echo "\n------ Thismeal ------"
-cat "/data/vendor/mitigation/thismeal.txt"
-echo "\n------ Mitigation Stats ------"
-echo "Source\t\tCount\tSOC\tTime\tVoltage"
-for f in `ls /sys/devices/virtual/pmic/mitigation/last_triggered_count/*`
-do
- count=`cat $f`
- a=${f/\/sys\/devices\/virtual\/pmic\/mitigation\/last_triggered_count\//}
- b=${f/last_triggered_count/last_triggered_capacity}
- c=${f/last_triggered_count/last_triggered_timestamp/}
- d=${f/last_triggered_count/last_triggered_voltage/}
- cnt=`cat $f`
- cap=`cat ${b/count/cap}`
- ti=`cat ${c/count/time}`
- volt=`cat ${d/count/volt}`
- echo "${a/_count/} \t$cnt\t$cap\t$ti\t$volt"
-done
-
-echo "\n------ Clock Divider Ratio ------"
-echo \"Source\t\tRatio\"
-for f in `ls /sys/devices/virtual/pmic/mitigation/clock_ratio/*`
-do ratio=`cat $f`
- a=${f/\/sys\/devices\/virtual\/pmic\/mitigation\/clock_ratio\//}
- echo "${a/_ratio/} \t$ratio"
-done
-
-echo "\n------ Clock Stats ------"
-echo "Source\t\tStats"
-for f in `ls /sys/devices/virtual/pmic/mitigation/clock_stats/*`
-do
- stats=`cat $f`
- a=${f/\/sys\/devices\/virtual\/pmic\/mitigation\/clock_stats\//};
- echo "${a/_stats/} \t$stats"
-done
-
-echo "\n------ Triggered Level ------"
-echo "Source\t\tLevel"
-for f in `ls /sys/devices/virtual/pmic/mitigation/triggered_lvl/*`
-do
- lvl=`cat $f`
- a=${f/\/sys\/devices\/virtual\/pmic\/mitigation\/triggered_lvl\//}
- echo "${a/_lvl/} \t$lvl"
-done
-
-echo "\n------ Instruction ------"
-for f in `ls /sys/devices/virtual/pmic/mitigation/instruction/*`
-do
- val=`cat $f`
- a=${f/\/sys\/devices\/virtual\/pmic\/mitigation\/instruction\//}
- echo "$a=$val"
-done
-
-echo "\n------ IRQ Duration Counts ------"
-echo "Source\t\t\t\tlt_5ms_cnt\tbt_5ms_to_10ms_cnt\tgt_10ms_cnt\tCode\tCurrent Threshold (uA)\tCurrent Reading (uA)"
-
-lt=`cat /sys/devices/virtual/pmic/mitigation/irq_dur_cnt/less_than_5ms_count`
-bt=`cat /sys/devices/virtual/pmic/mitigation/irq_dur_cnt/between_5ms_to_10ms_count`
-gt=`cat /sys/devices/virtual/pmic/mitigation/irq_dur_cnt/greater_than_10ms_count`
-lpf_cur_m=`cat /sys/devices/platform/acpm_mfd_bus@15500000/i2c-0/0-001f/s2mpg14-meter/s2mpg14-odpm/iio:device0/lpf_current`
-lpf_cur_s=`cat /sys/devices/platform/acpm_mfd_bus@15510000/i2c-1/1-002f/s2mpg15-meter/s2mpg15-odpm/iio:device1/lpf_current`
-
-lpf_cur_main=(${lpf_cur_m/\\n/;})
-lpf_cur_sub=(${lpf_cur_s/\\n/;})
-
-IFS_PRE=$IFS
-IFS=$'\n'
-lt_a=($lt)
-bt_a=($bt)
-gt_a=($gt)
-IFS=$IFS_PRE
-
-
-for f in `ls /sys/devices/virtual/pmic/mitigation/main_pwrwarn/*`
-do
- count=`cat $f`
- a=${f/\/sys\/devices\/virtual\/pmic\/mitigation\/main_pwrwarn\//}
- s=${a/main_pwrwarn_threshold/}
- arr=(${count//=/ })
- code=${arr[0]}
- threshold=${arr[1]}
- main_array[$s]="$code\t$threshold"
-done
-
-i=1
-main_current=()
-for f in "${main_array[@]}"
-do
- idx=$i
- idx2=$idx+1
- main_current+=(${lpf_cur_main[$idx2]})
- i=$i+2
-done
-
-for f in `ls /sys/devices/virtual/pmic/mitigation/sub_pwrwarn/*`
-do
- count=`cat $f`
- a=${f/\/sys\/devices\/virtual\/pmic\/mitigation\/sub_pwrwarn\//}
- s=${a/sub_pwrwarn_threshold/}
- arr=(${count//=/ })
- code=${arr[0]};
- threshold=${arr[1]};
- sub_array[$s]="$code\t$threshold"
-done
-i=1
-sub_current=()
-for f in "${sub_array[@]}"
-do
- idx=$i
- idx2=$idx+1
- sub_current+=(${lpf_cur_sub[$idx2]})
- i=$i+2
-done
-
-rows=${#lt_a[@]}
-for i in `seq 0 $rows`
-do
- n="${lt_a[i]%:*}"
- l="${lt_a[i]#*": "}"
- b="${bt_a[i]#*": "}"
- g="${gt_a[i]#*": "}"
- if [ $i -lt 9 ]
- then
- echo "$n \t\t$l\t\t$b\t\t\t$g"
- elif [ $i -ge 9 ] && [ $i -lt 21 ]
- then
- j=$i-9
- thresh="${main_array[j]}"
- current="${main_current[j]}"
- echo "$n \t$l\t\t$b\t\t\t$g\t\t$thresh \t\t$current"
- else
- j=$i-21
- thresh="${sub_array[j]}"
- current="${sub_current[j]}"
- echo "$n \t$l\t\t$b\t\t\t$g\t\t$thresh \t\t$current"
- fi
-done
diff --git a/dumpstate/item.mk b/dumpstate/item.mk
index 124fd1c2..441357a9 100644
--- a/dumpstate/item.mk
+++ b/dumpstate/item.mk
@@ -1,6 +1,4 @@
PRODUCT_PACKAGES += dump_wlan.sh \
- dump_power.sh
-
-PRODUCT_PACKAGES_DEBUG += dump_cma.sh \
- dump_gsa.sh
+ dump_power
+PRODUCT_PACKAGES_DEBUG += dump_gsa.sh
diff --git a/fingerprint/udfps.mk b/fingerprint/udfps.mk
deleted file mode 100644
index 61f138f6..00000000
--- a/fingerprint/udfps.mk
+++ /dev/null
@@ -1,28 +0,0 @@
-#
-# 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.
-#
-
-PRODUCT_COPY_FILES += \
- frameworks/native/data/etc/android.hardware.fingerprint.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.fingerprint.xml
-
-# Include the Goodix AIDL HAL namespaces.
-PRODUCT_SOONG_NAMESPACES += vendor/goodix/udfps/g6_trusty
-PRODUCT_SOONG_NAMESPACES += vendor/goodix/udfps/g6_aidl_trusty
-
-$(call soong_config_set,fp_hal_feature,biometric_suez_support,true)
-
-PRODUCT_PACKAGES += \
- android.hardware.biometrics.fingerprint@2.1-service.goodix \
- android.hardware.biometrics.fingerprint-service.goodix
diff --git a/fingerprint/udfps_factory.mk b/fingerprint/udfps_factory.mk
deleted file mode 100644
index 41aebe08..00000000
--- a/fingerprint/udfps_factory.mk
+++ /dev/null
@@ -1,22 +0,0 @@
-#
-# 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.
-#
-
-PRODUCT_PACKAGES += \
- GF_delmar_factory \
- udfps_test
-
-PRODUCT_PROPERTY_OVERRIDES += \
- gf.debug.dump_data=1
diff --git a/interfaces/boot/1.0/BootControl.cpp b/interfaces/boot/1.0/BootControl.cpp
deleted file mode 100644
index 1f155c9d..00000000
--- a/interfaces/boot/1.0/BootControl.cpp
+++ /dev/null
@@ -1,272 +0,0 @@
-/*
- * Copyright (C) 2019 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 "bootcontrolhal"
-
-#include "BootControl.h"
-#include "GptUtils.h"
-
-#include
-#include
-#include
-
-namespace android {
-namespace hardware {
-namespace boot {
-namespace V1_0 {
-namespace implementation {
-
-namespace {
-
-#define BOOT_A_PATH "/dev/block/by-name/boot_a"
-#define BOOT_B_PATH "/dev/block/by-name/boot_b"
-
-// slot flags
-#define AB_ATTR_PRIORITY_SHIFT 52
-#define AB_ATTR_PRIORITY_MASK (3UL << AB_ATTR_PRIORITY_SHIFT)
-#define AB_ATTR_ACTIVE_SHIFT 54
-#define AB_ATTR_ACTIVE (1UL << AB_ATTR_ACTIVE_SHIFT)
-#define AB_ATTR_RETRY_COUNT_SHIFT (55)
-#define AB_ATTR_RETRY_COUNT_MASK (7UL << AB_ATTR_RETRY_COUNT_SHIFT)
-#define AB_ATTR_SUCCESSFUL (1UL << 58)
-#define AB_ATTR_UNBOOTABLE (1UL << 59)
-
-#define AB_ATTR_MAX_PRIORITY 3UL
-#define AB_ATTR_MAX_RETRY_COUNT 3UL
-
-static std::string getDevPath(uint32_t slot) {
- char real_path[PATH_MAX];
-
- const char *path = slot == 0 ? BOOT_A_PATH : BOOT_B_PATH;
-
- int ret = readlink(path, real_path, sizeof real_path);
- if (ret < 0) {
- ALOGE("readlink failed for boot device %s\n", strerror(errno));
- return std::string();
- }
-
- std::string dp(real_path);
- // extract /dev/sda.. part
- return dp.substr(0, sizeof "/dev/block/sdX" - 1);
-}
-
-static bool isSlotFlagSet(uint32_t slot, uint64_t flag) {
- std::string dev_path = getDevPath(slot);
- if (dev_path.empty()) {
- ALOGI("Could not get device path for slot %d\n", slot);
- return false;
- }
-
- GptUtils gpt(dev_path);
- if (gpt.Load()) {
- ALOGI("failed to load gpt data\n");
- return false;
- }
-
- gpt_entry *e = gpt.GetPartitionEntry(slot ? "boot_b" : "boot_a");
- if (e == nullptr) {
- ALOGI("failed to get gpt entry\n");
- return false;
- }
-
- return !!(e->attr & flag);
-}
-
-static int setSlotFlag(uint32_t slot, uint64_t flag) {
- std::string dev_path = getDevPath(slot);
- if (dev_path.empty()) {
- ALOGI("Could not get device path for slot %d\n", slot);
- return -1;
- }
-
- GptUtils gpt(dev_path);
- if (gpt.Load()) {
- ALOGI("failed to load gpt data\n");
- return -1;
- }
-
- gpt_entry *e = gpt.GetPartitionEntry(slot ? "boot_b" : "boot_a");
- if (e == nullptr) {
- ALOGI("failed to get gpt entry\n");
- return -1;
- }
-
- e->attr |= flag;
- gpt.Sync();
-
- return 0;
-}
-
-}
-
-// Methods from ::android::hardware::boot::V1_0::IBootControl follow.
-Return BootControl::getNumberSlots() {
- uint32_t slots = 0;
-
- if (access(BOOT_A_PATH, F_OK) == 0)
- slots++;
-
- if (access(BOOT_B_PATH, F_OK) == 0)
- slots++;
-
- return slots;
-}
-
-Return BootControl::getCurrentSlot() {
- char suffix[PROPERTY_VALUE_MAX];
- property_get("ro.boot.slot_suffix", suffix, "_a");
- return std::string(suffix) == "_b" ? 1 : 0;
-}
-
-Return BootControl::markBootSuccessful(markBootSuccessful_cb _hidl_cb) {
- if (getNumberSlots() == 0) {
- // no slots, just return true otherwise Android keeps trying
- _hidl_cb({true, ""});
- return Void();
- }
- int ret = setSlotFlag(getCurrentSlot(), AB_ATTR_SUCCESSFUL);
- ret ? _hidl_cb({false, "Failed to set successfull flag"}) : _hidl_cb({true, ""});
- return Void();
-}
-
-Return BootControl::setActiveBootSlot(uint32_t slot, setActiveBootSlot_cb _hidl_cb) {
- if (slot >= 2) {
- _hidl_cb({false, "Invalid slot"});
- return Void();
- }
-
- std::string dev_path = getDevPath(slot);
- if (dev_path.empty()) {
- _hidl_cb({false, "Could not get device path for slot"});
- return Void();
- }
-
- GptUtils gpt(dev_path);
- if (gpt.Load()) {
- _hidl_cb({false, "failed to load gpt data"});
- return Void();
- }
-
- gpt_entry *active_entry = gpt.GetPartitionEntry(slot == 0 ? "boot_a" : "boot_b");
- gpt_entry *inactive_entry = gpt.GetPartitionEntry(slot == 0 ? "boot_b" : "boot_a");
- if (active_entry == nullptr || inactive_entry == nullptr) {
- _hidl_cb({false, "failed to get entries for boot partitions"});
- return Void();
- }
-
- ALOGV("slot active attributes %lx\n", active_entry->attr);
- ALOGV("slot inactive attributes %lx\n", inactive_entry->attr);
-
- char boot_dev[PROPERTY_VALUE_MAX];
- property_get("ro.boot.bootdevice", boot_dev, "");
- if (boot_dev[0] == '\0') {
- _hidl_cb({false, "invalid ro.boot.bootdevice prop"});
- return Void();
- }
-
- std::string boot_lun_path = std::string("/sys/devices/platform/") +
- boot_dev + "/pixel/boot_lun_enabled";
- int fd = open(boot_lun_path.c_str(), O_RDWR);
- if (fd < 0) {
- // Try old path for kernels < 5.4
- // TODO: remove once kernel 4.19 support is deprecated
- std::string boot_lun_path = std::string("/sys/devices/platform/") +
- boot_dev + "/attributes/boot_lun_enabled";
- fd = open(boot_lun_path.c_str(), O_RDWR);
- if (fd < 0) {
- _hidl_cb({false, "failed to open ufs attr boot_lun_enabled"});
- return Void();
- }
- }
-
- // update attributes for active and inactive
- inactive_entry->attr &= ~AB_ATTR_ACTIVE;
- active_entry->attr = AB_ATTR_ACTIVE | (AB_ATTR_MAX_PRIORITY << AB_ATTR_PRIORITY_SHIFT) |
- (AB_ATTR_MAX_RETRY_COUNT << AB_ATTR_RETRY_COUNT_SHIFT);
-
- //
- // bBootLunEn
- // 0x1 => Boot LU A = enabled, Boot LU B = disable
- // 0x2 => Boot LU A = disable, Boot LU B = enabled
- //
- int ret = android::base::WriteStringToFd(slot == 0 ? "1" : "2", fd);
- close(fd);
- if (ret < 0) {
- _hidl_cb({false, "faied to write boot_lun_enabled attribute"});
- return Void();
- }
-
- _hidl_cb({true, ""});
- return Void();
-}
-
-Return BootControl::setSlotAsUnbootable(uint32_t slot, setSlotAsUnbootable_cb _hidl_cb) {
- if (slot >= 2) {
- _hidl_cb({false, "Invalid slot"});
- return Void();
- }
-
- std::string dev_path = getDevPath(slot);
- if (dev_path.empty()) {
- _hidl_cb({false, "Could not get device path for slot"});
- return Void();
- }
-
- GptUtils gpt(dev_path);
- gpt.Load();
-
- gpt_entry *e = gpt.GetPartitionEntry(slot ? "boot_b" : "boot_a");
- e->attr |= AB_ATTR_UNBOOTABLE;
-
- gpt.Sync();
-
- _hidl_cb({true, ""});
- return Void();
-}
-
-Return<::android::hardware::boot::V1_0::BoolResult> BootControl::isSlotBootable(uint32_t slot) {
- if (getNumberSlots() == 0)
- return BoolResult::FALSE;
- if (slot >= getNumberSlots())
- return BoolResult::INVALID_SLOT;
- return isSlotFlagSet(slot, AB_ATTR_UNBOOTABLE) ? BoolResult::FALSE : BoolResult::TRUE;
-}
-
-Return<::android::hardware::boot::V1_0::BoolResult> BootControl::isSlotMarkedSuccessful(uint32_t slot) {
- if (getNumberSlots() == 0) {
- // just return true so that we don't we another call trying to mark it as successful
- // when there is no slots
- return BoolResult::TRUE;
- }
- if (slot >= getNumberSlots())
- return BoolResult::INVALID_SLOT;
- return isSlotFlagSet(slot, AB_ATTR_SUCCESSFUL) ? BoolResult::TRUE : BoolResult::FALSE;
-}
-
-Return BootControl::getSuffix(uint32_t slot, getSuffix_cb _hidl_cb) {
- _hidl_cb(slot == 0 ? "_a" : slot == 1 ? "_b" : "");
- return Void();
-}
-
-extern "C" IBootControl* HIDL_FETCH_IBootControl(const char*) {
- return new BootControl();
-}
-
-} // namespace implementation
-} // namespace V1_0
-} // namespace boot
-} // namespace hardware
-} // namespace android
diff --git a/interfaces/boot/1.0/BootControl.h b/interfaces/boot/1.0/BootControl.h
deleted file mode 100644
index eb81cb07..00000000
--- a/interfaces/boot/1.0/BootControl.h
+++ /dev/null
@@ -1,59 +0,0 @@
-/*
- * Copyright (C) 2019 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
-#include
-#include
-
-namespace android {
-namespace hardware {
-namespace boot {
-namespace V1_0 {
-namespace implementation {
-
-using ::android::hardware::hidl_array;
-using ::android::hardware::hidl_memory;
-using ::android::hardware::hidl_string;
-using ::android::hardware::hidl_vec;
-using ::android::hardware::Return;
-using ::android::hardware::Void;
-using ::android::sp;
-
-struct BootControl : public IBootControl {
- // Methods from ::android::hardware::boot::V1_0::IBootControl follow.
- Return getNumberSlots() override;
- Return getCurrentSlot() override;
- Return markBootSuccessful(markBootSuccessful_cb _hidl_cb) override;
- Return setActiveBootSlot(uint32_t slot, setActiveBootSlot_cb _hidl_cb) override;
- Return setSlotAsUnbootable(uint32_t slot, setSlotAsUnbootable_cb _hidl_cb) override;
- Return<::android::hardware::boot::V1_0::BoolResult> isSlotBootable(uint32_t slot) override;
- Return<::android::hardware::boot::V1_0::BoolResult> isSlotMarkedSuccessful(uint32_t slot) override;
- Return getSuffix(uint32_t slot, getSuffix_cb _hidl_cb) override;
-
- // Methods from ::android::hidl::base::V1_0::IBase follow.
-
-};
-
-// FIXME: most likely delete, this is only for passthrough implementations
-extern "C" IBootControl* HIDL_FETCH_IBootControl(const char* name);
-
-} // namespace implementation
-} // namespace V1_0
-} // namespace boot
-} // namespace hardware
-} // namespace android
diff --git a/interfaces/boot/1.0/GptUtils.cpp b/interfaces/boot/1.0/GptUtils.cpp
deleted file mode 100644
index f8936175..00000000
--- a/interfaces/boot/1.0/GptUtils.cpp
+++ /dev/null
@@ -1,199 +0,0 @@
-/*
- * Copyright (C) 2019 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 "bootcontrolhal"
-
-#include "GptUtils.h"
-
-#include
-#include
-#include
-#include
-#include
-
-namespace android {
-namespace hardware {
-namespace boot {
-namespace V1_0 {
-namespace implementation {
-
-namespace {
-
-static int ValidateGptHeader(gpt_header *gpt)
-{
- if (gpt->signature != GPT_SIGNATURE) {
- ALOGE("invalid gpt signature 0x%lx\n", gpt->signature);
- return -1;
- }
-
- if (gpt->header_size != sizeof(gpt_header)) {
- ALOGE("invalid gpt header size %u\n", gpt->header_size);
- return -1;
- }
-
- if (gpt->entry_size != sizeof(gpt_entry)) {
- ALOGE("invalid gpt entry size %u\n", gpt->entry_size);
- return -1;
- }
-
- return 0;
-}
-
-}
-
-GptUtils::GptUtils(const std::string dev_path) : dev_path(dev_path), fd(0) {}
-
-int GptUtils::Load(void)
-{
- fd = open(dev_path.c_str(), O_RDWR);
- if (fd < 0) {
- ALOGE("failed to open block dev %s, %d\n", dev_path.c_str(), errno);
- return -1;
- }
-
- int ret = ioctl(fd, BLKSSZGET, &block_size);
- if (ret < 0) {
- ALOGE("failed to get block size %d\n", errno);
- return -1;
- }
-
- // read primary header
- lseek64(fd, block_size, SEEK_SET);
- ret = read(fd, &gpt_primary, sizeof gpt_primary);
- if (ret < 0) {
- ALOGE("failed to read gpt primary header %d\n", errno);
- return -1;
- }
-
- if (ValidateGptHeader(&gpt_primary)) {
- ALOGE("error validating gpt header\n");
- return -1;
- }
-
- // read partition entries
- entry_array.resize(gpt_primary.entry_count);
- uint32_t entries_size = gpt_primary.entry_size * gpt_primary.entry_count;
- lseek64(fd, block_size * gpt_primary.start_lba, SEEK_SET);
- ret = read(fd, entry_array.data(), entries_size);
- if (ret < 0) {
- ALOGE("failed to read gpt partition entries %d\n", errno);
- return -1;
- }
-
- // read gpt back header
- lseek64(fd, block_size * gpt_primary.backup_lba, SEEK_SET);
- ret = read(fd, &gpt_backup, sizeof gpt_backup);
- if (ret < 0) {
- ALOGE("failed to read gpt backup header %d\n", errno);
- return -1;
- }
-
- if (ValidateGptHeader(&gpt_backup)) {
- ALOGW("error validating gpt backup\n"); // just warn about it, not fail
- }
-
- // Create map
- auto get_name = [](const uint16_t *efi_name) {
- char name[37] = {};
- for (int i = 0; efi_name[i] && i < sizeof name - 1; ++i)
- name[i] = efi_name[i];
- return std::string(name);
- };
-
- for (auto const &e: entry_array) {
- if (e.name[0] == 0)
- break; // stop at the first partition with no name
- std::string s = get_name(e.name);
- entries[s] = const_cast(&e);
- }
-
- return 0;
-}
-
-gpt_entry *GptUtils::GetPartitionEntry(std::string name)
-{
- return entries.find(name) != entries.end() ? entries[name] : nullptr;
-}
-
-int GptUtils::Sync(void)
-{
- if (!fd)
- return -1;
-
- // calculate crc and check if we need to update gpt
- gpt_primary.entries_crc32 = crc32(0, reinterpret_cast(entry_array.data()),
- entry_array.size() * sizeof(gpt_entry));
-
- // save old crc
- uint32_t crc = gpt_primary.crc32;
- gpt_primary.crc32 = 0;
-
- gpt_primary.crc32 = crc32(0, reinterpret_cast(&gpt_primary), sizeof gpt_primary);
- if (crc == gpt_primary.crc32)
- return 0; // nothing to do (no changes)
-
- ALOGI("updating GPT\n");
-
- lseek64(fd, block_size * gpt_primary.current_lba, SEEK_SET);
- int ret = write(fd, &gpt_primary, sizeof gpt_primary);
- if (ret < 0) {
- ALOGE("failed to write gpt primary header %d\n", errno);
- return -1;
- }
-
- lseek64(fd, block_size * gpt_primary.start_lba, SEEK_SET);
- ret = write(fd, entry_array.data(), entry_array.size() * sizeof(gpt_entry));
- if (ret < 0) {
- ALOGE("failed to write gpt partition entries %d\n", errno);
- return -1;
- }
-
- //update GPT backup entries and backup
- lseek64(fd, block_size * gpt_backup.start_lba, SEEK_SET);
- ret = write(fd, entry_array.data(), entry_array.size() * sizeof(gpt_entry));
- if (ret < 0) {
- ALOGE("failed to write gpt backup partition entries %d\n", errno);
- return -1;
- }
-
- gpt_backup.entries_crc32 = gpt_primary.entries_crc32;
- gpt_backup.crc32 = 0;
- gpt_backup.crc32 = crc32(0, reinterpret_cast(&gpt_backup), sizeof gpt_backup);
- lseek64(fd, block_size * gpt_primary.backup_lba, SEEK_SET);
- ret = write(fd, &gpt_backup, sizeof gpt_backup);
- if (ret < 0) {
- ALOGE("failed to write gpt backup header %d\n", errno);
- return -1;
- }
-
- fsync(fd);
-
- return 0;
-}
-
-GptUtils::~GptUtils()
-{
- if (fd) {
- Sync();
- close(fd);
- }
-}
-
-} // namespace implementation
-} // namespace V1_0
-} // namespace boot
-} // namespace hardware
-} // namespace android
diff --git a/interfaces/boot/1.0/GptUtils.h b/interfaces/boot/1.0/GptUtils.h
deleted file mode 100644
index d969d9d8..00000000
--- a/interfaces/boot/1.0/GptUtils.h
+++ /dev/null
@@ -1,79 +0,0 @@
-/*
- * Copyright (C) 2019 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
-#include
-#include