Merge Android 14 QPR2 to AOSP main
Bug: 319669529 Merged-In: I32eb36d69c485eaab1d138a6271e08660bfe39b0 Change-Id: Ie1a388e0381897e4b0522ffad710449f9ad465e4
This commit is contained in:
commit
9410b32a49
72 changed files with 2416 additions and 3773 deletions
|
@ -241,7 +241,7 @@ $(call soong_config_set,aoc_audio_func,ext_hidl,true)
|
||||||
ifneq (,$(filter userdebug eng, $(TARGET_BUILD_VARIANT)))
|
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,dump_usecase_data,true)
|
||||||
$(call soong_config_set,aoc_audio_func,hal_socket_control,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
|
endif
|
||||||
|
|
||||||
ifneq (,$(filter aosp_%,$(TARGET_PRODUCT)))
|
ifneq (,$(filter aosp_%,$(TARGET_PRODUCT)))
|
||||||
|
|
2
OWNERS
2
OWNERS
|
@ -1,2 +1,2 @@
|
||||||
# per-file for Pixel device makefiles, see go/pixel-device-mk-owner-checklist for details.
|
# 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
|
||||||
|
|
2
PREUPLOAD.cfg
Normal file
2
PREUPLOAD.cfg
Normal file
|
@ -0,0 +1,2 @@
|
||||||
|
[Builtin Hooks]
|
||||||
|
jsonlint = true
|
|
@ -24,30 +24,30 @@ on init
|
||||||
write /dev/sys/fs/by-name/userdata/data_io_flag 56
|
write /dev/sys/fs/by-name/userdata/data_io_flag 56
|
||||||
write /dev/sys/fs/by-name/userdata/node_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/groups/bg/set_task_group
|
||||||
chown system system /proc/vendor_sched/set_task_group_cam
|
chown system system /proc/vendor_sched/groups/cam/set_task_group
|
||||||
chown system system /proc/vendor_sched/set_task_group_fg
|
chown system system /proc/vendor_sched/groups/fg/set_task_group
|
||||||
chown system system /proc/vendor_sched/set_task_group_nnapi
|
chown system system /proc/vendor_sched/groups/nnapi/set_task_group
|
||||||
chown system system /proc/vendor_sched/set_task_group_sys
|
chown system system /proc/vendor_sched/groups/sys/set_task_group
|
||||||
chown system system /proc/vendor_sched/set_task_group_sysbg
|
chown system system /proc/vendor_sched/groups/sys_bg/set_task_group
|
||||||
chown system system /proc/vendor_sched/set_task_group_ta
|
chown system system /proc/vendor_sched/groups/ta/set_task_group
|
||||||
chown system system /proc/vendor_sched/set_task_group_rt
|
chown system system /proc/vendor_sched/groups/rt/set_task_group
|
||||||
chown system system /proc/vendor_sched/set_task_group_sf
|
chown system system /proc/vendor_sched/groups/sf/set_task_group
|
||||||
chown system system /proc/vendor_sched/set_task_group_dex2oat
|
chown system system /proc/vendor_sched/groups/dex2oat/set_task_group
|
||||||
chown system system /proc/vendor_sched/set_task_group_cam_power
|
chown system system /proc/vendor_sched/groups/cam_power/set_task_group
|
||||||
chown system system /proc/vendor_sched/set_task_group_ota
|
chown system system /proc/vendor_sched/groups/ota/set_task_group
|
||||||
chown system system /proc/vendor_sched/set_proc_group_bg
|
chown system system /proc/vendor_sched/groups/bg/set_proc_group
|
||||||
chown system system /proc/vendor_sched/set_proc_group_cam
|
chown system system /proc/vendor_sched/groups/cam/set_proc_group
|
||||||
chown system system /proc/vendor_sched/set_proc_group_fg
|
chown system system /proc/vendor_sched/groups/fg/set_proc_group
|
||||||
chown system system /proc/vendor_sched/set_proc_group_nnapi
|
chown system system /proc/vendor_sched/groups/nnapi/set_proc_group
|
||||||
chown system system /proc/vendor_sched/set_proc_group_sys
|
chown system system /proc/vendor_sched/groups/sys/set_proc_group
|
||||||
chown system system /proc/vendor_sched/set_proc_group_sysbg
|
chown system system /proc/vendor_sched/groups/sys_bg/set_proc_group
|
||||||
chown system system /proc/vendor_sched/set_proc_group_ta
|
chown system system /proc/vendor_sched/groups/ta/set_proc_group
|
||||||
chown system system /proc/vendor_sched/set_proc_group_rt
|
chown system system /proc/vendor_sched/groups/rt/set_proc_group
|
||||||
chown system system /proc/vendor_sched/set_proc_group_sf
|
chown system system /proc/vendor_sched/groups/sf/set_proc_group
|
||||||
chown system system /proc/vendor_sched/set_proc_group_dex2oat
|
chown system system /proc/vendor_sched/groups/dex2oat/set_proc_group
|
||||||
chown system system /proc/vendor_sched/set_proc_group_cam_power
|
chown system system /proc/vendor_sched/groups/cam_power/set_proc_group
|
||||||
chown system system /proc/vendor_sched/set_proc_group_ota
|
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_set
|
||||||
chown system system /proc/vendor_sched/prefer_idle_clear
|
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_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_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
|
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/groups/bg/set_task_group
|
||||||
chmod 0220 /proc/vendor_sched/set_task_group_cam
|
chmod 0220 /proc/vendor_sched/groups/cam/set_task_group
|
||||||
chmod 0220 /proc/vendor_sched/set_task_group_fg
|
chmod 0220 /proc/vendor_sched/groups/fg/set_task_group
|
||||||
chmod 0220 /proc/vendor_sched/set_task_group_nnapi
|
chmod 0220 /proc/vendor_sched/groups/nnapi/set_task_group
|
||||||
chmod 0220 /proc/vendor_sched/set_task_group_sys
|
chmod 0220 /proc/vendor_sched/groups/sys/set_task_group
|
||||||
chmod 0220 /proc/vendor_sched/set_task_group_sysbg
|
chmod 0220 /proc/vendor_sched/groups/sys_bg/set_task_group
|
||||||
chmod 0220 /proc/vendor_sched/set_task_group_ta
|
chmod 0220 /proc/vendor_sched/groups/ta/set_task_group
|
||||||
chmod 0220 /proc/vendor_sched/set_task_group_rt
|
chmod 0220 /proc/vendor_sched/groups/rt/set_task_group
|
||||||
chmod 0220 /proc/vendor_sched/set_task_group_sf
|
chmod 0220 /proc/vendor_sched/groups/sf/set_task_group
|
||||||
chmod 0220 /proc/vendor_sched/set_task_group_dex2oat
|
chmod 0220 /proc/vendor_sched/groups/dex2oat/set_task_group
|
||||||
chmod 0220 /proc/vendor_sched/set_task_group_cam_power
|
chmod 0220 /proc/vendor_sched/groups/cam_power/set_task_group
|
||||||
chmod 0220 /proc/vendor_sched/set_task_group_ota
|
chmod 0220 /proc/vendor_sched/groups/ota/set_task_group
|
||||||
chmod 0220 /proc/vendor_sched/set_proc_group_bg
|
chmod 0220 /proc/vendor_sched/groups/bg/set_proc_group
|
||||||
chmod 0220 /proc/vendor_sched/set_proc_group_cam
|
chmod 0220 /proc/vendor_sched/groups/cam/set_proc_group
|
||||||
chmod 0220 /proc/vendor_sched/set_proc_group_fg
|
chmod 0220 /proc/vendor_sched/groups/fg/set_proc_group
|
||||||
chmod 0220 /proc/vendor_sched/set_proc_group_nnapi
|
chmod 0220 /proc/vendor_sched/groups/nnapi/set_proc_group
|
||||||
chmod 0220 /proc/vendor_sched/set_proc_group_sys
|
chmod 0220 /proc/vendor_sched/groups/sys/set_proc_group
|
||||||
chmod 0220 /proc/vendor_sched/set_proc_group_sysbg
|
chmod 0220 /proc/vendor_sched/groups/sys_bg/set_proc_group
|
||||||
chmod 0220 /proc/vendor_sched/set_proc_group_ta
|
chmod 0220 /proc/vendor_sched/groups/ta/set_proc_group
|
||||||
chmod 0220 /proc/vendor_sched/set_proc_group_rt
|
chmod 0220 /proc/vendor_sched/groups/rt/set_proc_group
|
||||||
chmod 0220 /proc/vendor_sched/set_proc_group_sf
|
chmod 0220 /proc/vendor_sched/groups/sf/set_proc_group
|
||||||
chmod 0220 /proc/vendor_sched/set_proc_group_dex2oat
|
chmod 0220 /proc/vendor_sched/groups/dex2oat/set_proc_group
|
||||||
chmod 0220 /proc/vendor_sched/set_proc_group_cam_power
|
chmod 0220 /proc/vendor_sched/groups/cam_power/set_proc_group
|
||||||
chmod 0220 /proc/vendor_sched/set_proc_group_ota
|
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_set
|
||||||
chmod 0220 /proc/vendor_sched/prefer_idle_clear
|
chmod 0220 /proc/vendor_sched/prefer_idle_clear
|
||||||
chmod 0660 /proc/vendor_sched/pmu_poll_enable
|
chmod 0660 /proc/vendor_sched/pmu_poll_enable
|
||||||
|
@ -119,6 +119,9 @@ on init
|
||||||
write /sys/block/zram0/comp_algorithm lz77eh
|
write /sys/block/zram0/comp_algorithm lz77eh
|
||||||
write /proc/sys/vm/page-cluster 0
|
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
|
# Some user code relies on ro.boot.hardware.revision
|
||||||
setprop ro.boot.hardware.revision ${ro.revision}
|
setprop ro.boot.hardware.revision ${ro.revision}
|
||||||
|
|
||||||
|
@ -164,12 +167,12 @@ on init
|
||||||
mkdir /dev/socket/pdx/system/vr/sensors 0775 system system
|
mkdir /dev/socket/pdx/system/vr/sensors 0775 system system
|
||||||
|
|
||||||
# Boot time 183626384
|
# Boot time 183626384
|
||||||
write /proc/vendor_sched/ta_uclamp_min 221
|
write /proc/vendor_sched/groups/ta/uclamp_min 221
|
||||||
write /proc/vendor_sched/ta_prefer_idle 1
|
write /proc/vendor_sched/groups/ta/prefer_idle 1
|
||||||
write /proc/vendor_sched/fg_uclamp_min 221
|
write /proc/vendor_sched/groups/fg/uclamp_min 221
|
||||||
write /proc/vendor_sched/fg_prefer_idle 1
|
write /proc/vendor_sched/groups/fg/prefer_idle 1
|
||||||
write /proc/vendor_sched/sys_uclamp_min 221
|
write /proc/vendor_sched/groups/sys/uclamp_min 221
|
||||||
write /proc/vendor_sched/sys_prefer_idle 1
|
write /proc/vendor_sched/groups/sys/prefer_idle 1
|
||||||
|
|
||||||
# governor setting
|
# governor setting
|
||||||
write /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor sched_pixel
|
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
|
chown system system /dev/cpuset/camera-daemon-mid-high-group/tasks
|
||||||
chmod 0664 /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/groups/cam/prefer_idle 1
|
||||||
write /proc/vendor_sched/cam_uclamp_min 1
|
write /proc/vendor_sched/groups/cam/uclamp_min 1
|
||||||
|
|
||||||
chown system system /dev/cpuset/cgroup.procs
|
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
|
chown system system /sys/class/power_supply/maxfg_base/m5_model_state
|
||||||
|
|
||||||
# Dump eeprom
|
# Dump eeprom
|
||||||
chown system system /sys/devices/platform/10970000.hsi2c/i2c-5/5-0050/eeprom
|
chown system system /sys/devices/platform/10c90000.hsi2c/i2c-9/9-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 /dev/battery_history
|
chown system system /dev/battery_history
|
||||||
chmod 0644 /dev/battery_history
|
chmod 0644 /dev/battery_history
|
||||||
|
|
||||||
|
@ -315,8 +314,8 @@ on init
|
||||||
chown system system /dev/bbd_pwrstat
|
chown system system /dev/bbd_pwrstat
|
||||||
|
|
||||||
# Add a boost for NNAPI HAL
|
# Add a boost for NNAPI HAL
|
||||||
write /proc/vendor_sched/nnapi_prefer_idle 0
|
write /proc/vendor_sched/groups/nnapi/prefer_idle 0
|
||||||
write /proc/vendor_sched/nnapi_uclamp_min 512
|
write /proc/vendor_sched/groups/nnapi/uclamp_min 512
|
||||||
|
|
||||||
# Add memlat governor settings
|
# 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_cpu0_memlat@17000010/polling_interval 10
|
||||||
|
@ -413,6 +412,9 @@ on post-fs-data
|
||||||
# Modem extended log folder
|
# Modem extended log folder
|
||||||
mkdir /data/vendor/radio/extended_logs 0770 radio system
|
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
|
# Modem MDS log folder
|
||||||
mkdir /data/vendor/radio/mds 0771 radio system
|
mkdir /data/vendor/radio/mds 0771 radio system
|
||||||
|
|
||||||
|
@ -474,32 +476,32 @@ on post-fs-data
|
||||||
on zygote-start
|
on zygote-start
|
||||||
# For PixelLogger configuration file.
|
# For PixelLogger configuration file.
|
||||||
chmod 0771 /data/vendor/wifi
|
chmod 0771 /data/vendor/wifi
|
||||||
write /proc/vendor_sched/ta_uclamp_min 1
|
write /proc/vendor_sched/groups/ta/uclamp_min 1
|
||||||
write /proc/vendor_sched/fg_uclamp_min 0
|
write /proc/vendor_sched/groups/fg/uclamp_min 0
|
||||||
write /proc/vendor_sched/sys_uclamp_min 0
|
write /proc/vendor_sched/groups/sys/uclamp_min 0
|
||||||
write /proc/vendor_sched/ta_preferred_idle_mask_low 0x03f
|
write /proc/vendor_sched/groups/ta/preferred_idle_mask_low 0x03f
|
||||||
write /proc/vendor_sched/ta_preferred_idle_mask_mid 0x1f0
|
write /proc/vendor_sched/groups/ta/preferred_idle_mask_mid 0x1f0
|
||||||
write /proc/vendor_sched/ta_preferred_idle_mask_high 0x1f0
|
write /proc/vendor_sched/groups/ta/preferred_idle_mask_high 0x1f0
|
||||||
write /proc/vendor_sched/ta_prefer_idle 1
|
write /proc/vendor_sched/groups/ta/prefer_idle 1
|
||||||
write /proc/vendor_sched/fg_preferred_idle_mask_low 0x03f
|
write /proc/vendor_sched/groups/fg/preferred_idle_mask_low 0x03f
|
||||||
write /proc/vendor_sched/fg_preferred_idle_mask_mid 0x1f0
|
write /proc/vendor_sched/groups/fg/preferred_idle_mask_mid 0x1f0
|
||||||
write /proc/vendor_sched/fg_preferred_idle_mask_high 0x1f0
|
write /proc/vendor_sched/groups/fg/preferred_idle_mask_high 0x1f0
|
||||||
write /proc/vendor_sched/fg_prefer_idle 1
|
write /proc/vendor_sched/groups/fg/prefer_idle 1
|
||||||
write /proc/vendor_sched/sys_preferred_idle_mask_low 0x03f
|
write /proc/vendor_sched/groups/sys/preferred_idle_mask_low 0x03f
|
||||||
write /proc/vendor_sched/sys_preferred_idle_mask_mid 0x1f0
|
write /proc/vendor_sched/groups/sys/preferred_idle_mask_mid 0x1f0
|
||||||
write /proc/vendor_sched/sys_preferred_idle_mask_high 0x1f0
|
write /proc/vendor_sched/groups/sys/preferred_idle_mask_high 0x1f0
|
||||||
write /proc/vendor_sched/sys_prefer_idle 1
|
write /proc/vendor_sched/groups/sys/prefer_idle 1
|
||||||
|
|
||||||
write /proc/vendor_sched/bg_ug 0
|
write /proc/vendor_sched/groups/bg/ug 0
|
||||||
write /proc/vendor_sched/sysbg_ug 0
|
write /proc/vendor_sched/groups/sys_bg/ug 0
|
||||||
write /proc/vendor_sched/ota_ug 0
|
write /proc/vendor_sched/groups/ota/ug 0
|
||||||
write /proc/vendor_sched/dex2oat_ug 1
|
write /proc/vendor_sched/groups/dex2oat/ug 1
|
||||||
write /proc/vendor_sched/ta_ug 2
|
write /proc/vendor_sched/groups/ta/ug 2
|
||||||
write /proc/vendor_sched/fg_ug 2
|
write /proc/vendor_sched/groups/fg/ug 2
|
||||||
write /proc/vendor_sched/nnapi_ug 2
|
write /proc/vendor_sched/groups/nnapi/ug 2
|
||||||
write /proc/vendor_sched/rt_ug 2
|
write /proc/vendor_sched/groups/rt/ug 2
|
||||||
write /proc/vendor_sched/sf_ug 2
|
write /proc/vendor_sched/groups/sf/ug 2
|
||||||
write /proc/vendor_sched/sys_ug 2
|
write /proc/vendor_sched/groups/sys/ug 2
|
||||||
|
|
||||||
|
|
||||||
on post-fs-data
|
on post-fs-data
|
||||||
|
@ -640,6 +642,9 @@ on fs
|
||||||
mount_all /vendor/etc/fstab.modem --early
|
mount_all /vendor/etc/fstab.modem --early
|
||||||
restorecon_recursive /mnt/vendor/modem_img
|
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
|
||||||
restorecon_recursive /mnt/vendor/persist/aoc
|
restorecon_recursive /mnt/vendor/persist/aoc
|
||||||
restorecon_recursive /mnt/vendor/persist/audio
|
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_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/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/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/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/ambient_light
|
||||||
chown system system /sys/class/dqe0/atc/st
|
chown system system /sys/class/dqe0/atc/st
|
||||||
chown system system /sys/class/dqe0/atc/en
|
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/gain_limit
|
||||||
chown system system /sys/class/dqe0/atc/lt_calc_ab_shift
|
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
|
chown system system /sys/devices/platform/19470000.drmdecon/early_wakeup
|
||||||
chmod 0660 /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
|
write /sys/devices/platform/17000010.devfreq_mif/devfreq/17000010.devfreq_mif/exynos_data/cancel_boot_freq 1
|
||||||
|
|
||||||
# Restore prefer idle
|
# Restore prefer idle
|
||||||
write /proc/vendor_sched/ta_preferred_idle_mask_low 0x1ff
|
write /proc/vendor_sched/groups/ta/preferred_idle_mask_low 0x1ff
|
||||||
write /proc/vendor_sched/ta_preferred_idle_mask_mid 0x1ff
|
write /proc/vendor_sched/groups/ta/preferred_idle_mask_mid 0x1ff
|
||||||
write /proc/vendor_sched/ta_preferred_idle_mask_high 0x1ff
|
write /proc/vendor_sched/groups/ta/preferred_idle_mask_high 0x1ff
|
||||||
write /proc/vendor_sched/fg_preferred_idle_mask_low 0x1ff
|
write /proc/vendor_sched/groups/fg/preferred_idle_mask_low 0x1ff
|
||||||
write /proc/vendor_sched/fg_preferred_idle_mask_mid 0x1ff
|
write /proc/vendor_sched/groups/fg/preferred_idle_mask_mid 0x1ff
|
||||||
write /proc/vendor_sched/fg_preferred_idle_mask_high 0x1ff
|
write /proc/vendor_sched/groups/fg/preferred_idle_mask_high 0x1ff
|
||||||
write /proc/vendor_sched/sys_preferred_idle_mask_low 0x1ff
|
write /proc/vendor_sched/groups/sys/preferred_idle_mask_low 0x1ff
|
||||||
write /proc/vendor_sched/sys_preferred_idle_mask_mid 0x1ff
|
write /proc/vendor_sched/groups/sys/preferred_idle_mask_mid 0x1ff
|
||||||
write /proc/vendor_sched/sys_preferred_idle_mask_high 0x1ff
|
write /proc/vendor_sched/groups/sys/preferred_idle_mask_high 0x1ff
|
||||||
|
|
||||||
# Setup final cpuset
|
# Setup final cpuset
|
||||||
write /dev/cpuset/top-app/cpus 0-8
|
write /dev/cpuset/top-app/cpus 0-8
|
||||||
|
@ -826,26 +835,26 @@ on property:sys.boot_completed=1
|
||||||
setprop vendor.powerhal.init 1
|
setprop vendor.powerhal.init 1
|
||||||
|
|
||||||
# Setup final cpu.uclamp
|
# Setup final cpu.uclamp
|
||||||
write /proc/vendor_sched/ta_uclamp_min 1
|
write /proc/vendor_sched/groups/ta/uclamp_min 1
|
||||||
write /proc/vendor_sched/fg_uclamp_min 0
|
write /proc/vendor_sched/groups/fg/uclamp_min 0
|
||||||
write /proc/vendor_sched/sys_prefer_idle 0
|
write /proc/vendor_sched/groups/sys/prefer_idle 0
|
||||||
|
|
||||||
# Set ug group
|
# Set ug group
|
||||||
write /proc/vendor_sched/bg_ug 0
|
write /proc/vendor_sched/groups/bg/ug 0
|
||||||
write /proc/vendor_sched/sysbg_ug 0
|
write /proc/vendor_sched/groups/sys_bg/ug 0
|
||||||
write /proc/vendor_sched/ota_ug 0
|
write /proc/vendor_sched/groups/ota/ug 0
|
||||||
write /proc/vendor_sched/dex2oat_ug 1
|
write /proc/vendor_sched/groups/dex2oat/ug 1
|
||||||
write /proc/vendor_sched/ta_ug 1
|
write /proc/vendor_sched/groups/ta/ug 1
|
||||||
|
|
||||||
# Set bg group throttle
|
# Set bg group throttle
|
||||||
write /proc/vendor_sched/ug_bg_group_throttle ${persist.device_config.vendor_system_native.ug_bg_group_throttle:-308}
|
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
|
# 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/auto_uclamp_max "130 130 130 130 512 512 512 512 670"
|
||||||
write /proc/vendor_sched/bg_uclamp_max 130
|
write /proc/vendor_sched/groups/bg/uclamp_max 130
|
||||||
write /proc/vendor_sched/sysbg_uclamp_max 512
|
write /proc/vendor_sched/groups/sys_bg/uclamp_max 512
|
||||||
write /proc/vendor_sched/ota_uclamp_max 512
|
write /proc/vendor_sched/groups/ota/uclamp_max 512
|
||||||
write /proc/vendor_sched/dex2oat_uclamp_max -2
|
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_divider 4
|
||||||
write /proc/vendor_sched/uclamp_max_filter_rt 16
|
write /proc/vendor_sched/uclamp_max_filter_rt 16
|
||||||
|
@ -1149,12 +1158,12 @@ on charger
|
||||||
|
|
||||||
# Cancel boot devfreq and uclamp
|
# Cancel boot devfreq and uclamp
|
||||||
write /sys/devices/platform/17000010.devfreq_mif/devfreq/17000010.devfreq_mif/exynos_data/cancel_boot_freq 1
|
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/groups/ta/uclamp_min 0
|
||||||
write /proc/vendor_sched/ta_prefer_idle 0
|
write /proc/vendor_sched/groups/ta/prefer_idle 0
|
||||||
write /proc/vendor_sched/fg_uclamp_min 0
|
write /proc/vendor_sched/groups/fg/uclamp_min 0
|
||||||
write /proc/vendor_sched/fg_prefer_idle 0
|
write /proc/vendor_sched/groups/fg/prefer_idle 0
|
||||||
write /proc/vendor_sched/sys_uclamp_min 0
|
write /proc/vendor_sched/groups/sys/uclamp_min 0
|
||||||
write /proc/vendor_sched/sys_prefer_idle 0
|
write /proc/vendor_sched/groups/sys/prefer_idle 0
|
||||||
|
|
||||||
on property:vendor.disable.bcl.control=1
|
on property:vendor.disable.bcl.control=1
|
||||||
write /sys/devices/virtual/pmic/mitigation/instruction/enable_mitigation 0
|
write /sys/devices/virtual/pmic/mitigation/instruction/enable_mitigation 0
|
||||||
|
|
|
@ -370,6 +370,8 @@ on boot
|
||||||
write sys/module/usbcore/parameters/initial_descriptor_timeout 500
|
write sys/module/usbcore/parameters/initial_descriptor_timeout 500
|
||||||
# Use USB Gadget HAL
|
# Use USB Gadget HAL
|
||||||
setprop sys.usb.configfs 2
|
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
|
on property:sys.usb.ffs.ready=1 && property:sys.usb.config=adb && property:sys.usb.configfs=1
|
||||||
write /config/usb_gadget/g1/idProduct 0x4EE7
|
write /config/usb_gadget/g1/idProduct 0x4EE7
|
||||||
|
|
|
@ -155,6 +155,10 @@
|
||||||
/dev/acd-com.google.chre 0660 system system
|
/dev/acd-com.google.chre 0660 system system
|
||||||
/dev/acd-com.google.chre.non_wake_up 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
|
# LWIS
|
||||||
/dev/lwis* 0660 system system
|
/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_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_osc_freq 0440 system system
|
||||||
/sys/bus/aoc/devices/control udfps_get_disp_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
|
|
@ -75,6 +75,11 @@
|
||||||
<permission name="android.permission.POST_NOTIFICATIONS" fixed="false"/>
|
<permission name="android.permission.POST_NOTIFICATIONS" fixed="false"/>
|
||||||
</exception>
|
</exception>
|
||||||
|
|
||||||
|
<exception package="com.google.android.apps.setupwizard.searchselector">
|
||||||
|
<!-- Notifications -->
|
||||||
|
<permission name="android.permission.POST_NOTIFICATIONS" fixed="false"/>
|
||||||
|
</exception>
|
||||||
|
|
||||||
<exception
|
<exception
|
||||||
package="com.google.android.apps.restore">
|
package="com.google.android.apps.restore">
|
||||||
<!-- External storage -->
|
<!-- External storage -->
|
||||||
|
@ -145,5 +150,15 @@
|
||||||
<!-- Notifications -->
|
<!-- Notifications -->
|
||||||
<permission name="android.permission.POST_NOTIFICATIONS" fixed="true"/>
|
<permission name="android.permission.POST_NOTIFICATIONS" fixed="true"/>
|
||||||
</exception>
|
</exception>
|
||||||
|
<exception
|
||||||
|
package="com.google.android.apps.turbo">
|
||||||
|
<!-- Notifications -->
|
||||||
|
<permission name="android.permission.POST_NOTIFICATIONS" fixed="false"/>
|
||||||
|
</exception>
|
||||||
|
<exception
|
||||||
|
package="com.google.android.euicc">
|
||||||
|
<!-- Notifications -->
|
||||||
|
<permission name="android.permission.POST_NOTIFICATIONS" fixed="false"/>
|
||||||
|
</exception>
|
||||||
</exceptions>
|
</exceptions>
|
||||||
|
|
||||||
|
|
|
@ -56,6 +56,9 @@ PRODUCT_PRODUCT_PROPERTIES += \
|
||||||
# force enable MTE.
|
# force enable MTE.
|
||||||
ifeq (,$(filter %_fullmte,$(TARGET_PRODUCT)))
|
ifeq (,$(filter %_fullmte,$(TARGET_PRODUCT)))
|
||||||
PRODUCT_PRODUCT_PROPERTIES += ro.arm64.memtag.bootctl_supported=1
|
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.android.se=off
|
||||||
PRODUCT_PRODUCT_PROPERTIES += persist.arm64.memtag.app.com.google.android.bluetooth=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.app.com.android.nfc=off
|
||||||
|
|
91
device.mk
91
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/trusty/trusty.mk
|
||||||
include device/google/gs-common/pcie/pcie.mk
|
include device/google/gs-common/pcie/pcie.mk
|
||||||
include device/google/gs-common/storage/storage.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/performance/perf.mk
|
||||||
include device/google/gs-common/pixel_metrics/pixel_metrics.mk
|
include device/google/gs-common/pixel_metrics/pixel_metrics.mk
|
||||||
include device/google/gs-common/soc/freq.mk
|
include device/google/gs-common/soc/freq.mk
|
||||||
include device/google/gs-common/gps/dump/log.mk
|
include device/google/gs-common/gps/dump/log.mk
|
||||||
include device/google/gs-common/bcmbt/dump/dumplog.mk
|
include device/google/gs-common/bcmbt/dump/dumplog.mk
|
||||||
include device/google/gs-common/display/dump.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/camera/dump.mk
|
||||||
include device/google/gs-common/radio/dump.mk
|
include device/google/gs-common/radio/dump.mk
|
||||||
include device/google/gs-common/gear/dumpstate/aidl.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/sota_app/factoryota.mk
|
||||||
include device/google/gs-common/misc_writer/misc_writer.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/gyotaku_app/gyotaku.mk
|
||||||
|
include device/google/gs-common/bootctrl/bootctrl_aidl.mk
|
||||||
|
|
||||||
include device/google/zuma/dumpstate/item.mk
|
include device/google/zuma/dumpstate/item.mk
|
||||||
|
|
||||||
|
@ -118,9 +121,13 @@ ifneq (,$(filter userdebug eng, $(TARGET_BUILD_VARIANT)))
|
||||||
PRODUCT_PROPERTY_OVERRIDES += \
|
PRODUCT_PROPERTY_OVERRIDES += \
|
||||||
ro.logd.size=1M
|
ro.logd.size=1M
|
||||||
# b/114766334: persist all logs by default rotating on 30 files of 1MiB
|
# b/114766334: persist all logs by default rotating on 30 files of 1MiB
|
||||||
|
# change to 60 files for zuma
|
||||||
PRODUCT_PROPERTY_OVERRIDES += \
|
PRODUCT_PROPERTY_OVERRIDES += \
|
||||||
logd.logpersistd=logcatd \
|
logd.logpersistd=logcatd \
|
||||||
logd.logpersistd.size=30
|
logd.logpersistd.size=60
|
||||||
|
|
||||||
|
PRODUCT_PRODUCT_PROPERTIES += \
|
||||||
|
ro.logcat.compress=true
|
||||||
endif
|
endif
|
||||||
|
|
||||||
# From system.property
|
# From system.property
|
||||||
|
@ -191,11 +198,19 @@ PRODUCT_PRODUCT_PROPERTIES += \
|
||||||
|
|
||||||
# Carrier configuration default location
|
# Carrier configuration default location
|
||||||
PRODUCT_PROPERTY_OVERRIDES += \
|
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 += \
|
PRODUCT_PROPERTY_OVERRIDES += \
|
||||||
telephony.active_modems.max_count=2
|
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_LASSEN_OEMHOOK := true
|
||||||
|
|
||||||
# Use for GRIL
|
# Use for GRIL
|
||||||
|
@ -228,6 +243,7 @@ PRODUCT_SOONG_NAMESPACES += \
|
||||||
$(call soong_config_set,pixel_mali,soc,$(TARGET_BOARD_PLATFORM))
|
$(call soong_config_set,pixel_mali,soc,$(TARGET_BOARD_PLATFORM))
|
||||||
$(call soong_config_set,arm_gralloc,soc,$(TARGET_BOARD_PLATFORM))
|
$(call soong_config_set,arm_gralloc,soc,$(TARGET_BOARD_PLATFORM))
|
||||||
|
|
||||||
|
include device/google/gs-common/gpu/gpu.mk
|
||||||
PRODUCT_PACKAGES += \
|
PRODUCT_PACKAGES += \
|
||||||
csffw_image_prebuilt__firmware_prebuilt_ttux_mali_csffw.bin \
|
csffw_image_prebuilt__firmware_prebuilt_ttux_mali_csffw.bin \
|
||||||
libGLES_mali \
|
libGLES_mali \
|
||||||
|
@ -256,7 +272,7 @@ endif
|
||||||
PRODUCT_VENDOR_PROPERTIES += \
|
PRODUCT_VENDOR_PROPERTIES += \
|
||||||
vendor.mali.platform.config=/vendor/etc/mali/platform.config \
|
vendor.mali.platform.config=/vendor/etc/mali/platform.config \
|
||||||
vendor.mali.debug.config=/vendor/etc/mali/debug.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.base_protected_tls_max=67108864 \
|
||||||
vendor.mali.platform_agt_frequency_khz=24576
|
vendor.mali.platform_agt_frequency_khz=24576
|
||||||
|
|
||||||
|
@ -280,6 +296,9 @@ PRODUCT_VENDOR_PROPERTIES += \
|
||||||
graphics.gpu.profiler.support=true \
|
graphics.gpu.profiler.support=true \
|
||||||
debug.renderengine.backend=skiaglthreaded \
|
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)
|
# GRAPHICS - GPU (end)
|
||||||
# ####################
|
# ####################
|
||||||
|
|
||||||
|
@ -405,6 +424,10 @@ PRODUCT_PROPERTY_OVERRIDES += \
|
||||||
persist.vendor.verbose_logging_enabled=false
|
persist.vendor.verbose_logging_enabled=false
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
# Vendor modem extensive logging default property
|
||||||
|
PRODUCT_PROPERTY_OVERRIDES += \
|
||||||
|
persist.vendor.modem.extensive_logging_enabled=false
|
||||||
|
|
||||||
# CP Logging properties
|
# CP Logging properties
|
||||||
PRODUCT_PROPERTY_OVERRIDES += \
|
PRODUCT_PROPERTY_OVERRIDES += \
|
||||||
ro.vendor.sys.modem.logging.loc = /data/vendor/slog \
|
ro.vendor.sys.modem.logging.loc = /data/vendor/slog \
|
||||||
|
@ -527,7 +550,7 @@ PRODUCT_PACKAGES += \
|
||||||
|
|
||||||
PRODUCT_PACKAGES += \
|
PRODUCT_PACKAGES += \
|
||||||
android.hardware.graphics.mapper@4.0-impl \
|
android.hardware.graphics.mapper@4.0-impl \
|
||||||
android.hardware.graphics.allocator-V1-service
|
android.hardware.graphics.allocator-V2-service
|
||||||
|
|
||||||
PRODUCT_PACKAGES += \
|
PRODUCT_PACKAGES += \
|
||||||
android.hardware.memtrack-service.pixel \
|
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/emulated_storage.mk)
|
||||||
|
|
||||||
$(call inherit-product, $(SRC_TARGET_DIR)/product/virtual_ab_ota/android_t_baseline.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
|
# Enforce generic ramdisk allow list
|
||||||
$(call inherit-product, $(SRC_TARGET_DIR)/product/generic_ramdisk.mk)
|
$(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.earlyGl.app.duration=16600000
|
||||||
PRODUCT_DEFAULT_PROPERTY_OVERRIDES += debug.sf.frame_rate_multiple_threshold=120
|
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.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.enable_layer_caching=true
|
||||||
PRODUCT_DEFAULT_PROPERTY_OVERRIDES += ro.surface_flinger.set_idle_timer_ms?=80
|
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-storage.mk)
|
||||||
$(call inherit-product, system/core/trusty/trusty-base.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 += \
|
PRODUCT_PACKAGES_DEBUG += \
|
||||||
trusty-ut-ctrl \
|
trusty-ut-ctrl \
|
||||||
tipc-test \
|
tipc-test \
|
||||||
trusty_stats_test \
|
trusty_stats_test \
|
||||||
|
trusty-coverage-controller \
|
||||||
|
|
||||||
include device/google/gs101/confirmationui/confirmationui.mk
|
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
|
PRODUCT_PACKAGES += ShannonIms
|
||||||
|
|
||||||
#RCS Test Messaging App
|
|
||||||
PRODUCT_PACKAGES_DEBUG += \
|
|
||||||
TestRcsApp
|
|
||||||
|
|
||||||
PRODUCT_PACKAGES += ShannonRcs
|
PRODUCT_PACKAGES += ShannonRcs
|
||||||
|
|
||||||
ifeq (,$(filter aosp_% factory_%,$(TARGET_PRODUCT)))
|
ifeq (,$(filter aosp_% factory_%,$(TARGET_PRODUCT)))
|
||||||
|
@ -906,11 +927,6 @@ PRODUCT_PACKAGES += \
|
||||||
ImsMediaService \
|
ImsMediaService \
|
||||||
libimsmedia
|
libimsmedia
|
||||||
|
|
||||||
# Boot Control HAL
|
|
||||||
PRODUCT_PACKAGES += \
|
|
||||||
android.hardware.boot-service.default-zuma\
|
|
||||||
android.hardware.boot-service.default_recovery-zuma
|
|
||||||
|
|
||||||
# Exynos RIL and telephony
|
# Exynos RIL and telephony
|
||||||
# Multi SIM(DSDS)
|
# Multi SIM(DSDS)
|
||||||
SIM_COUNT := 2
|
SIM_COUNT := 2
|
||||||
|
@ -963,20 +979,40 @@ endif
|
||||||
# modem logging binary/configs
|
# modem logging binary/configs
|
||||||
PRODUCT_PACKAGES += modem_logging_control
|
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 += \
|
PRODUCT_PACKAGES += \
|
||||||
logging.conf \
|
logging.conf \
|
||||||
default.cfg \
|
default.cfg \
|
||||||
default.nprf \
|
default.nprf \
|
||||||
default_metrics.xml \
|
default_metrics.xml \
|
||||||
Pixel_stability.cfg \
|
extensive_logging.conf
|
||||||
Pixel_stability.nprf
|
|
||||||
|
# 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
|
endif
|
||||||
|
|
||||||
# ARM NN files
|
|
||||||
ARM_COMPUTE_CL_ENABLE := 1
|
|
||||||
|
|
||||||
# Vibrator Diag
|
# Vibrator Diag
|
||||||
PRODUCT_PACKAGES_DEBUG += \
|
PRODUCT_PACKAGES_DEBUG += \
|
||||||
diag-vibrator \
|
diag-vibrator \
|
||||||
|
@ -990,7 +1026,11 @@ PRODUCT_PACKAGES += \
|
||||||
|
|
||||||
# Audio
|
# Audio
|
||||||
# Audio HAL Server & Default Implementations
|
# 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
|
include device/google/gs-common/audio/hidl_zuma.mk
|
||||||
|
endif
|
||||||
|
|
||||||
## AoC soong
|
## AoC soong
|
||||||
PRODUCT_SOONG_NAMESPACES += \
|
PRODUCT_SOONG_NAMESPACES += \
|
||||||
|
@ -1045,7 +1085,6 @@ PRODUCT_PACKAGES += \
|
||||||
include device/google/gs101/telephony/pktrouter.mk
|
include device/google/gs101/telephony/pktrouter.mk
|
||||||
|
|
||||||
# Thermal HAL
|
# Thermal HAL
|
||||||
include hardware/google/pixel/thermal/device.mk
|
|
||||||
PRODUCT_PROPERTY_OVERRIDES += persist.vendor.enable.thermal.genl=true
|
PRODUCT_PROPERTY_OVERRIDES += persist.vendor.enable.thermal.genl=true
|
||||||
|
|
||||||
# EdgeTPU
|
# EdgeTPU
|
||||||
|
@ -1132,10 +1171,6 @@ PRODUCT_VENDOR_PROPERTIES += ro.crypto.metadata_init_delete_all_keys.enabled?=tr
|
||||||
PRODUCT_PROPERTY_OVERRIDES += \
|
PRODUCT_PROPERTY_OVERRIDES += \
|
||||||
ro.crypto.volume.options=aes-256-xts:aes-256-hctr2
|
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
|
# Hardware Info Collection
|
||||||
include hardware/google/pixel/HardwareInfo/HardwareInfo.mk
|
include hardware/google/pixel/HardwareInfo/HardwareInfo.mk
|
||||||
|
|
||||||
|
|
|
@ -76,9 +76,9 @@
|
||||||
<instance>default</instance>
|
<instance>default</instance>
|
||||||
</interface>
|
</interface>
|
||||||
</hal>
|
</hal>
|
||||||
<hal format="aidl" optional="true">
|
<hal format="aidl" optional="true" updatable-via-apex="true">
|
||||||
<name>com.google.face.debug</name>
|
<name>com.google.face.debug</name>
|
||||||
<version>4</version>
|
<version>3-4</version>
|
||||||
<interface>
|
<interface>
|
||||||
<name>IDebugHost</name>
|
<name>IDebugHost</name>
|
||||||
<instance>default</instance>
|
<instance>default</instance>
|
||||||
|
@ -104,9 +104,17 @@
|
||||||
<instance>default</instance>
|
<instance>default</instance>
|
||||||
</interface>
|
</interface>
|
||||||
</hal>
|
</hal>
|
||||||
|
<hal format="aidl" optional="true">
|
||||||
|
<name>com.google.edgetpu.tachyon</name>
|
||||||
|
<version>1</version>
|
||||||
|
<interface>
|
||||||
|
<name>IComputeService</name>
|
||||||
|
<instance>default</instance>
|
||||||
|
</interface>
|
||||||
|
</hal>
|
||||||
<hal format="aidl" optional="true">
|
<hal format="aidl" optional="true">
|
||||||
<name>com.google.hardware.pixel.display</name>
|
<name>com.google.hardware.pixel.display</name>
|
||||||
<version>9</version>
|
<version>10</version>
|
||||||
<interface>
|
<interface>
|
||||||
<name>IDisplay</name>
|
<name>IDisplay</name>
|
||||||
<instance>default</instance>
|
<instance>default</instance>
|
||||||
|
@ -122,7 +130,7 @@
|
||||||
</hal>
|
</hal>
|
||||||
<hal format="aidl" optional="true">
|
<hal format="aidl" optional="true">
|
||||||
<name>com.google.input</name>
|
<name>com.google.input</name>
|
||||||
<version>2</version>
|
<version>1-2</version>
|
||||||
<interface>
|
<interface>
|
||||||
<name>ITouchContextService</name>
|
<name>ITouchContextService</name>
|
||||||
<instance>default</instance>
|
<instance>default</instance>
|
||||||
|
@ -153,7 +161,7 @@
|
||||||
</hal>
|
</hal>
|
||||||
<hal format="aidl" optional="true">
|
<hal format="aidl" optional="true">
|
||||||
<name>vendor.google.google_battery</name>
|
<name>vendor.google.google_battery</name>
|
||||||
<version>2</version>
|
<version>2-3</version>
|
||||||
<interface>
|
<interface>
|
||||||
<name>IGoogleBattery</name>
|
<name>IGoogleBattery</name>
|
||||||
<instance>default</instance>
|
<instance>default</instance>
|
||||||
|
@ -169,7 +177,7 @@
|
||||||
</hal>
|
</hal>
|
||||||
<hal format="aidl" optional="true">
|
<hal format="aidl" optional="true">
|
||||||
<name>vendor.google.wifi_ext</name>
|
<name>vendor.google.wifi_ext</name>
|
||||||
<version>1</version>
|
<version>2-3</version>
|
||||||
<interface>
|
<interface>
|
||||||
<name>IWifiExt</name>
|
<name>IWifiExt</name>
|
||||||
<instance>default</instance>
|
<instance>default</instance>
|
||||||
|
@ -185,6 +193,13 @@
|
||||||
<instance>sced0</instance>
|
<instance>sced0</instance>
|
||||||
</interface>
|
</interface>
|
||||||
</hal>
|
</hal>
|
||||||
|
<hal format="aidl" optional="true">
|
||||||
|
<name>com.google.pixel.modem.logmasklibrary</name>
|
||||||
|
<interface>
|
||||||
|
<name>ILiboemserviceProxy</name>
|
||||||
|
<instance>default</instance>
|
||||||
|
</interface>
|
||||||
|
</hal>
|
||||||
<hal format="hidl" optional="true">
|
<hal format="hidl" optional="true">
|
||||||
<name>vendor.samsung_slsi.telephony.hardware.radioExternal</name>
|
<name>vendor.samsung_slsi.telephony.hardware.radioExternal</name>
|
||||||
<version>1.1</version>
|
<version>1.1</version>
|
||||||
|
|
|
@ -9,18 +9,21 @@ sh_binary {
|
||||||
sub_dir: "dump",
|
sub_dir: "dump",
|
||||||
}
|
}
|
||||||
|
|
||||||
sh_binary {
|
cc_binary {
|
||||||
name: "dump_power.sh",
|
name: "dump_power",
|
||||||
src: "dump_power.sh",
|
srcs: ["dump_power.cpp"],
|
||||||
|
cflags: [
|
||||||
|
"-Wall",
|
||||||
|
"-Wextra",
|
||||||
|
"-Werror",
|
||||||
|
],
|
||||||
|
shared_libs: [
|
||||||
|
"libbase",
|
||||||
|
"libdump",
|
||||||
|
"libdumpstateutil",
|
||||||
|
],
|
||||||
vendor: true,
|
vendor: true,
|
||||||
sub_dir: "dump",
|
relative_install_path: "dump",
|
||||||
}
|
|
||||||
|
|
||||||
sh_binary {
|
|
||||||
name: "dump_cma.sh",
|
|
||||||
src: "dump_cma.sh",
|
|
||||||
vendor: true,
|
|
||||||
sub_dir: "dump",
|
|
||||||
}
|
}
|
||||||
|
|
||||||
sh_binary {
|
sh_binary {
|
||||||
|
@ -29,3 +32,4 @@ sh_binary {
|
||||||
vendor: true,
|
vendor: true,
|
||||||
sub_dir: "dump",
|
sub_dir: "dump",
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -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
|
|
||||||
|
|
935
dumpstate/dump_power.cpp
Normal file
935
dumpstate/dump_power.cpp
Normal file
|
@ -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 <cstring>
|
||||||
|
#include <dirent.h>
|
||||||
|
#include <dump/pixel_dump.h>
|
||||||
|
#include <fstream>
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <sys/sysinfo.h>
|
||||||
|
#include <time.h>
|
||||||
|
#include <vector>
|
||||||
|
|
||||||
|
#include <android-base/file.h>
|
||||||
|
#include <android-base/strings.h>
|
||||||
|
#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<std::string> *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<std::string> 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<std::string> 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<std::string> 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<std::string> 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<std::string> 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<std::string> 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<std::string> 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<std::string> 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<std::string> channelNames;
|
||||||
|
std::vector<std::string> channelData[DUR_MAX];
|
||||||
|
std::vector<std::string> pwrwarnThreshold[PWRWARN_MAX];
|
||||||
|
std::vector<std::string> pwrwarnCode[PWRWARN_MAX];
|
||||||
|
std::vector<std::string> lpfCurrentVals[PWRWARN_MAX];
|
||||||
|
std::vector<std::string> 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();
|
||||||
|
}
|
||||||
|
|
|
@ -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
|
|
|
@ -1,6 +1,4 @@
|
||||||
PRODUCT_PACKAGES += dump_wlan.sh \
|
PRODUCT_PACKAGES += dump_wlan.sh \
|
||||||
dump_power.sh
|
dump_power
|
||||||
|
|
||||||
PRODUCT_PACKAGES_DEBUG += dump_cma.sh \
|
|
||||||
dump_gsa.sh
|
|
||||||
|
|
||||||
|
PRODUCT_PACKAGES_DEBUG += dump_gsa.sh
|
||||||
|
|
|
@ -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
|
|
|
@ -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
|
|
|
@ -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 <android-base/file.h>
|
|
||||||
#include <cutils/properties.h>
|
|
||||||
#include <log/log.h>
|
|
||||||
|
|
||||||
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<uint32_t> 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<uint32_t> BootControl::getCurrentSlot() {
|
|
||||||
char suffix[PROPERTY_VALUE_MAX];
|
|
||||||
property_get("ro.boot.slot_suffix", suffix, "_a");
|
|
||||||
return std::string(suffix) == "_b" ? 1 : 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
Return<void> 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<void> 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<void> 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<void> 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
|
|
|
@ -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 <android/hardware/boot/1.0/IBootControl.h>
|
|
||||||
#include <hidl/MQDescriptor.h>
|
|
||||||
#include <hidl/Status.h>
|
|
||||||
|
|
||||||
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<uint32_t> getNumberSlots() override;
|
|
||||||
Return<uint32_t> getCurrentSlot() override;
|
|
||||||
Return<void> markBootSuccessful(markBootSuccessful_cb _hidl_cb) override;
|
|
||||||
Return<void> setActiveBootSlot(uint32_t slot, setActiveBootSlot_cb _hidl_cb) override;
|
|
||||||
Return<void> 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<void> 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
|
|
|
@ -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 <errno.h>
|
|
||||||
#include <log/log.h>
|
|
||||||
#include <android-base/file.h>
|
|
||||||
#include <linux/fs.h>
|
|
||||||
#include <zlib.h>
|
|
||||||
|
|
||||||
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 <partition name, gpt_entry pointer>
|
|
||||||
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<gpt_entry *>(&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<uint8_t *>(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<uint8_t *>(&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<uint8_t *>(&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
|
|
|
@ -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 <string>
|
|
||||||
#include <vector>
|
|
||||||
#include <map>
|
|
||||||
|
|
||||||
namespace android {
|
|
||||||
namespace hardware {
|
|
||||||
namespace boot {
|
|
||||||
namespace V1_0 {
|
|
||||||
namespace implementation {
|
|
||||||
|
|
||||||
#define GPT_SIGNATURE 0x5452415020494645UL
|
|
||||||
|
|
||||||
typedef struct {
|
|
||||||
uint8_t type_guid[16];
|
|
||||||
uint8_t guid[16];
|
|
||||||
uint64_t first_lba;
|
|
||||||
uint64_t last_lba;
|
|
||||||
uint64_t attr;
|
|
||||||
uint16_t name[36];
|
|
||||||
} __attribute__((packed)) gpt_entry;
|
|
||||||
|
|
||||||
typedef struct {
|
|
||||||
uint64_t signature;
|
|
||||||
uint32_t revision;
|
|
||||||
uint32_t header_size;
|
|
||||||
uint32_t crc32;
|
|
||||||
uint32_t reserved;
|
|
||||||
uint64_t current_lba;
|
|
||||||
uint64_t backup_lba;
|
|
||||||
uint64_t first_usable_lba;
|
|
||||||
uint64_t last_usable_lba;
|
|
||||||
uint8_t disk_guid[16];
|
|
||||||
uint64_t start_lba;
|
|
||||||
uint32_t entry_count;
|
|
||||||
uint32_t entry_size;
|
|
||||||
uint32_t entries_crc32;
|
|
||||||
} __attribute__((packed)) gpt_header;
|
|
||||||
|
|
||||||
class GptUtils {
|
|
||||||
public:
|
|
||||||
GptUtils(const std::string dev_path);
|
|
||||||
int Load(void);
|
|
||||||
gpt_entry *GetPartitionEntry(std::string name);
|
|
||||||
int Sync(void);
|
|
||||||
~GptUtils();
|
|
||||||
|
|
||||||
private:
|
|
||||||
std::string dev_path;
|
|
||||||
int fd;
|
|
||||||
uint32_t block_size;
|
|
||||||
gpt_header gpt_primary;
|
|
||||||
gpt_header gpt_backup;
|
|
||||||
std::vector<gpt_entry> entry_array;
|
|
||||||
std::map<std::string, gpt_entry *>entries;
|
|
||||||
};
|
|
||||||
|
|
||||||
} // namespace implementation
|
|
||||||
} // namespace V1_0
|
|
||||||
} // namespace boot
|
|
||||||
} // namespace hardware
|
|
||||||
} // namespace android
|
|
|
@ -1,4 +0,0 @@
|
||||||
service vendor.boot-hal-1-0 /vendor/bin/hw/android.hardware.boot@1.0-service-zuma
|
|
||||||
class early_hal
|
|
||||||
user root
|
|
||||||
group root
|
|
|
@ -1,47 +0,0 @@
|
||||||
/*
|
|
||||||
* Copyright (C) 2016 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.boot@1.0-service"
|
|
||||||
|
|
||||||
#include <log/log.h>
|
|
||||||
#include <hidl/HidlTransportSupport.h>
|
|
||||||
#include <hidl/Status.h>
|
|
||||||
#include <android/hardware/boot/1.0/IBootControl.h>
|
|
||||||
#include "BootControl.h"
|
|
||||||
|
|
||||||
using ::android::status_t;
|
|
||||||
|
|
||||||
using ::android::hardware::boot::V1_0::IBootControl;
|
|
||||||
|
|
||||||
using ::android::hardware::boot::V1_0::implementation::BootControl;
|
|
||||||
|
|
||||||
int main (int /* argc */, char * /* argv */ []) {
|
|
||||||
// This function must be called before you join to ensure the proper
|
|
||||||
// number of threads are created. The threadpool will never exceed
|
|
||||||
// size one because of this call.
|
|
||||||
::android::hardware::configureRpcThreadpool(1 /*threads*/, true /*willJoin*/);
|
|
||||||
|
|
||||||
::android::sp bootctrl = new BootControl();
|
|
||||||
const status_t status = bootctrl->registerAsService();
|
|
||||||
if (status != ::android::OK) {
|
|
||||||
return 1; // or handle error
|
|
||||||
}
|
|
||||||
|
|
||||||
// Adds this thread to the threadpool, resulting in one total
|
|
||||||
// thread in the threadpool. We could also do other things, but
|
|
||||||
// would have to specify 'false' to willJoin in configureRpcThreadpool.
|
|
||||||
::android::hardware::joinRpcThreadpool();
|
|
||||||
return 1; // joinRpcThreadpool should never return
|
|
||||||
}
|
|
|
@ -1,83 +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.
|
|
||||||
|
|
||||||
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: "android.hardware.boot@1.2-service-zuma",
|
|
||||||
defaults: ["hidl_defaults"],
|
|
||||||
relative_install_path: "hw",
|
|
||||||
vendor: true,
|
|
||||||
init_rc: ["android.hardware.boot@1.2-service-zuma.rc"],
|
|
||||||
srcs: [
|
|
||||||
"BootControl.cpp",
|
|
||||||
"GptUtils.cpp",
|
|
||||||
"service.cpp"
|
|
||||||
],
|
|
||||||
shared_libs: [
|
|
||||||
"libbase",
|
|
||||||
"liblog",
|
|
||||||
"libhidlbase",
|
|
||||||
"libutils",
|
|
||||||
"libcutils",
|
|
||||||
"libz",
|
|
||||||
"libtrusty",
|
|
||||||
"android.hardware.boot@1.0",
|
|
||||||
"android.hardware.boot@1.1",
|
|
||||||
"android.hardware.boot@1.2",
|
|
||||||
],
|
|
||||||
static_libs: [
|
|
||||||
"libboot_control",
|
|
||||||
"libbootloader_message_vendor",
|
|
||||||
"libfstab",
|
|
||||||
],
|
|
||||||
}
|
|
||||||
|
|
||||||
cc_library {
|
|
||||||
name: "android.hardware.boot@1.2-impl-zuma",
|
|
||||||
stem: "android.hardware.boot@1.0-impl-1.2-impl-zuma",
|
|
||||||
recovery: true,
|
|
||||||
srcs: [
|
|
||||||
"BootControl.cpp",
|
|
||||||
"GptUtils.cpp",
|
|
||||||
],
|
|
||||||
relative_install_path: "hw",
|
|
||||||
shared_libs: [
|
|
||||||
"libbase",
|
|
||||||
"liblog",
|
|
||||||
"libhidlbase",
|
|
||||||
"libutils",
|
|
||||||
"libcutils",
|
|
||||||
"libz",
|
|
||||||
"libtrusty",
|
|
||||||
"android.hardware.boot@1.0",
|
|
||||||
"android.hardware.boot@1.1",
|
|
||||||
"android.hardware.boot@1.2",
|
|
||||||
],
|
|
||||||
static_libs: [
|
|
||||||
"libboot_control",
|
|
||||||
"libbootloader_message_vendor",
|
|
||||||
"libfstab",
|
|
||||||
],
|
|
||||||
}
|
|
|
@ -1,501 +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.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#define LOG_TAG "bootcontrolhal"
|
|
||||||
|
|
||||||
#include "BootControl.h"
|
|
||||||
|
|
||||||
#include <android-base/file.h>
|
|
||||||
#include <android-base/unique_fd.h>
|
|
||||||
#include <bootloader_message/bootloader_message.h>
|
|
||||||
#include <cutils/properties.h>
|
|
||||||
#include <libboot_control/libboot_control.h>
|
|
||||||
#include <log/log.h>
|
|
||||||
#include <trusty/tipc.h>
|
|
||||||
|
|
||||||
#include "DevInfo.h"
|
|
||||||
#include "GptUtils.h"
|
|
||||||
|
|
||||||
namespace android {
|
|
||||||
namespace hardware {
|
|
||||||
namespace boot {
|
|
||||||
namespace V1_2 {
|
|
||||||
namespace implementation {
|
|
||||||
|
|
||||||
using android::bootable::GetMiscVirtualAbMergeStatus;
|
|
||||||
using android::bootable::InitMiscVirtualAbMessageIfNeeded;
|
|
||||||
using android::bootable::SetMiscVirtualAbMergeStatus;
|
|
||||||
using android::hardware::boot::V1_0::BoolResult;
|
|
||||||
using android::hardware::boot::V1_0::CommandResult;
|
|
||||||
using android::hardware::boot::V1_1::MergeStatus;
|
|
||||||
|
|
||||||
namespace {
|
|
||||||
|
|
||||||
// clang-format off
|
|
||||||
|
|
||||||
#define BOOT_A_PATH "/dev/block/by-name/boot_a"
|
|
||||||
#define BOOT_B_PATH "/dev/block/by-name/boot_b"
|
|
||||||
#define DEVINFO_PATH "/dev/block/by-name/devinfo"
|
|
||||||
|
|
||||||
// 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
|
|
||||||
|
|
||||||
// clang-format on
|
|
||||||
|
|
||||||
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 bool 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 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;
|
|
||||||
}
|
|
||||||
|
|
||||||
e->attr |= flag;
|
|
||||||
gpt.Sync();
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
static bool is_devinfo_valid;
|
|
||||||
static bool is_devinfo_initialized;
|
|
||||||
static std::mutex devinfo_lock;
|
|
||||||
static devinfo_t devinfo;
|
|
||||||
|
|
||||||
static bool isDevInfoValid() {
|
|
||||||
const std::lock_guard<std::mutex> lock(devinfo_lock);
|
|
||||||
|
|
||||||
if (is_devinfo_initialized) {
|
|
||||||
return is_devinfo_valid;
|
|
||||||
}
|
|
||||||
|
|
||||||
is_devinfo_initialized = true;
|
|
||||||
|
|
||||||
android::base::unique_fd fd(open(DEVINFO_PATH, O_RDONLY));
|
|
||||||
android::base::ReadFully(fd, &devinfo, sizeof devinfo);
|
|
||||||
|
|
||||||
if (devinfo.magic != DEVINFO_MAGIC) {
|
|
||||||
return is_devinfo_valid;
|
|
||||||
}
|
|
||||||
|
|
||||||
uint32_t version = ((uint32_t)devinfo.ver_major << 16) | devinfo.ver_minor;
|
|
||||||
// only version 3.3+ supports A/B data
|
|
||||||
if (version >= 0x0003'0003) {
|
|
||||||
is_devinfo_valid = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
return is_devinfo_valid;
|
|
||||||
}
|
|
||||||
|
|
||||||
static bool DevInfoSync() {
|
|
||||||
if (!isDevInfoValid()) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
android::base::unique_fd fd(open(DEVINFO_PATH, O_WRONLY | O_DSYNC));
|
|
||||||
return android::base::WriteFully(fd, &devinfo, sizeof devinfo);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void DevInfoInitSlot(devinfo_ab_slot_data_t &slot_data) {
|
|
||||||
slot_data.retry_count = AB_ATTR_MAX_RETRY_COUNT;
|
|
||||||
slot_data.unbootable = 0;
|
|
||||||
slot_data.successful = 0;
|
|
||||||
slot_data.active = 1;
|
|
||||||
slot_data.fastboot_ok = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
static int blow_otp_AR(bool secure) {
|
|
||||||
static const char *dev_name = "/dev/trusty-ipc-dev0";
|
|
||||||
static const char *otp_name = "com.android.trusty.otp_manager.tidl";
|
|
||||||
int fd = 1, ret = 0;
|
|
||||||
uint32_t cmd = secure? OTP_CMD_write_antirbk_secure_ap : OTP_CMD_write_antirbk_non_secure_ap;
|
|
||||||
fd = tipc_connect(dev_name, otp_name);
|
|
||||||
if (fd < 0) {
|
|
||||||
ALOGI("Failed to connect to OTP_MGR ns TA - is it missing?\n");
|
|
||||||
ret = -1;
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
struct otp_mgr_req_base req = {
|
|
||||||
.command = cmd,
|
|
||||||
.resp_payload_size = 0,
|
|
||||||
};
|
|
||||||
struct iovec iov[] = {
|
|
||||||
{
|
|
||||||
.iov_base = &req,
|
|
||||||
.iov_len = sizeof(req),
|
|
||||||
},
|
|
||||||
};
|
|
||||||
|
|
||||||
int rc = tipc_send(fd, iov, 1, NULL, 0);
|
|
||||||
if (rc != sizeof(req)) {
|
|
||||||
ALOGI("Send fail! %x\n", rc);
|
|
||||||
return rc;
|
|
||||||
}
|
|
||||||
|
|
||||||
struct otp_mgr_rsp_base resp;
|
|
||||||
rc = read(fd, &resp, sizeof(resp));
|
|
||||||
if (rc < 0) {
|
|
||||||
ALOGI("Read fail! %x\n", rc);
|
|
||||||
return rc;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (rc < sizeof(resp)) {
|
|
||||||
ALOGI("Not enough data! %x\n", rc);
|
|
||||||
return -EIO;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (resp.command != (cmd | OTP_RESP_BIT)) {
|
|
||||||
ALOGI("Wrong command! %x\n", resp.command);
|
|
||||||
return -EINVAL;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (resp.result != 0) {
|
|
||||||
fprintf(stderr, "AR writing error! %x\n", resp.result);
|
|
||||||
return -EINVAL;
|
|
||||||
}
|
|
||||||
|
|
||||||
tipc_close(fd);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
static bool blowAR() {
|
|
||||||
int ret = blow_otp_AR(true);
|
|
||||||
if (ret) {
|
|
||||||
ALOGI("Blow secure anti-rollback OTP failed");
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
ret = blow_otp_AR(false);
|
|
||||||
if (ret) {
|
|
||||||
ALOGI("Blow non-secure anti-rollback OTP failed");
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
} // namespace
|
|
||||||
|
|
||||||
// Methods from ::android::hardware::boot::V1_0::IBootControl follow.
|
|
||||||
Return<uint32_t> 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<uint32_t> BootControl::getCurrentSlot() {
|
|
||||||
char suffix[PROPERTY_VALUE_MAX];
|
|
||||||
property_get("ro.boot.slot_suffix", suffix, "_a");
|
|
||||||
return std::string(suffix) == "_b" ? 1 : 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
Return<void> BootControl::markBootSuccessful(markBootSuccessful_cb _hidl_cb) {
|
|
||||||
if (getNumberSlots() == 0) {
|
|
||||||
// no slots, just return true otherwise Android keeps trying
|
|
||||||
_hidl_cb({true, ""});
|
|
||||||
return Void();
|
|
||||||
}
|
|
||||||
|
|
||||||
bool ret;
|
|
||||||
if (isDevInfoValid()) {
|
|
||||||
auto const slot = getCurrentSlot();
|
|
||||||
devinfo.ab_data.slots[slot].successful = 1;
|
|
||||||
ret = DevInfoSync();
|
|
||||||
} else {
|
|
||||||
ret = setSlotFlag(getCurrentSlot(), AB_ATTR_SUCCESSFUL);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!ret) {
|
|
||||||
_hidl_cb({false, "Failed to set successful flag"});
|
|
||||||
return Void();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!blowAR()) {
|
|
||||||
ALOGE("Failed to blow anti-rollback counter");
|
|
||||||
// Ignore the error, since ABL will re-trigger it on reboot
|
|
||||||
}
|
|
||||||
|
|
||||||
_hidl_cb({true, ""});
|
|
||||||
return Void();
|
|
||||||
}
|
|
||||||
|
|
||||||
Return<void> BootControl::setActiveBootSlot(uint32_t slot, setActiveBootSlot_cb _hidl_cb) {
|
|
||||||
if (slot >= 2) {
|
|
||||||
_hidl_cb({false, "Invalid slot"});
|
|
||||||
return Void();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (isDevInfoValid()) {
|
|
||||||
auto &active_slot_data = devinfo.ab_data.slots[slot];
|
|
||||||
auto &inactive_slot_data = devinfo.ab_data.slots[!slot];
|
|
||||||
|
|
||||||
inactive_slot_data.active = 0;
|
|
||||||
DevInfoInitSlot(active_slot_data);
|
|
||||||
|
|
||||||
if (!DevInfoSync()) {
|
|
||||||
_hidl_cb({false, "Could not update DevInfo data"});
|
|
||||||
return Void();
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
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);
|
|
||||||
|
|
||||||
// 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);
|
|
||||||
}
|
|
||||||
|
|
||||||
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 | O_DSYNC);
|
|
||||||
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 | O_DSYNC);
|
|
||||||
if (fd < 0) {
|
|
||||||
_hidl_cb({false, "failed to open ufs attr boot_lun_enabled"});
|
|
||||||
return Void();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
// 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<void> BootControl::setSlotAsUnbootable(uint32_t slot, setSlotAsUnbootable_cb _hidl_cb) {
|
|
||||||
if (slot >= 2) {
|
|
||||||
_hidl_cb({false, "Invalid slot"});
|
|
||||||
return Void();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (isDevInfoValid()) {
|
|
||||||
auto &slot_data = devinfo.ab_data.slots[slot];
|
|
||||||
slot_data.unbootable = 1;
|
|
||||||
if (!DevInfoSync()) {
|
|
||||||
_hidl_cb({false, "Could not update DevInfo data"});
|
|
||||||
return Void();
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
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;
|
|
||||||
|
|
||||||
bool unbootable;
|
|
||||||
if (isDevInfoValid()) {
|
|
||||||
auto &slot_data = devinfo.ab_data.slots[slot];
|
|
||||||
unbootable = !!slot_data.unbootable;
|
|
||||||
} else {
|
|
||||||
unbootable = isSlotFlagSet(slot, AB_ATTR_UNBOOTABLE);
|
|
||||||
}
|
|
||||||
|
|
||||||
return 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;
|
|
||||||
|
|
||||||
bool successful;
|
|
||||||
if (isDevInfoValid()) {
|
|
||||||
auto &slot_data = devinfo.ab_data.slots[slot];
|
|
||||||
successful = !!slot_data.successful;
|
|
||||||
} else {
|
|
||||||
successful = isSlotFlagSet(slot, AB_ATTR_SUCCESSFUL);
|
|
||||||
}
|
|
||||||
|
|
||||||
return successful ? BoolResult::TRUE : BoolResult::FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
Return<void> BootControl::getSuffix(uint32_t slot, getSuffix_cb _hidl_cb) {
|
|
||||||
_hidl_cb(slot == 0 ? "_a" : slot == 1 ? "_b" : "");
|
|
||||||
return Void();
|
|
||||||
}
|
|
||||||
|
|
||||||
// Methods from ::android::hardware::boot::V1_1::IBootControl follow.
|
|
||||||
bool BootControl::Init() {
|
|
||||||
return InitMiscVirtualAbMessageIfNeeded();
|
|
||||||
}
|
|
||||||
|
|
||||||
Return<bool> BootControl::setSnapshotMergeStatus(
|
|
||||||
::android::hardware::boot::V1_1::MergeStatus status) {
|
|
||||||
return SetMiscVirtualAbMergeStatus(getCurrentSlot(), status);
|
|
||||||
}
|
|
||||||
|
|
||||||
Return<::android::hardware::boot::V1_1::MergeStatus> BootControl::getSnapshotMergeStatus() {
|
|
||||||
MergeStatus status;
|
|
||||||
if (!GetMiscVirtualAbMergeStatus(getCurrentSlot(), &status)) {
|
|
||||||
return MergeStatus::UNKNOWN;
|
|
||||||
}
|
|
||||||
return status;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Methods from ::android::hardware::boot::V1_2::IBootControl follow.
|
|
||||||
Return<uint32_t> BootControl::getActiveBootSlot() {
|
|
||||||
if (getNumberSlots() == 0)
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
if (isDevInfoValid())
|
|
||||||
return devinfo.ab_data.slots[1].active ? 1 : 0;
|
|
||||||
return isSlotFlagSet(1, AB_ATTR_ACTIVE) ? 1 : 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Methods from ::android::hidl::base::V1_0::IBase follow.
|
|
||||||
|
|
||||||
IBootControl *HIDL_FETCH_IBootControl(const char * /* name */) {
|
|
||||||
auto module = new BootControl();
|
|
||||||
|
|
||||||
module->Init();
|
|
||||||
|
|
||||||
return module;
|
|
||||||
}
|
|
||||||
|
|
||||||
} // namespace implementation
|
|
||||||
} // namespace V1_2
|
|
||||||
} // namespace boot
|
|
||||||
} // namespace hardware
|
|
||||||
} // namespace android
|
|
|
@ -1,88 +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.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#pragma once
|
|
||||||
|
|
||||||
#include <android/hardware/boot/1.2/IBootControl.h>
|
|
||||||
#include <hidl/MQDescriptor.h>
|
|
||||||
#include <hidl/Status.h>
|
|
||||||
|
|
||||||
namespace android {
|
|
||||||
namespace hardware {
|
|
||||||
namespace boot {
|
|
||||||
namespace V1_2 {
|
|
||||||
namespace implementation {
|
|
||||||
|
|
||||||
using ::android::sp;
|
|
||||||
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;
|
|
||||||
|
|
||||||
struct BootControl : public IBootControl {
|
|
||||||
bool Init();
|
|
||||||
|
|
||||||
// Methods from ::android::hardware::boot::V1_0::IBootControl follow.
|
|
||||||
Return<uint32_t> getNumberSlots() override;
|
|
||||||
Return<uint32_t> getCurrentSlot() override;
|
|
||||||
Return<void> markBootSuccessful(markBootSuccessful_cb _hidl_cb) override;
|
|
||||||
Return<void> setActiveBootSlot(uint32_t slot, setActiveBootSlot_cb _hidl_cb) override;
|
|
||||||
Return<void> 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<void> getSuffix(uint32_t slot, getSuffix_cb _hidl_cb) override;
|
|
||||||
|
|
||||||
// Methods from ::android::hardware::boot::V1_1::IBootControl follow.
|
|
||||||
Return<bool> setSnapshotMergeStatus(
|
|
||||||
::android::hardware::boot::V1_1::MergeStatus status) override;
|
|
||||||
Return<::android::hardware::boot::V1_1::MergeStatus> getSnapshotMergeStatus() override;
|
|
||||||
|
|
||||||
// Methods from ::android::hardware::boot::V1_2::IBootControl follow.
|
|
||||||
Return<uint32_t> getActiveBootSlot() 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);
|
|
||||||
|
|
||||||
enum otpmgr_command : uint32_t {
|
|
||||||
OTP_REQ_SHIFT = 1,
|
|
||||||
OTP_RESP_BIT = 1,
|
|
||||||
OTP_CMD_write_antirbk_non_secure_ap = (7 << OTP_REQ_SHIFT),
|
|
||||||
OTP_CMD_write_antirbk_secure_ap = (8 << OTP_REQ_SHIFT),
|
|
||||||
};
|
|
||||||
|
|
||||||
struct otp_mgr_req_base {
|
|
||||||
uint32_t command;
|
|
||||||
uint32_t resp_payload_size;
|
|
||||||
uint8_t handle;
|
|
||||||
}__packed;
|
|
||||||
|
|
||||||
struct otp_mgr_rsp_base {
|
|
||||||
uint32_t command;
|
|
||||||
uint32_t resp_payload_size;
|
|
||||||
int result;
|
|
||||||
}__packed;
|
|
||||||
|
|
||||||
} // namespace implementation
|
|
||||||
} // namespace V1_2
|
|
||||||
} // namespace boot
|
|
||||||
} // namespace hardware
|
|
||||||
} // namespace android
|
|
|
@ -1,61 +0,0 @@
|
||||||
/*
|
|
||||||
* Copyright (C) 2021 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
|
|
||||||
|
|
||||||
namespace android {
|
|
||||||
namespace hardware {
|
|
||||||
namespace boot {
|
|
||||||
namespace V1_2 {
|
|
||||||
namespace implementation {
|
|
||||||
|
|
||||||
//
|
|
||||||
// definitions taken from ABL code
|
|
||||||
//
|
|
||||||
|
|
||||||
constexpr uint32_t DEVINFO_MAGIC = 0x49564544;
|
|
||||||
constexpr size_t DEVINFO_AB_SLOT_COUNT = 2;
|
|
||||||
|
|
||||||
struct devinfo_ab_slot_data_t {
|
|
||||||
uint8_t retry_count;
|
|
||||||
uint8_t unbootable : 1;
|
|
||||||
uint8_t successful : 1;
|
|
||||||
uint8_t active : 1;
|
|
||||||
uint8_t fastboot_ok : 1;
|
|
||||||
uint8_t : 4;
|
|
||||||
uint8_t unused[2];
|
|
||||||
} __attribute__((packed));
|
|
||||||
|
|
||||||
typedef struct {
|
|
||||||
devinfo_ab_slot_data_t slots[DEVINFO_AB_SLOT_COUNT];
|
|
||||||
} __attribute__((packed)) devinfo_ab_data_t;
|
|
||||||
|
|
||||||
struct devinfo_t {
|
|
||||||
uint32_t magic;
|
|
||||||
uint16_t ver_major;
|
|
||||||
uint16_t ver_minor;
|
|
||||||
uint8_t unused[40];
|
|
||||||
devinfo_ab_data_t ab_data;
|
|
||||||
uint8_t unused1[72]; // use remaining up to complete 128 bytes
|
|
||||||
} __attribute__((packed));
|
|
||||||
|
|
||||||
static_assert(sizeof(devinfo_t) == 128, "invalid devinfo struct size");
|
|
||||||
|
|
||||||
} // namespace implementation
|
|
||||||
} // namespace V1_2
|
|
||||||
} // namespace boot
|
|
||||||
} // namespace hardware
|
|
||||||
} // namespace android
|
|
|
@ -1,193 +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 <android-base/file.h>
|
|
||||||
#include <errno.h>
|
|
||||||
#include <linux/fs.h>
|
|
||||||
#include <log/log.h>
|
|
||||||
#include <zlib.h>
|
|
||||||
|
|
||||||
namespace android {
|
|
||||||
namespace hardware {
|
|
||||||
namespace boot {
|
|
||||||
namespace V1_2 {
|
|
||||||
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;
|
|
||||||
}
|
|
||||||
|
|
||||||
} // namespace
|
|
||||||
|
|
||||||
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 <partition name, gpt_entry pointer>
|
|
||||||
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<gpt_entry *>(&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<uint8_t *>(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<uint8_t *>(&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<uint8_t *>(&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_2
|
|
||||||
} // namespace boot
|
|
||||||
} // namespace hardware
|
|
||||||
} // namespace android
|
|
|
@ -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 <map>
|
|
||||||
#include <string>
|
|
||||||
#include <vector>
|
|
||||||
|
|
||||||
namespace android {
|
|
||||||
namespace hardware {
|
|
||||||
namespace boot {
|
|
||||||
namespace V1_2 {
|
|
||||||
namespace implementation {
|
|
||||||
|
|
||||||
#define GPT_SIGNATURE 0x5452415020494645UL
|
|
||||||
|
|
||||||
typedef struct {
|
|
||||||
uint8_t type_guid[16];
|
|
||||||
uint8_t guid[16];
|
|
||||||
uint64_t first_lba;
|
|
||||||
uint64_t last_lba;
|
|
||||||
uint64_t attr;
|
|
||||||
uint16_t name[36];
|
|
||||||
} __attribute__((packed)) gpt_entry;
|
|
||||||
|
|
||||||
typedef struct {
|
|
||||||
uint64_t signature;
|
|
||||||
uint32_t revision;
|
|
||||||
uint32_t header_size;
|
|
||||||
uint32_t crc32;
|
|
||||||
uint32_t reserved;
|
|
||||||
uint64_t current_lba;
|
|
||||||
uint64_t backup_lba;
|
|
||||||
uint64_t first_usable_lba;
|
|
||||||
uint64_t last_usable_lba;
|
|
||||||
uint8_t disk_guid[16];
|
|
||||||
uint64_t start_lba;
|
|
||||||
uint32_t entry_count;
|
|
||||||
uint32_t entry_size;
|
|
||||||
uint32_t entries_crc32;
|
|
||||||
} __attribute__((packed)) gpt_header;
|
|
||||||
|
|
||||||
class GptUtils {
|
|
||||||
public:
|
|
||||||
GptUtils(const std::string dev_path);
|
|
||||||
int Load(void);
|
|
||||||
gpt_entry *GetPartitionEntry(std::string name);
|
|
||||||
int Sync(void);
|
|
||||||
~GptUtils();
|
|
||||||
|
|
||||||
private:
|
|
||||||
std::string dev_path;
|
|
||||||
int fd;
|
|
||||||
uint32_t block_size;
|
|
||||||
gpt_header gpt_primary;
|
|
||||||
gpt_header gpt_backup;
|
|
||||||
std::vector<gpt_entry> entry_array;
|
|
||||||
std::map<std::string, gpt_entry *> entries;
|
|
||||||
};
|
|
||||||
|
|
||||||
} // namespace implementation
|
|
||||||
} // namespace V1_2
|
|
||||||
} // namespace boot
|
|
||||||
} // namespace hardware
|
|
||||||
} // namespace android
|
|
|
@ -1,7 +0,0 @@
|
||||||
service vendor.boot-hal-1-2 /vendor/bin/hw/android.hardware.boot@1.2-service-zuma
|
|
||||||
interface android.hardware.boot@1.0::IBootControl default
|
|
||||||
interface android.hardware.boot@1.1::IBootControl default
|
|
||||||
interface android.hardware.boot@1.2::IBootControl default
|
|
||||||
class early_hal
|
|
||||||
user root
|
|
||||||
group root drmrpc
|
|
|
@ -1,50 +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.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#define LOG_TAG "android.hardware.boot@1.2-service"
|
|
||||||
|
|
||||||
#include <android/hardware/boot/1.2/IBootControl.h>
|
|
||||||
#include <hidl/HidlTransportSupport.h>
|
|
||||||
#include <hidl/Status.h>
|
|
||||||
#include <log/log.h>
|
|
||||||
|
|
||||||
#include "BootControl.h"
|
|
||||||
|
|
||||||
using ::android::status_t;
|
|
||||||
|
|
||||||
using ::android::hardware::boot::V1_2::IBootControl;
|
|
||||||
|
|
||||||
using ::android::hardware::boot::V1_2::implementation::BootControl;
|
|
||||||
// using ::android::hardware::boot::implementation::BootControl;
|
|
||||||
|
|
||||||
int main(int /* argc */, char * /* argv */[]) {
|
|
||||||
// This function must be called before you join to ensure the proper
|
|
||||||
// number of threads are created. The threadpool will never exceed
|
|
||||||
// size one because of this call.
|
|
||||||
::android::hardware::configureRpcThreadpool(1 /*threads*/, true /*willJoin*/);
|
|
||||||
|
|
||||||
::android::sp bootctrl = new BootControl();
|
|
||||||
const status_t status = bootctrl->registerAsService();
|
|
||||||
if (status != ::android::OK) {
|
|
||||||
return 1; // or handle error
|
|
||||||
}
|
|
||||||
|
|
||||||
// Adds this thread to the threadpool, resulting in one total
|
|
||||||
// thread in the threadpool. We could also do other things, but
|
|
||||||
// would have to specify 'false' to willJoin in configureRpcThreadpool.
|
|
||||||
::android::hardware::joinRpcThreadpool();
|
|
||||||
return 1; // joinRpcThreadpool should never return
|
|
||||||
}
|
|
|
@ -1,65 +0,0 @@
|
||||||
//
|
|
||||||
// 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.
|
|
||||||
//
|
|
||||||
|
|
||||||
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_defaults {
|
|
||||||
name: "android.hardware.boot-service_common-zuma",
|
|
||||||
relative_install_path: "hw",
|
|
||||||
defaults: ["libboot_control_defaults"],
|
|
||||||
shared_libs: [
|
|
||||||
"libbase",
|
|
||||||
"libbinder_ndk",
|
|
||||||
"libcutils",
|
|
||||||
"libz",
|
|
||||||
"libtrusty",
|
|
||||||
"android.hardware.boot@1.1",
|
|
||||||
"android.hardware.boot-V1-ndk",
|
|
||||||
],
|
|
||||||
static_libs: [
|
|
||||||
"libboot_control",
|
|
||||||
"libbootloader_message_vendor",
|
|
||||||
],
|
|
||||||
srcs: [
|
|
||||||
"BootControl.cpp",
|
|
||||||
"GptUtils.cpp",
|
|
||||||
"service.cpp"
|
|
||||||
],
|
|
||||||
}
|
|
||||||
|
|
||||||
cc_binary {
|
|
||||||
name: "android.hardware.boot-service.default-zuma",
|
|
||||||
defaults: ["android.hardware.boot-service_common-zuma"],
|
|
||||||
init_rc: ["android.hardware.boot-service.default-zuma.rc"],
|
|
||||||
vendor: true,
|
|
||||||
}
|
|
||||||
|
|
||||||
cc_binary {
|
|
||||||
name: "android.hardware.boot-service.default_recovery-zuma",
|
|
||||||
defaults: ["android.hardware.boot-service_common-zuma"],
|
|
||||||
vintf_fragments: ["android.hardware.boot-service.default_recovery-zuma.xml"],
|
|
||||||
init_rc: ["android.hardware.boot-service.default_recovery-zuma.rc"],
|
|
||||||
recovery: true,
|
|
||||||
}
|
|
|
@ -1,538 +0,0 @@
|
||||||
/*
|
|
||||||
* 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 "bootcontrolhal"
|
|
||||||
|
|
||||||
#include "BootControl.h"
|
|
||||||
|
|
||||||
#include <android-base/file.h>
|
|
||||||
#include <android-base/logging.h>
|
|
||||||
#include <android-base/unique_fd.h>
|
|
||||||
#include <bootloader_message/bootloader_message.h>
|
|
||||||
#include <cutils/properties.h>
|
|
||||||
#include <libboot_control/libboot_control.h>
|
|
||||||
#include <log/log.h>
|
|
||||||
#include <trusty/tipc.h>
|
|
||||||
|
|
||||||
#include "DevInfo.h"
|
|
||||||
#include "GptUtils.h"
|
|
||||||
|
|
||||||
using HIDLMergeStatus = ::android::bootable::BootControl::MergeStatus;
|
|
||||||
using ndk::ScopedAStatus;
|
|
||||||
|
|
||||||
using android::bootable::GetMiscVirtualAbMergeStatus;
|
|
||||||
using android::bootable::InitMiscVirtualAbMessageIfNeeded;
|
|
||||||
using android::bootable::SetMiscVirtualAbMergeStatus;
|
|
||||||
|
|
||||||
namespace aidl::android::hardware::boot {
|
|
||||||
|
|
||||||
namespace {
|
|
||||||
|
|
||||||
// clang-format off
|
|
||||||
|
|
||||||
#define BOOT_A_PATH "/dev/block/by-name/boot_a"
|
|
||||||
#define BOOT_B_PATH "/dev/block/by-name/boot_b"
|
|
||||||
#define DEVINFO_PATH "/dev/block/by-name/devinfo"
|
|
||||||
|
|
||||||
// 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
|
|
||||||
|
|
||||||
// clang-format on
|
|
||||||
|
|
||||||
static std::string getDevPath(int32_t in_slot) {
|
|
||||||
char real_path[PATH_MAX];
|
|
||||||
|
|
||||||
const char *path = in_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(int32_t in_slot, uint64_t flag) {
|
|
||||||
std::string dev_path = getDevPath(in_slot);
|
|
||||||
if (dev_path.empty()) {
|
|
||||||
ALOGI("Could not get device path for slot %d\n", in_slot);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
GptUtils gpt(dev_path);
|
|
||||||
if (gpt.Load()) {
|
|
||||||
ALOGI("failed to load gpt data\n");
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
gpt_entry *e = gpt.GetPartitionEntry(in_slot ? "boot_b" : "boot_a");
|
|
||||||
if (e == nullptr) {
|
|
||||||
ALOGI("failed to get gpt entry\n");
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
return !!(e->attr & flag);
|
|
||||||
}
|
|
||||||
|
|
||||||
static bool setSlotFlag(int32_t in_slot, uint64_t flag) {
|
|
||||||
std::string dev_path = getDevPath(in_slot);
|
|
||||||
if (dev_path.empty()) {
|
|
||||||
ALOGI("Could not get device path for slot %d\n", in_slot);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
GptUtils gpt(dev_path);
|
|
||||||
if (gpt.Load()) {
|
|
||||||
ALOGI("failed to load gpt data\n");
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
gpt_entry *e = gpt.GetPartitionEntry(in_slot ? "boot_b" : "boot_a");
|
|
||||||
if (e == nullptr) {
|
|
||||||
ALOGI("failed to get gpt entry\n");
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
e->attr |= flag;
|
|
||||||
gpt.Sync();
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
static bool is_devinfo_valid;
|
|
||||||
static bool is_devinfo_initialized;
|
|
||||||
static std::mutex devinfo_lock;
|
|
||||||
static devinfo_t devinfo;
|
|
||||||
|
|
||||||
static bool isDevInfoValid() {
|
|
||||||
const std::lock_guard<std::mutex> lock(devinfo_lock);
|
|
||||||
|
|
||||||
if (is_devinfo_initialized) {
|
|
||||||
return is_devinfo_valid;
|
|
||||||
}
|
|
||||||
|
|
||||||
is_devinfo_initialized = true;
|
|
||||||
|
|
||||||
::android::base::unique_fd fd(open(DEVINFO_PATH, O_RDONLY));
|
|
||||||
::android::base::ReadFully(fd, &devinfo, sizeof devinfo);
|
|
||||||
|
|
||||||
if (devinfo.magic != DEVINFO_MAGIC) {
|
|
||||||
return is_devinfo_valid;
|
|
||||||
}
|
|
||||||
|
|
||||||
uint32_t version = ((uint32_t)devinfo.ver_major << 16) | devinfo.ver_minor;
|
|
||||||
// only version 3.3+ supports A/B data
|
|
||||||
if (version >= 0x0003'0003) {
|
|
||||||
is_devinfo_valid = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
return is_devinfo_valid;
|
|
||||||
}
|
|
||||||
|
|
||||||
static bool DevInfoSync() {
|
|
||||||
if (!isDevInfoValid()) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
::android::base::unique_fd fd(open(DEVINFO_PATH, O_WRONLY | O_DSYNC));
|
|
||||||
return ::android::base::WriteFully(fd, &devinfo, sizeof devinfo);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void DevInfoInitSlot(devinfo_ab_slot_data_t &slot_data) {
|
|
||||||
slot_data.retry_count = AB_ATTR_MAX_RETRY_COUNT;
|
|
||||||
slot_data.unbootable = 0;
|
|
||||||
slot_data.successful = 0;
|
|
||||||
slot_data.active = 1;
|
|
||||||
slot_data.fastboot_ok = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
static int blow_otp_AR(bool secure) {
|
|
||||||
static const char *dev_name = "/dev/trusty-ipc-dev0";
|
|
||||||
static const char *otp_name = "com.android.trusty.otp_manager.tidl";
|
|
||||||
int fd = 1, ret = 0;
|
|
||||||
uint32_t cmd = secure? OTP_CMD_write_antirbk_secure_ap : OTP_CMD_write_antirbk_non_secure_ap;
|
|
||||||
fd = tipc_connect(dev_name, otp_name);
|
|
||||||
if (fd < 0) {
|
|
||||||
ALOGI("Failed to connect to OTP_MGR ns TA - is it missing?\n");
|
|
||||||
ret = -1;
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
struct otp_mgr_req_base req = {
|
|
||||||
.command = cmd,
|
|
||||||
.resp_payload_size = 0,
|
|
||||||
};
|
|
||||||
struct iovec iov[] = {
|
|
||||||
{
|
|
||||||
.iov_base = &req,
|
|
||||||
.iov_len = sizeof(req),
|
|
||||||
},
|
|
||||||
};
|
|
||||||
|
|
||||||
size_t rc = tipc_send(fd, iov, 1, NULL, 0);
|
|
||||||
if (rc != sizeof(req)) {
|
|
||||||
ALOGI("Send fail! %zx\n", rc);
|
|
||||||
return rc;
|
|
||||||
}
|
|
||||||
|
|
||||||
struct otp_mgr_rsp_base resp;
|
|
||||||
rc = read(fd, &resp, sizeof(resp));
|
|
||||||
if (rc < 0) {
|
|
||||||
ALOGI("Read fail! %zx\n", rc);
|
|
||||||
return rc;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (rc < sizeof(resp)) {
|
|
||||||
ALOGI("Not enough data! %zx\n", rc);
|
|
||||||
return -EIO;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (resp.command != (cmd | OTP_RESP_BIT)) {
|
|
||||||
ALOGI("Wrong command! %x\n", resp.command);
|
|
||||||
return -EINVAL;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (resp.result != 0) {
|
|
||||||
fprintf(stderr, "AR writing error! %x\n", resp.result);
|
|
||||||
return -EINVAL;
|
|
||||||
}
|
|
||||||
|
|
||||||
tipc_close(fd);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
static bool blowAR() {
|
|
||||||
int ret = blow_otp_AR(true);
|
|
||||||
if (ret) {
|
|
||||||
ALOGI("Blow secure anti-rollback OTP failed");
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
ret = blow_otp_AR(false);
|
|
||||||
if (ret) {
|
|
||||||
ALOGI("Blow non-secure anti-rollback OTP failed");
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
static constexpr MergeStatus ToAIDLMergeStatus(HIDLMergeStatus status) {
|
|
||||||
switch (status) {
|
|
||||||
case HIDLMergeStatus::NONE:
|
|
||||||
return MergeStatus::NONE;
|
|
||||||
case HIDLMergeStatus::UNKNOWN:
|
|
||||||
return MergeStatus::UNKNOWN;
|
|
||||||
case HIDLMergeStatus::SNAPSHOTTED:
|
|
||||||
return MergeStatus::SNAPSHOTTED;
|
|
||||||
case HIDLMergeStatus::MERGING:
|
|
||||||
return MergeStatus::MERGING;
|
|
||||||
case HIDLMergeStatus::CANCELLED:
|
|
||||||
return MergeStatus::CANCELLED;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static constexpr HIDLMergeStatus ToHIDLMergeStatus(MergeStatus status) {
|
|
||||||
switch (status) {
|
|
||||||
case MergeStatus::NONE:
|
|
||||||
return HIDLMergeStatus::NONE;
|
|
||||||
case MergeStatus::UNKNOWN:
|
|
||||||
return HIDLMergeStatus::UNKNOWN;
|
|
||||||
case MergeStatus::SNAPSHOTTED:
|
|
||||||
return HIDLMergeStatus::SNAPSHOTTED;
|
|
||||||
case MergeStatus::MERGING:
|
|
||||||
return HIDLMergeStatus::MERGING;
|
|
||||||
case MergeStatus::CANCELLED:
|
|
||||||
return HIDLMergeStatus::CANCELLED;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
} // namespace
|
|
||||||
|
|
||||||
BootControl::BootControl() {
|
|
||||||
CHECK(InitMiscVirtualAbMessageIfNeeded());
|
|
||||||
}
|
|
||||||
|
|
||||||
ScopedAStatus BootControl::getActiveBootSlot(int32_t* _aidl_return) {
|
|
||||||
int32_t slots = 0;
|
|
||||||
getNumberSlots(&slots);
|
|
||||||
if (slots == 0) {
|
|
||||||
*_aidl_return = 0;
|
|
||||||
return ScopedAStatus::ok();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (isDevInfoValid()) {
|
|
||||||
*_aidl_return = devinfo.ab_data.slots[1].active ? 1 : 0;
|
|
||||||
return ScopedAStatus::ok();
|
|
||||||
}
|
|
||||||
*_aidl_return = isSlotFlagSet(1, AB_ATTR_ACTIVE) ? 1 : 0;
|
|
||||||
return ScopedAStatus::ok();
|
|
||||||
}
|
|
||||||
|
|
||||||
ScopedAStatus BootControl::getCurrentSlot(int32_t* _aidl_return) {
|
|
||||||
char suffix[PROPERTY_VALUE_MAX];
|
|
||||||
property_get("ro.boot.slot_suffix", suffix, "_a");
|
|
||||||
*_aidl_return = std::string(suffix) == "_b" ? 1 : 0;
|
|
||||||
return ScopedAStatus::ok();
|
|
||||||
}
|
|
||||||
|
|
||||||
ScopedAStatus BootControl::getNumberSlots(int32_t* _aidl_return) {
|
|
||||||
int32_t slots = 0;
|
|
||||||
|
|
||||||
if (access(BOOT_A_PATH, F_OK) == 0)
|
|
||||||
slots++;
|
|
||||||
|
|
||||||
if (access(BOOT_B_PATH, F_OK) == 0)
|
|
||||||
slots++;
|
|
||||||
|
|
||||||
*_aidl_return = slots;
|
|
||||||
return ScopedAStatus::ok();
|
|
||||||
}
|
|
||||||
|
|
||||||
ScopedAStatus BootControl::getSnapshotMergeStatus(MergeStatus* _aidl_return) {
|
|
||||||
HIDLMergeStatus status;
|
|
||||||
int32_t current_slot = 0;
|
|
||||||
getCurrentSlot(¤t_slot);
|
|
||||||
if (!GetMiscVirtualAbMergeStatus(current_slot, &status)) {
|
|
||||||
*_aidl_return = MergeStatus::UNKNOWN;
|
|
||||||
return ScopedAStatus::ok();
|
|
||||||
}
|
|
||||||
*_aidl_return = ToAIDLMergeStatus(status);
|
|
||||||
return ScopedAStatus::ok();
|
|
||||||
}
|
|
||||||
|
|
||||||
ScopedAStatus BootControl::getSuffix(int32_t in_slot, std::string* _aidl_return) {
|
|
||||||
*_aidl_return = in_slot == 0 ? "_a" : in_slot == 1 ? "_b" : "";
|
|
||||||
return ScopedAStatus::ok();
|
|
||||||
}
|
|
||||||
|
|
||||||
ScopedAStatus BootControl::isSlotBootable(int32_t in_slot, bool* _aidl_return) {
|
|
||||||
int32_t slots = 0;
|
|
||||||
getNumberSlots(&slots);
|
|
||||||
if (slots == 0) {
|
|
||||||
*_aidl_return = false;
|
|
||||||
return ScopedAStatus::ok();
|
|
||||||
}
|
|
||||||
if (in_slot >= slots)
|
|
||||||
return ScopedAStatus::fromServiceSpecificErrorWithMessage(
|
|
||||||
INVALID_SLOT, (std::string("Invalid slot ") + std::to_string(in_slot)).c_str());
|
|
||||||
|
|
||||||
bool unbootable;
|
|
||||||
if (isDevInfoValid()) {
|
|
||||||
auto &slot_data = devinfo.ab_data.slots[in_slot];
|
|
||||||
unbootable = !!slot_data.unbootable;
|
|
||||||
} else {
|
|
||||||
unbootable = isSlotFlagSet(in_slot, AB_ATTR_UNBOOTABLE);
|
|
||||||
}
|
|
||||||
|
|
||||||
*_aidl_return = unbootable ? false: true;
|
|
||||||
return ScopedAStatus::ok();
|
|
||||||
}
|
|
||||||
|
|
||||||
ScopedAStatus BootControl::isSlotMarkedSuccessful(int32_t in_slot, bool* _aidl_return) {
|
|
||||||
int32_t slots = 0;
|
|
||||||
getNumberSlots(&slots);
|
|
||||||
if (slots == 0) {
|
|
||||||
// just return true so that we don't we another call trying to mark it as successful
|
|
||||||
// when there is no slots
|
|
||||||
*_aidl_return = true;
|
|
||||||
return ScopedAStatus::ok();
|
|
||||||
}
|
|
||||||
if (in_slot >= slots)
|
|
||||||
return ScopedAStatus::fromServiceSpecificErrorWithMessage(
|
|
||||||
INVALID_SLOT, (std::string("Invalid slot ") + std::to_string(in_slot)).c_str());
|
|
||||||
|
|
||||||
bool successful;
|
|
||||||
if (isDevInfoValid()) {
|
|
||||||
auto &slot_data = devinfo.ab_data.slots[in_slot];
|
|
||||||
successful = !!slot_data.successful;
|
|
||||||
} else {
|
|
||||||
successful = isSlotFlagSet(in_slot, AB_ATTR_SUCCESSFUL);
|
|
||||||
}
|
|
||||||
|
|
||||||
*_aidl_return = successful ? true : false;
|
|
||||||
return ScopedAStatus::ok();
|
|
||||||
}
|
|
||||||
|
|
||||||
ScopedAStatus BootControl::markBootSuccessful() {
|
|
||||||
int32_t slots = 0;
|
|
||||||
getNumberSlots(&slots);
|
|
||||||
if (slots == 0) {
|
|
||||||
// no slots, just return true otherwise Android keeps trying
|
|
||||||
return ScopedAStatus::ok();
|
|
||||||
}
|
|
||||||
|
|
||||||
bool ret;
|
|
||||||
int32_t current_slot = 0;
|
|
||||||
getCurrentSlot(¤t_slot);
|
|
||||||
if (isDevInfoValid()) {
|
|
||||||
auto const slot = current_slot;
|
|
||||||
devinfo.ab_data.slots[slot].successful = 1;
|
|
||||||
ret = DevInfoSync();
|
|
||||||
} else {
|
|
||||||
ret = setSlotFlag(current_slot, AB_ATTR_SUCCESSFUL);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!ret) {
|
|
||||||
return ScopedAStatus::fromServiceSpecificErrorWithMessage(COMMAND_FAILED,
|
|
||||||
"Failed to set successful flag");
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!blowAR()) {
|
|
||||||
ALOGE("Failed to blow anti-rollback counter");
|
|
||||||
// Ignore the error, since ABL will re-trigger it on reboot
|
|
||||||
}
|
|
||||||
|
|
||||||
return ScopedAStatus::ok();
|
|
||||||
}
|
|
||||||
|
|
||||||
ScopedAStatus BootControl::setActiveBootSlot(int32_t in_slot) {
|
|
||||||
if (in_slot >= 2) {
|
|
||||||
return ScopedAStatus::fromServiceSpecificErrorWithMessage(
|
|
||||||
INVALID_SLOT, (std::string("Invalid slot ") + std::to_string(in_slot)).c_str());
|
|
||||||
}
|
|
||||||
|
|
||||||
if (isDevInfoValid()) {
|
|
||||||
auto &active_slot_data = devinfo.ab_data.slots[in_slot];
|
|
||||||
auto &inactive_slot_data = devinfo.ab_data.slots[!in_slot];
|
|
||||||
|
|
||||||
inactive_slot_data.active = 0;
|
|
||||||
DevInfoInitSlot(active_slot_data);
|
|
||||||
|
|
||||||
if (!DevInfoSync()) {
|
|
||||||
return ScopedAStatus::fromServiceSpecificErrorWithMessage(
|
|
||||||
COMMAND_FAILED, "Could not update DevInfo data");
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
std::string dev_path = getDevPath(in_slot);
|
|
||||||
if (dev_path.empty()) {
|
|
||||||
return ScopedAStatus::fromServiceSpecificErrorWithMessage(
|
|
||||||
COMMAND_FAILED, "Could not get device path for slot");
|
|
||||||
}
|
|
||||||
|
|
||||||
GptUtils gpt(dev_path);
|
|
||||||
if (gpt.Load()) {
|
|
||||||
return ScopedAStatus::fromServiceSpecificErrorWithMessage(COMMAND_FAILED,
|
|
||||||
"failed to load gpt data");
|
|
||||||
}
|
|
||||||
|
|
||||||
gpt_entry *active_entry = gpt.GetPartitionEntry(in_slot == 0 ? "boot_a" : "boot_b");
|
|
||||||
gpt_entry *inactive_entry = gpt.GetPartitionEntry(in_slot == 0 ? "boot_b" : "boot_a");
|
|
||||||
if (active_entry == nullptr || inactive_entry == nullptr) {
|
|
||||||
return ScopedAStatus::fromServiceSpecificErrorWithMessage(
|
|
||||||
COMMAND_FAILED, "failed to get entries for boot partitions");
|
|
||||||
}
|
|
||||||
|
|
||||||
ALOGV("slot active attributes %lx\n", active_entry->attr);
|
|
||||||
ALOGV("slot inactive attributes %lx\n", inactive_entry->attr);
|
|
||||||
|
|
||||||
// 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);
|
|
||||||
}
|
|
||||||
|
|
||||||
char boot_dev[PROPERTY_VALUE_MAX];
|
|
||||||
property_get("ro.boot.bootdevice", boot_dev, "");
|
|
||||||
if (boot_dev[0] == '\0') {
|
|
||||||
return ScopedAStatus::fromServiceSpecificErrorWithMessage(
|
|
||||||
COMMAND_FAILED, "invalid ro.boot.bootdevice prop");
|
|
||||||
}
|
|
||||||
|
|
||||||
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 | O_DSYNC);
|
|
||||||
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 | O_DSYNC);
|
|
||||||
if (fd < 0) {
|
|
||||||
return ScopedAStatus::fromServiceSpecificErrorWithMessage(
|
|
||||||
COMMAND_FAILED, "failed to open ufs attr boot_lun_enabled");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
// bBootLunEn
|
|
||||||
// 0x1 => Boot LU A = enabled, Boot LU B = disable
|
|
||||||
// 0x2 => Boot LU A = disable, Boot LU B = enabled
|
|
||||||
//
|
|
||||||
int ret = ::android::base::WriteStringToFd(in_slot == 0 ? "1" : "2", fd);
|
|
||||||
close(fd);
|
|
||||||
if (ret < 0) {
|
|
||||||
return ScopedAStatus::fromServiceSpecificErrorWithMessage(
|
|
||||||
COMMAND_FAILED, "faied to write boot_lun_enabled attribute");
|
|
||||||
}
|
|
||||||
|
|
||||||
return ScopedAStatus::ok();
|
|
||||||
}
|
|
||||||
|
|
||||||
ScopedAStatus BootControl::setSlotAsUnbootable(int32_t in_slot) {
|
|
||||||
if (in_slot >= 2)
|
|
||||||
return ScopedAStatus::fromServiceSpecificErrorWithMessage(
|
|
||||||
INVALID_SLOT, (std::string("Invalid slot ") + std::to_string(in_slot)).c_str());
|
|
||||||
|
|
||||||
if (isDevInfoValid()) {
|
|
||||||
auto &slot_data = devinfo.ab_data.slots[in_slot];
|
|
||||||
slot_data.unbootable = 1;
|
|
||||||
if (!DevInfoSync()) {
|
|
||||||
return ScopedAStatus::fromServiceSpecificErrorWithMessage(
|
|
||||||
COMMAND_FAILED, "Could not update DevInfo data");
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
std::string dev_path = getDevPath(in_slot);
|
|
||||||
if (dev_path.empty()) {
|
|
||||||
return ScopedAStatus::fromServiceSpecificErrorWithMessage(
|
|
||||||
COMMAND_FAILED, "Could not get device path for slot");
|
|
||||||
}
|
|
||||||
|
|
||||||
GptUtils gpt(dev_path);
|
|
||||||
gpt.Load();
|
|
||||||
|
|
||||||
gpt_entry *e = gpt.GetPartitionEntry(in_slot ? "boot_b" : "boot_a");
|
|
||||||
e->attr |= AB_ATTR_UNBOOTABLE;
|
|
||||||
|
|
||||||
gpt.Sync();
|
|
||||||
}
|
|
||||||
|
|
||||||
return ScopedAStatus::ok();
|
|
||||||
}
|
|
||||||
|
|
||||||
ScopedAStatus BootControl::setSnapshotMergeStatus(MergeStatus in_status) {
|
|
||||||
int32_t current_slot = 0;
|
|
||||||
getCurrentSlot(¤t_slot);
|
|
||||||
if (!SetMiscVirtualAbMergeStatus(current_slot, ToHIDLMergeStatus(in_status)))
|
|
||||||
return ScopedAStatus::fromServiceSpecificErrorWithMessage(COMMAND_FAILED,
|
|
||||||
"Operation failed");
|
|
||||||
return ScopedAStatus::ok();
|
|
||||||
}
|
|
||||||
|
|
||||||
} // namespace aidl::android::hardware::boot
|
|
|
@ -1,61 +0,0 @@
|
||||||
/*
|
|
||||||
* 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/boot/BnBootControl.h>
|
|
||||||
#include <libboot_control/libboot_control.h>
|
|
||||||
|
|
||||||
namespace aidl::android::hardware::boot {
|
|
||||||
|
|
||||||
class BootControl final : public BnBootControl {
|
|
||||||
public:
|
|
||||||
BootControl();
|
|
||||||
::ndk::ScopedAStatus getActiveBootSlot(int32_t* _aidl_return) override;
|
|
||||||
::ndk::ScopedAStatus getCurrentSlot(int32_t* _aidl_return) override;
|
|
||||||
::ndk::ScopedAStatus getNumberSlots(int32_t* _aidl_return) override;
|
|
||||||
::ndk::ScopedAStatus getSnapshotMergeStatus(
|
|
||||||
::aidl::android::hardware::boot::MergeStatus* _aidl_return) override;
|
|
||||||
::ndk::ScopedAStatus getSuffix(int32_t in_slot, std::string* _aidl_return) override;
|
|
||||||
::ndk::ScopedAStatus isSlotBootable(int32_t in_slot, bool* _aidl_return) override;
|
|
||||||
::ndk::ScopedAStatus isSlotMarkedSuccessful(int32_t in_slot, bool* _aidl_return) override;
|
|
||||||
::ndk::ScopedAStatus markBootSuccessful() override;
|
|
||||||
::ndk::ScopedAStatus setActiveBootSlot(int32_t in_slot) override;
|
|
||||||
::ndk::ScopedAStatus setSlotAsUnbootable(int32_t in_slot) override;
|
|
||||||
::ndk::ScopedAStatus setSnapshotMergeStatus(
|
|
||||||
::aidl::android::hardware::boot::MergeStatus in_status) override;
|
|
||||||
};
|
|
||||||
|
|
||||||
enum otpmgr_command : uint32_t {
|
|
||||||
OTP_REQ_SHIFT = 1,
|
|
||||||
OTP_RESP_BIT = 1,
|
|
||||||
OTP_CMD_write_antirbk_non_secure_ap = (7 << OTP_REQ_SHIFT),
|
|
||||||
OTP_CMD_write_antirbk_secure_ap = (8 << OTP_REQ_SHIFT),
|
|
||||||
};
|
|
||||||
|
|
||||||
struct otp_mgr_req_base {
|
|
||||||
uint32_t command;
|
|
||||||
uint32_t resp_payload_size;
|
|
||||||
uint8_t handle;
|
|
||||||
}__packed;
|
|
||||||
|
|
||||||
struct otp_mgr_rsp_base {
|
|
||||||
uint32_t command;
|
|
||||||
uint32_t resp_payload_size;
|
|
||||||
int result;
|
|
||||||
}__packed;
|
|
||||||
|
|
||||||
} // namespace aidl::android::hardware::boot
|
|
|
@ -1,53 +0,0 @@
|
||||||
/*
|
|
||||||
* Copyright (C) 2021 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
|
|
||||||
|
|
||||||
namespace aidl::android::hardware::boot {
|
|
||||||
|
|
||||||
//
|
|
||||||
// definitions taken from ABL code
|
|
||||||
//
|
|
||||||
|
|
||||||
constexpr uint32_t DEVINFO_MAGIC = 0x49564544;
|
|
||||||
constexpr size_t DEVINFO_AB_SLOT_COUNT = 2;
|
|
||||||
|
|
||||||
struct devinfo_ab_slot_data_t {
|
|
||||||
uint8_t retry_count;
|
|
||||||
uint8_t unbootable : 1;
|
|
||||||
uint8_t successful : 1;
|
|
||||||
uint8_t active : 1;
|
|
||||||
uint8_t fastboot_ok : 1;
|
|
||||||
uint8_t : 4;
|
|
||||||
uint8_t unused[2];
|
|
||||||
} __attribute__((packed));
|
|
||||||
|
|
||||||
typedef struct {
|
|
||||||
devinfo_ab_slot_data_t slots[DEVINFO_AB_SLOT_COUNT];
|
|
||||||
} __attribute__((packed)) devinfo_ab_data_t;
|
|
||||||
|
|
||||||
struct devinfo_t {
|
|
||||||
uint32_t magic;
|
|
||||||
uint16_t ver_major;
|
|
||||||
uint16_t ver_minor;
|
|
||||||
uint8_t unused[40];
|
|
||||||
devinfo_ab_data_t ab_data;
|
|
||||||
uint8_t unused1[72]; // use remaining up to complete 128 bytes
|
|
||||||
} __attribute__((packed));
|
|
||||||
|
|
||||||
static_assert(sizeof(devinfo_t) == 128, "invalid devinfo struct size");
|
|
||||||
|
|
||||||
} // namespace aidl::android::hardware::boot
|
|
|
@ -1,185 +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 <android-base/file.h>
|
|
||||||
#include <errno.h>
|
|
||||||
#include <linux/fs.h>
|
|
||||||
#include <log/log.h>
|
|
||||||
#include <zlib.h>
|
|
||||||
|
|
||||||
namespace aidl::android::hardware::boot {
|
|
||||||
|
|
||||||
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;
|
|
||||||
}
|
|
||||||
|
|
||||||
} // namespace
|
|
||||||
|
|
||||||
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 <partition name, gpt_entry pointer>
|
|
||||||
auto get_name = [](const uint16_t *efi_name) {
|
|
||||||
char name[37] = {};
|
|
||||||
for (size_t 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<gpt_entry *>(&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<uint8_t *>(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<uint8_t *>(&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<uint8_t *>(&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 aidl::android::hardware::boot
|
|
|
@ -1,71 +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 <map>
|
|
||||||
#include <string>
|
|
||||||
#include <vector>
|
|
||||||
|
|
||||||
namespace aidl::android::hardware::boot {
|
|
||||||
|
|
||||||
#define GPT_SIGNATURE 0x5452415020494645UL
|
|
||||||
|
|
||||||
typedef struct {
|
|
||||||
uint8_t type_guid[16];
|
|
||||||
uint8_t guid[16];
|
|
||||||
uint64_t first_lba;
|
|
||||||
uint64_t last_lba;
|
|
||||||
uint64_t attr;
|
|
||||||
uint16_t name[36];
|
|
||||||
} __attribute__((packed)) gpt_entry;
|
|
||||||
|
|
||||||
typedef struct {
|
|
||||||
uint64_t signature;
|
|
||||||
uint32_t revision;
|
|
||||||
uint32_t header_size;
|
|
||||||
uint32_t crc32;
|
|
||||||
uint32_t reserved;
|
|
||||||
uint64_t current_lba;
|
|
||||||
uint64_t backup_lba;
|
|
||||||
uint64_t first_usable_lba;
|
|
||||||
uint64_t last_usable_lba;
|
|
||||||
uint8_t disk_guid[16];
|
|
||||||
uint64_t start_lba;
|
|
||||||
uint32_t entry_count;
|
|
||||||
uint32_t entry_size;
|
|
||||||
uint32_t entries_crc32;
|
|
||||||
} __attribute__((packed)) gpt_header;
|
|
||||||
|
|
||||||
class GptUtils {
|
|
||||||
public:
|
|
||||||
GptUtils(const std::string dev_path);
|
|
||||||
int Load(void);
|
|
||||||
gpt_entry *GetPartitionEntry(std::string name);
|
|
||||||
int Sync(void);
|
|
||||||
~GptUtils();
|
|
||||||
|
|
||||||
private:
|
|
||||||
std::string dev_path;
|
|
||||||
int fd;
|
|
||||||
uint32_t block_size;
|
|
||||||
gpt_header gpt_primary;
|
|
||||||
gpt_header gpt_backup;
|
|
||||||
std::vector<gpt_entry> entry_array;
|
|
||||||
std::map<std::string, gpt_entry *> entries;
|
|
||||||
};
|
|
||||||
|
|
||||||
} // namespace aidl::android::hardware::boot
|
|
|
@ -1,5 +0,0 @@
|
||||||
service vendor.boot-default /vendor/bin/hw/android.hardware.boot-service.default-zuma
|
|
||||||
class early_hal
|
|
||||||
user root
|
|
||||||
group root drmrpc
|
|
||||||
|
|
|
@ -1,7 +0,0 @@
|
||||||
service vendor.boot-default /system/bin/hw/android.hardware.boot-service.default_recovery-zuma
|
|
||||||
class early_hal
|
|
||||||
user root
|
|
||||||
group root
|
|
||||||
seclabel u:r:hal_bootctl_default:s0
|
|
||||||
interface aidl android.hardware.boot.IBootControl/default
|
|
||||||
|
|
|
@ -1,6 +0,0 @@
|
||||||
<manifest version="1.0" type="device">
|
|
||||||
<hal format="aidl">
|
|
||||||
<name>android.hardware.boot</name>
|
|
||||||
<fqname>IBootControl/default</fqname>
|
|
||||||
</hal>
|
|
||||||
</manifest>
|
|
|
@ -1,44 +0,0 @@
|
||||||
/*
|
|
||||||
* 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.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#define LOG_TAG "aidl.android.hardware.boot-service.default"
|
|
||||||
|
|
||||||
#include <android-base/logging.h>
|
|
||||||
#include <android/binder_manager.h>
|
|
||||||
#include <android/binder_process.h>
|
|
||||||
#include <hidl/HidlSupport.h>
|
|
||||||
#include <hidl/HidlTransportSupport.h>
|
|
||||||
|
|
||||||
#include "BootControl.h"
|
|
||||||
|
|
||||||
using aidl::android::hardware::boot::BootControl;
|
|
||||||
using aidl::android::hardware::boot::IBootControl;
|
|
||||||
using ::android::hardware::configureRpcThreadpool;
|
|
||||||
using ::android::hardware::joinRpcThreadpool;
|
|
||||||
|
|
||||||
int main(int, char* argv[]) {
|
|
||||||
android::base::InitLogging(argv, android::base::KernelLogger);
|
|
||||||
ABinderProcess_setThreadPoolMaxThreadCount(0);
|
|
||||||
std::shared_ptr<IBootControl> service = ndk::SharedRefBase::make<BootControl>();
|
|
||||||
|
|
||||||
const std::string instance = std::string(BootControl::descriptor) + "/default";
|
|
||||||
auto status = AServiceManager_addService(service->asBinder().get(), instance.c_str());
|
|
||||||
CHECK_EQ(status, STATUS_OK) << "Failed to add service " << instance << " " << status;
|
|
||||||
LOG(INFO) << "IBootControl AIDL service running...";
|
|
||||||
|
|
||||||
ABinderProcess_joinThreadPool();
|
|
||||||
return EXIT_FAILURE; // should not reach
|
|
||||||
}
|
|
|
@ -1,59 +0,0 @@
|
||||||
/*
|
|
||||||
** Copyright 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.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <unistd.h>
|
|
||||||
|
|
||||||
#define LOG_TAG "wait_for_strongbox"
|
|
||||||
#include <android-base/logging.h>
|
|
||||||
|
|
||||||
#include <keymasterV4_1/Keymaster.h>
|
|
||||||
|
|
||||||
using android::hardware::keymaster::V4_1::SecurityLevel;
|
|
||||||
using android::hardware::keymaster::V4_1::support::Keymaster;
|
|
||||||
|
|
||||||
useconds_t kWaitTimeMicroseconds = 1 * 1000; // 1 milliseconds
|
|
||||||
|
|
||||||
int main() {
|
|
||||||
for (unsigned cycleCount = 0; /* Forever */; ++cycleCount) {
|
|
||||||
auto keymasters = Keymaster::enumerateAvailableDevices();
|
|
||||||
|
|
||||||
bool foundStrongBox = false;
|
|
||||||
bool foundTee = false;
|
|
||||||
for (auto &dev : keymasters) {
|
|
||||||
SecurityLevel securityLevel = dev->halVersion().securityLevel;
|
|
||||||
uint8_t majorVersion = dev->halVersion().majorVersion;
|
|
||||||
if (securityLevel == SecurityLevel::STRONGBOX && majorVersion == 4) {
|
|
||||||
foundStrongBox = true;
|
|
||||||
}
|
|
||||||
if (securityLevel == SecurityLevel::TRUSTED_ENVIRONMENT && majorVersion == 4) {
|
|
||||||
foundTee = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (foundTee && foundStrongBox) {
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
if (cycleCount % 10 == 1) {
|
|
||||||
if (!foundStrongBox) {
|
|
||||||
LOG(WARNING) << "Still waiting for StrongBox Keymaster";
|
|
||||||
}
|
|
||||||
if (!foundTee) {
|
|
||||||
LOG(WARNING) << "Still waiting for TEE Keymaster";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
usleep(kWaitTimeMicroseconds);
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,9 +0,0 @@
|
||||||
# Wait for both Trusty and Strongbox HALs to be up
|
|
||||||
service wait_for_strongbox /vendor/bin/hw/wait_for_strongbox
|
|
||||||
user root
|
|
||||||
group root system
|
|
||||||
priority -20
|
|
||||||
ioprio rt 0
|
|
||||||
|
|
||||||
on late-fs
|
|
||||||
exec_start wait_for_strongbox
|
|
|
@ -29,7 +29,7 @@
|
||||||
<Limit name="performance-point-1920x1080" value="180" />
|
<Limit name="performance-point-1920x1080" value="180" />
|
||||||
<Limit name="performance-point-1920x1079" value="120" />
|
<Limit name="performance-point-1920x1079" value="120" />
|
||||||
<Limit name="performance-point-3840x2160" value="60" />
|
<Limit name="performance-point-3840x2160" value="60" />
|
||||||
<!--Feature name="adaptive-playback" /-->
|
<Feature name="adaptive-playback" />
|
||||||
<Feature name="can-swap-width-height" value="1" />
|
<Feature name="can-swap-width-height" value="1" />
|
||||||
</MediaCodec>
|
</MediaCodec>
|
||||||
<MediaCodec name="c2.google.av1.decoder.secure" type="video/av01">
|
<MediaCodec name="c2.google.av1.decoder.secure" type="video/av01">
|
||||||
|
@ -44,7 +44,7 @@
|
||||||
<Limit name="performance-point-1920x1080" value="180" />
|
<Limit name="performance-point-1920x1080" value="180" />
|
||||||
<Limit name="performance-point-1920x1079" value="120" />
|
<Limit name="performance-point-1920x1079" value="120" />
|
||||||
<Limit name="performance-point-3840x2160" value="60" />
|
<Limit name="performance-point-3840x2160" value="60" />
|
||||||
<!--Feature name="adaptive-playback" /-->
|
<Feature name="adaptive-playback" />
|
||||||
<Feature name="secure-playback" required="true" />
|
<Feature name="secure-playback" required="true" />
|
||||||
<Feature name="can-swap-width-height" value="1" />
|
<Feature name="can-swap-width-height" value="1" />
|
||||||
</MediaCodec>
|
</MediaCodec>
|
||||||
|
|
|
@ -171,6 +171,12 @@
|
||||||
<Limit name="measured-frame-rate-720x480" range="47-189" />
|
<Limit name="measured-frame-rate-720x480" range="47-189" />
|
||||||
<Limit name="measured-frame-rate-1280x720" range="44-54" />
|
<Limit name="measured-frame-rate-1280x720" range="44-54" />
|
||||||
</MediaCodec>
|
</MediaCodec>
|
||||||
|
<MediaCodec name="c2.android.av1-dav1d.decoder" type="video/av01" update="true">
|
||||||
|
<Limit name="measured-frame-rate-352x288" range="233-315" />
|
||||||
|
<Limit name="measured-frame-rate-640x360" range="114-247" />
|
||||||
|
<Limit name="measured-frame-rate-720x480" range="47-189" />
|
||||||
|
<Limit name="measured-frame-rate-1280x720" range="44-54" />
|
||||||
|
</MediaCodec>
|
||||||
</Decoders>
|
</Decoders>
|
||||||
|
|
||||||
<Encoders>
|
<Encoders>
|
||||||
|
|
|
@ -215,7 +215,7 @@
|
||||||
|
|
||||||
<!-- Default color temperature, in Kelvin, to tint the screen when night display is
|
<!-- Default color temperature, in Kelvin, to tint the screen when night display is
|
||||||
activated. -->
|
activated. -->
|
||||||
<integer name="config_nightDisplayColorTemperatureDefault">3339</integer>
|
<integer name="config_nightDisplayColorTemperatureDefault">4000</integer>
|
||||||
|
|
||||||
<!-- Whether the device enable the standalone (SA) mode of 5G NR.-->
|
<!-- Whether the device enable the standalone (SA) mode of 5G NR.-->
|
||||||
<bool name="config_telephony5gStandalone">true</bool>
|
<bool name="config_telephony5gStandalone">true</bool>
|
||||||
|
@ -252,6 +252,9 @@
|
||||||
<!-- Should the pinner service pin the Home application? -->
|
<!-- Should the pinner service pin the Home application? -->
|
||||||
<bool name="config_pinnerHomeApp">true</bool>
|
<bool name="config_pinnerHomeApp">true</bool>
|
||||||
|
|
||||||
|
<!-- Bytes that the PinnerService will pin for WebView -->
|
||||||
|
<integer name="config_pinnerWebviewPinBytes">20971520</integer>
|
||||||
|
|
||||||
<!-- The default intensity level for alarm vibrations. See
|
<!-- The default intensity level for alarm vibrations. See
|
||||||
Settings.System.ALARM_VIBRATION_INTENSITY more details on the constant values and
|
Settings.System.ALARM_VIBRATION_INTENSITY more details on the constant values and
|
||||||
meanings. -->
|
meanings. -->
|
||||||
|
@ -287,4 +290,28 @@
|
||||||
|
|
||||||
<!-- Enable variable refresh rate when typing. -->
|
<!-- Enable variable refresh rate when typing. -->
|
||||||
<bool name="config_variableRefreshRateTypingSupported">false</bool>
|
<bool name="config_variableRefreshRateTypingSupported">false</bool>
|
||||||
|
|
||||||
|
<!-- The list of packages to automatically opt in of fresh rate suppressing by small area
|
||||||
|
detection. Format of this array should be packageName:threshold and threshold value should
|
||||||
|
be between 0 to 1-->
|
||||||
|
<string-array name="config_smallAreaDetectionAllowlist" translatable="false">
|
||||||
|
<!-- Add packages:threshold here -->
|
||||||
|
<item>com.tencent.mm:0.07</item>
|
||||||
|
<item>com.facebook.katana:0.07</item>
|
||||||
|
<item>com.instagram.android:0.07</item>
|
||||||
|
<item>com.spotify.music:0.05</item>
|
||||||
|
<item>com.reddit.frontpage:0.07</item>
|
||||||
|
<item>com.zhiliaoapp.musically:0.07</item>
|
||||||
|
<item>com.bilibili.app.in:0.07</item>
|
||||||
|
<item>com.twitter.android:0.07</item>
|
||||||
|
</string-array>
|
||||||
|
|
||||||
|
<!-- Pre-scale volume at volume step 1 for Absolute Volume -->
|
||||||
|
<fraction name="config_prescaleAbsoluteVolume_index1">100%</fraction>
|
||||||
|
|
||||||
|
<!-- Pre-scale volume at volume step 2 for Absolute Volume -->
|
||||||
|
<fraction name="config_prescaleAbsoluteVolume_index2">100%</fraction>
|
||||||
|
|
||||||
|
<!-- Pre-scale volume at volume step 3 for Absolute Volume -->
|
||||||
|
<fraction name="config_prescaleAbsoluteVolume_index3">100%</fraction>
|
||||||
</resources>
|
</resources>
|
||||||
|
|
|
@ -97,7 +97,11 @@ const struct SysfsCollector::SysfsPaths sysfs_paths = {
|
||||||
.CCARatePath = "/sys/devices/platform/audiometrics/cca_count_read_once",
|
.CCARatePath = "/sys/devices/platform/audiometrics/cca_count_read_once",
|
||||||
.PcmLatencyPath = "/sys/devices/platform/audiometrics/pcm_latency",
|
.PcmLatencyPath = "/sys/devices/platform/audiometrics/pcm_latency",
|
||||||
.PcmCountPath = "/sys/devices/platform/audiometrics/pcm_count",
|
.PcmCountPath = "/sys/devices/platform/audiometrics/pcm_count",
|
||||||
.TotalCallCountPath = "/sys/devices/platform/audiometrics/call_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"
|
||||||
};
|
};
|
||||||
|
|
||||||
const struct UeventListener::UeventPaths ueventPaths = {
|
const struct UeventListener::UeventPaths ueventPaths = {
|
||||||
|
|
|
@ -20,6 +20,7 @@
|
||||||
#include <CpupmStateResidencyDataProvider.h>
|
#include <CpupmStateResidencyDataProvider.h>
|
||||||
#include <DevfreqStateResidencyDataProvider.h>
|
#include <DevfreqStateResidencyDataProvider.h>
|
||||||
#include <AdaptiveDvfsStateResidencyDataProvider.h>
|
#include <AdaptiveDvfsStateResidencyDataProvider.h>
|
||||||
|
#include <TpuDvfsStateResidencyDataProvider.h>
|
||||||
#include <UfsStateResidencyDataProvider.h>
|
#include <UfsStateResidencyDataProvider.h>
|
||||||
#include <dataproviders/GenericStateResidencyDataProvider.h>
|
#include <dataproviders/GenericStateResidencyDataProvider.h>
|
||||||
#include <dataproviders/IioEnergyMeterDataProvider.h>
|
#include <dataproviders/IioEnergyMeterDataProvider.h>
|
||||||
|
@ -45,6 +46,7 @@ using aidl::android::hardware::power::stats::GenericStateResidencyDataProvider;
|
||||||
using aidl::android::hardware::power::stats::IioEnergyMeterDataProvider;
|
using aidl::android::hardware::power::stats::IioEnergyMeterDataProvider;
|
||||||
using aidl::android::hardware::power::stats::PixelStateResidencyDataProvider;
|
using aidl::android::hardware::power::stats::PixelStateResidencyDataProvider;
|
||||||
using aidl::android::hardware::power::stats::PowerStatsEnergyConsumer;
|
using aidl::android::hardware::power::stats::PowerStatsEnergyConsumer;
|
||||||
|
using aidl::android::hardware::power::stats::TpuDvfsStateResidencyDataProvider;
|
||||||
|
|
||||||
// TODO (b/181070764) (b/182941084):
|
// TODO (b/181070764) (b/182941084):
|
||||||
// Remove this when Wifi/BT energy consumption models are available or revert before ship
|
// Remove this when Wifi/BT energy consumption models are available or revert before ship
|
||||||
|
@ -178,17 +180,6 @@ void addDvfsStats(std::shared_ptr<PowerStats> p) {
|
||||||
path, NS_TO_MS, adpCfgs));
|
path, NS_TO_MS, adpCfgs));
|
||||||
|
|
||||||
std::vector<DvfsStateResidencyDataProvider::Config> cfgs;
|
std::vector<DvfsStateResidencyDataProvider::Config> cfgs;
|
||||||
cfgs.push_back({"TPU", {
|
|
||||||
std::make_pair("1119MHz", "1119000"),
|
|
||||||
std::make_pair("1066MHz", "1066000"),
|
|
||||||
std::make_pair("967MHz", "967000"),
|
|
||||||
std::make_pair("845MHz", "845000"),
|
|
||||||
std::make_pair("712MHz", "712000"),
|
|
||||||
std::make_pair("627MHz", "627000"),
|
|
||||||
std::make_pair("455MHz", "455000"),
|
|
||||||
std::make_pair("226MHz", "226000"),
|
|
||||||
}});
|
|
||||||
|
|
||||||
cfgs.push_back({"AUR", {
|
cfgs.push_back({"AUR", {
|
||||||
std::make_pair("1065MHz", "1065000"),
|
std::make_pair("1065MHz", "1065000"),
|
||||||
std::make_pair("861MHz", "861000"),
|
std::make_pair("861MHz", "861000"),
|
||||||
|
@ -201,6 +192,20 @@ void addDvfsStats(std::shared_ptr<PowerStats> p) {
|
||||||
|
|
||||||
p->addStateResidencyDataProvider(std::make_unique<DvfsStateResidencyDataProvider>(
|
p->addStateResidencyDataProvider(std::make_unique<DvfsStateResidencyDataProvider>(
|
||||||
path, NS_TO_MS, cfgs));
|
path, NS_TO_MS, cfgs));
|
||||||
|
|
||||||
|
// TPU DVFS
|
||||||
|
const int TICK_TO_MS = 100;
|
||||||
|
std::vector<std::string> freqs = {
|
||||||
|
"1119000",
|
||||||
|
"1066000",
|
||||||
|
"845000",
|
||||||
|
"712000",
|
||||||
|
"627000",
|
||||||
|
"455000",
|
||||||
|
"226000"
|
||||||
|
};
|
||||||
|
p->addStateResidencyDataProvider(std::make_unique<TpuDvfsStateResidencyDataProvider>(
|
||||||
|
"/sys/devices/platform/1a000000.rio/tpu_usage", freqs, TICK_TO_MS));
|
||||||
}
|
}
|
||||||
|
|
||||||
void addSoC(std::shared_ptr<PowerStats> p) {
|
void addSoC(std::shared_ptr<PowerStats> p) {
|
||||||
|
|
|
@ -24,38 +24,6 @@ package {
|
||||||
],
|
],
|
||||||
}
|
}
|
||||||
|
|
||||||
prebuilt_etc {
|
|
||||||
name: "logging.conf",
|
|
||||||
vendor: true,
|
|
||||||
proprietary: true,
|
|
||||||
src: "config/logging.conf",
|
|
||||||
relative_install_path: "modem"
|
|
||||||
}
|
|
||||||
|
|
||||||
prebuilt_etc {
|
|
||||||
name: "default.cfg",
|
|
||||||
vendor: true,
|
|
||||||
proprietary: true,
|
|
||||||
src: "config/default.cfg",
|
|
||||||
relative_install_path: "modem"
|
|
||||||
}
|
|
||||||
|
|
||||||
prebuilt_etc {
|
|
||||||
name: "default.nprf",
|
|
||||||
vendor: true,
|
|
||||||
proprietary: true,
|
|
||||||
src: "config/default.nprf",
|
|
||||||
relative_install_path: "modem"
|
|
||||||
}
|
|
||||||
|
|
||||||
prebuilt_etc {
|
|
||||||
name: "default_metrics.xml",
|
|
||||||
vendor: true,
|
|
||||||
proprietary: true,
|
|
||||||
src: "config/default_metrics.xml",
|
|
||||||
relative_install_path: "modem"
|
|
||||||
}
|
|
||||||
|
|
||||||
prebuilt_etc {
|
prebuilt_etc {
|
||||||
name: "Pixel_stability.cfg",
|
name: "Pixel_stability.cfg",
|
||||||
vendor: true,
|
vendor: true,
|
||||||
|
|
92
radio/config/default/Android.bp
Normal file
92
radio/config/default/Android.bp
Normal file
|
@ -0,0 +1,92 @@
|
||||||
|
//
|
||||||
|
// 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.
|
||||||
|
|
||||||
|
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",
|
||||||
|
],
|
||||||
|
}
|
||||||
|
|
||||||
|
prebuilt_etc {
|
||||||
|
name: "logging.conf",
|
||||||
|
vendor: true,
|
||||||
|
proprietary: true,
|
||||||
|
src: "logging.conf",
|
||||||
|
relative_install_path: "modem"
|
||||||
|
}
|
||||||
|
|
||||||
|
prebuilt_etc {
|
||||||
|
name: "default.cfg",
|
||||||
|
vendor: true,
|
||||||
|
proprietary: true,
|
||||||
|
src: "default.cfg",
|
||||||
|
relative_install_path: "modem"
|
||||||
|
}
|
||||||
|
|
||||||
|
prebuilt_etc {
|
||||||
|
name: "default.nprf",
|
||||||
|
vendor: true,
|
||||||
|
proprietary: true,
|
||||||
|
src: "default.nprf",
|
||||||
|
relative_install_path: "modem"
|
||||||
|
}
|
||||||
|
|
||||||
|
prebuilt_etc {
|
||||||
|
name: "default_metrics.xml",
|
||||||
|
vendor: true,
|
||||||
|
proprietary: true,
|
||||||
|
src: "default_metrics.xml",
|
||||||
|
relative_install_path: "modem"
|
||||||
|
}
|
||||||
|
|
||||||
|
// the mask should also be copied to another folder to be accessible to logmasklibrary
|
||||||
|
|
||||||
|
prebuilt_etc {
|
||||||
|
name: "default_modem_log_mask.conf",
|
||||||
|
vendor: true,
|
||||||
|
proprietary: true,
|
||||||
|
src: "logging.conf",
|
||||||
|
relative_install_path: "radio/log_masks/default"
|
||||||
|
}
|
||||||
|
|
||||||
|
prebuilt_etc {
|
||||||
|
name: "default_modem_log_mask.cfg",
|
||||||
|
vendor: true,
|
||||||
|
proprietary: true,
|
||||||
|
src: "default.cfg",
|
||||||
|
relative_install_path: "radio/log_masks/default"
|
||||||
|
}
|
||||||
|
|
||||||
|
prebuilt_etc {
|
||||||
|
name: "default_modem_log_mask.nprf",
|
||||||
|
vendor: true,
|
||||||
|
proprietary: true,
|
||||||
|
src: "default.nprf",
|
||||||
|
relative_install_path: "radio/log_masks/default"
|
||||||
|
}
|
||||||
|
|
||||||
|
prebuilt_etc {
|
||||||
|
name: "default_modem_log_mask.xml",
|
||||||
|
vendor: true,
|
||||||
|
proprietary: true,
|
||||||
|
src: "default_metrics.xml",
|
||||||
|
relative_install_path: "radio/log_masks/default"
|
||||||
|
}
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
modem_logging_control START -o /data/vendor/radio/logs/always-on -n 50 -s 50 -m /vendor/etc/modem/default.cfg --enable_exmetric --enable_exmetric_internal
|
modem_logging_control START -o /data/vendor/radio/logs/always-on -n 50 -s 50 -m /vendor/etc/modem/default.cfg --enable_exmetric --enable_exmetric_internal
|
|
@ -1,5 +1,5 @@
|
||||||
//
|
//
|
||||||
// Copyright (C) 2019 The Android Open Source Project
|
// Copyright (C) 2023 The Android Open Source Project
|
||||||
//
|
//
|
||||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
// you may not use this file except in compliance with the License.
|
// you may not use this file except in compliance with the License.
|
||||||
|
@ -24,43 +24,34 @@ package {
|
||||||
],
|
],
|
||||||
}
|
}
|
||||||
|
|
||||||
cc_binary {
|
prebuilt_etc {
|
||||||
name: "android.hardware.boot@1.0-service-zuma",
|
name: "empty_modem_log_mask.conf",
|
||||||
defaults: ["hidl_defaults"],
|
|
||||||
relative_install_path: "hw",
|
|
||||||
vendor: true,
|
vendor: true,
|
||||||
init_rc: ["android.hardware.boot@1.0-service-zuma.rc"],
|
proprietary: true,
|
||||||
srcs: [
|
src: "logging.conf",
|
||||||
"BootControl.cpp",
|
relative_install_path: "radio/log_masks/empty"
|
||||||
"GptUtils.cpp",
|
|
||||||
"service.cpp"
|
|
||||||
],
|
|
||||||
shared_libs: [
|
|
||||||
"libbase",
|
|
||||||
"liblog",
|
|
||||||
"libhidlbase",
|
|
||||||
"libutils",
|
|
||||||
"libcutils",
|
|
||||||
"libz",
|
|
||||||
"android.hardware.boot@1.0",
|
|
||||||
],
|
|
||||||
}
|
}
|
||||||
|
|
||||||
cc_library {
|
prebuilt_etc {
|
||||||
name: "android.hardware.boot@1.0-impl-zuma",
|
name: "empty_modem_log_mask.cfg",
|
||||||
recovery: true,
|
vendor: true,
|
||||||
srcs: [
|
proprietary: true,
|
||||||
"BootControl.cpp",
|
src: "empty.cfg",
|
||||||
"GptUtils.cpp",
|
relative_install_path: "radio/log_masks/empty"
|
||||||
],
|
}
|
||||||
relative_install_path: "hw",
|
|
||||||
shared_libs: [
|
prebuilt_etc {
|
||||||
"libbase",
|
name: "empty_modem_log_mask.nprf",
|
||||||
"liblog",
|
vendor: true,
|
||||||
"libhidlbase",
|
proprietary: true,
|
||||||
"libutils",
|
src: "empty.nprf",
|
||||||
"libcutils",
|
relative_install_path: "radio/log_masks/empty"
|
||||||
"libz",
|
}
|
||||||
"android.hardware.boot@1.0",
|
|
||||||
],
|
prebuilt_etc {
|
||||||
|
name: "empty_modem_log_mask.xml",
|
||||||
|
vendor: true,
|
||||||
|
proprietary: true,
|
||||||
|
src: "empty_metrics.xml",
|
||||||
|
relative_install_path: "radio/log_masks/empty"
|
||||||
}
|
}
|
1
radio/config/empty/empty.cfg
Normal file
1
radio/config/empty/empty.cfg
Normal file
|
@ -0,0 +1 @@
|
||||||
|
default.nprf,default_metrics.xml
|
BIN
radio/config/empty/empty.nprf
Normal file
BIN
radio/config/empty/empty.nprf
Normal file
Binary file not shown.
191
radio/config/empty/empty_metrics.xml
Normal file
191
radio/config/empty/empty_metrics.xml
Normal file
|
@ -0,0 +1,191 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<NODE FILTER="Basic Metrics">
|
||||||
|
<ITEM NAME="COMMON">
|
||||||
|
<ITEM NAME="COMMON_BASIC_INFORMATION" VALUE="0x0100" CHECKED="false"></ITEM>
|
||||||
|
<ITEM NAME="COMMON_CELL_INFORMATION" VALUE="0x0101" CHECKED="false"></ITEM>
|
||||||
|
<ITEM NAME="COMMON_DATA_INFORMATION" VALUE="0x0102" CHECKED="false"></ITEM>
|
||||||
|
<ITEM NAME="COMMON_SIG_MSG_INFORMATION" VALUE="0x0103" CHECKED="false"></ITEM>
|
||||||
|
<ITEM NAME="COMMON_SMS_INFORMATION" VALUE="0x0104" CHECKED="false"></ITEM>
|
||||||
|
<ITEM NAME="COMMON_HPLMN_TIMER_INFORMATION" VALUE="0x0105" CHECKED="false"></ITEM>
|
||||||
|
<ITEM NAME="COMMON_SIG_MSG_INFORMATION_MULTI" VALUE="0x0106" CHECKED="false"></ITEM>
|
||||||
|
<ITEM NAME="NR_RRC_SIGNALING_MESSAGE" VALUE="0x0108" CHECKED="false"></ITEM>
|
||||||
|
<ITEM NAME="NR_NAS_SIGNALING_MESSAGE" VALUE="0x0109" CHECKED="false"></ITEM>
|
||||||
|
<ITEM NAME="COMMON_PC5_SIG_MSG" VALUE="0x010A" CHECKED="false"></ITEM>
|
||||||
|
</ITEM>
|
||||||
|
<ITEM NAME="LTE">
|
||||||
|
<ITEM NAME="LTE_PHY_PHY_STATUS_INFO" VALUE="0x0200" CHECKED="false"></ITEM>
|
||||||
|
<ITEM NAME="LTE_PHY_CELL_SERCH_MEAS_INFO" VALUE="0x0201" CHECKED="false"></ITEM>
|
||||||
|
<ITEM NAME="LTE_PHY_NCELL_MEAS_INFO" VALUE="0x0202" CHECKED="false"></ITEM>
|
||||||
|
<ITEM NAME="LTE_PHY_SYSTEM_INF" VALUE="0x0204" CHECKED="false"></ITEM>
|
||||||
|
<ITEM NAME="LTE_PHY_CHAN_QUAL_INFO" VALUE="0x0205" CHECKED="false"></ITEM>
|
||||||
|
<ITEM NAME="LTE_PHY_PARAMETER_INFO" VALUE="0x0206" CHECKED="false"></ITEM>
|
||||||
|
<ITEM NAME="LTE_PHY_PHICH_INFO" VALUE="0x0207" CHECKED="false"></ITEM>
|
||||||
|
<ITEM NAME="LTE_PHY_THROUGHPUT_INFO" VALUE="0x0208" CHECKED="false"></ITEM>
|
||||||
|
<ITEM NAME="LTE_PHY_RCVD_SIGNAL_QUALITY_INFO" VALUE="0x0209" CHECKED="false"></ITEM>
|
||||||
|
<ITEM NAME="LTE_PHY_PHICH_TTIB_INFO" VALUE="0x020A" CHECKED="false"></ITEM>
|
||||||
|
<ITEM NAME="LTE_PHY_PUSCH_TTIB_INFO" VALUE="0x020B" CHECKED="false"></ITEM>
|
||||||
|
<ITEM NAME="LTE_L1_RF_INFO" VALUE="0x0210" CHECKED="false"></ITEM>
|
||||||
|
<ITEM NAME="LTE_L1_SYNC_INFO" VALUE="0x0211" CHECKED="false"></ITEM>
|
||||||
|
<ITEM NAME="LTE_L1_DOWNLINK_INFO" VALUE="0x0212" CHECKED="false"></ITEM>
|
||||||
|
<ITEM NAME="LTE_L1_UPLINK_INFO" VALUE="0x0213" CHECKED="false"></ITEM>
|
||||||
|
<ITEM NAME="LTE_L1_DRX_CONFIG" VALUE="0x0214" CHECKED="false"></ITEM>
|
||||||
|
<ITEM NAME="LTE_L1_EVENT" VALUE="0x0215" CHECKED="false"></ITEM>
|
||||||
|
<ITEM NAME="LTE_L1_PUSCH_STATS" VALUE="0x0216" CHECKED="false"></ITEM>
|
||||||
|
<ITEM NAME="LTE_L1_RACH_ATTEMPT" VALUE="0x0217" CHECKED="false"></ITEM>
|
||||||
|
<ITEM NAME="LTE_L1_UL_SCHED_STATS" VALUE="0x0218" CHECKED="false"></ITEM>
|
||||||
|
<ITEM NAME="LTE_L1_SECONDARY_CELL_INFO" VALUE="0x0219" CHECKED="false"></ITEM>
|
||||||
|
<ITEM NAME="LTE_L1_OTDOA_MEASURE_REPORT_INFO" VALUE="0x021A" CHECKED="false"></ITEM>
|
||||||
|
<ITEM NAME="LTE_L1_DOWNLINK_INFO2" VALUE="0x021B" CHECKED="false"></ITEM>
|
||||||
|
<ITEM NAME="LTE_L1_RF_BLACKOUT_TIME" VALUE="0x0220" CHECKED="false"></ITEM>
|
||||||
|
<ITEM NAME="LTE_L1_SAR_MTPL" VALUE="0x0221" CHECKED="false"></ITEM>
|
||||||
|
<ITEM NAME="LTE_L1_ANTENNA_SELECTION" VALUE="0x0222" CHECKED="false"></ITEM>
|
||||||
|
<ITEM NAME="LTE_L2_UL_SPECIFIC_PARAM" VALUE="0x0230" CHECKED="false"></ITEM>
|
||||||
|
<ITEM NAME="LTE_L2_DL_SCH_CONFIG" VALUE="0x0231" CHECKED="false"></ITEM>
|
||||||
|
<ITEM NAME="LTE_L2_UL_SCH_CONFIG" VALUE="0x0232" CHECKED="false"></ITEM>
|
||||||
|
<ITEM NAME="LTE_L2_TIME_ALIGNMENT_TIMER" VALUE="0x0233" CHECKED="false"></ITEM>
|
||||||
|
<ITEM NAME="LTE_L2_PHR_CONFIG" VALUE="0x0234" CHECKED="false"></ITEM>
|
||||||
|
<ITEM NAME="LTE_L2_PREAMBLE_INFO" VALUE="0x0235" CHECKED="false"></ITEM>
|
||||||
|
<ITEM NAME="LTE_L2_POWER_RAMPING_STEP" VALUE="0x0236" CHECKED="false"></ITEM>
|
||||||
|
<ITEM NAME="LTE_L2_RA_SUPERVISION_INFO" VALUE="0x0237" CHECKED="false"></ITEM>
|
||||||
|
<ITEM NAME="LTE_L2_MAX_HARQ_MSG3TX" VALUE="0x0238" CHECKED="false"></ITEM>
|
||||||
|
<ITEM NAME="LTE_L2_RACH_INFO" VALUE="0x0239" CHECKED="false"></ITEM>
|
||||||
|
<ITEM NAME="LTE_L2_RNTI_INFO" VALUE="0x023A" CHECKED="false"></ITEM>
|
||||||
|
<ITEM NAME="LTE_L2_RA_FAILURE_INFO" VALUE="0x023B" CHECKED="false"></ITEM>
|
||||||
|
<ITEM NAME="LTE_L2_UL_SYNC_STAT_INFO" VALUE="0x023C" CHECKED="false"></ITEM>
|
||||||
|
<ITEM NAME="LTE_L2_D_SR_STATUS" VALUE="0x023D" CHECKED="false"></ITEM>
|
||||||
|
<ITEM NAME="LTE_L2_BUFFER_STAT_INFO" VALUE="0x023E" CHECKED="false"></ITEM>
|
||||||
|
<ITEM NAME="LTE_L2_MAC_THROUGHPUT_INFO" VALUE="0x023F" CHECKED="false"></ITEM>
|
||||||
|
<ITEM NAME="LTE_L2_RLC_INFO" VALUE="0x0240" CHECKED="false"></ITEM>
|
||||||
|
<ITEM NAME="LTE_L2_RLC_STATUS_INFO" VALUE="0x0241" CHECKED="false"></ITEM>
|
||||||
|
<ITEM NAME="LTE_L2_UL_PDCP_INFO" VALUE="0x0242" CHECKED="false"></ITEM>
|
||||||
|
<ITEM NAME="LTE_L2_DL_PDCP_INFO" VALUE="0x0243" CHECKED="false"></ITEM>
|
||||||
|
<ITEM NAME="LTE_L2_ROHC_CONF_INFO" VALUE="0x0244" CHECKED="false"></ITEM>
|
||||||
|
<ITEM NAME="LTE_L2_UL_ROHC_INFO" VALUE="0x0245" CHECKED="false"></ITEM>
|
||||||
|
<ITEM NAME="LTE_L2_DL_ROHC_INFO" VALUE="0x0246" CHECKED="false"></ITEM>
|
||||||
|
<ITEM NAME="LTE_L2_TTI_BUNDLING" VALUE="0x0247" CHECKED="false"></ITEM>
|
||||||
|
<ITEM NAME="LTE_L2_MAC_CE" VALUE="0x0248" CHECKED="false"></ITEM>
|
||||||
|
<ITEM NAME="LTE_L2_TIMER_STATE" VALUE="0x0249" CHECKED="false"></ITEM>
|
||||||
|
<ITEM NAME="LTE_L2_BSR_STATS" VALUE="0x024A" CHECKED="false"></ITEM>
|
||||||
|
<ITEM NAME="LTE_L2_RLC_STATS" VALUE="0x024B" CHECKED="false"></ITEM>
|
||||||
|
<ITEM NAME="LTE_L2_PDCP_STATS" VALUE="0x024C" CHECKED="false"></ITEM>
|
||||||
|
<ITEM NAME="LTE_RRC_SERVING_CELL_INFO = 0x0250" VALUE="0x0250" CHECKED="false"></ITEM>
|
||||||
|
<ITEM NAME="LTE_RRC_STATUS_VARIABLE_INFO" VALUE="0x0251" CHECKED="false"></ITEM>
|
||||||
|
<ITEM NAME="LTE_RRC_PEER_MSG_INFO" VALUE="0x0252" CHECKED="false"></ITEM>
|
||||||
|
<ITEM NAME="LTE_RRC_TIMER_INFO" VALUE="0x0253" CHECKED="false"></ITEM>
|
||||||
|
<ITEM NAME="LTE_RRC_PEER_MULTI_MSG_INFO" VALUE="0x0254" CHECKED="false"></ITEM>
|
||||||
|
<ITEM NAME="LTE_RRC_RACH_MSG_INFO" VALUE="0x0255" CHECKED="false"></ITEM>
|
||||||
|
<ITEM NAME="LTE_RRC_TIMER_STATE_INFO" VALUE="0x0256" CHECKED="false"></ITEM>
|
||||||
|
<ITEM NAME="LTE_RRC_EVENT" VALUE="0x0257" CHECKED="false"></ITEM>
|
||||||
|
<ITEM NAME="LTE_NAS_SIM_DATA_INFO = 0x0258" VALUE="0x0258" CHECKED="false"></ITEM>
|
||||||
|
<ITEM NAME="LTE_NAS_STATE_VARIABLE_INFO" VALUE="0x0259" CHECKED="false"></ITEM>
|
||||||
|
<ITEM NAME="LTE_NAS_L3_MM_MSG_INFO" VALUE="0x025A" CHECKED="false"></ITEM>
|
||||||
|
<ITEM NAME="LTE_NAS_EPS_BEARER_CONTEXT" VALUE="0x025B" CHECKED="false"></ITEM>
|
||||||
|
<ITEM NAME="LTE_NAS_EPS_BEARER_QOS" VALUE="0x025C" CHECKED="false"></ITEM>
|
||||||
|
<ITEM NAME="LTE_NAS_PDP_INFO" VALUE="0x025D" CHECKED="false"></ITEM>
|
||||||
|
<ITEM NAME="LTE_NAS_IP_INFO" VALUE="0x025E" CHECKED="false"></ITEM>
|
||||||
|
<ITEM NAME="LTE_NAS_L3_SM_MSG_INFO" VALUE="0x025F" CHECKED="false"></ITEM>
|
||||||
|
<ITEM NAME="LTE_DATA_HANDOVER_STAT_INFO" VALUE="0x0262" CHECKED="false"></ITEM>
|
||||||
|
<ITEM NAME="LTE_DATA_CALL_DROP_INFO" VALUE="0x0263" CHECKED="false"></ITEM>
|
||||||
|
<ITEM NAME="LTE_NAS_TIN_INFO" VALUE="0x0264" CHECKED="false"></ITEM>
|
||||||
|
<ITEM NAME="LTE_NAS_ATTEMPT_INFO" VALUE="0x0265" CHECKED="false"></ITEM>
|
||||||
|
<ITEM NAME="LTE_NAS_EMM_TIMER_STATE_INFO" VALUE="0x0266" CHECKED="false"></ITEM>
|
||||||
|
<ITEM NAME="LTE_NAS_ESM_TIMER_STATE_INFO" VALUE="0x0267" CHECKED="false"></ITEM>
|
||||||
|
<ITEM NAME="LTE_VOLTE_TX_PACKET_INFO" VALUE="0x0270" CHECKED="false"></ITEM>
|
||||||
|
<ITEM NAME="LTE_VOLTE_RX_PACKET_INFO" VALUE="0x0271" CHECKED="false"></ITEM>
|
||||||
|
<ITEM NAME="LTE_VOLTE_TX_OVERALL_STAT_INFO" VALUE="0x0272" CHECKED="false"></ITEM>
|
||||||
|
<ITEM NAME="LTE_VOLTE_RX_OVERALL_STAT_INFO" VALUE="0x0273" CHECKED="false"></ITEM>
|
||||||
|
<ITEM NAME="LTE_VOLTE_TX_RTP_STAT_INFO" VALUE="0x0274" CHECKED="false"></ITEM>
|
||||||
|
<ITEM NAME="LTE_VOLTE_RX_RTP_STAT_INFO" VALUE="0x0275" CHECKED="false"></ITEM>
|
||||||
|
<ITEM NAME="LTE_VOLTE_RX_RTP_FRAME_INFO" VALUE= "0x0276" CHECKED="false"></ITEM>
|
||||||
|
<ITEM NAME="LTE_VOLTE_RTP_CALL_STATS" VALUE="0x0277" CHECKED="false"></ITEM>
|
||||||
|
<ITEM NAME="LTE_VOLTE_TX_RTP_INFO" VALUE="0x0278" CHECKED="false"></ITEM>
|
||||||
|
<ITEM NAME="LTE_VOLTE_RX_RTP_INFO" VALUE="0x0279" CHECKED="false"></ITEM>
|
||||||
|
<ITEM NAME="LTE_RRC_MBMS_SERVICE_INFO" VALUE="0x0280" CHECKED="false"></ITEM>
|
||||||
|
<ITEM NAME="LTE_RF_STATUS_RX_MODE_INFO" VALUE="0x0290" CHECKED="false"></ITEM>
|
||||||
|
<ITEM NAME="LTE_RF_STATUS_SENSOR_INFO" VALUE="0x0291" CHECKED="false"></ITEM>
|
||||||
|
<ITEM NAME="LTE_RF_STATUS_TX_SWAP_INFO" VALUE="0x0292" CHECKED="false"></ITEM>
|
||||||
|
<ITEM NAME="LTE_RF_STATUS_RF_POWER_INFO" VALUE="0x0293" CHECKED="false"></ITEM>
|
||||||
|
</ITEM>
|
||||||
|
<ITEM NAME="EDGE">
|
||||||
|
<ITEM NAME="EDGE_PHY_TIME_SLOT_INFO" VALUE="0x0300" CHECKED="false"></ITEM>
|
||||||
|
<ITEM NAME="EDGE_PHY_RLC_INFO" VALUE="0x0301" CHECKED="false"></ITEM>
|
||||||
|
<ITEM NAME="EDGE_RESERVED_MSG_02" VALUE="0x0302" CHECKED="false"></ITEM>
|
||||||
|
<ITEM NAME="EDGE_PHY_SCELL_MEAS_REPT_INFO" VALUE="0x0303" CHECKED="false"></ITEM>
|
||||||
|
<ITEM NAME="EDGE_PHY_DEDICATED_STATE_INFO" VALUE="0x0304" CHECKED="false"></ITEM>
|
||||||
|
<ITEM NAME="EDGE_PHY_SCELL_INFO" VALUE="0x0305" CHECKED="false"></ITEM>
|
||||||
|
<ITEM NAME="EDGE_PHY_NCELL_INFO" VALUE="0x0306" CHECKED="false"></ITEM>
|
||||||
|
<ITEM NAME="EDGE_PHY_3G_NCELL_INFO" VALUE="0x0307" CHECKED="false"></ITEM>
|
||||||
|
<ITEM NAME="EDGE_PHY_HANDOVER_INFO" VALUE="0x0308" CHECKED="false"></ITEM>
|
||||||
|
<ITEM NAME="EDGE_PHY_HO_HISTORY_INFO" VALUE="0x0309" CHECKED="false"></ITEM>
|
||||||
|
<ITEM NAME="EDGE_PHY_BASIC_INFO" VALUE="0x030A" CHECKED="false"></ITEM>
|
||||||
|
<ITEM NAME="EDGE_PHY_MEASUREMENT_INFO" VALUE="0x030B" CHECKED="false"></ITEM>
|
||||||
|
<ITEM NAME="EDGE_PHY_PWR_CNTRL_INFO" VALUE="0x030C" CHECKED="false"></ITEM>
|
||||||
|
<ITEM NAME="EDGE_L2_QOS_INFO" VALUE="0x0310" CHECKED="false"></ITEM>
|
||||||
|
<ITEM NAME="EDGE_L3_MM_GMM_INFO" VALUE="0x0311" CHECKED="false"></ITEM>
|
||||||
|
<ITEM NAME="EDGE_L2_RLC_STATS" VALUE="0x0312" CHECKED="false"></ITEM>
|
||||||
|
<ITEM NAME="EDGE_L3_EVENT" VALUE="0x0313" CHECKED="false"></ITEM>
|
||||||
|
<ITEM NAME="EDGE_L1_SAR_MTPL" VALUE="0x0320" CHECKED="false"></ITEM>
|
||||||
|
<ITEM NAME="EDGE_L1_ANTENNA_SELECTION" VALUE="0x0321" CHECKED="false"></ITEM>
|
||||||
|
</ITEM>
|
||||||
|
<ITEM NAME="HSPA">
|
||||||
|
<ITEM NAME="HSPA_GP_POWER_CONTROL_INFO" VALUE="0x0400" CHECKED="false"></ITEM>
|
||||||
|
<ITEM NAME="HSPA_GP_TRCH_BLER_INFO" VALUE="0x0401" CHECKED="false"></ITEM>
|
||||||
|
<ITEM NAME="HSPA_GP_FINGER_INFO" VALUE="0x0402" CHECKED="false"></ITEM>
|
||||||
|
<ITEM NAME="HSPA_GD_DPA_INFO" VALUE="0x0403" CHECKED="false"></ITEM>
|
||||||
|
<ITEM NAME="HSPA_GD_DPA_INFO2" VALUE="0x0404" CHECKED="false"></ITEM>
|
||||||
|
<ITEM NAME="HSPA_GD_DPA_INFO3" VALUE="0x0405" CHECKED="false"></ITEM>
|
||||||
|
<ITEM NAME="HSPA_UL1_CM_STATE" VALUE="0x040D" CHECKED="false"></ITEM>
|
||||||
|
<ITEM NAME="HSPA_UL1_TRANSPORT_CHANNEL" VALUE="0x040E" CHECKED="false"></ITEM>
|
||||||
|
<ITEM NAME="HSPA_UL1_RL_STATUS" VALUE="0x040F" CHECKED="false"></ITEM>
|
||||||
|
<ITEM NAME="HSPA_UL1_UMTS_RF_INFO" VALUE="0x0410" CHECKED="false"></ITEM>
|
||||||
|
<ITEM NAME="HSPA_UL1_SEARCH_INFO" VALUE="0x0411" CHECKED="false"></ITEM>
|
||||||
|
<ITEM NAME="HSPA_UL1_FREQ_SEARCH_INFO" VALUE="0x0412" CHECKED="false"></ITEM>
|
||||||
|
<ITEM NAME="HSPA_UL1_POWER_CONTROL_INFO" VALUE="0x0413" CHECKED="false"></ITEM>
|
||||||
|
<ITEM NAME="HSPA_UL1_OLPC_INFO" VALUE="0x0414" CHECKED="false"></ITEM>
|
||||||
|
<ITEM NAME="HSPA_UL1_HSDPA_STATS" VALUE="0x0415" CHECKED="false"></ITEM>
|
||||||
|
<ITEM NAME="HSPA_UL1_MID_TYPE_INFO" VALUE="0x0416" CHECKED="false"></ITEM>
|
||||||
|
<ITEM NAME="HSPA_UL1_CELL_MEAS_INFO" VALUE="0x0417" CHECKED="false"></ITEM>
|
||||||
|
<ITEM NAME="HSPA_UL1_INTER_FREQ_MEAS_INFO" VALUE="0x0418" CHECKED="false"></ITEM>
|
||||||
|
<ITEM NAME="HSPA_UL1_INTER_RAT_MEAS_INFO" VALUE="0x0419" CHECKED="false"></ITEM>
|
||||||
|
<ITEM NAME="HSPA_UL1_INTERNAL_MEAS_INFO" VALUE="0x041A" CHECKED="false"></ITEM>
|
||||||
|
<ITEM NAME="HSPA_UL1_SERVING_CELL_INFO" VALUE="0x041B" CHECKED="false"></ITEM>
|
||||||
|
<ITEM NAME="HSPA_UL1_INTRA_FREQ_RESEL_INFO" VALUE="0x041C" CHECKED="false"></ITEM>
|
||||||
|
<ITEM NAME="HSPA_UL1_INTER_FREQ_RESEL_INFO" VALUE="0x041D" CHECKED="false"></ITEM>
|
||||||
|
<ITEM NAME="HSPA_RESERVED_MSG_1E" VALUE="0x041E" CHECKED="false"></ITEM>
|
||||||
|
<ITEM NAME="HSPA_UL1_CHIPSET_DELAY_INFO" VALUE="0x041F" CHECKED="false"></ITEM>
|
||||||
|
<ITEM NAME="HSPA_URRC_STATUS_INFO" VALUE="0x0420" CHECKED="false"></ITEM>
|
||||||
|
<ITEM NAME="HSPA_URRC_RB_MAP_INFO" VALUE="0x0421" CHECKED="false"></ITEM>
|
||||||
|
<ITEM NAME="HSPA_URRC_NETWORK_INFO" VALUE="0x0422" CHECKED="false"></ITEM>
|
||||||
|
<ITEM NAME="HSPA_URRC_EVENT" VALUE="0x0423" CHECKED="false"></ITEM>
|
||||||
|
<ITEM NAME="HSPA_UUL_RACH_CONFIG_INFO" VALUE="0x0428" CHECKED="false"></ITEM>
|
||||||
|
<ITEM NAME="HSPA_UUL_UDPCH_CONFIG_INFO" VALUE="0x0429" CHECKED="false"></ITEM>
|
||||||
|
<ITEM NAME="HSPA_UUL_POWER_INFO" VALUE="0x042A" CHECKED="false"></ITEM>
|
||||||
|
<ITEM NAME="HSPA_UL2_UPDCP_CHAN_CONF_INFO" VALUE="0x0430" CHECKED="false"></ITEM>
|
||||||
|
<ITEM NAME="HSPA_UL2_RLC_AM_CHAN_STAT_INFO" VALUE="0x0431" CHECKED="false"></ITEM>
|
||||||
|
<ITEM NAME="HSPA_UL2_URLC_AM_CONFIG_INFO" VALUE="0x0432" CHECKED="false"></ITEM>
|
||||||
|
<ITEM NAME="HSPA_UL2_RLC_UM_CHAN_STAT_INFO" VALUE="0x0433" CHECKED="false"></ITEM>
|
||||||
|
<ITEM NAME="HSPA_UL2_URLC_UM_CONFIG_INFO" VALUE="0x0434" CHECKED="false"></ITEM>
|
||||||
|
<ITEM NAME="HSPA_UL2_HSUPA_STATS" VALUE="0x0435" CHECKED="false"></ITEM>
|
||||||
|
<ITEM NAME="HSPA_UL2_WCDMA_MAC_INFO" VALUE="0x0436" CHECKED="false"></ITEM>
|
||||||
|
<ITEM NAME="HSPA_UL2_HS_MAC_INFO" VALUE="0x0437" CHECKED="false"></ITEM>
|
||||||
|
<ITEM NAME="HSPA_UL2_EUL_MAC_INFO" VALUE="0x0438" CHECKED="false"></ITEM>
|
||||||
|
<ITEM NAME="HSPA_UL2_EUL_MAC_STAT_INFO" VALUE="0x0439" CHECKED="false"></ITEM>
|
||||||
|
<ITEM NAME="HSPA_MM_GMM_INFO" VALUE="0x043A" CHECKED="false"></ITEM>
|
||||||
|
<ITEM NAME="HSPA_UL2_RLC_STATS" VALUE="0x043B" CHECKED="false"></ITEM>
|
||||||
|
<ITEM NAME="HSPA_UL2_RLC_RESET" VALUE="0x043C" CHECKED="false"></ITEM>
|
||||||
|
<ITEM NAME="HSPA_UL3_CC_INFO" VALUE="0x0450" CHECKED="false"></ITEM>
|
||||||
|
<ITEM NAME="HSPA_UL3_SS_INFO" VALUE="0x0451" CHECKED="false"></ITEM>
|
||||||
|
<ITEM NAME="HSPA_UL3_SM_INFO" VALUE="0x0452" CHECKED="false"></ITEM>
|
||||||
|
<ITEM NAME="HSPA_VOC_RX_STAT = 0x0460" VALUE="0x0460" CHECKED="false"></ITEM>
|
||||||
|
<ITEM NAME="HSPA_VOC_TX_STAT = 0x0461" VALUE="0x0461" CHECKED="false"></ITEM>
|
||||||
|
<ITEM NAME="HSPA_L1_SAR_MTPL = 0x0470" VALUE="0x0470" CHECKED="false"></ITEM>
|
||||||
|
<ITEM NAME="HSPA_L1_ANTENNA_SELECTION" VALUE="0x0471" CHECKED="false"></ITEM>
|
||||||
|
</ITEM>
|
||||||
|
<ITEM NAME="CDMA">
|
||||||
|
<ITEM NAME="CDMA_COM_1X_MESSAGE" VALUE="0x0B00" CHECKED="false"></ITEM>
|
||||||
|
<ITEM NAME="CDMA_COM_EVDO_MESSAGE" VALUE="0x0B01" CHECKED="false"></ITEM>
|
||||||
|
<ITEM NAME="CDMA_COM_MRU_TABLE_UPDATE_MESSAGE" VALUE="0x0B10" CHECKED="false"></ITEM>
|
||||||
|
<ITEM NAME="CDMA_RTT_L3_MESSAGE" VALUE="0x0B30" CHECKED="false"></ITEM>
|
||||||
|
<ITEM NAME="CDMA_EVDO_L3_MESSAGE" VALUE="0x0B31" CHECKED="false"></ITEM>
|
||||||
|
</ITEM>
|
||||||
|
</NODE>
|
1
radio/config/empty/logging.conf
Normal file
1
radio/config/empty/logging.conf
Normal file
|
@ -0,0 +1 @@
|
||||||
|
modem_logging_control START -o /data/vendor/radio/logs/always-on -n 50 -s 50 -m /vendor/etc/modem/default.cfg --enable_exmetric --enable_exmetric_internal
|
|
@ -1,5 +1,5 @@
|
||||||
//
|
//
|
||||||
// Copyright (C) 2018 The Android Open Source Project
|
// Copyright (C) 2023 The Android Open Source Project
|
||||||
//
|
//
|
||||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
// you may not use this file except in compliance with the License.
|
// you may not use this file except in compliance with the License.
|
||||||
|
@ -24,17 +24,10 @@ package {
|
||||||
],
|
],
|
||||||
}
|
}
|
||||||
|
|
||||||
cc_binary {
|
prebuilt_etc {
|
||||||
name: "wait_for_strongbox",
|
name: "extensive_logging.conf",
|
||||||
init_rc: ["wait_for_strongbox.rc"],
|
vendor: true,
|
||||||
relative_install_path: "hw",
|
|
||||||
srcs: [ "wait_for_strongbox.cpp" ],
|
|
||||||
cflags: [ "-Werror", "-Wall" ],
|
|
||||||
shared_libs: [
|
|
||||||
"android.hardware.keymaster@4.0",
|
|
||||||
"libbase",
|
|
||||||
"libkeymaster4_1support",
|
|
||||||
"libutils",
|
|
||||||
],
|
|
||||||
proprietary: true,
|
proprietary: true,
|
||||||
|
src: "extensive_logging.conf",
|
||||||
|
relative_install_path: "modem"
|
||||||
}
|
}
|
1
radio/config/extensive_logging/extensive_logging.conf
Normal file
1
radio/config/extensive_logging/extensive_logging.conf
Normal file
|
@ -0,0 +1 @@
|
||||||
|
modem_logging_control START -o /data/vendor/radio/logs/always-on -n 50 -s 50 -i 0 --enable_exmetric --enable_exmetric_internal --enable_dsp
|
33
radio/config/lassen_default/Android.bp
Normal file
33
radio/config/lassen_default/Android.bp
Normal file
|
@ -0,0 +1,33 @@
|
||||||
|
//
|
||||||
|
// 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.
|
||||||
|
|
||||||
|
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",
|
||||||
|
],
|
||||||
|
}
|
||||||
|
|
||||||
|
prebuilt_etc {
|
||||||
|
name: "lassen_default.conf",
|
||||||
|
vendor: true,
|
||||||
|
proprietary: true,
|
||||||
|
src: "logging.conf",
|
||||||
|
relative_install_path: "radio/log_masks/lassen_default"
|
||||||
|
}
|
1
radio/config/lassen_default/logging.conf
Normal file
1
radio/config/lassen_default/logging.conf
Normal file
|
@ -0,0 +1 @@
|
||||||
|
modem_logging_control START -o /data/vendor/radio/logs/always-on -n 50 -s 50 -i 1 --enable_exmetric --enable_exmetric_internal
|
|
@ -7,8 +7,8 @@
|
||||||
"Name": "WriteFile",
|
"Name": "WriteFile",
|
||||||
"Params":
|
"Params":
|
||||||
{
|
{
|
||||||
"FilePath": "/proc/vendor_sched/set_task_group_ta",
|
"FilePath": "/proc/vendor_sched/groups/ta/set_task_group",
|
||||||
"ProcFilePath": "/proc/vendor_sched/set_proc_group_ta",
|
"ProcFilePath": "/proc/vendor_sched/groups/ta/set_proc_group",
|
||||||
"Value": "<pid>",
|
"Value": "<pid>",
|
||||||
"LogFailures": "false"
|
"LogFailures": "false"
|
||||||
}
|
}
|
||||||
|
@ -22,8 +22,8 @@
|
||||||
"Name": "WriteFile",
|
"Name": "WriteFile",
|
||||||
"Params":
|
"Params":
|
||||||
{
|
{
|
||||||
"FilePath": "/proc/vendor_sched/set_task_group_cam",
|
"FilePath": "/proc/vendor_sched/groups/cam/set_task_group",
|
||||||
"ProcFilePath": "/proc/vendor_sched/set_proc_group_cam",
|
"ProcFilePath": "/proc/vendor_sched/groups/cam/set_proc_group",
|
||||||
"Value": "<pid>",
|
"Value": "<pid>",
|
||||||
"LogFailures": "false"
|
"LogFailures": "false"
|
||||||
}
|
}
|
||||||
|
@ -37,8 +37,8 @@
|
||||||
"Name": "WriteFile",
|
"Name": "WriteFile",
|
||||||
"Params":
|
"Params":
|
||||||
{
|
{
|
||||||
"FilePath": "/proc/vendor_sched/set_task_group_cam_power",
|
"FilePath": "/proc/vendor_sched/groups/cam_power/set_task_group",
|
||||||
"ProcFilePath": "/proc/vendor_sched/set_proc_group_cam_power",
|
"ProcFilePath": "/proc/vendor_sched/groups/cam_power/set_proc_group",
|
||||||
"Value": "<pid>",
|
"Value": "<pid>",
|
||||||
"LogFailures": "false"
|
"LogFailures": "false"
|
||||||
}
|
}
|
||||||
|
@ -52,8 +52,8 @@
|
||||||
"Name": "WriteFile",
|
"Name": "WriteFile",
|
||||||
"Params":
|
"Params":
|
||||||
{
|
{
|
||||||
"FilePath": "/proc/vendor_sched/set_task_group_dex2oat",
|
"FilePath": "/proc/vendor_sched/groups/dex2oat/set_task_group",
|
||||||
"ProcFilePath": "/proc/vendor_sched/set_proc_group_dex2oat",
|
"ProcFilePath": "/proc/vendor_sched/groups/dex2oat/set_proc_group",
|
||||||
"Value": "<pid>",
|
"Value": "<pid>",
|
||||||
"LogFailures": "false"
|
"LogFailures": "false"
|
||||||
}
|
}
|
||||||
|
@ -67,8 +67,8 @@
|
||||||
"Name": "WriteFile",
|
"Name": "WriteFile",
|
||||||
"Params":
|
"Params":
|
||||||
{
|
{
|
||||||
"FilePath": "/proc/vendor_sched/set_task_group_ota",
|
"FilePath": "/proc/vendor_sched/groups/ota/set_task_group",
|
||||||
"ProcFilePath": "/proc/vendor_sched/set_proc_group_ota",
|
"ProcFilePath": "/proc/vendor_sched/groups/ota/set_proc_group",
|
||||||
"Value": "<pid>",
|
"Value": "<pid>",
|
||||||
"LogFailures": "false"
|
"LogFailures": "false"
|
||||||
}
|
}
|
||||||
|
@ -121,8 +121,8 @@
|
||||||
"Name": "WriteFile",
|
"Name": "WriteFile",
|
||||||
"Params":
|
"Params":
|
||||||
{
|
{
|
||||||
"FilePath": "/proc/vendor_sched/set_task_group_bg",
|
"FilePath": "/proc/vendor_sched/groups/bg/set_task_group",
|
||||||
"ProcFilePath": "/proc/vendor_sched/set_proc_group_bg",
|
"ProcFilePath": "/proc/vendor_sched/groups/bg/set_proc_group",
|
||||||
"Value": "<pid>",
|
"Value": "<pid>",
|
||||||
"LogFailures": "false"
|
"LogFailures": "false"
|
||||||
}
|
}
|
||||||
|
@ -136,8 +136,8 @@
|
||||||
"Name": "WriteFile",
|
"Name": "WriteFile",
|
||||||
"Params":
|
"Params":
|
||||||
{
|
{
|
||||||
"FilePath": "/proc/vendor_sched/set_task_group_sys",
|
"FilePath": "/proc/vendor_sched/groups/sys/set_task_group",
|
||||||
"ProcFilePath": "/proc/vendor_sched/set_proc_group_sys",
|
"ProcFilePath": "/proc/vendor_sched/groups/sys/set_proc_group",
|
||||||
"Value": "<pid>",
|
"Value": "<pid>",
|
||||||
"LogFailures": "false"
|
"LogFailures": "false"
|
||||||
}
|
}
|
||||||
|
@ -151,8 +151,8 @@
|
||||||
"Name": "WriteFile",
|
"Name": "WriteFile",
|
||||||
"Params":
|
"Params":
|
||||||
{
|
{
|
||||||
"FilePath": "/proc/vendor_sched/set_task_group_fg",
|
"FilePath": "/proc/vendor_sched/groups/fg/set_task_group",
|
||||||
"ProcFilePath": "/proc/vendor_sched/set_proc_group_fg",
|
"ProcFilePath": "/proc/vendor_sched/groups/fg/set_proc_group",
|
||||||
"Value": "<pid>",
|
"Value": "<pid>",
|
||||||
"LogFailures": "false"
|
"LogFailures": "false"
|
||||||
}
|
}
|
||||||
|
@ -166,8 +166,8 @@
|
||||||
"Name": "WriteFile",
|
"Name": "WriteFile",
|
||||||
"Params":
|
"Params":
|
||||||
{
|
{
|
||||||
"FilePath": "/proc/vendor_sched/set_task_group_ta",
|
"FilePath": "/proc/vendor_sched/groups/ta/set_task_group",
|
||||||
"ProcFilePath": "/proc/vendor_sched/set_proc_group_ta",
|
"ProcFilePath": "/proc/vendor_sched/groups/ta/set_proc_group",
|
||||||
"Value": "<pid>",
|
"Value": "<pid>",
|
||||||
"LogFailures": "false"
|
"LogFailures": "false"
|
||||||
}
|
}
|
||||||
|
@ -181,8 +181,8 @@
|
||||||
"Name": "WriteFile",
|
"Name": "WriteFile",
|
||||||
"Params":
|
"Params":
|
||||||
{
|
{
|
||||||
"FilePath": "/proc/vendor_sched/set_task_group_nnapi",
|
"FilePath": "/proc/vendor_sched/groups/nnapi/set_task_group",
|
||||||
"ProcFilePath": "/proc/vendor_sched/set_proc_group_nnapi",
|
"ProcFilePath": "/proc/vendor_sched/groups/nnapi/set_proc_group",
|
||||||
"Value": "<pid>",
|
"Value": "<pid>",
|
||||||
"LogFailures": "false"
|
"LogFailures": "false"
|
||||||
}
|
}
|
||||||
|
@ -196,8 +196,8 @@
|
||||||
"Name": "WriteFile",
|
"Name": "WriteFile",
|
||||||
"Params":
|
"Params":
|
||||||
{
|
{
|
||||||
"FilePath": "/proc/vendor_sched/set_task_group_sysbg",
|
"FilePath": "/proc/vendor_sched/groups/sys_bg/set_task_group",
|
||||||
"ProcFilePath": "/proc/vendor_sched/set_proc_group_sysbg",
|
"ProcFilePath": "/proc/vendor_sched/groups/sys_bg/set_proc_group",
|
||||||
"Value": "<pid>",
|
"Value": "<pid>",
|
||||||
"LogFailures": "false"
|
"LogFailures": "false"
|
||||||
}
|
}
|
||||||
|
@ -219,8 +219,8 @@
|
||||||
"Name": "WriteFile",
|
"Name": "WriteFile",
|
||||||
"Params":
|
"Params":
|
||||||
{
|
{
|
||||||
"FilePath": "/proc/vendor_sched/set_task_group_sf",
|
"FilePath": "/proc/vendor_sched/groups/sf/set_task_group",
|
||||||
"ProcFilePath": "/proc/vendor_sched/set_proc_group_sf",
|
"ProcFilePath": "/proc/vendor_sched/groups/sf/set_proc_group",
|
||||||
"Value": "<pid>",
|
"Value": "<pid>",
|
||||||
"LogFailures": "false"
|
"LogFailures": "false"
|
||||||
}
|
}
|
||||||
|
@ -242,8 +242,8 @@
|
||||||
"Name": "WriteFile",
|
"Name": "WriteFile",
|
||||||
"Params":
|
"Params":
|
||||||
{
|
{
|
||||||
"FilePath": "/proc/vendor_sched/set_task_group_rt",
|
"FilePath": "/proc/vendor_sched/groups/rt/set_task_group",
|
||||||
"ProcFilePath": "/proc/vendor_sched/set_proc_group_rt",
|
"ProcFilePath": "/proc/vendor_sched/groups/rt/set_proc_group",
|
||||||
"Value": "<pid>",
|
"Value": "<pid>",
|
||||||
"LogFailures": "false"
|
"LogFailures": "false"
|
||||||
}
|
}
|
||||||
|
|
|
@ -34,6 +34,7 @@ cc_binary {
|
||||||
srcs: [
|
srcs: [
|
||||||
"service.cpp",
|
"service.cpp",
|
||||||
"Usb.cpp",
|
"Usb.cpp",
|
||||||
|
"UsbDataSessionMonitor.cpp",
|
||||||
],
|
],
|
||||||
shared_libs: [
|
shared_libs: [
|
||||||
"libbase",
|
"libbase",
|
||||||
|
@ -46,21 +47,29 @@ cc_binary {
|
||||||
"android.hardware.thermal@2.0",
|
"android.hardware.thermal@2.0",
|
||||||
"android.hardware.thermal-V1-ndk",
|
"android.hardware.thermal-V1-ndk",
|
||||||
"android.hardware.usb.gadget@1.0",
|
"android.hardware.usb.gadget@1.0",
|
||||||
"android.hardware.usb-V2-ndk",
|
"android.hardware.usb-V3-ndk",
|
||||||
"android.hardware.usb.gadget-V1-ndk",
|
"android.hardware.usb.gadget-V1-ndk",
|
||||||
"libcutils",
|
"libcutils",
|
||||||
"android.frameworks.stats-V1-ndk",
|
"android.frameworks.stats-V2-ndk",
|
||||||
"pixelatoms-cpp",
|
"pixelatoms-cpp",
|
||||||
"libbinder_ndk",
|
"libbinder_ndk",
|
||||||
|
"libprotobuf-cpp-lite",
|
||||||
|
"server_configurable_flags",
|
||||||
],
|
],
|
||||||
static_libs: [
|
static_libs: [
|
||||||
"libpixelusb-aidl",
|
"libpixelusb-aidl",
|
||||||
"libpixelstats",
|
"libpixelstats",
|
||||||
"libthermalutils",
|
"libthermalutils",
|
||||||
|
"android.hardware.usb.flags-aconfig-c-lib",
|
||||||
],
|
],
|
||||||
export_shared_lib_headers: [
|
export_shared_lib_headers: [
|
||||||
"android.frameworks.stats-V1-ndk",
|
"android.frameworks.stats-V2-ndk",
|
||||||
"pixelatoms-cpp",
|
"pixelatoms-cpp",
|
||||||
],
|
],
|
||||||
}
|
}
|
||||||
|
|
||||||
|
cc_aconfig_library {
|
||||||
|
name: "android.hardware.usb.flags-aconfig-c-lib",
|
||||||
|
vendor: true,
|
||||||
|
aconfig_declarations: "android.hardware.usb.flags-aconfig",
|
||||||
|
}
|
||||||
|
|
219
usb/usb/Usb.cpp
219
usb/usb/Usb.cpp
|
@ -27,7 +27,6 @@
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <chrono>
|
|
||||||
#include <regex>
|
#include <regex>
|
||||||
#include <thread>
|
#include <thread>
|
||||||
#include <unordered_map>
|
#include <unordered_map>
|
||||||
|
@ -42,9 +41,12 @@
|
||||||
#include "Usb.h"
|
#include "Usb.h"
|
||||||
|
|
||||||
#include <aidl/android/frameworks/stats/IStats.h>
|
#include <aidl/android/frameworks/stats/IStats.h>
|
||||||
|
#include <android_hardware_usb_flags.h>
|
||||||
#include <pixelusb/UsbGadgetAidlCommon.h>
|
#include <pixelusb/UsbGadgetAidlCommon.h>
|
||||||
#include <pixelstats/StatsHelper.h>
|
#include <pixelstats/StatsHelper.h>
|
||||||
|
|
||||||
|
namespace usb_flags = android::hardware::usb::flags;
|
||||||
|
|
||||||
using aidl::android::frameworks::stats::IStats;
|
using aidl::android::frameworks::stats::IStats;
|
||||||
using android::base::GetProperty;
|
using android::base::GetProperty;
|
||||||
using android::base::Join;
|
using android::base::Join;
|
||||||
|
@ -74,6 +76,7 @@ constexpr char kComplianceWarningBC12[] = "bc12";
|
||||||
constexpr char kComplianceWarningDebugAccessory[] = "debug-accessory";
|
constexpr char kComplianceWarningDebugAccessory[] = "debug-accessory";
|
||||||
constexpr char kComplianceWarningMissingRp[] = "missing_rp";
|
constexpr char kComplianceWarningMissingRp[] = "missing_rp";
|
||||||
constexpr char kComplianceWarningOther[] = "other";
|
constexpr char kComplianceWarningOther[] = "other";
|
||||||
|
constexpr char kComplianceWarningInputPowerLimited[] = "input_power_limited";
|
||||||
constexpr char kStatusPath[] = "-0025/contaminant_detection_status";
|
constexpr char kStatusPath[] = "-0025/contaminant_detection_status";
|
||||||
constexpr char kSinkLimitEnable[] = "-0025/usb_limit_sink_enable";
|
constexpr char kSinkLimitEnable[] = "-0025/usb_limit_sink_enable";
|
||||||
constexpr char kSourceLimitEnable[] = "-0025/usb_limit_source_enable";
|
constexpr char kSourceLimitEnable[] = "-0025/usb_limit_source_enable";
|
||||||
|
@ -90,6 +93,17 @@ constexpr char kPogoUsbActive[] = "/sys/devices/platform/google,pogo/pogo_usb_ac
|
||||||
constexpr char kPogoEnableUsb[] = "/sys/devices/platform/google,pogo/enable_usb";
|
constexpr char kPogoEnableUsb[] = "/sys/devices/platform/google,pogo/enable_usb";
|
||||||
constexpr char kPowerSupplyUsbType[] = "/sys/class/power_supply/usb/usb_type";
|
constexpr char kPowerSupplyUsbType[] = "/sys/class/power_supply/usb/usb_type";
|
||||||
constexpr char kIrqHpdCounPath[] = "-0025/irq_hpd_count";
|
constexpr char kIrqHpdCounPath[] = "-0025/irq_hpd_count";
|
||||||
|
constexpr char kUdcUeventRegex[] =
|
||||||
|
"/devices/platform/11210000.usb/11210000.dwc3/udc/11210000.dwc3";
|
||||||
|
constexpr char kUdcStatePath[] =
|
||||||
|
"/sys/devices/platform/11210000.usb/11210000.dwc3/udc/11210000.dwc3/state";
|
||||||
|
constexpr char kHost1UeventRegex[] =
|
||||||
|
"/devices/platform/11210000.usb/11210000.dwc3/xhci-hcd-exynos.[0-9].auto/usb1/1-0:1.0";
|
||||||
|
constexpr char kHost1StatePath[] = "/sys/bus/usb/devices/usb1/1-0:1.0/usb1-port1/state";
|
||||||
|
constexpr char kHost2UeventRegex[] =
|
||||||
|
"/devices/platform/11210000.usb/11210000.dwc3/xhci-hcd-exynos.[0-9].auto/usb2/2-0:1.0";
|
||||||
|
constexpr char kHost2StatePath[] = "/sys/bus/usb/devices/usb2/2-0:1.0/usb2-port1/state";
|
||||||
|
constexpr char kDataRolePath[] = "/sys/devices/platform/11210000.usb/new_data_role";
|
||||||
constexpr int kSamplingIntervalSec = 5;
|
constexpr int kSamplingIntervalSec = 5;
|
||||||
void queryVersionHelper(android::hardware::usb::Usb *usb,
|
void queryVersionHelper(android::hardware::usb::Usb *usb,
|
||||||
std::vector<PortStatus> *currentPortStatus);
|
std::vector<PortStatus> *currentPortStatus);
|
||||||
|
@ -100,6 +114,7 @@ ScopedAStatus Usb::enableUsbData(const string& in_portName, bool in_enable,
|
||||||
int64_t in_transactionId) {
|
int64_t in_transactionId) {
|
||||||
bool result = true;
|
bool result = true;
|
||||||
std::vector<PortStatus> currentPortStatus;
|
std::vector<PortStatus> currentPortStatus;
|
||||||
|
string displayPortPartnerPath;
|
||||||
|
|
||||||
ALOGI("Userspace turn %s USB data signaling. opID:%ld", in_enable ? "on" : "off",
|
ALOGI("Userspace turn %s USB data signaling. opID:%ld", in_enable ? "on" : "off",
|
||||||
in_transactionId);
|
in_transactionId);
|
||||||
|
@ -115,6 +130,27 @@ ScopedAStatus Usb::enableUsbData(const string& in_portName, bool in_enable,
|
||||||
ALOGE("Gadget cannot be pulled up");
|
ALOGE("Gadget cannot be pulled up");
|
||||||
result = false;
|
result = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!WriteStringToFile("1", DISPLAYPORT_ACTIVE_PATH)) {
|
||||||
|
ALOGE("Failed to enable DisplayPort Alt Mode on port");
|
||||||
|
} else {
|
||||||
|
ALOGI("Successfully enabled DisplayPort Alt Mode on port");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (getDisplayPortUsbPathHelper(&displayPortPartnerPath) == Status::SUCCESS) {
|
||||||
|
size_t pos = displayPortPartnerPath.find("/displayport");
|
||||||
|
if (pos != string::npos) {
|
||||||
|
displayPortPartnerPath = displayPortPartnerPath.substr(0, pos) + "/mode1/active";
|
||||||
|
}
|
||||||
|
if (!WriteStringToFile("1", displayPortPartnerPath)) {
|
||||||
|
ALOGE("Failed to enable DisplayPort Alt Mode on partner at %s",
|
||||||
|
displayPortPartnerPath.c_str());
|
||||||
|
} else {
|
||||||
|
ALOGI("Successfully enabled DisplayPort Alt Mode on partner at %s",
|
||||||
|
displayPortPartnerPath.c_str());
|
||||||
|
setupDisplayPortPoll();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (!WriteStringToFile("1", ID_PATH)) {
|
if (!WriteStringToFile("1", ID_PATH)) {
|
||||||
|
@ -136,6 +172,27 @@ ScopedAStatus Usb::enableUsbData(const string& in_portName, bool in_enable,
|
||||||
ALOGE("Gadget cannot be pulled down");
|
ALOGE("Gadget cannot be pulled down");
|
||||||
result = false;
|
result = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (getDisplayPortUsbPathHelper(&displayPortPartnerPath) == Status::SUCCESS) {
|
||||||
|
size_t pos = displayPortPartnerPath.find("/displayport");
|
||||||
|
if (pos != string::npos) {
|
||||||
|
displayPortPartnerPath = displayPortPartnerPath.substr(0, pos) + "/mode1/active";
|
||||||
|
}
|
||||||
|
if (!WriteStringToFile("0", displayPortPartnerPath)) {
|
||||||
|
ALOGE("Failed to disable DisplayPort Alt Mode on partner at %s",
|
||||||
|
displayPortPartnerPath.c_str());
|
||||||
|
} else {
|
||||||
|
ALOGI("Successfully disabled DisplayPort Alt Mode on partner at %s",
|
||||||
|
displayPortPartnerPath.c_str());
|
||||||
|
shutdownDisplayPortPoll(true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!WriteStringToFile("0", DISPLAYPORT_ACTIVE_PATH)) {
|
||||||
|
ALOGE("Failed to disable DisplayPort Alt Mode on port");
|
||||||
|
} else {
|
||||||
|
ALOGI("Successfully disabled DisplayPort Alt Mode on port");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (result) {
|
if (result) {
|
||||||
|
@ -307,9 +364,20 @@ Status queryNonCompliantChargerStatus(std::vector<PortStatus> *currentPortStatus
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (!strncmp(reason.c_str(), kComplianceWarningOther,
|
if (!strncmp(reason.c_str(), kComplianceWarningOther,
|
||||||
strlen(kComplianceWarningOther))) {
|
strlen(kComplianceWarningOther)) ||
|
||||||
(*currentPortStatus)[i].complianceWarnings.push_back(ComplianceWarning::OTHER);
|
!strncmp(reason.c_str(), kComplianceWarningInputPowerLimited,
|
||||||
continue;
|
strlen(kComplianceWarningInputPowerLimited))) {
|
||||||
|
if (usb_flags::enable_usb_data_compliance_warning() &&
|
||||||
|
usb_flags::enable_input_power_limited_warning()) {
|
||||||
|
ALOGI("Report through INPUT_POWER_LIMITED warning");
|
||||||
|
(*currentPortStatus)[i].complianceWarnings.push_back(
|
||||||
|
ComplianceWarning::INPUT_POWER_LIMITED);
|
||||||
|
continue;
|
||||||
|
} else {
|
||||||
|
(*currentPortStatus)[i].complianceWarnings.push_back(
|
||||||
|
ComplianceWarning::OTHER);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ((*currentPortStatus)[i].complianceWarnings.size() > 0 &&
|
if ((*currentPortStatus)[i].complianceWarnings.size() > 0 &&
|
||||||
|
@ -442,11 +510,20 @@ bool switchMode(const string &portName, const PortRole &in_role, struct Usb *usb
|
||||||
return roleSwitch;
|
return roleSwitch;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void updatePortStatus(android::hardware::usb::Usb *usb) {
|
||||||
|
std::vector<PortStatus> currentPortStatus;
|
||||||
|
|
||||||
|
queryVersionHelper(usb, ¤tPortStatus);
|
||||||
|
}
|
||||||
|
|
||||||
Usb::Usb()
|
Usb::Usb()
|
||||||
: mLock(PTHREAD_MUTEX_INITIALIZER),
|
: mLock(PTHREAD_MUTEX_INITIALIZER),
|
||||||
mRoleSwitchLock(PTHREAD_MUTEX_INITIALIZER),
|
mRoleSwitchLock(PTHREAD_MUTEX_INITIALIZER),
|
||||||
mPartnerLock(PTHREAD_MUTEX_INITIALIZER),
|
mPartnerLock(PTHREAD_MUTEX_INITIALIZER),
|
||||||
mPartnerUp(false),
|
mPartnerUp(false),
|
||||||
|
mUsbDataSessionMonitor(kUdcUeventRegex, kUdcStatePath, kHost1UeventRegex, kHost1StatePath,
|
||||||
|
kHost2UeventRegex, kHost2StatePath, kDataRolePath,
|
||||||
|
std::bind(&updatePortStatus, this)),
|
||||||
mOverheat(ZoneInfo(TemperatureType::USB_PORT, kThermalZoneForTrip,
|
mOverheat(ZoneInfo(TemperatureType::USB_PORT, kThermalZoneForTrip,
|
||||||
ThrottlingSeverity::CRITICAL),
|
ThrottlingSeverity::CRITICAL),
|
||||||
{ZoneInfo(TemperatureType::UNKNOWN, kThermalZoneForTempReadPrimary,
|
{ZoneInfo(TemperatureType::UNKNOWN, kThermalZoneForTempReadPrimary,
|
||||||
|
@ -491,6 +568,11 @@ Usb::Usb()
|
||||||
ALOGE("mDisplayPortDebounceTimer timerfd failed: %s", strerror(errno));
|
ALOGE("mDisplayPortDebounceTimer timerfd failed: %s", strerror(errno));
|
||||||
abort();
|
abort();
|
||||||
}
|
}
|
||||||
|
mDisplayPortActivateTimer = timerfd_create(CLOCK_MONOTONIC, TFD_NONBLOCK);
|
||||||
|
if (mDisplayPortActivateTimer == -1) {
|
||||||
|
ALOGE("mDisplayPortActivateTimer timerfd failed: %s", strerror(errno));
|
||||||
|
abort();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ScopedAStatus Usb::switchRole(const string& in_portName, const PortRole& in_role,
|
ScopedAStatus Usb::switchRole(const string& in_portName, const PortRole& in_role,
|
||||||
|
@ -916,6 +998,29 @@ AltModeData::DisplayPortAltModeData constructAltModeData(string hpd, string pin_
|
||||||
return dpData;
|
return dpData;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Status queryPartnerSvids(std::vector<string> *svids) {
|
||||||
|
DIR *dp;
|
||||||
|
|
||||||
|
dp = opendir(kDisplayPortUsbPath);
|
||||||
|
if (dp != NULL) {
|
||||||
|
struct dirent *ep;
|
||||||
|
// Iterate through directories for Alt Mode SVIDs
|
||||||
|
while ((ep = readdir(dp))) {
|
||||||
|
if (ep->d_type == DT_DIR) {
|
||||||
|
string svid;
|
||||||
|
string portPartnerPath = string(kDisplayPortUsbPath) + string(ep->d_name) + "/svid";
|
||||||
|
if (ReadFileToString(portPartnerPath, &svid)) {
|
||||||
|
(*svids).push_back(Trim(svid));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
closedir(dp);
|
||||||
|
} else {
|
||||||
|
return Status::ERROR;
|
||||||
|
}
|
||||||
|
return Status::SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
/* DisplayPort Helper Functions End */
|
/* DisplayPort Helper Functions End */
|
||||||
|
|
||||||
// Only care about first port which must support DisplayPortAltMode
|
// Only care about first port which must support DisplayPortAltMode
|
||||||
|
@ -925,23 +1030,49 @@ Status queryDisplayPortStatus(android::hardware::usb::Usb *usb,
|
||||||
string path;
|
string path;
|
||||||
AltModeData::DisplayPortAltModeData dpData;
|
AltModeData::DisplayPortAltModeData dpData;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* We check if the DisplayPort Alt Mode sysfs nodes exist. If they don't, then it means that the
|
||||||
|
* device has not entered Alt Mode with the port partner because of a source/sink role
|
||||||
|
* incompatibility, pin assignment incompatibility, etc. So, we then check to see if the partner
|
||||||
|
* supports Thunderbolt and DisplayPort SVIDs. If it supports DisplayPort, then we assume that
|
||||||
|
* it must be a source device and Thunderbolt should operate similarly; we don't populate the
|
||||||
|
* DisplayPortAltModeStatus. If it only supports Thunderbolt, then we cannot determine if it is
|
||||||
|
* sink or source capable, and need to notify the user.
|
||||||
|
*/
|
||||||
if (usb->getDisplayPortUsbPathHelper(&path) == Status::ERROR) {
|
if (usb->getDisplayPortUsbPathHelper(&path) == Status::ERROR) {
|
||||||
(*currentPortStatus)[0].supportedAltModes.push_back(dpData);
|
std::vector<string> svids;
|
||||||
return Status::SUCCESS;
|
if (queryPartnerSvids(&svids) == Status::SUCCESS) {
|
||||||
|
if (std::count(svids.begin(), svids.end(), SVID_THUNDERBOLT) &&
|
||||||
|
!std::count(svids.begin(), svids.end(), SVID_DISPLAYPORT)) {
|
||||||
|
dpData.cableStatus = DisplayPortAltModeStatus::NOT_CAPABLE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
usb->readDisplayPortAttribute("hpd", path, &hpd);
|
||||||
|
usb->readDisplayPortAttribute("pin_assignment", path, &pinAssign);
|
||||||
|
usb->readDisplayPortAttribute("vdo", path, &vdo);
|
||||||
|
usb->readDisplayPortAttribute("link_status", path, &linkStatus);
|
||||||
|
|
||||||
|
dpData = constructAltModeData(hpd, pinAssign, linkStatus, vdo);
|
||||||
}
|
}
|
||||||
|
|
||||||
usb->readDisplayPortAttribute("hpd", path, &hpd);
|
|
||||||
usb->readDisplayPortAttribute("pin_assignment", path, &pinAssign);
|
|
||||||
usb->readDisplayPortAttribute("vdo", path, &vdo);
|
|
||||||
usb->readDisplayPortAttribute("link_status", path, &linkStatus);
|
|
||||||
|
|
||||||
// Set DisplayPortAltModeInfo
|
|
||||||
dpData = constructAltModeData(hpd, pinAssign, linkStatus, vdo);
|
|
||||||
(*currentPortStatus)[0].supportedAltModes.push_back(dpData);
|
(*currentPortStatus)[0].supportedAltModes.push_back(dpData);
|
||||||
|
|
||||||
return Status::SUCCESS;
|
return Status::SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void queryUsbDataSession(android::hardware::usb::Usb *usb,
|
||||||
|
std::vector<PortStatus> *currentPortStatus) {
|
||||||
|
std::vector<ComplianceWarning> warnings;
|
||||||
|
|
||||||
|
usb->mUsbDataSessionMonitor.getComplianceWarnings(
|
||||||
|
(*currentPortStatus)[0].currentDataRole, &warnings);
|
||||||
|
(*currentPortStatus)[0].complianceWarnings.insert(
|
||||||
|
(*currentPortStatus)[0].complianceWarnings.end(),
|
||||||
|
warnings.begin(),
|
||||||
|
warnings.end());
|
||||||
|
}
|
||||||
|
|
||||||
void queryVersionHelper(android::hardware::usb::Usb *usb,
|
void queryVersionHelper(android::hardware::usb::Usb *usb,
|
||||||
std::vector<PortStatus> *currentPortStatus) {
|
std::vector<PortStatus> *currentPortStatus) {
|
||||||
Status status;
|
Status status;
|
||||||
|
@ -952,6 +1083,7 @@ void queryVersionHelper(android::hardware::usb::Usb *usb,
|
||||||
queryMoistureDetectionStatus(currentPortStatus);
|
queryMoistureDetectionStatus(currentPortStatus);
|
||||||
queryPowerTransferStatus(currentPortStatus);
|
queryPowerTransferStatus(currentPortStatus);
|
||||||
queryNonCompliantChargerStatus(currentPortStatus);
|
queryNonCompliantChargerStatus(currentPortStatus);
|
||||||
|
queryUsbDataSession(usb, currentPortStatus);
|
||||||
pthread_mutex_lock(&usb->mDisplayPortLock);
|
pthread_mutex_lock(&usb->mDisplayPortLock);
|
||||||
if (!usb->mDisplayPortFirstSetupDone &&
|
if (!usb->mDisplayPortFirstSetupDone &&
|
||||||
usb->getDisplayPortUsbPathHelper(&displayPortUsbPath) == Status::SUCCESS) {
|
usb->getDisplayPortUsbPathHelper(&displayPortUsbPath) == Status::SUCCESS) {
|
||||||
|
@ -1400,6 +1532,10 @@ static int displayPortPollOpenFileHelper(const char *file, int flags) {
|
||||||
return fd;
|
return fd;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* armTimerFdHelper - Sets timerfd (fd) to trigger after (ms) milliseconds.
|
||||||
|
* Setting ms to 0 disarms the timer.
|
||||||
|
*/
|
||||||
static int armTimerFdHelper(int fd, int ms) {
|
static int armTimerFdHelper(int fd, int ms) {
|
||||||
struct itimerspec ts;
|
struct itimerspec ts;
|
||||||
|
|
||||||
|
@ -1412,23 +1548,31 @@ static int armTimerFdHelper(int fd, int ms) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void *displayPortPollWork(void *param) {
|
void *displayPortPollWork(void *param) {
|
||||||
|
/* USB Payload */
|
||||||
|
::aidl::android::hardware::usb::Usb *usb = (::aidl::android::hardware::usb::Usb *)param;
|
||||||
|
/* Epoll fields */
|
||||||
int epoll_fd;
|
int epoll_fd;
|
||||||
struct epoll_event ev_hpd, ev_pin, ev_orientation, ev_eventfd, ev_link, ev_debounce;
|
struct epoll_event ev_hpd, ev_pin, ev_orientation, ev_eventfd, ev_link, ev_debounce;
|
||||||
|
struct epoll_event ev_activate;
|
||||||
int nevents = 0;
|
int nevents = 0;
|
||||||
int hpd_fd, pin_fd, orientation_fd, link_training_status_fd;
|
int hpd_fd, pin_fd, orientation_fd, link_training_status_fd;
|
||||||
int file_flags = O_RDONLY;
|
int file_flags = O_RDONLY;
|
||||||
int epoll_flags;
|
int epoll_flags;
|
||||||
|
/* DisplayPort link statuses */
|
||||||
bool orientationSet = false;
|
bool orientationSet = false;
|
||||||
bool pinSet = false;
|
bool pinSet = false;
|
||||||
|
int activateRetryCount = 0;
|
||||||
unsigned long res;
|
unsigned long res;
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
|
/* File paths */
|
||||||
string displayPortUsbPath, irqHpdCountPath, hpdPath, pinAssignmentPath, orientationPath;
|
string displayPortUsbPath, irqHpdCountPath, hpdPath, pinAssignmentPath, orientationPath;
|
||||||
string tcpcI2cBus, linkPath;
|
string tcpcI2cBus, linkPath, partnerActivePath, portActivePath;
|
||||||
::aidl::android::hardware::usb::Usb *usb = (::aidl::android::hardware::usb::Usb *)param;
|
|
||||||
|
|
||||||
usb->mDisplayPortPollRunning = true;
|
usb->mDisplayPortPollRunning = true;
|
||||||
usb->mDisplayPortPollStarting = false;
|
usb->mDisplayPortPollStarting = false;
|
||||||
|
|
||||||
|
/*---------- Setup ----------*/
|
||||||
|
|
||||||
if (usb->getDisplayPortUsbPathHelper(&displayPortUsbPath) == Status::ERROR) {
|
if (usb->getDisplayPortUsbPathHelper(&displayPortUsbPath) == Status::ERROR) {
|
||||||
ALOGE("usbdp: worker: could not locate usb displayport directory");
|
ALOGE("usbdp: worker: could not locate usb displayport directory");
|
||||||
goto usb_path_error;
|
goto usb_path_error;
|
||||||
|
@ -1440,6 +1584,9 @@ void *displayPortPollWork(void *param) {
|
||||||
orientationPath = "/sys/class/typec/port0/orientation";
|
orientationPath = "/sys/class/typec/port0/orientation";
|
||||||
linkPath = string(kDisplayPortDrmPath) + "link_status";
|
linkPath = string(kDisplayPortDrmPath) + "link_status";
|
||||||
|
|
||||||
|
partnerActivePath = displayPortUsbPath + "../mode1/active";
|
||||||
|
portActivePath = "/sys/class/typec/port0/port0.0/mode1/active";
|
||||||
|
|
||||||
getI2cBusHelper(&tcpcI2cBus);
|
getI2cBusHelper(&tcpcI2cBus);
|
||||||
irqHpdCountPath = kI2CPath + tcpcI2cBus + "/" + tcpcI2cBus + kIrqHpdCounPath;
|
irqHpdCountPath = kI2CPath + tcpcI2cBus + "/" + tcpcI2cBus + kIrqHpdCounPath;
|
||||||
ALOGI("usbdp: worker: irqHpdCountPath:%s", irqHpdCountPath.c_str());
|
ALOGI("usbdp: worker: irqHpdCountPath:%s", irqHpdCountPath.c_str());
|
||||||
|
@ -1472,12 +1619,15 @@ void *displayPortPollWork(void *param) {
|
||||||
ev_eventfd.events = epoll_flags;
|
ev_eventfd.events = epoll_flags;
|
||||||
ev_link.events = epoll_flags;
|
ev_link.events = epoll_flags;
|
||||||
ev_debounce.events = epoll_flags;
|
ev_debounce.events = epoll_flags;
|
||||||
|
ev_activate.events = epoll_flags;
|
||||||
|
|
||||||
ev_hpd.data.fd = hpd_fd;
|
ev_hpd.data.fd = hpd_fd;
|
||||||
ev_pin.data.fd = pin_fd;
|
ev_pin.data.fd = pin_fd;
|
||||||
ev_orientation.data.fd = orientation_fd;
|
ev_orientation.data.fd = orientation_fd;
|
||||||
ev_eventfd.data.fd = usb->mDisplayPortEventPipe;
|
ev_eventfd.data.fd = usb->mDisplayPortEventPipe;
|
||||||
ev_link.data.fd = link_training_status_fd;
|
ev_link.data.fd = link_training_status_fd;
|
||||||
ev_debounce.data.fd = usb->mDisplayPortDebounceTimer;
|
ev_debounce.data.fd = usb->mDisplayPortDebounceTimer;
|
||||||
|
ev_activate.data.fd = usb->mDisplayPortActivateTimer;
|
||||||
|
|
||||||
if (epoll_ctl(epoll_fd, EPOLL_CTL_ADD, hpd_fd, &ev_hpd) == -1) {
|
if (epoll_ctl(epoll_fd, EPOLL_CTL_ADD, hpd_fd, &ev_hpd) == -1) {
|
||||||
ALOGE("usbdp: worker: epoll_ctl failed to add hpd; errno=%d", errno);
|
ALOGE("usbdp: worker: epoll_ctl failed to add hpd; errno=%d", errno);
|
||||||
|
@ -1496,7 +1646,11 @@ void *displayPortPollWork(void *param) {
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
if (epoll_ctl(epoll_fd, EPOLL_CTL_ADD, usb->mDisplayPortDebounceTimer, &ev_debounce) == -1) {
|
if (epoll_ctl(epoll_fd, EPOLL_CTL_ADD, usb->mDisplayPortDebounceTimer, &ev_debounce) == -1) {
|
||||||
ALOGE("usbdp: worker: epoll_ctl failed to add debounce; errno=%d", errno);
|
ALOGE("usbdp: worker: epoll_ctl failed to add framework update debounce; errno=%d", errno);
|
||||||
|
goto error;
|
||||||
|
}
|
||||||
|
if (epoll_ctl(epoll_fd, EPOLL_CTL_ADD, usb->mDisplayPortActivateTimer, &ev_activate) == -1) {
|
||||||
|
ALOGE("usbdp: worker: epoll_ctl failed to add activate debounce; errno=%d", errno);
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
if (epoll_ctl(epoll_fd, EPOLL_CTL_ADD, usb->mDisplayPortEventPipe, &ev_eventfd) == -1) {
|
if (epoll_ctl(epoll_fd, EPOLL_CTL_ADD, usb->mDisplayPortEventPipe, &ev_eventfd) == -1) {
|
||||||
|
@ -1504,6 +1658,9 @@ void *displayPortPollWork(void *param) {
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Arm timer to see if DisplayPort Alt Mode Activates */
|
||||||
|
armTimerFdHelper(usb->mDisplayPortActivateTimer, DISPLAYPORT_ACTIVATE_DEBOUNCE_MS);
|
||||||
|
|
||||||
while (!destroyDisplayPortThread) {
|
while (!destroyDisplayPortThread) {
|
||||||
struct epoll_event events[64];
|
struct epoll_event events[64];
|
||||||
|
|
||||||
|
@ -1553,6 +1710,33 @@ void *displayPortPollWork(void *param) {
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
ALOGE("usbdp: debounce read errno:%d", errno);
|
ALOGE("usbdp: debounce read errno:%d", errno);
|
||||||
queryVersionHelper(usb, ¤tPortStatus);
|
queryVersionHelper(usb, ¤tPortStatus);
|
||||||
|
} else if (events[n].data.fd == usb->mDisplayPortActivateTimer) {
|
||||||
|
string activePartner, activePort;
|
||||||
|
|
||||||
|
if (ReadFileToString(partnerActivePath.c_str(), &activePartner) &&
|
||||||
|
ReadFileToString(portActivePath.c_str(), &activePort)) {
|
||||||
|
// Retry activate signal when DisplayPort Alt Mode is active on port but not
|
||||||
|
// partner.
|
||||||
|
if (!strncmp(activePartner.c_str(), "no", strlen("no")) &&
|
||||||
|
!strncmp(activePort.c_str(), "yes", strlen("yes")) &&
|
||||||
|
activateRetryCount < DISPLAYPORT_ACTIVATE_MAX_RETRIES) {
|
||||||
|
if (!WriteStringToFile("1", partnerActivePath)) {
|
||||||
|
ALOGE("usbdp: Failed to activate port partner Alt Mode");
|
||||||
|
} else {
|
||||||
|
ALOGI("usbdp: Attempting to activate port partner Alt Mode");
|
||||||
|
}
|
||||||
|
activateRetryCount++;
|
||||||
|
armTimerFdHelper(usb->mDisplayPortActivateTimer,
|
||||||
|
DISPLAYPORT_ACTIVATE_DEBOUNCE_MS);
|
||||||
|
} else {
|
||||||
|
ALOGI("usbdp: DisplayPort Alt Mode is active, or disabled on port");
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
activateRetryCount++;
|
||||||
|
armTimerFdHelper(usb->mDisplayPortActivateTimer,
|
||||||
|
DISPLAYPORT_ACTIVATE_DEBOUNCE_MS);
|
||||||
|
ALOGE("usbdp: Failed to read active state from port or partner");
|
||||||
|
}
|
||||||
} else if (events[n].data.fd == usb->mDisplayPortEventPipe) {
|
} else if (events[n].data.fd == usb->mDisplayPortEventPipe) {
|
||||||
uint64_t flag = 0;
|
uint64_t flag = 0;
|
||||||
if (!read(usb->mDisplayPortEventPipe, &flag, sizeof(flag))) {
|
if (!read(usb->mDisplayPortEventPipe, &flag, sizeof(flag))) {
|
||||||
|
@ -1574,6 +1758,8 @@ void *displayPortPollWork(void *param) {
|
||||||
}
|
}
|
||||||
|
|
||||||
error:
|
error:
|
||||||
|
/* Need to disarm so new threads don't get old event */
|
||||||
|
armTimerFdHelper(usb->mDisplayPortActivateTimer, 0);
|
||||||
close(link_training_status_fd);
|
close(link_training_status_fd);
|
||||||
link_training_status_fd_error:
|
link_training_status_fd_error:
|
||||||
close(orientation_fd);
|
close(orientation_fd);
|
||||||
|
@ -1583,6 +1769,7 @@ pin_fd_error:
|
||||||
close(hpd_fd);
|
close(hpd_fd);
|
||||||
hpd_fd_error:
|
hpd_fd_error:
|
||||||
epoll_ctl(epoll_fd, EPOLL_CTL_DEL, usb->mDisplayPortDebounceTimer, &ev_debounce);
|
epoll_ctl(epoll_fd, EPOLL_CTL_DEL, usb->mDisplayPortDebounceTimer, &ev_debounce);
|
||||||
|
epoll_ctl(epoll_fd, EPOLL_CTL_DEL, usb->mDisplayPortActivateTimer, &ev_activate);
|
||||||
epoll_ctl(epoll_fd, EPOLL_CTL_DEL, usb->mDisplayPortEventPipe, &ev_eventfd);
|
epoll_ctl(epoll_fd, EPOLL_CTL_DEL, usb->mDisplayPortEventPipe, &ev_eventfd);
|
||||||
close(epoll_fd);
|
close(epoll_fd);
|
||||||
epoll_fd_error:
|
epoll_fd_error:
|
||||||
|
|
|
@ -22,6 +22,7 @@
|
||||||
#include <pixelusb/UsbOverheatEvent.h>
|
#include <pixelusb/UsbOverheatEvent.h>
|
||||||
#include <sys/eventfd.h>
|
#include <sys/eventfd.h>
|
||||||
#include <utils/Log.h>
|
#include <utils/Log.h>
|
||||||
|
#include <UsbDataSessionMonitor.h>
|
||||||
|
|
||||||
#define UEVENT_MSG_LEN 2048
|
#define UEVENT_MSG_LEN 2048
|
||||||
// The type-c stack waits for 4.5 - 5.5 secs before declaring a port non-pd.
|
// The type-c stack waits for 4.5 - 5.5 secs before declaring a port non-pd.
|
||||||
|
@ -31,6 +32,13 @@
|
||||||
#define PORT_TYPE_TIMEOUT 8
|
#define PORT_TYPE_TIMEOUT 8
|
||||||
#define DISPLAYPORT_CAPABILITIES_RECEPTACLE_BIT 6
|
#define DISPLAYPORT_CAPABILITIES_RECEPTACLE_BIT 6
|
||||||
#define DISPLAYPORT_STATUS_DEBOUNCE_MS 2000
|
#define DISPLAYPORT_STATUS_DEBOUNCE_MS 2000
|
||||||
|
/*
|
||||||
|
* Type-C HAL should wait 2 seconds to reattempt DisplayPort Alt Mode entry to
|
||||||
|
* allow the port and port partner to settle Role Swaps.
|
||||||
|
*/
|
||||||
|
#define DISPLAYPORT_ACTIVATE_DEBOUNCE_MS 2000
|
||||||
|
// Number of times the HAL should reattempt to enter DisplayPort Alt Mode
|
||||||
|
#define DISPLAYPORT_ACTIVATE_MAX_RETRIES 2
|
||||||
|
|
||||||
namespace aidl {
|
namespace aidl {
|
||||||
namespace android {
|
namespace android {
|
||||||
|
@ -59,6 +67,8 @@ constexpr char kGadgetName[] = "11210000.dwc3";
|
||||||
#define VBUS_PATH NEW_UDC_PATH "dwc3_exynos_otg_b_sess"
|
#define VBUS_PATH NEW_UDC_PATH "dwc3_exynos_otg_b_sess"
|
||||||
#define USB_DATA_PATH NEW_UDC_PATH "usb_data_enabled"
|
#define USB_DATA_PATH NEW_UDC_PATH "usb_data_enabled"
|
||||||
|
|
||||||
|
#define DISPLAYPORT_ACTIVE_PATH "/sys/class/typec/port0/port0.0/mode1/active"
|
||||||
|
|
||||||
#define LINK_TRAINING_STATUS_UNKNOWN "0"
|
#define LINK_TRAINING_STATUS_UNKNOWN "0"
|
||||||
#define LINK_TRAINING_STATUS_SUCCESS "1"
|
#define LINK_TRAINING_STATUS_SUCCESS "1"
|
||||||
#define LINK_TRAINING_STATUS_FAILURE "2"
|
#define LINK_TRAINING_STATUS_FAILURE "2"
|
||||||
|
@ -70,6 +80,9 @@ constexpr char kGadgetName[] = "11210000.dwc3";
|
||||||
|
|
||||||
#define DISPLAYPORT_POLL_WAIT_MS 100
|
#define DISPLAYPORT_POLL_WAIT_MS 100
|
||||||
|
|
||||||
|
#define SVID_DISPLAYPORT "ff01"
|
||||||
|
#define SVID_THUNDERBOLT "8087"
|
||||||
|
|
||||||
struct Usb : public BnUsb {
|
struct Usb : public BnUsb {
|
||||||
Usb();
|
Usb();
|
||||||
|
|
||||||
|
@ -108,6 +121,8 @@ struct Usb : public BnUsb {
|
||||||
// Variable to signal partner coming back online after type switch
|
// Variable to signal partner coming back online after type switch
|
||||||
bool mPartnerUp;
|
bool mPartnerUp;
|
||||||
|
|
||||||
|
// Report usb data session event and data incompliance warnings
|
||||||
|
UsbDataSessionMonitor mUsbDataSessionMonitor;
|
||||||
// Usb Overheat object for push suez event
|
// Usb Overheat object for push suez event
|
||||||
UsbOverheatEvent mOverheat;
|
UsbOverheatEvent mOverheat;
|
||||||
// Temperature when connected
|
// Temperature when connected
|
||||||
|
@ -137,6 +152,11 @@ struct Usb : public BnUsb {
|
||||||
* sending notifications to the frameworks layer.
|
* sending notifications to the frameworks layer.
|
||||||
*/
|
*/
|
||||||
int mDisplayPortDebounceTimer;
|
int mDisplayPortDebounceTimer;
|
||||||
|
/*
|
||||||
|
* eventfd to monitor whether a connection results in DisplayPort Alt Mode activating.
|
||||||
|
*/
|
||||||
|
int mDisplayPortActivateTimer;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
pthread_t mPoll;
|
pthread_t mPoll;
|
||||||
pthread_t mDisplayPortPoll;
|
pthread_t mDisplayPortPoll;
|
||||||
|
|
420
usb/usb/UsbDataSessionMonitor.cpp
Normal file
420
usb/usb/UsbDataSessionMonitor.cpp
Normal file
|
@ -0,0 +1,420 @@
|
||||||
|
/*
|
||||||
|
* 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 <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
|
||||||
|
|
||||||
|
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();
|
||||||
|
|
||||||
|
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);
|
||||||
|
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();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
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;
|
||||||
|
|
||||||
|
// TODO: add heuristics and update newWarningSet
|
||||||
|
if (mDataRole == PortDataRole::DEVICE && mUdcBind) {
|
||||||
|
} else if (mDataRole == PortDataRole::HOST) {
|
||||||
|
}
|
||||||
|
|
||||||
|
if (newWarningSet != mWarningSet) {
|
||||||
|
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::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();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Set up for the new data session
|
||||||
|
mWarningSet.clear();
|
||||||
|
mDataRole = newDataRole;
|
||||||
|
mDataSessionStart = boot_clock::now();
|
||||||
|
|
||||||
|
if (newDataRole == PortDataRole::DEVICE) {
|
||||||
|
clearDeviceStateEvents(&mDeviceState);
|
||||||
|
} else if (newDataRole == PortDataRole::HOST) {
|
||||||
|
clearDeviceStateEvents(&mHost1State);
|
||||||
|
clearDeviceStateEvents(&mHost2State);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
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.
|
||||||
|
clearDeviceStateEvents(&mDeviceState);
|
||||||
|
mDataSessionStart = boot_clock::now();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
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::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->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
|
114
usb/usb/UsbDataSessionMonitor.h
Normal file
114
usb/usb/UsbDataSessionMonitor.h
Normal file
|
@ -0,0 +1,114 @@
|
||||||
|
/*
|
||||||
|
* 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 handleDataRoleEvent();
|
||||||
|
void handleDeviceStateEvent(struct usbDeviceState *deviceState);
|
||||||
|
void clearDeviceStateEvents(struct usbDeviceState *deviceState);
|
||||||
|
void reportUsbDataSessionMetrics();
|
||||||
|
void evaluateComplianceWarning();
|
||||||
|
void notifyComplianceWarning();
|
||||||
|
void updateUdcBindStatus(const std::string &devname);
|
||||||
|
|
||||||
|
pthread_t mMonitor;
|
||||||
|
unique_fd mEpollFd;
|
||||||
|
unique_fd mUeventFd;
|
||||||
|
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
|
|
@ -8,76 +8,14 @@ on post-fs
|
||||||
chown root system /sys/class/typec/port0/power_role
|
chown root system /sys/class/typec/port0/power_role
|
||||||
chown root system /sys/class/typec/port0/data_role
|
chown root system /sys/class/typec/port0/data_role
|
||||||
chown root system /sys/class/typec/port0/port_type
|
chown root system /sys/class/typec/port0/port_type
|
||||||
chown root system /sys/devices/platform/10cb0000.hsi2c/i2c-0/0-0025/contaminant_detection
|
chown root system /sys/class/typec/port0/port0.0/mode1/active
|
||||||
chown root system /sys/devices/platform/10cb0000.hsi2c/i2c-1/1-0025/contaminant_detection
|
chown root system /sys/devices/platform/10cb0000.hsi2c/i2c-11/11-0025/contaminant_detection
|
||||||
chown root system /sys/devices/platform/10cb0000.hsi2c/i2c-2/2-0025/contaminant_detection
|
chown root system /sys/devices/platform/10cb0000.hsi2c/i2c-11/11-0025/usb_limit_accessory_current
|
||||||
chown root system /sys/devices/platform/10cb0000.hsi2c/i2c-3/3-0025/contaminant_detection
|
chown root system /sys/devices/platform/10cb0000.hsi2c/i2c-11/11-0025/usb_limit_accessory_enable
|
||||||
chown root system /sys/devices/platform/10cb0000.hsi2c/i2c-4/4-0025/contaminant_detection
|
chown root system /sys/devices/platform/10cb0000.hsi2c/i2c-11/11-0025/usb_limit_sink_current
|
||||||
chown root system /sys/devices/platform/10cb0000.hsi2c/i2c-5/5-0025/contaminant_detection
|
chown root system /sys/devices/platform/10cb0000.hsi2c/i2c-11/11-0025/usb_limit_sink_enable
|
||||||
chown root system /sys/devices/platform/10cb0000.hsi2c/i2c-6/6-0025/contaminant_detection
|
chown root system /sys/devices/platform/10cb0000.hsi2c/i2c-11/11-0025/usb_limit_source_enable
|
||||||
chown root system /sys/devices/platform/10cb0000.hsi2c/i2c-7/7-0025/contaminant_detection
|
chown root system /sys/devices/platform/10cb0000.hsi2c/i2c-11/11-0025/update_sdp_enum_timeout
|
||||||
chown root system /sys/devices/platform/10cb0000.hsi2c/i2c-8/8-0025/contaminant_detection
|
|
||||||
chown root system /sys/devices/platform/10cb0000.hsi2c/i2c-9/9-0025/contaminant_detection
|
|
||||||
chown root system /sys/devices/platform/10cb0000.hsi2c/i2c-0/0-0025/usb_limit_accessory_current
|
|
||||||
chown root system /sys/devices/platform/10cb0000.hsi2c/i2c-1/1-0025/usb_limit_accessory_current
|
|
||||||
chown root system /sys/devices/platform/10cb0000.hsi2c/i2c-2/2-0025/usb_limit_accessory_current
|
|
||||||
chown root system /sys/devices/platform/10cb0000.hsi2c/i2c-3/3-0025/usb_limit_accessory_current
|
|
||||||
chown root system /sys/devices/platform/10cb0000.hsi2c/i2c-4/4-0025/usb_limit_accessory_current
|
|
||||||
chown root system /sys/devices/platform/10cb0000.hsi2c/i2c-5/5-0025/usb_limit_accessory_current
|
|
||||||
chown root system /sys/devices/platform/10cb0000.hsi2c/i2c-6/6-0025/usb_limit_accessory_current
|
|
||||||
chown root system /sys/devices/platform/10cb0000.hsi2c/i2c-7/7-0025/usb_limit_accessory_current
|
|
||||||
chown root system /sys/devices/platform/10cb0000.hsi2c/i2c-8/8-0025/usb_limit_accessory_current
|
|
||||||
chown root system /sys/devices/platform/10cb0000.hsi2c/i2c-9/9-0025/usb_limit_accessory_current
|
|
||||||
chown root system /sys/devices/platform/10cb0000.hsi2c/i2c-0/0-0025/usb_limit_accessory_enable
|
|
||||||
chown root system /sys/devices/platform/10cb0000.hsi2c/i2c-1/1-0025/usb_limit_accessory_enable
|
|
||||||
chown root system /sys/devices/platform/10cb0000.hsi2c/i2c-2/2-0025/usb_limit_accessory_enable
|
|
||||||
chown root system /sys/devices/platform/10cb0000.hsi2c/i2c-3/3-0025/usb_limit_accessory_enable
|
|
||||||
chown root system /sys/devices/platform/10cb0000.hsi2c/i2c-4/4-0025/usb_limit_accessory_enable
|
|
||||||
chown root system /sys/devices/platform/10cb0000.hsi2c/i2c-5/5-0025/usb_limit_accessory_enable
|
|
||||||
chown root system /sys/devices/platform/10cb0000.hsi2c/i2c-6/6-0025/usb_limit_accessory_enable
|
|
||||||
chown root system /sys/devices/platform/10cb0000.hsi2c/i2c-7/7-0025/usb_limit_accessory_enable
|
|
||||||
chown root system /sys/devices/platform/10cb0000.hsi2c/i2c-8/8-0025/usb_limit_accessory_enable
|
|
||||||
chown root system /sys/devices/platform/10cb0000.hsi2c/i2c-9/9-0025/usb_limit_accessory_enable
|
|
||||||
chown root system /sys/devices/platform/10cb0000.hsi2c/i2c-0/0-0025/usb_limit_sink_current
|
|
||||||
chown root system /sys/devices/platform/10cb0000.hsi2c/i2c-1/1-0025/usb_limit_sink_current
|
|
||||||
chown root system /sys/devices/platform/10cb0000.hsi2c/i2c-2/2-0025/usb_limit_sink_current
|
|
||||||
chown root system /sys/devices/platform/10cb0000.hsi2c/i2c-3/3-0025/usb_limit_sink_current
|
|
||||||
chown root system /sys/devices/platform/10cb0000.hsi2c/i2c-4/4-0025/usb_limit_sink_current
|
|
||||||
chown root system /sys/devices/platform/10cb0000.hsi2c/i2c-5/5-0025/usb_limit_sink_current
|
|
||||||
chown root system /sys/devices/platform/10cb0000.hsi2c/i2c-6/6-0025/usb_limit_sink_current
|
|
||||||
chown root system /sys/devices/platform/10cb0000.hsi2c/i2c-7/7-0025/usb_limit_sink_current
|
|
||||||
chown root system /sys/devices/platform/10cb0000.hsi2c/i2c-8/8-0025/usb_limit_sink_current
|
|
||||||
chown root system /sys/devices/platform/10cb0000.hsi2c/i2c-9/9-0025/usb_limit_sink_current
|
|
||||||
chown root system /sys/devices/platform/10cb0000.hsi2c/i2c-0/0-0025/usb_limit_sink_enable
|
|
||||||
chown root system /sys/devices/platform/10cb0000.hsi2c/i2c-1/1-0025/usb_limit_sink_enable
|
|
||||||
chown root system /sys/devices/platform/10cb0000.hsi2c/i2c-2/2-0025/usb_limit_sink_enable
|
|
||||||
chown root system /sys/devices/platform/10cb0000.hsi2c/i2c-3/3-0025/usb_limit_sink_enable
|
|
||||||
chown root system /sys/devices/platform/10cb0000.hsi2c/i2c-4/4-0025/usb_limit_sink_enable
|
|
||||||
chown root system /sys/devices/platform/10cb0000.hsi2c/i2c-5/5-0025/usb_limit_sink_enable
|
|
||||||
chown root system /sys/devices/platform/10cb0000.hsi2c/i2c-6/6-0025/usb_limit_sink_enable
|
|
||||||
chown root system /sys/devices/platform/10cb0000.hsi2c/i2c-7/7-0025/usb_limit_sink_enable
|
|
||||||
chown root system /sys/devices/platform/10cb0000.hsi2c/i2c-8/8-0025/usb_limit_sink_enable
|
|
||||||
chown root system /sys/devices/platform/10cb0000.hsi2c/i2c-9/9-0025/usb_limit_sink_enable
|
|
||||||
chown root system /sys/devices/platform/10cb0000.hsi2c/i2c-0/0-0025/usb_limit_source_enable
|
|
||||||
chown root system /sys/devices/platform/10cb0000.hsi2c/i2c-1/1-0025/usb_limit_source_enable
|
|
||||||
chown root system /sys/devices/platform/10cb0000.hsi2c/i2c-2/2-0025/usb_limit_source_enable
|
|
||||||
chown root system /sys/devices/platform/10cb0000.hsi2c/i2c-3/3-0025/usb_limit_source_enable
|
|
||||||
chown root system /sys/devices/platform/10cb0000.hsi2c/i2c-4/4-0025/usb_limit_source_enable
|
|
||||||
chown root system /sys/devices/platform/10cb0000.hsi2c/i2c-5/5-0025/usb_limit_source_enable
|
|
||||||
chown root system /sys/devices/platform/10cb0000.hsi2c/i2c-6/6-0025/usb_limit_source_enable
|
|
||||||
chown root system /sys/devices/platform/10cb0000.hsi2c/i2c-7/7-0025/usb_limit_source_enable
|
|
||||||
chown root system /sys/devices/platform/10cb0000.hsi2c/i2c-8/8-0025/usb_limit_source_enable
|
|
||||||
chown root system /sys/devices/platform/10cb0000.hsi2c/i2c-9/9-0025/usb_limit_source_enable
|
|
||||||
chown root system /sys/devices/platform/10cb0000.hsi2c/i2c-0/0-0025/update_sdp_enum_timeout
|
|
||||||
chown root system /sys/devices/platform/10cb0000.hsi2c/i2c-1/1-0025/update_sdp_enum_timeout
|
|
||||||
chown root system /sys/devices/platform/10cb0000.hsi2c/i2c-2/2-0025/update_sdp_enum_timeout
|
|
||||||
chown root system /sys/devices/platform/10cb0000.hsi2c/i2c-3/3-0025/update_sdp_enum_timeout
|
|
||||||
chown root system /sys/devices/platform/10cb0000.hsi2c/i2c-4/4-0025/update_sdp_enum_timeout
|
|
||||||
chown root system /sys/devices/platform/10cb0000.hsi2c/i2c-5/5-0025/update_sdp_enum_timeout
|
|
||||||
chown root system /sys/devices/platform/10cb0000.hsi2c/i2c-6/6-0025/update_sdp_enum_timeout
|
|
||||||
chown root system /sys/devices/platform/10cb0000.hsi2c/i2c-7/7-0025/update_sdp_enum_timeout
|
|
||||||
chown root system /sys/devices/platform/10cb0000.hsi2c/i2c-8/8-0025/update_sdp_enum_timeout
|
|
||||||
chown root system /sys/devices/platform/10cb0000.hsi2c/i2c-9/9-0025/update_sdp_enum_timeout
|
|
||||||
chown root system /sys/devices/platform/110f0000.drmdp/drm-displayport/hpd
|
chown root system /sys/devices/platform/110f0000.drmdp/drm-displayport/hpd
|
||||||
chown root system /sys/devices/platform/110f0000.drmdp/drm-displayport/irq_hpd
|
chown root system /sys/devices/platform/110f0000.drmdp/drm-displayport/irq_hpd
|
||||||
chown root system /sys/devices/platform/110f0000.drmdp/drm-displayport/orientation
|
chown root system /sys/devices/platform/110f0000.drmdp/drm-displayport/orientation
|
||||||
|
@ -90,79 +28,17 @@ on post-fs
|
||||||
chmod 664 /sys/class/typec/port0/power_role
|
chmod 664 /sys/class/typec/port0/power_role
|
||||||
chmod 664 /sys/class/typec/port0/data_role
|
chmod 664 /sys/class/typec/port0/data_role
|
||||||
chmod 664 /sys/class/typec/port0/port_type
|
chmod 664 /sys/class/typec/port0/port_type
|
||||||
|
chmod 664 /sys/class/typec/port0/port0.0/mode1/active
|
||||||
chmod 664 /sys/devices/platform/11110000.usb/dwc3_exynos_otg_b_sess
|
chmod 664 /sys/devices/platform/11110000.usb/dwc3_exynos_otg_b_sess
|
||||||
chmod 664 /sys/devices/platform/11110000.usb/dwc3_exynos_otg_id
|
chmod 664 /sys/devices/platform/11110000.usb/dwc3_exynos_otg_id
|
||||||
chmod 664 /sys/devices/platform/11110000.usb/usb_data_enabled
|
chmod 664 /sys/devices/platform/11110000.usb/usb_data_enabled
|
||||||
chmod 664 /sys/devices/platform/10cb0000.hsi2c/i2c-0/0-0025/contaminant_detection
|
chmod 664 /sys/devices/platform/10cb0000.hsi2c/i2c-11/11-0025/contaminant_detection
|
||||||
chmod 664 /sys/devices/platform/10cb0000.hsi2c/i2c-1/1-0025/contaminant_detection
|
chmod 664 /sys/devices/platform/10cb0000.hsi2c/i2c-11/11-0025/usb_limit_accessory_current
|
||||||
chmod 664 /sys/devices/platform/10cb0000.hsi2c/i2c-2/2-0025/contaminant_detection
|
chmod 664 /sys/devices/platform/10cb0000.hsi2c/i2c-11/11-0025/usb_limit_accessory_enable
|
||||||
chmod 664 /sys/devices/platform/10cb0000.hsi2c/i2c-3/3-0025/contaminant_detection
|
chmod 664 /sys/devices/platform/10cb0000.hsi2c/i2c-11/11-0025/usb_limit_sink_current
|
||||||
chmod 664 /sys/devices/platform/10cb0000.hsi2c/i2c-4/4-0025/contaminant_detection
|
chmod 664 /sys/devices/platform/10cb0000.hsi2c/i2c-11/11-0025/usb_limit_sink_enable
|
||||||
chmod 664 /sys/devices/platform/10cb0000.hsi2c/i2c-5/5-0025/contaminant_detection
|
chmod 664 /sys/devices/platform/10cb0000.hsi2c/i2c-11/11-0025/usb_limit_source_enable
|
||||||
chmod 664 /sys/devices/platform/10cb0000.hsi2c/i2c-6/6-0025/contaminant_detection
|
chmod 664 /sys/devices/platform/10cb0000.hsi2c/i2c-11/11-0025/update_sdp_enum_timeout
|
||||||
chmod 664 /sys/devices/platform/10cb0000.hsi2c/i2c-7/7-0025/contaminant_detection
|
|
||||||
chmod 664 /sys/devices/platform/10cb0000.hsi2c/i2c-8/8-0025/contaminant_detection
|
|
||||||
chmod 664 /sys/devices/platform/10cb0000.hsi2c/i2c-9/9-0025/contaminant_detection
|
|
||||||
chmod 664 /sys/devices/platform/10cb0000.hsi2c/i2c-0/0-0025/usb_limit_accessory_current
|
|
||||||
chmod 664 /sys/devices/platform/10cb0000.hsi2c/i2c-1/1-0025/usb_limit_accessory_current
|
|
||||||
chmod 664 /sys/devices/platform/10cb0000.hsi2c/i2c-2/2-0025/usb_limit_accessory_current
|
|
||||||
chmod 664 /sys/devices/platform/10cb0000.hsi2c/i2c-3/3-0025/usb_limit_accessory_current
|
|
||||||
chmod 664 /sys/devices/platform/10cb0000.hsi2c/i2c-4/4-0025/usb_limit_accessory_current
|
|
||||||
chmod 664 /sys/devices/platform/10cb0000.hsi2c/i2c-5/5-0025/usb_limit_accessory_current
|
|
||||||
chmod 664 /sys/devices/platform/10cb0000.hsi2c/i2c-6/6-0025/usb_limit_accessory_current
|
|
||||||
chmod 664 /sys/devices/platform/10cb0000.hsi2c/i2c-7/7-0025/usb_limit_accessory_current
|
|
||||||
chmod 664 /sys/devices/platform/10cb0000.hsi2c/i2c-8/8-0025/usb_limit_accessory_current
|
|
||||||
chmod 664 /sys/devices/platform/10cb0000.hsi2c/i2c-9/9-0025/usb_limit_accessory_current
|
|
||||||
chmod 664 /sys/devices/platform/10cb0000.hsi2c/i2c-0/0-0025/usb_limit_accessory_enable
|
|
||||||
chmod 664 /sys/devices/platform/10cb0000.hsi2c/i2c-1/1-0025/usb_limit_accessory_enable
|
|
||||||
chmod 664 /sys/devices/platform/10cb0000.hsi2c/i2c-2/2-0025/usb_limit_accessory_enable
|
|
||||||
chmod 664 /sys/devices/platform/10cb0000.hsi2c/i2c-3/3-0025/usb_limit_accessory_enable
|
|
||||||
chmod 664 /sys/devices/platform/10cb0000.hsi2c/i2c-4/4-0025/usb_limit_accessory_enable
|
|
||||||
chmod 664 /sys/devices/platform/10cb0000.hsi2c/i2c-5/5-0025/usb_limit_accessory_enable
|
|
||||||
chmod 664 /sys/devices/platform/10cb0000.hsi2c/i2c-6/6-0025/usb_limit_accessory_enable
|
|
||||||
chmod 664 /sys/devices/platform/10cb0000.hsi2c/i2c-7/7-0025/usb_limit_accessory_enable
|
|
||||||
chmod 664 /sys/devices/platform/10cb0000.hsi2c/i2c-8/8-0025/usb_limit_accessory_enable
|
|
||||||
chmod 664 /sys/devices/platform/10cb0000.hsi2c/i2c-9/9-0025/usb_limit_accessory_enable
|
|
||||||
chmod 664 /sys/devices/platform/10cb0000.hsi2c/i2c-0/0-0025/usb_limit_sink_current
|
|
||||||
chmod 664 /sys/devices/platform/10cb0000.hsi2c/i2c-1/1-0025/usb_limit_sink_current
|
|
||||||
chmod 664 /sys/devices/platform/10cb0000.hsi2c/i2c-2/2-0025/usb_limit_sink_current
|
|
||||||
chmod 664 /sys/devices/platform/10cb0000.hsi2c/i2c-3/3-0025/usb_limit_sink_current
|
|
||||||
chmod 664 /sys/devices/platform/10cb0000.hsi2c/i2c-4/4-0025/usb_limit_sink_current
|
|
||||||
chmod 664 /sys/devices/platform/10cb0000.hsi2c/i2c-5/5-0025/usb_limit_sink_current
|
|
||||||
chmod 664 /sys/devices/platform/10cb0000.hsi2c/i2c-6/6-0025/usb_limit_sink_current
|
|
||||||
chmod 664 /sys/devices/platform/10cb0000.hsi2c/i2c-7/7-0025/usb_limit_sink_current
|
|
||||||
chmod 664 /sys/devices/platform/10cb0000.hsi2c/i2c-8/8-0025/usb_limit_sink_current
|
|
||||||
chmod 664 /sys/devices/platform/10cb0000.hsi2c/i2c-9/9-0025/usb_limit_sink_current
|
|
||||||
chmod 664 /sys/devices/platform/10cb0000.hsi2c/i2c-0/0-0025/usb_limit_sink_enable
|
|
||||||
chmod 664 /sys/devices/platform/10cb0000.hsi2c/i2c-1/1-0025/usb_limit_sink_enable
|
|
||||||
chmod 664 /sys/devices/platform/10cb0000.hsi2c/i2c-2/2-0025/usb_limit_sink_enable
|
|
||||||
chmod 664 /sys/devices/platform/10cb0000.hsi2c/i2c-3/3-0025/usb_limit_sink_enable
|
|
||||||
chmod 664 /sys/devices/platform/10cb0000.hsi2c/i2c-4/4-0025/usb_limit_sink_enable
|
|
||||||
chmod 664 /sys/devices/platform/10cb0000.hsi2c/i2c-5/5-0025/usb_limit_sink_enable
|
|
||||||
chmod 664 /sys/devices/platform/10cb0000.hsi2c/i2c-6/6-0025/usb_limit_sink_enable
|
|
||||||
chmod 664 /sys/devices/platform/10cb0000.hsi2c/i2c-7/7-0025/usb_limit_sink_enable
|
|
||||||
chmod 664 /sys/devices/platform/10cb0000.hsi2c/i2c-8/8-0025/usb_limit_sink_enable
|
|
||||||
chmod 664 /sys/devices/platform/10cb0000.hsi2c/i2c-9/9-0025/usb_limit_sink_enable
|
|
||||||
chmod 664 /sys/devices/platform/10cb0000.hsi2c/i2c-0/0-0025/usb_limit_source_enable
|
|
||||||
chmod 664 /sys/devices/platform/10cb0000.hsi2c/i2c-1/1-0025/usb_limit_source_enable
|
|
||||||
chmod 664 /sys/devices/platform/10cb0000.hsi2c/i2c-2/2-0025/usb_limit_source_enable
|
|
||||||
chmod 664 /sys/devices/platform/10cb0000.hsi2c/i2c-3/3-0025/usb_limit_source_enable
|
|
||||||
chmod 664 /sys/devices/platform/10cb0000.hsi2c/i2c-4/4-0025/usb_limit_source_enable
|
|
||||||
chmod 664 /sys/devices/platform/10cb0000.hsi2c/i2c-5/5-0025/usb_limit_source_enable
|
|
||||||
chmod 664 /sys/devices/platform/10cb0000.hsi2c/i2c-6/6-0025/usb_limit_source_enable
|
|
||||||
chmod 664 /sys/devices/platform/10cb0000.hsi2c/i2c-7/7-0025/usb_limit_source_enable
|
|
||||||
chmod 664 /sys/devices/platform/10cb0000.hsi2c/i2c-8/8-0025/usb_limit_source_enable
|
|
||||||
chmod 664 /sys/devices/platform/10cb0000.hsi2c/i2c-9/9-0025/usb_limit_source_enable
|
|
||||||
chmod 664 /sys/devices/platform/10cb0000.hsi2c/i2c-0/0-0025/update_sdp_enum_timeout
|
|
||||||
chmod 664 /sys/devices/platform/10cb0000.hsi2c/i2c-1/1-0025/update_sdp_enum_timeout
|
|
||||||
chmod 664 /sys/devices/platform/10cb0000.hsi2c/i2c-2/2-0025/update_sdp_enum_timeout
|
|
||||||
chmod 664 /sys/devices/platform/10cb0000.hsi2c/i2c-3/3-0025/update_sdp_enum_timeout
|
|
||||||
chmod 664 /sys/devices/platform/10cb0000.hsi2c/i2c-4/4-0025/update_sdp_enum_timeout
|
|
||||||
chmod 664 /sys/devices/platform/10cb0000.hsi2c/i2c-5/5-0025/update_sdp_enum_timeout
|
|
||||||
chmod 664 /sys/devices/platform/10cb0000.hsi2c/i2c-6/6-0025/update_sdp_enum_timeout
|
|
||||||
chmod 664 /sys/devices/platform/10cb0000.hsi2c/i2c-7/7-0025/update_sdp_enum_timeout
|
|
||||||
chmod 664 /sys/devices/platform/10cb0000.hsi2c/i2c-8/8-0025/update_sdp_enum_timeout
|
|
||||||
chmod 664 /sys/devices/platform/10cb0000.hsi2c/i2c-9/9-0025/update_sdp_enum_timeout
|
|
||||||
chmod 664 /sys/devices/platform/110f0000.drmdp/drm-displayport/hpd
|
chmod 664 /sys/devices/platform/110f0000.drmdp/drm-displayport/hpd
|
||||||
chmod 664 /sys/devices/platform/110f0000.drmdp/drm-displayport/irq_hpd
|
chmod 664 /sys/devices/platform/110f0000.drmdp/drm-displayport/irq_hpd
|
||||||
chmod 664 /sys/devices/platform/110f0000.drmdp/drm-displayport/orientation
|
chmod 664 /sys/devices/platform/110f0000.drmdp/drm-displayport/orientation
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
<manifest version="1.0" type="device">
|
<manifest version="1.0" type="device">
|
||||||
<hal format="aidl">
|
<hal format="aidl">
|
||||||
<name>android.hardware.usb</name>
|
<name>android.hardware.usb</name>
|
||||||
<version>2</version>
|
<version>3</version>
|
||||||
<interface>
|
<interface>
|
||||||
<name>IUsb</name>
|
<name>IUsb</name>
|
||||||
<instance>default</instance>
|
<instance>default</instance>
|
||||||
|
|
|
@ -1,17 +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.
|
|
||||||
#
|
|
||||||
|
|
||||||
include $(call first-makefiles-under, $(call my-dir))
|
|
Loading…
Add table
Add a link
Reference in a new issue