diff --git a/BoardConfig-common.mk b/BoardConfig-common.mk index 723b6b6e..e1d6cd4f 100644 --- a/BoardConfig-common.mk +++ b/BoardConfig-common.mk @@ -233,7 +233,7 @@ $(call soong_config_set,aoc_audio_func,ext_hidl,true) ifneq (,$(filter userdebug eng, $(TARGET_BUILD_VARIANT))) $(call soong_config_set,aoc_audio_func,dump_usecase_data,true) $(call soong_config_set,aoc_audio_func,hal_socket_control,true) -$(call soong_config_set,aoc_audio_func,record_tunning_keys,true) +$(call soong_config_set,aoc_audio_func,record_tuning_keys,true) endif ifneq (,$(filter aosp_%,$(TARGET_PRODUCT))) diff --git a/OWNERS b/OWNERS index 1cbf9196..4bdbb973 100644 --- a/OWNERS +++ b/OWNERS @@ -1,2 +1,2 @@ # per-file for Pixel device makefiles, see go/pixel-device-mk-owner-checklist for details. -per-file *.mk=file:device/google/gs-common:master:/OWNERS +per-file *.mk=file:device/google/gs-common:main:/OWNERS diff --git a/PREUPLOAD.cfg b/PREUPLOAD.cfg new file mode 100644 index 00000000..37ebb5e7 --- /dev/null +++ b/PREUPLOAD.cfg @@ -0,0 +1,2 @@ +[Builtin Hooks] +jsonlint = true diff --git a/conf/init.check_ap_pd_auth.sh b/conf/init.check_ap_pd_auth.sh new file mode 100644 index 00000000..8175e754 --- /dev/null +++ b/conf/init.check_ap_pd_auth.sh @@ -0,0 +1,15 @@ +#!/vendor/bin/sh + +# This script sets up `ro.vendor.sjtag_ap_is_unlocked` for the non-fused +# device. For a fused device, this property should be set by +# betterbug->ss-restart-detector when PD is acquired. + +SJTAG_STATUS=0x$(cat /sys/devices/platform/sjtag_ap/interface/status) +SOFT_LOCK_BIT=4 +AUTH_PASS_BIT=8 + +# Unlocked or locked but auth passed. +if test "$((SJTAG_STATUS & (1 << SOFT_LOCK_BIT)))" = 0 -o \ + "$((SJTAG_STATUS & (1 << AUTH_PASS_BIT)))" != 0 ; then + setprop ro.vendor.sjtag_ap_is_unlocked true +fi diff --git a/conf/init.debug.rc b/conf/init.debug.rc index d4de2c87..3f8be42f 100644 --- a/conf/init.debug.rc +++ b/conf/init.debug.rc @@ -39,7 +39,13 @@ on property:ro.revision=PROTO1.1 on property:ro.revision=EVT1.0 setprop debug.hypervisor.metrics_tag "hwrev_a0" -# Enable etm/etm2dram when ramdump is enabled. -on property:ro.boot.ramdump=enabled +service vendor.check_ap_pd_auth_sh /vendor/bin/init.check_ap_pd_auth.sh + class main + user root + group root system + oneshot + +# Enable etm/etm2dram when ramdump is enabled, and ap-sjtag is unlocked. +on property:ro.boot.ramdump=enabled && property:ro.vendor.sjtag_ap_is_unlocked=true write /sys/devices/platform/exynos-etm/etm_on 1 write /sys/devices/platform/etm2dram/arm 1 diff --git a/conf/init.gs201.rc b/conf/init.gs201.rc index 847c2611..4c6da6df 100644 --- a/conf/init.gs201.rc +++ b/conf/init.gs201.rc @@ -27,30 +27,30 @@ on init write /dev/sys/fs/by-name/userdata/data_io_flag 56 write /dev/sys/fs/by-name/userdata/node_io_flag 56 - chown system system /proc/vendor_sched/set_task_group_bg - chown system system /proc/vendor_sched/set_task_group_cam - chown system system /proc/vendor_sched/set_task_group_fg - chown system system /proc/vendor_sched/set_task_group_nnapi - chown system system /proc/vendor_sched/set_task_group_sys - chown system system /proc/vendor_sched/set_task_group_sysbg - chown system system /proc/vendor_sched/set_task_group_ta - chown system system /proc/vendor_sched/set_task_group_rt - chown system system /proc/vendor_sched/set_task_group_sf - chown system system /proc/vendor_sched/set_task_group_dex2oat - chown system system /proc/vendor_sched/set_task_group_cam_power - chown system system /proc/vendor_sched/set_task_group_ota - chown system system /proc/vendor_sched/set_proc_group_bg - chown system system /proc/vendor_sched/set_proc_group_cam - chown system system /proc/vendor_sched/set_proc_group_fg - chown system system /proc/vendor_sched/set_proc_group_nnapi - chown system system /proc/vendor_sched/set_proc_group_sys - chown system system /proc/vendor_sched/set_proc_group_sysbg - chown system system /proc/vendor_sched/set_proc_group_ta - chown system system /proc/vendor_sched/set_proc_group_rt - chown system system /proc/vendor_sched/set_proc_group_sf - chown system system /proc/vendor_sched/set_proc_group_dex2oat - chown system system /proc/vendor_sched/set_proc_group_cam_power - chown system system /proc/vendor_sched/set_proc_group_ota + chown system system /proc/vendor_sched/groups/bg/set_task_group + chown system system /proc/vendor_sched/groups/cam/set_task_group + chown system system /proc/vendor_sched/groups/fg/set_task_group + chown system system /proc/vendor_sched/groups/nnapi/set_task_group + chown system system /proc/vendor_sched/groups/sys/set_task_group + chown system system /proc/vendor_sched/groups/sys_bg/set_task_group + chown system system /proc/vendor_sched/groups/ta/set_task_group + chown system system /proc/vendor_sched/groups/rt/set_task_group + chown system system /proc/vendor_sched/groups/sf/set_task_group + chown system system /proc/vendor_sched/groups/dex2oat/set_task_group + chown system system /proc/vendor_sched/groups/cam_power/set_task_group + chown system system /proc/vendor_sched/groups/ota/set_task_group + chown system system /proc/vendor_sched/groups/bg/set_proc_group + chown system system /proc/vendor_sched/groups/cam/set_proc_group + chown system system /proc/vendor_sched/groups/fg/set_proc_group + chown system system /proc/vendor_sched/groups/nnapi/set_proc_group + chown system system /proc/vendor_sched/groups/sys/set_proc_group + chown system system /proc/vendor_sched/groups/sys_bg/set_proc_group + chown system system /proc/vendor_sched/groups/ta/set_proc_group + chown system system /proc/vendor_sched/groups/rt/set_proc_group + chown system system /proc/vendor_sched/groups/sf/set_proc_group + chown system system /proc/vendor_sched/groups/dex2oat/set_proc_group + chown system system /proc/vendor_sched/groups/cam_power/set_proc_group + chown system system /proc/vendor_sched/groups/ota/set_proc_group chown system system /proc/vendor_sched/prefer_idle_set chown system system /proc/vendor_sched/prefer_idle_clear chown system system /proc/vendor_sched/pmu_poll_enable @@ -76,30 +76,30 @@ on init chown system system /sys/class/devfreq/gs_memlat_devfreq:devfreq_mif_cpu6_memlat@17000010/memlat_cpuidle_state_aware chown system system /sys/class/devfreq/gs_memlat_devfreq:devfreq_mif_cpu7_memlat@17000010/memlat_cpuidle_state_aware - chmod 0220 /proc/vendor_sched/set_task_group_bg - chmod 0220 /proc/vendor_sched/set_task_group_cam - chmod 0220 /proc/vendor_sched/set_task_group_fg - chmod 0220 /proc/vendor_sched/set_task_group_nnapi - chmod 0220 /proc/vendor_sched/set_task_group_sys - chmod 0220 /proc/vendor_sched/set_task_group_sysbg - chmod 0220 /proc/vendor_sched/set_task_group_ta - chmod 0220 /proc/vendor_sched/set_task_group_rt - chmod 0220 /proc/vendor_sched/set_task_group_sf - chmod 0220 /proc/vendor_sched/set_task_group_dex2oat - chmod 0220 /proc/vendor_sched/set_task_group_cam_power - chmod 0220 /proc/vendor_sched/set_task_group_ota - chmod 0220 /proc/vendor_sched/set_proc_group_bg - chmod 0220 /proc/vendor_sched/set_proc_group_cam - chmod 0220 /proc/vendor_sched/set_proc_group_fg - chmod 0220 /proc/vendor_sched/set_proc_group_nnapi - chmod 0220 /proc/vendor_sched/set_proc_group_sys - chmod 0220 /proc/vendor_sched/set_proc_group_sysbg - chmod 0220 /proc/vendor_sched/set_proc_group_ta - chmod 0220 /proc/vendor_sched/set_proc_group_rt - chmod 0220 /proc/vendor_sched/set_proc_group_sf - chmod 0220 /proc/vendor_sched/set_proc_group_dex2oat - chmod 0220 /proc/vendor_sched/set_proc_group_cam_power - chmod 0220 /proc/vendor_sched/set_proc_group_ota + chmod 0220 /proc/vendor_sched/groups/bg/set_task_group + chmod 0220 /proc/vendor_sched/groups/cam/set_task_group + chmod 0220 /proc/vendor_sched/groups/fg/set_task_group + chmod 0220 /proc/vendor_sched/groups/nnapi/set_task_group + chmod 0220 /proc/vendor_sched/groups/sys/set_task_group + chmod 0220 /proc/vendor_sched/groups/sys_bg/set_task_group + chmod 0220 /proc/vendor_sched/groups/ta/set_task_group + chmod 0220 /proc/vendor_sched/groups/rt/set_task_group + chmod 0220 /proc/vendor_sched/groups/sf/set_task_group + chmod 0220 /proc/vendor_sched/groups/dex2oat/set_task_group + chmod 0220 /proc/vendor_sched/groups/cam_power/set_task_group + chmod 0220 /proc/vendor_sched/groups/ota/set_task_group + chmod 0220 /proc/vendor_sched/groups/bg/set_proc_group + chmod 0220 /proc/vendor_sched/groups/cam/set_proc_group + chmod 0220 /proc/vendor_sched/groups/fg/set_proc_group + chmod 0220 /proc/vendor_sched/groups/nnapi/set_proc_group + chmod 0220 /proc/vendor_sched/groups/sys/set_proc_group + chmod 0220 /proc/vendor_sched/groups/sys_bg/set_proc_group + chmod 0220 /proc/vendor_sched/groups/ta/set_proc_group + chmod 0220 /proc/vendor_sched/groups/rt/set_proc_group + chmod 0220 /proc/vendor_sched/groups/sf/set_proc_group + chmod 0220 /proc/vendor_sched/groups/dex2oat/set_proc_group + chmod 0220 /proc/vendor_sched/groups/cam_power/set_proc_group + chmod 0220 /proc/vendor_sched/groups/ota/set_proc_group chmod 0220 /proc/vendor_sched/prefer_idle_set chmod 0220 /proc/vendor_sched/prefer_idle_clear chmod 0220 /proc/vendor_sched/pmu_poll_enable @@ -165,12 +165,12 @@ on init mkdir /dev/socket/pdx/system/vr/sensors 0775 system system # Boot time 183626384 - write /proc/vendor_sched/ta_uclamp_min 159 - write /proc/vendor_sched/ta_prefer_idle 1 - write /proc/vendor_sched/fg_uclamp_min 159 - write /proc/vendor_sched/fg_prefer_idle 1 - write /proc/vendor_sched/sys_uclamp_min 159 - write /proc/vendor_sched/sys_prefer_idle 1 + write /proc/vendor_sched/groups/ta/uclamp_min 159 + write /proc/vendor_sched/groups/ta/prefer_idle 1 + write /proc/vendor_sched/groups/fg/uclamp_min 159 + write /proc/vendor_sched/groups/fg/prefer_idle 1 + write /proc/vendor_sched/groups/sys/uclamp_min 159 + write /proc/vendor_sched/groups/sys/prefer_idle 1 # governor setting write /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor sched_pixel @@ -221,8 +221,8 @@ on init chown system system /dev/cpuset/camera-daemon-mid-high-group/tasks chmod 0664 /dev/cpuset/camera-daemon-mid-high-group/tasks - write /proc/vendor_sched/cam_prefer_idle 1 - write /proc/vendor_sched/cam_uclamp_min 1 + write /proc/vendor_sched/groups/cam/prefer_idle 1 + write /proc/vendor_sched/groups/cam/uclamp_min 1 chown system system /dev/cpuset/cgroup.procs @@ -324,8 +324,8 @@ on init chown system system /dev/bbd_pwrstat # Add a boost for NNAPI HAL - write /proc/vendor_sched/nnapi_prefer_idle 0 - write /proc/vendor_sched/nnapi_uclamp_min 512 + write /proc/vendor_sched/groups/nnapi/prefer_idle 0 + write /proc/vendor_sched/groups/nnapi/uclamp_min 512 # Add memlat governor settings write /sys/class/devfreq/gs_memlat_devfreq:devfreq_mif_cpu0_memlat@17000010/polling_interval 10 @@ -420,7 +420,7 @@ on post-fs-data on zygote-start # For PixelLogger configuration file. chmod 0771 /data/vendor/wifi - write /proc/vendor_sched/sys_uclamp_min 0 + write /proc/vendor_sched/groups/sys/uclamp_min 0 on post-fs-data # Create the directories used by the Wireless subsystem @@ -596,6 +596,7 @@ on fs chown system system /sys/devices/platform/exynos-drm/primary-panel/panel_idle chown system system /sys/devices/platform/exynos-drm/primary-panel/panel_need_handle_idle_exit chown system system /sys/module/drm/parameters/vblankoffdelay + chown system system /sys/module/drm/parameters/debug chown system system /sys/class/dqe0/atc/ambient_light chown system system /sys/class/dqe0/atc/st chown system system /sys/class/dqe0/atc/en @@ -729,25 +730,25 @@ on property:sys.boot_completed=1 setprop vendor.powerhal.init 1 # Setup final cpu.uclamp - write /proc/vendor_sched/ta_uclamp_min 1 - write /proc/vendor_sched/fg_uclamp_min 0 - write /proc/vendor_sched/sys_prefer_idle 0 + write /proc/vendor_sched/groups/ta/uclamp_min 1 + write /proc/vendor_sched/groups/fg/uclamp_min 0 + write /proc/vendor_sched/groups/sys/prefer_idle 0 # Set ug group - write /proc/vendor_sched/bg_ug 0 - write /proc/vendor_sched/sysbg_ug 0 - write /proc/vendor_sched/ota_ug 0 - write /proc/vendor_sched/dex2oat_ug 1 - write /proc/vendor_sched/ta_ug 1 + write /proc/vendor_sched/groups/bg/ug 0 + write /proc/vendor_sched/groups/sys_bg/ug 0 + write /proc/vendor_sched/groups/ota/ug 0 + write /proc/vendor_sched/groups/dex2oat/ug 1 + write /proc/vendor_sched/groups/ta/ug 1 # Set bg group throttle write /proc/vendor_sched/ug_bg_group_throttle ${persist.device_config.vendor_system_native.ug_bg_group_throttle:-308} # Set uclamp.max for some groups, which could indicate cpu importance used in scheduling - write /proc/vendor_sched/bg_uclamp_max 512 - write /proc/vendor_sched/sysbg_uclamp_max 512 - write /proc/vendor_sched/ota_uclamp_max 512 - write /proc/vendor_sched/dex2oat_uclamp_max 615 + write /proc/vendor_sched/groups/bg/uclamp_max 512 + write /proc/vendor_sched/groups/sys_bg/uclamp_max 512 + write /proc/vendor_sched/groups/ota/uclamp_max 512 + write /proc/vendor_sched/groups/dex2oat/uclamp_max 615 # Set PMU freq limit parameters write /sys/devices/system/cpu/cpufreq/policy0/sched_pixel/lcpi_threshold 2 @@ -933,13 +934,13 @@ on post-fs-data on property:vendor.brownout.mitigation.ready=1 # BCL - write /sys/devices/virtual/pmic/mitigation/clock_ratio/tpu_light_clk_ratio 0xfff041c1 #DFS - write /sys/devices/virtual/pmic/mitigation/clock_ratio/cpu1_heavy_clk_ratio 0xfff041c1 #DFS - write /sys/devices/virtual/pmic/mitigation/clock_ratio/cpu2_heavy_clk_ratio 0xfff041c1 #DFS - write /sys/devices/virtual/pmic/mitigation/clock_ratio/gpu_light_clk_ratio 0xfff041c1 #DFS + write /sys/devices/virtual/pmic/mitigation/clock_ratio/tpu_light_clk_ratio 0x80041c3 #DFS + write /sys/devices/virtual/pmic/mitigation/clock_ratio/cpu1_heavy_clk_ratio 0xfff041c0 #DFS + write /sys/devices/virtual/pmic/mitigation/clock_ratio/cpu2_heavy_clk_ratio 0xfff041c0 #DFS + write /sys/devices/virtual/pmic/mitigation/clock_ratio/gpu_light_clk_ratio 0x80041c3 #DFS write /sys/devices/virtual/pmic/mitigation/clock_ratio/cpu2_light_clk_ratio 0xfff041c3 #OCP - write /sys/devices/virtual/pmic/mitigation/clock_ratio/gpu_heavy_clk_ratio 0xfff04385 #OCP - write /sys/devices/virtual/pmic/mitigation/clock_ratio/tpu_heavy_clk_ratio 0xfff041c3 #OCP + write /sys/devices/virtual/pmic/mitigation/clock_ratio/gpu_heavy_clk_ratio 0xfff04381 #OCP + write /sys/devices/virtual/pmic/mitigation/clock_ratio/tpu_heavy_clk_ratio 0xfff041c1 #OCP write /sys/devices/virtual/pmic/mitigation/triggered_lvl/uvlo1_lvl 3200 write /sys/devices/virtual/pmic/mitigation/triggered_lvl/smpl_lvl 3100 write /sys/devices/virtual/pmic/mitigation/triggered_lvl/uvlo2_lvl 3000 @@ -1037,12 +1038,12 @@ on charger # Cancel boot devfreq and uclamp write /sys/devices/platform/17000010.devfreq_mif/devfreq/17000010.devfreq_mif/exynos_data/cancel_boot_freq 1 write /sys/devices/platform/17000020.devfreq_int/devfreq/17000020.devfreq_int/exynos_data/cancel_boot_freq 1 - write /proc/vendor_sched/ta_uclamp_min 0 - write /proc/vendor_sched/ta_prefer_idle 0 - write /proc/vendor_sched/fg_uclamp_min 0 - write /proc/vendor_sched/fg_prefer_idle 0 - write /proc/vendor_sched/sys_uclamp_min 0 - write /proc/vendor_sched/sys_prefer_idle 0 + write /proc/vendor_sched/groups/ta/uclamp_min 0 + write /proc/vendor_sched/groups/ta/prefer_idle 0 + write /proc/vendor_sched/groups/fg/uclamp_min 0 + write /proc/vendor_sched/groups/fg/prefer_idle 0 + write /proc/vendor_sched/groups/sys/uclamp_min 0 + write /proc/vendor_sched/groups/sys/prefer_idle 0 # Enable SICD write /sys/devices/system/cpu/cpupm/cpupm/sicd 1 diff --git a/conf/init.gs201.usb.rc b/conf/init.gs201.usb.rc index 6a52fb07..9ba9eb8a 100644 --- a/conf/init.gs201.usb.rc +++ b/conf/init.gs201.usb.rc @@ -371,6 +371,8 @@ on boot write sys/module/usbcore/parameters/initial_descriptor_timeout 500 # Use USB Gadget HAL setprop sys.usb.configfs 2 + # Enable in-kernel media-presence polling for SD cards + write /sys/module/block/parameters/events_dfl_poll_msecs 2000 on property:sys.usb.ffs.ready=1 && property:sys.usb.config=adb && property:sys.usb.configfs=1 write /config/usb_gadget/g1/idProduct 0x4EE7 diff --git a/device-common.mk b/device-common.mk index bfd64abb..55f5020d 100644 --- a/device-common.mk +++ b/device-common.mk @@ -18,7 +18,6 @@ ifneq ($(BOARD_WITHOUT_RADIO),true) -include vendor/google_devices/gs201/proprietary/telephony/device-vendor.mk endif include device/google/gs201/device.mk -include device/google/gs101/tts/voice_packs.mk ifneq ($(BOARD_WITHOUT_RADIO),true) # Telephony diff --git a/device.mk b/device.mk index bb54f1c4..d15c21d4 100644 --- a/device.mk +++ b/device.mk @@ -21,12 +21,13 @@ include device/google/gs-common/soc/soc.mk include device/google/gs-common/soc/freq.mk include device/google/gs-common/modem/modem.mk include device/google/gs-common/aoc/aoc.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/pixel_metrics/pixel_metrics.mk include device/google/gs-common/performance/perf.mk include device/google/gs-common/display/dump.mk include device/google/gs-common/camera/dump.mk -include device/google/gs-common/gxp/dump.mk +include device/google/gs-common/gxp/gxp.mk include device/google/gs-common/gps/dump/log.mk include device/google/gs-common/radio/dump.mk include device/google/gs-common/umfw_stat/umfw_stat.mk @@ -35,6 +36,7 @@ include device/google/gs-common/widevine/widevine.mk include device/google/gs-common/sota_app/factoryota.mk include device/google/gs-common/misc_writer/misc_writer.mk include device/google/gs-common/gyotaku_app/gyotaku.mk +include device/google/gs-common/bootctrl/bootctrl_aidl.mk TARGET_BOARD_PLATFORM := gs201 @@ -190,7 +192,7 @@ PRODUCT_PRODUCT_PROPERTIES += \ # Carrier configuration default location PRODUCT_PROPERTY_OVERRIDES += \ - persist.vendor.radio.config.carrier_config_dir=/mnt/vendor/modem_img/images/default/confpack + persist.vendor.radio.config.carrier_config_dir=/vendor/firmware/carrierconfig PRODUCT_PROPERTY_OVERRIDES += \ telephony.active_modems.max_count=2 @@ -219,13 +221,18 @@ USES_GAUDIO := true USE_SWIFTSHADER := false # HWUI -TARGET_USES_VULKAN = true +ifeq ($(USE_SWIFTSHADER),true) + TARGET_USES_VULKAN = false +else + TARGET_USES_VULKAN = true +endif PRODUCT_SOONG_NAMESPACES += \ vendor/arm/mali/valhall $(call soong_config_set,pixel_mali,soc,$(TARGET_BOARD_PLATFORM)) +include device/google/gs-common/gpu/gpu.mk PRODUCT_PACKAGES += \ csffw_image_prebuilt__firmware_prebuilt_todx_mali_csffw.bin \ libGLES_mali \ @@ -233,9 +240,6 @@ PRODUCT_PACKAGES += \ libOpenCL \ libgpudataproducer \ -PRODUCT_VENDOR_PROPERTIES += \ - ro.hardware.vulkan=mali - # Mali Configuration Properties # b/221255664 prevents setting PROTECTED_MAX_CORE_COUNT=2 PRODUCT_VENDOR_PROPERTIES += \ @@ -245,13 +249,6 @@ PRODUCT_VENDOR_PROPERTIES += \ vendor.mali.base_protected_tls_max=67108864 \ vendor.mali.platform_agt_frequency_khz=24576 -ifeq ($(USE_SWIFTSHADER),true) -PRODUCT_PACKAGES += \ - libGLESv1_CM_swiftshader \ - libEGL_swiftshader \ - libGLESv2_swiftshader -endif - PRODUCT_COPY_FILES += \ frameworks/native/data/etc/android.hardware.opengles.aep.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.opengles.aep.xml \ frameworks/native/data/etc/android.hardware.vulkan.version-1_3.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.vulkan.version.xml \ @@ -260,12 +257,20 @@ PRODUCT_COPY_FILES += \ frameworks/native/data/etc/android.software.vulkan.deqp.level-2023-03-01.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.software.vulkan.deqp.level.xml \ frameworks/native/data/etc/android.software.opengles.deqp.level-2023-03-01.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.software.opengles.deqp.level.xml +ifeq ($(USE_SWIFTSHADER),true) +PRODUCT_PACKAGES += \ + vulkan.pastel +endif + ifeq ($(USE_SWIFTSHADER),true) PRODUCT_VENDOR_PROPERTIES += \ - ro.hardware.egl = swiftshader + ro.hardware.egl = mali \ + persist.graphics.egl = angle \ + ro.hardware.vulkan = pastel else PRODUCT_VENDOR_PROPERTIES += \ - ro.hardware.egl = mali + ro.hardware.egl = mali \ + ro.hardware.vulkan = mali endif # Configure EGL blobcache @@ -278,6 +283,9 @@ PRODUCT_VENDOR_PROPERTIES += \ graphics.gpu.profiler.support=true \ debug.renderengine.backend=skiaglthreaded +# b/295257834 Add HDR shaders to SurfaceFlinger's pre-warming cache +PRODUCT_VENDOR_PROPERTIES += ro.surface_flinger.prime_shader_cache.ultrahdr=1 + # GRAPHICS - GPU (end) # #################### @@ -326,7 +334,8 @@ PRODUCT_COPY_FILES += \ ifneq (,$(filter userdebug eng, $(TARGET_BUILD_VARIANT))) PRODUCT_COPY_FILES += \ - device/google/gs201/conf/init.debug.rc:$(TARGET_COPY_OUT_VENDOR)/etc/init/init.debug.rc + device/google/gs201/conf/init.debug.rc:$(TARGET_COPY_OUT_VENDOR)/etc/init/init.debug.rc \ + device/google/gs201/conf/init.check_ap_pd_auth.sh:$(TARGET_COPY_OUT_VENDOR)/bin/init.check_ap_pd_auth.sh endif # Recovery files @@ -508,7 +517,7 @@ PRODUCT_PACKAGES += \ PRODUCT_PACKAGES += \ android.hardware.graphics.mapper@4.0-impl \ - android.hardware.graphics.allocator-V1-service + android.hardware.graphics.allocator-V2-service PRODUCT_PACKAGES += \ android.hardware.memtrack-service.pixel \ @@ -810,11 +819,12 @@ $(call inherit-product, system/core/trusty/trusty-base.mk) # Trusty dump include device/google/gs-common/trusty/trusty.mk -# Trusty unit test tool +# Trusty unit test and code coverage tool PRODUCT_PACKAGES_DEBUG += \ trusty-ut-ctrl \ tipc-test \ trusty_stats_test \ + trusty-coverage-controller \ include device/google/gs101/confirmationui/confirmationui.mk @@ -907,19 +917,12 @@ $(call inherit-product-if-exists, vendor/samsung_slsi/telephony/$(BOARD_USES_SHA PRODUCT_PACKAGES += ShannonIms -#RCS Test Messaging App PRODUCT_PACKAGES_DEBUG += \ - preinstalled-packages-product-gs201-device-debug.xml \ - TestRcsApp + preinstalled-packages-product-gs201-device-debug.xml PRODUCT_PACKAGES += ShannonRcs endif -# Boot Control HAL -PRODUCT_PACKAGES += \ - android.hardware.boot@1.2-impl-gs201 \ - android.hardware.boot@1.2-service-gs201 - # Exynos RIL and telephony # Multi SIM(DSDS) SIM_COUNT := 2 @@ -1000,9 +1003,6 @@ PRODUCT_COPY_FILES += \ device/google/$(TARGET_BOARD_PLATFORM)/radio/config/Pixel_stability.cfg:$(TARGET_COPY_OUT_VENDOR)/etc/modem/Pixel_stability.cfg \ device/google/$(TARGET_BOARD_PLATFORM)/radio/config/Pixel_stability.nprf:$(TARGET_COPY_OUT_VENDOR)/etc/modem/Pixel_stability.nprf \ -# ARM NN files -ARMNN_COMPUTE_CL_ENABLE := 1 - # Vibrator Diag PRODUCT_PACKAGES_DEBUG += \ diag-vibrator \ @@ -1076,7 +1076,6 @@ include device/google/gs101/telephony/pktrouter.mk # Thermal HAL PRODUCT_PROPERTY_OVERRIDES += persist.vendor.enable.thermal.genl=true -include hardware/google/pixel/thermal/device.mk # EdgeTPU include device/google/gs-common/edgetpu/edgetpu.mk @@ -1163,10 +1162,6 @@ PRODUCT_COPY_FILES += \ # Call deleteAllKeys if vold detects a factory reset PRODUCT_VENDOR_PROPERTIES += ro.crypto.metadata_init_delete_all_keys.enabled?=true -# Increase lmkd aggressiveness -PRODUCT_PROPERTY_OVERRIDES += \ - ro.lmk.swap_free_low_percentage=100 - # Hardware Info include hardware/google/pixel/HardwareInfo/HardwareInfo.mk diff --git a/device_framework_matrix_product.xml b/device_framework_matrix_product.xml index 951a1253..1e34caf2 100644 --- a/device_framework_matrix_product.xml +++ b/device_framework_matrix_product.xml @@ -42,7 +42,7 @@ com.google.face.debug - 4 + 3-4 IDebugHost default @@ -68,9 +68,17 @@ default + + com.google.edgetpu.tachyon + 1 + + IComputeService + default + + com.google.hardware.pixel.display - 9 + 10 IDisplay default @@ -102,7 +110,7 @@ vendor.google.google_battery - 2 + 2-3 IGoogleBattery default @@ -118,7 +126,7 @@ vendor.google.wifi_ext - 1 + 2-3 IWifiExt default @@ -134,6 +142,13 @@ sced0 + + com.google.pixel.modem.logmasklibrary + + ILiboemserviceProxy + default + + vendor.samsung_slsi.telephony.hardware.radioExternal 1.1 diff --git a/fingerprint/udfps.mk b/fingerprint/udfps.mk deleted file mode 100644 index 61f138f6..00000000 --- a/fingerprint/udfps.mk +++ /dev/null @@ -1,28 +0,0 @@ -# -# Copyright (C) 2020 The Android Open-Source Project -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# - -PRODUCT_COPY_FILES += \ - frameworks/native/data/etc/android.hardware.fingerprint.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.fingerprint.xml - -# Include the Goodix AIDL HAL namespaces. -PRODUCT_SOONG_NAMESPACES += vendor/goodix/udfps/g6_trusty -PRODUCT_SOONG_NAMESPACES += vendor/goodix/udfps/g6_aidl_trusty - -$(call soong_config_set,fp_hal_feature,biometric_suez_support,true) - -PRODUCT_PACKAGES += \ - android.hardware.biometrics.fingerprint@2.1-service.goodix \ - android.hardware.biometrics.fingerprint-service.goodix diff --git a/fingerprint/udfps_factory.mk b/fingerprint/udfps_factory.mk deleted file mode 100644 index 41aebe08..00000000 --- a/fingerprint/udfps_factory.mk +++ /dev/null @@ -1,22 +0,0 @@ -# -# Copyright (C) 2020 The Android Open-Source Project -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# - -PRODUCT_PACKAGES += \ - GF_delmar_factory \ - udfps_test - -PRODUCT_PROPERTY_OVERRIDES += \ - gf.debug.dump_data=1 diff --git a/interfaces/boot/1.0/Android.bp b/interfaces/boot/1.0/Android.bp deleted file mode 100644 index a5937e78..00000000 --- a/interfaces/boot/1.0/Android.bp +++ /dev/null @@ -1,66 +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. - -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/gs201:device_google_gs201_license" - // to get the below license kinds: - // SPDX-license-identifier-Apache-2.0 - default_applicable_licenses: [ - "//device/google/gs201:device_google_gs201_license", - ], -} - -cc_binary { - name: "android.hardware.boot@1.0-service-gs201", - defaults: ["hidl_defaults"], - relative_install_path: "hw", - vendor: true, - init_rc: ["android.hardware.boot@1.0-service-gs201.rc"], - srcs: [ - "BootControl.cpp", - "GptUtils.cpp", - "service.cpp" - ], - shared_libs: [ - "libbase", - "liblog", - "libhidlbase", - "libutils", - "libcutils", - "libz", - "android.hardware.boot@1.0", - ], -} - -cc_library { - name: "android.hardware.boot@1.0-impl-gs201", - recovery: true, - srcs: [ - "BootControl.cpp", - "GptUtils.cpp", - ], - relative_install_path: "hw", - shared_libs: [ - "libbase", - "liblog", - "libhidlbase", - "libutils", - "libcutils", - "libz", - "android.hardware.boot@1.0", - ], -} diff --git a/interfaces/boot/1.0/BootControl.cpp b/interfaces/boot/1.0/BootControl.cpp deleted file mode 100644 index 1f155c9d..00000000 --- a/interfaces/boot/1.0/BootControl.cpp +++ /dev/null @@ -1,272 +0,0 @@ -/* - * Copyright (C) 2019 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#define LOG_TAG "bootcontrolhal" - -#include "BootControl.h" -#include "GptUtils.h" - -#include -#include -#include - -namespace android { -namespace hardware { -namespace boot { -namespace V1_0 { -namespace implementation { - -namespace { - -#define BOOT_A_PATH "/dev/block/by-name/boot_a" -#define BOOT_B_PATH "/dev/block/by-name/boot_b" - -// slot flags -#define AB_ATTR_PRIORITY_SHIFT 52 -#define AB_ATTR_PRIORITY_MASK (3UL << AB_ATTR_PRIORITY_SHIFT) -#define AB_ATTR_ACTIVE_SHIFT 54 -#define AB_ATTR_ACTIVE (1UL << AB_ATTR_ACTIVE_SHIFT) -#define AB_ATTR_RETRY_COUNT_SHIFT (55) -#define AB_ATTR_RETRY_COUNT_MASK (7UL << AB_ATTR_RETRY_COUNT_SHIFT) -#define AB_ATTR_SUCCESSFUL (1UL << 58) -#define AB_ATTR_UNBOOTABLE (1UL << 59) - -#define AB_ATTR_MAX_PRIORITY 3UL -#define AB_ATTR_MAX_RETRY_COUNT 3UL - -static std::string getDevPath(uint32_t slot) { - char real_path[PATH_MAX]; - - const char *path = slot == 0 ? BOOT_A_PATH : BOOT_B_PATH; - - int ret = readlink(path, real_path, sizeof real_path); - if (ret < 0) { - ALOGE("readlink failed for boot device %s\n", strerror(errno)); - return std::string(); - } - - std::string dp(real_path); - // extract /dev/sda.. part - return dp.substr(0, sizeof "/dev/block/sdX" - 1); -} - -static bool isSlotFlagSet(uint32_t slot, uint64_t flag) { - std::string dev_path = getDevPath(slot); - if (dev_path.empty()) { - ALOGI("Could not get device path for slot %d\n", slot); - return false; - } - - GptUtils gpt(dev_path); - if (gpt.Load()) { - ALOGI("failed to load gpt data\n"); - return false; - } - - gpt_entry *e = gpt.GetPartitionEntry(slot ? "boot_b" : "boot_a"); - if (e == nullptr) { - ALOGI("failed to get gpt entry\n"); - return false; - } - - return !!(e->attr & flag); -} - -static int setSlotFlag(uint32_t slot, uint64_t flag) { - std::string dev_path = getDevPath(slot); - if (dev_path.empty()) { - ALOGI("Could not get device path for slot %d\n", slot); - return -1; - } - - GptUtils gpt(dev_path); - if (gpt.Load()) { - ALOGI("failed to load gpt data\n"); - return -1; - } - - gpt_entry *e = gpt.GetPartitionEntry(slot ? "boot_b" : "boot_a"); - if (e == nullptr) { - ALOGI("failed to get gpt entry\n"); - return -1; - } - - e->attr |= flag; - gpt.Sync(); - - return 0; -} - -} - -// Methods from ::android::hardware::boot::V1_0::IBootControl follow. -Return BootControl::getNumberSlots() { - uint32_t slots = 0; - - if (access(BOOT_A_PATH, F_OK) == 0) - slots++; - - if (access(BOOT_B_PATH, F_OK) == 0) - slots++; - - return slots; -} - -Return BootControl::getCurrentSlot() { - char suffix[PROPERTY_VALUE_MAX]; - property_get("ro.boot.slot_suffix", suffix, "_a"); - return std::string(suffix) == "_b" ? 1 : 0; -} - -Return BootControl::markBootSuccessful(markBootSuccessful_cb _hidl_cb) { - if (getNumberSlots() == 0) { - // no slots, just return true otherwise Android keeps trying - _hidl_cb({true, ""}); - return Void(); - } - int ret = setSlotFlag(getCurrentSlot(), AB_ATTR_SUCCESSFUL); - ret ? _hidl_cb({false, "Failed to set successfull flag"}) : _hidl_cb({true, ""}); - return Void(); -} - -Return BootControl::setActiveBootSlot(uint32_t slot, setActiveBootSlot_cb _hidl_cb) { - if (slot >= 2) { - _hidl_cb({false, "Invalid slot"}); - return Void(); - } - - std::string dev_path = getDevPath(slot); - if (dev_path.empty()) { - _hidl_cb({false, "Could not get device path for slot"}); - return Void(); - } - - GptUtils gpt(dev_path); - if (gpt.Load()) { - _hidl_cb({false, "failed to load gpt data"}); - return Void(); - } - - gpt_entry *active_entry = gpt.GetPartitionEntry(slot == 0 ? "boot_a" : "boot_b"); - gpt_entry *inactive_entry = gpt.GetPartitionEntry(slot == 0 ? "boot_b" : "boot_a"); - if (active_entry == nullptr || inactive_entry == nullptr) { - _hidl_cb({false, "failed to get entries for boot partitions"}); - return Void(); - } - - ALOGV("slot active attributes %lx\n", active_entry->attr); - ALOGV("slot inactive attributes %lx\n", inactive_entry->attr); - - char boot_dev[PROPERTY_VALUE_MAX]; - property_get("ro.boot.bootdevice", boot_dev, ""); - if (boot_dev[0] == '\0') { - _hidl_cb({false, "invalid ro.boot.bootdevice prop"}); - return Void(); - } - - std::string boot_lun_path = std::string("/sys/devices/platform/") + - boot_dev + "/pixel/boot_lun_enabled"; - int fd = open(boot_lun_path.c_str(), O_RDWR); - if (fd < 0) { - // Try old path for kernels < 5.4 - // TODO: remove once kernel 4.19 support is deprecated - std::string boot_lun_path = std::string("/sys/devices/platform/") + - boot_dev + "/attributes/boot_lun_enabled"; - fd = open(boot_lun_path.c_str(), O_RDWR); - if (fd < 0) { - _hidl_cb({false, "failed to open ufs attr boot_lun_enabled"}); - return Void(); - } - } - - // update attributes for active and inactive - inactive_entry->attr &= ~AB_ATTR_ACTIVE; - active_entry->attr = AB_ATTR_ACTIVE | (AB_ATTR_MAX_PRIORITY << AB_ATTR_PRIORITY_SHIFT) | - (AB_ATTR_MAX_RETRY_COUNT << AB_ATTR_RETRY_COUNT_SHIFT); - - // - // bBootLunEn - // 0x1 => Boot LU A = enabled, Boot LU B = disable - // 0x2 => Boot LU A = disable, Boot LU B = enabled - // - int ret = android::base::WriteStringToFd(slot == 0 ? "1" : "2", fd); - close(fd); - if (ret < 0) { - _hidl_cb({false, "faied to write boot_lun_enabled attribute"}); - return Void(); - } - - _hidl_cb({true, ""}); - return Void(); -} - -Return BootControl::setSlotAsUnbootable(uint32_t slot, setSlotAsUnbootable_cb _hidl_cb) { - if (slot >= 2) { - _hidl_cb({false, "Invalid slot"}); - return Void(); - } - - std::string dev_path = getDevPath(slot); - if (dev_path.empty()) { - _hidl_cb({false, "Could not get device path for slot"}); - return Void(); - } - - GptUtils gpt(dev_path); - gpt.Load(); - - gpt_entry *e = gpt.GetPartitionEntry(slot ? "boot_b" : "boot_a"); - e->attr |= AB_ATTR_UNBOOTABLE; - - gpt.Sync(); - - _hidl_cb({true, ""}); - return Void(); -} - -Return<::android::hardware::boot::V1_0::BoolResult> BootControl::isSlotBootable(uint32_t slot) { - if (getNumberSlots() == 0) - return BoolResult::FALSE; - if (slot >= getNumberSlots()) - return BoolResult::INVALID_SLOT; - return isSlotFlagSet(slot, AB_ATTR_UNBOOTABLE) ? BoolResult::FALSE : BoolResult::TRUE; -} - -Return<::android::hardware::boot::V1_0::BoolResult> BootControl::isSlotMarkedSuccessful(uint32_t slot) { - if (getNumberSlots() == 0) { - // just return true so that we don't we another call trying to mark it as successful - // when there is no slots - return BoolResult::TRUE; - } - if (slot >= getNumberSlots()) - return BoolResult::INVALID_SLOT; - return isSlotFlagSet(slot, AB_ATTR_SUCCESSFUL) ? BoolResult::TRUE : BoolResult::FALSE; -} - -Return BootControl::getSuffix(uint32_t slot, getSuffix_cb _hidl_cb) { - _hidl_cb(slot == 0 ? "_a" : slot == 1 ? "_b" : ""); - return Void(); -} - -extern "C" IBootControl* HIDL_FETCH_IBootControl(const char*) { - return new BootControl(); -} - -} // namespace implementation -} // namespace V1_0 -} // namespace boot -} // namespace hardware -} // namespace android diff --git a/interfaces/boot/1.0/BootControl.h b/interfaces/boot/1.0/BootControl.h deleted file mode 100644 index eb81cb07..00000000 --- a/interfaces/boot/1.0/BootControl.h +++ /dev/null @@ -1,59 +0,0 @@ -/* - * Copyright (C) 2019 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#pragma once - -#include -#include -#include - -namespace android { -namespace hardware { -namespace boot { -namespace V1_0 { -namespace implementation { - -using ::android::hardware::hidl_array; -using ::android::hardware::hidl_memory; -using ::android::hardware::hidl_string; -using ::android::hardware::hidl_vec; -using ::android::hardware::Return; -using ::android::hardware::Void; -using ::android::sp; - -struct BootControl : public IBootControl { - // Methods from ::android::hardware::boot::V1_0::IBootControl follow. - Return getNumberSlots() override; - Return getCurrentSlot() override; - Return markBootSuccessful(markBootSuccessful_cb _hidl_cb) override; - Return setActiveBootSlot(uint32_t slot, setActiveBootSlot_cb _hidl_cb) override; - Return setSlotAsUnbootable(uint32_t slot, setSlotAsUnbootable_cb _hidl_cb) override; - Return<::android::hardware::boot::V1_0::BoolResult> isSlotBootable(uint32_t slot) override; - Return<::android::hardware::boot::V1_0::BoolResult> isSlotMarkedSuccessful(uint32_t slot) override; - Return getSuffix(uint32_t slot, getSuffix_cb _hidl_cb) override; - - // Methods from ::android::hidl::base::V1_0::IBase follow. - -}; - -// FIXME: most likely delete, this is only for passthrough implementations -extern "C" IBootControl* HIDL_FETCH_IBootControl(const char* name); - -} // namespace implementation -} // namespace V1_0 -} // namespace boot -} // namespace hardware -} // namespace android diff --git a/interfaces/boot/1.0/GptUtils.cpp b/interfaces/boot/1.0/GptUtils.cpp deleted file mode 100644 index f8936175..00000000 --- a/interfaces/boot/1.0/GptUtils.cpp +++ /dev/null @@ -1,199 +0,0 @@ -/* - * Copyright (C) 2019 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#define LOG_TAG "bootcontrolhal" - -#include "GptUtils.h" - -#include -#include -#include -#include -#include - -namespace android { -namespace hardware { -namespace boot { -namespace V1_0 { -namespace implementation { - -namespace { - -static int ValidateGptHeader(gpt_header *gpt) -{ - if (gpt->signature != GPT_SIGNATURE) { - ALOGE("invalid gpt signature 0x%lx\n", gpt->signature); - return -1; - } - - if (gpt->header_size != sizeof(gpt_header)) { - ALOGE("invalid gpt header size %u\n", gpt->header_size); - return -1; - } - - if (gpt->entry_size != sizeof(gpt_entry)) { - ALOGE("invalid gpt entry size %u\n", gpt->entry_size); - return -1; - } - - return 0; -} - -} - -GptUtils::GptUtils(const std::string dev_path) : dev_path(dev_path), fd(0) {} - -int GptUtils::Load(void) -{ - fd = open(dev_path.c_str(), O_RDWR); - if (fd < 0) { - ALOGE("failed to open block dev %s, %d\n", dev_path.c_str(), errno); - return -1; - } - - int ret = ioctl(fd, BLKSSZGET, &block_size); - if (ret < 0) { - ALOGE("failed to get block size %d\n", errno); - return -1; - } - - // read primary header - lseek64(fd, block_size, SEEK_SET); - ret = read(fd, &gpt_primary, sizeof gpt_primary); - if (ret < 0) { - ALOGE("failed to read gpt primary header %d\n", errno); - return -1; - } - - if (ValidateGptHeader(&gpt_primary)) { - ALOGE("error validating gpt header\n"); - return -1; - } - - // read partition entries - entry_array.resize(gpt_primary.entry_count); - uint32_t entries_size = gpt_primary.entry_size * gpt_primary.entry_count; - lseek64(fd, block_size * gpt_primary.start_lba, SEEK_SET); - ret = read(fd, entry_array.data(), entries_size); - if (ret < 0) { - ALOGE("failed to read gpt partition entries %d\n", errno); - return -1; - } - - // read gpt back header - lseek64(fd, block_size * gpt_primary.backup_lba, SEEK_SET); - ret = read(fd, &gpt_backup, sizeof gpt_backup); - if (ret < 0) { - ALOGE("failed to read gpt backup header %d\n", errno); - return -1; - } - - if (ValidateGptHeader(&gpt_backup)) { - ALOGW("error validating gpt backup\n"); // just warn about it, not fail - } - - // Create map - auto get_name = [](const uint16_t *efi_name) { - char name[37] = {}; - for (int i = 0; efi_name[i] && i < sizeof name - 1; ++i) - name[i] = efi_name[i]; - return std::string(name); - }; - - for (auto const &e: entry_array) { - if (e.name[0] == 0) - break; // stop at the first partition with no name - std::string s = get_name(e.name); - entries[s] = const_cast(&e); - } - - return 0; -} - -gpt_entry *GptUtils::GetPartitionEntry(std::string name) -{ - return entries.find(name) != entries.end() ? entries[name] : nullptr; -} - -int GptUtils::Sync(void) -{ - if (!fd) - return -1; - - // calculate crc and check if we need to update gpt - gpt_primary.entries_crc32 = crc32(0, reinterpret_cast(entry_array.data()), - entry_array.size() * sizeof(gpt_entry)); - - // save old crc - uint32_t crc = gpt_primary.crc32; - gpt_primary.crc32 = 0; - - gpt_primary.crc32 = crc32(0, reinterpret_cast(&gpt_primary), sizeof gpt_primary); - if (crc == gpt_primary.crc32) - return 0; // nothing to do (no changes) - - ALOGI("updating GPT\n"); - - lseek64(fd, block_size * gpt_primary.current_lba, SEEK_SET); - int ret = write(fd, &gpt_primary, sizeof gpt_primary); - if (ret < 0) { - ALOGE("failed to write gpt primary header %d\n", errno); - return -1; - } - - lseek64(fd, block_size * gpt_primary.start_lba, SEEK_SET); - ret = write(fd, entry_array.data(), entry_array.size() * sizeof(gpt_entry)); - if (ret < 0) { - ALOGE("failed to write gpt partition entries %d\n", errno); - return -1; - } - - //update GPT backup entries and backup - lseek64(fd, block_size * gpt_backup.start_lba, SEEK_SET); - ret = write(fd, entry_array.data(), entry_array.size() * sizeof(gpt_entry)); - if (ret < 0) { - ALOGE("failed to write gpt backup partition entries %d\n", errno); - return -1; - } - - gpt_backup.entries_crc32 = gpt_primary.entries_crc32; - gpt_backup.crc32 = 0; - gpt_backup.crc32 = crc32(0, reinterpret_cast(&gpt_backup), sizeof gpt_backup); - lseek64(fd, block_size * gpt_primary.backup_lba, SEEK_SET); - ret = write(fd, &gpt_backup, sizeof gpt_backup); - if (ret < 0) { - ALOGE("failed to write gpt backup header %d\n", errno); - return -1; - } - - fsync(fd); - - return 0; -} - -GptUtils::~GptUtils() -{ - if (fd) { - Sync(); - close(fd); - } -} - -} // namespace implementation -} // namespace V1_0 -} // namespace boot -} // namespace hardware -} // namespace android diff --git a/interfaces/boot/1.0/GptUtils.h b/interfaces/boot/1.0/GptUtils.h deleted file mode 100644 index d969d9d8..00000000 --- a/interfaces/boot/1.0/GptUtils.h +++ /dev/null @@ -1,79 +0,0 @@ -/* - * Copyright (C) 2019 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#pragma once - -#include -#include -#include - -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 entry_array; - std::mapentries; -}; - -} // namespace implementation -} // namespace V1_0 -} // namespace boot -} // namespace hardware -} // namespace android diff --git a/interfaces/boot/1.0/android.hardware.boot@1.0-service-gs201.rc b/interfaces/boot/1.0/android.hardware.boot@1.0-service-gs201.rc deleted file mode 100644 index 7a7849fd..00000000 --- a/interfaces/boot/1.0/android.hardware.boot@1.0-service-gs201.rc +++ /dev/null @@ -1,4 +0,0 @@ -service vendor.boot-hal-1-0 /vendor/bin/hw/android.hardware.boot@1.0-service-gs201 - class early_hal - user root - group root diff --git a/interfaces/boot/1.0/service.cpp b/interfaces/boot/1.0/service.cpp deleted file mode 100644 index 9dcd78cc..00000000 --- a/interfaces/boot/1.0/service.cpp +++ /dev/null @@ -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 -#include -#include -#include -#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 -} diff --git a/interfaces/boot/1.2/Android.bp b/interfaces/boot/1.2/Android.bp deleted file mode 100644 index a9fb7f49..00000000 --- a/interfaces/boot/1.2/Android.bp +++ /dev/null @@ -1,81 +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/gs201:device_google_gs201_license" - // to get the below license kinds: - // SPDX-license-identifier-Apache-2.0 - default_applicable_licenses: [ - "//device/google/gs201:device_google_gs201_license", - ], -} - -cc_binary { - name: "android.hardware.boot@1.2-service-gs201", - defaults: ["hidl_defaults"], - relative_install_path: "hw", - vendor: true, - init_rc: ["android.hardware.boot@1.2-service-gs201.rc"], - srcs: [ - "BootControl.cpp", - "GptUtils.cpp", - "service.cpp" - ], - shared_libs: [ - "libbase", - "liblog", - "libhidlbase", - "libutils", - "libcutils", - "libz", - "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-gs201", - stem: "android.hardware.boot@1.0-impl-1.2-impl-gs201", - recovery: true, - srcs: [ - "BootControl.cpp", - "GptUtils.cpp", - ], - relative_install_path: "hw", - shared_libs: [ - "libbase", - "liblog", - "libhidlbase", - "libutils", - "libcutils", - "libz", - "android.hardware.boot@1.0", - "android.hardware.boot@1.1", - "android.hardware.boot@1.2", - ], - static_libs: [ - "libboot_control", - "libbootloader_message_vendor", - "libfstab", - ], -} diff --git a/interfaces/boot/1.2/BootControl.cpp b/interfaces/boot/1.2/BootControl.cpp deleted file mode 100644 index a28be05a..00000000 --- a/interfaces/boot/1.2/BootControl.cpp +++ /dev/null @@ -1,420 +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 -#include -#include -#include -#include -#include - -#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 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; -} - -} // namespace - -// Methods from ::android::hardware::boot::V1_0::IBootControl follow. -Return BootControl::getNumberSlots() { - uint32_t slots = 0; - - if (access(BOOT_A_PATH, F_OK) == 0) - slots++; - - if (access(BOOT_B_PATH, F_OK) == 0) - slots++; - - return slots; -} - -Return BootControl::getCurrentSlot() { - char suffix[PROPERTY_VALUE_MAX]; - property_get("ro.boot.slot_suffix", suffix, "_a"); - return std::string(suffix) == "_b" ? 1 : 0; -} - -Return BootControl::markBootSuccessful(markBootSuccessful_cb _hidl_cb) { - if (getNumberSlots() == 0) { - // no slots, just return true otherwise Android keeps trying - _hidl_cb({true, ""}); - return Void(); - } - - bool ret; - if (isDevInfoValid()) { - auto const slot = getCurrentSlot(); - devinfo.ab_data.slots[slot].successful = 1; - ret = DevInfoSync(); - } else { - ret = setSlotFlag(getCurrentSlot(), AB_ATTR_SUCCESSFUL); - } - - !ret ? _hidl_cb({false, "Failed to set successful flag"}) : _hidl_cb({true, ""}); - return Void(); -} - -Return BootControl::setActiveBootSlot(uint32_t slot, setActiveBootSlot_cb _hidl_cb) { - if (slot >= 2) { - _hidl_cb({false, "Invalid slot"}); - return Void(); - } - - 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 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 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 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 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 diff --git a/interfaces/boot/1.2/BootControl.h b/interfaces/boot/1.2/BootControl.h deleted file mode 100644 index 17b5f0fb..00000000 --- a/interfaces/boot/1.2/BootControl.h +++ /dev/null @@ -1,69 +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 -#include -#include - -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 getNumberSlots() override; - Return getCurrentSlot() override; - Return markBootSuccessful(markBootSuccessful_cb _hidl_cb) override; - Return setActiveBootSlot(uint32_t slot, setActiveBootSlot_cb _hidl_cb) override; - Return setSlotAsUnbootable(uint32_t slot, setSlotAsUnbootable_cb _hidl_cb) override; - Return<::android::hardware::boot::V1_0::BoolResult> isSlotBootable(uint32_t slot) override; - Return<::android::hardware::boot::V1_0::BoolResult> isSlotMarkedSuccessful( - uint32_t slot) override; - Return getSuffix(uint32_t slot, getSuffix_cb _hidl_cb) override; - - // Methods from ::android::hardware::boot::V1_1::IBootControl follow. - Return 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 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); - -} // namespace implementation -} // namespace V1_2 -} // namespace boot -} // namespace hardware -} // namespace android diff --git a/interfaces/boot/1.2/DevInfo.h b/interfaces/boot/1.2/DevInfo.h deleted file mode 100644 index a09a83a2..00000000 --- a/interfaces/boot/1.2/DevInfo.h +++ /dev/null @@ -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 diff --git a/interfaces/boot/1.2/GptUtils.cpp b/interfaces/boot/1.2/GptUtils.cpp deleted file mode 100644 index 25088e79..00000000 --- a/interfaces/boot/1.2/GptUtils.cpp +++ /dev/null @@ -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 -#include -#include -#include -#include - -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 - auto get_name = [](const uint16_t *efi_name) { - char name[37] = {}; - for (int i = 0; efi_name[i] && i < sizeof name - 1; ++i) name[i] = efi_name[i]; - return std::string(name); - }; - - for (auto const &e : entry_array) { - if (e.name[0] == 0) - break; // stop at the first partition with no name - std::string s = get_name(e.name); - entries[s] = const_cast(&e); - } - - return 0; -} - -gpt_entry *GptUtils::GetPartitionEntry(std::string name) { - return entries.find(name) != entries.end() ? entries[name] : nullptr; -} - -int GptUtils::Sync(void) { - if (!fd) - return -1; - - // calculate crc and check if we need to update gpt - gpt_primary.entries_crc32 = crc32(0, reinterpret_cast(entry_array.data()), - entry_array.size() * sizeof(gpt_entry)); - - // save old crc - uint32_t crc = gpt_primary.crc32; - gpt_primary.crc32 = 0; - - gpt_primary.crc32 = crc32(0, reinterpret_cast(&gpt_primary), sizeof gpt_primary); - if (crc == gpt_primary.crc32) - return 0; // nothing to do (no changes) - - ALOGI("updating GPT\n"); - - lseek64(fd, block_size * gpt_primary.current_lba, SEEK_SET); - int ret = write(fd, &gpt_primary, sizeof gpt_primary); - if (ret < 0) { - ALOGE("failed to write gpt primary header %d\n", errno); - return -1; - } - - lseek64(fd, block_size * gpt_primary.start_lba, SEEK_SET); - ret = write(fd, entry_array.data(), entry_array.size() * sizeof(gpt_entry)); - if (ret < 0) { - ALOGE("failed to write gpt partition entries %d\n", errno); - return -1; - } - - // update GPT backup entries and backup - lseek64(fd, block_size * gpt_backup.start_lba, SEEK_SET); - ret = write(fd, entry_array.data(), entry_array.size() * sizeof(gpt_entry)); - if (ret < 0) { - ALOGE("failed to write gpt backup partition entries %d\n", errno); - return -1; - } - - gpt_backup.entries_crc32 = gpt_primary.entries_crc32; - gpt_backup.crc32 = 0; - gpt_backup.crc32 = crc32(0, reinterpret_cast(&gpt_backup), sizeof gpt_backup); - lseek64(fd, block_size * gpt_primary.backup_lba, SEEK_SET); - ret = write(fd, &gpt_backup, sizeof gpt_backup); - if (ret < 0) { - ALOGE("failed to write gpt backup header %d\n", errno); - return -1; - } - - fsync(fd); - - return 0; -} - -GptUtils::~GptUtils() { - if (fd) { - Sync(); - close(fd); - } -} - -} // namespace implementation -} // namespace V1_2 -} // namespace boot -} // namespace hardware -} // namespace android diff --git a/interfaces/boot/1.2/GptUtils.h b/interfaces/boot/1.2/GptUtils.h deleted file mode 100644 index a2bed334..00000000 --- a/interfaces/boot/1.2/GptUtils.h +++ /dev/null @@ -1,79 +0,0 @@ -/* - * Copyright (C) 2019 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#pragma once - -#include -#include -#include - -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 entry_array; - std::map entries; -}; - -} // namespace implementation -} // namespace V1_2 -} // namespace boot -} // namespace hardware -} // namespace android diff --git a/interfaces/boot/1.2/android.hardware.boot@1.2-service-gs201.rc b/interfaces/boot/1.2/android.hardware.boot@1.2-service-gs201.rc deleted file mode 100644 index 3457b5f0..00000000 --- a/interfaces/boot/1.2/android.hardware.boot@1.2-service-gs201.rc +++ /dev/null @@ -1,7 +0,0 @@ -service vendor.boot-hal-1-2 /vendor/bin/hw/android.hardware.boot@1.2-service-gs201 - 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 diff --git a/interfaces/boot/1.2/service.cpp b/interfaces/boot/1.2/service.cpp deleted file mode 100644 index f07682e9..00000000 --- a/interfaces/boot/1.2/service.cpp +++ /dev/null @@ -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 -#include -#include -#include - -#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 -} diff --git a/manifest-gralloc3.xml b/manifest-gralloc3.xml index fee04558..cd405200 100644 --- a/manifest-gralloc3.xml +++ b/manifest-gralloc3.xml @@ -68,10 +68,9 @@ default - + android.hardware.boot - hwbinder - @1.2::IBootControl/default + IBootControl/default android.hardware.sensors @@ -97,7 +96,7 @@ vendor.google.google_battery - 2 + 2-3 IGoogleBattery default diff --git a/manifest.xml b/manifest.xml index 031b46f3..a5cf98dc 100644 --- a/manifest.xml +++ b/manifest.xml @@ -8,10 +8,9 @@ default - + android.hardware.boot - hwbinder - @1.2::IBootControl/default + IBootControl/default com.google.input diff --git a/media_codecs_bo_c2.xml b/media_codecs_bo_c2.xml index b57a92aa..3a397263 100644 --- a/media_codecs_bo_c2.xml +++ b/media_codecs_bo_c2.xml @@ -29,7 +29,7 @@ - + @@ -43,7 +43,7 @@ - + diff --git a/media_codecs_performance_c2.xml b/media_codecs_performance_c2.xml index 13609f2b..12dde41e 100644 --- a/media_codecs_performance_c2.xml +++ b/media_codecs_performance_c2.xml @@ -173,6 +173,12 @@ + + + + + + diff --git a/overlay/frameworks/base/core/res/res/values/config.xml b/overlay/frameworks/base/core/res/res/values/config.xml index 3f1e2c1c..e9e4f01b 100644 --- a/overlay/frameworks/base/core/res/res/values/config.xml +++ b/overlay/frameworks/base/core/res/res/values/config.xml @@ -215,7 +215,7 @@ - 3339 + 4000 true @@ -252,6 +252,9 @@ true + + 20971520 + @@ -292,4 +295,28 @@ false - + + + + + com.tencent.mm:0.07 + com.facebook.katana:0.07 + com.instagram.android:0.07 + com.spotify.music:0.05 + com.reddit.frontpage:0.07 + com.zhiliaoapp.musically:0.07 + com.bilibili.app.in:0.07 + com.twitter.android:0.07 + + + + 100% + + + 100% + + + 100% + diff --git a/pixelstats/service.cpp b/pixelstats/service.cpp index b7df808e..ab6f85f2 100644 --- a/pixelstats/service.cpp +++ b/pixelstats/service.cpp @@ -44,6 +44,10 @@ const struct SysfsCollector::SysfsPaths sysfs_paths = { .ImpedancePath = "/sys/devices/platform/audiometrics/speaker_impedance", .CodecPath = "/sys/devices/platform/audiometrics/codec_state", .EEPROMPath = "/dev/battery_history", + .MitigationPath = "/sys/devices/virtual/pmic/mitigation", + .MitigationDurationPath = "/sys/devices/virtual/pmic/mitigation/irq_dur_cnt", + .BrownoutReasonProp = "vendor.brownout_reason", + .BrownoutLogPath = "/data/vendor/mitigation/lastmeal.txt", .SpeakerTemperaturePath = "/sys/devices/platform/audiometrics/speaker_temp", .SpeakerExcursionPath = "/sys/devices/platform/audiometrics/speaker_excursion", .SpeakerHeartBeatPath = "/sys/devices/platform/audiometrics/speaker_heartbeat", @@ -67,7 +71,7 @@ const struct SysfsCollector::SysfsPaths sysfs_paths = { "/sys/devices/platform/100b0000.TPU/trip_counter", "/sys/devices/platform/100b0000.AUR/trip_counter", }, - .CCARatePath = "/sys/devices/platform/audiometrics/cca_rate_read_once", + .CCARatePath = "/sys/devices/platform/audiometrics/cca_count_read_once", .TempResidencyAndResetPaths = { { "/sys/kernel/metrics/thermal/tr_by_group/tmu/stats", @@ -83,7 +87,9 @@ const struct SysfsCollector::SysfsPaths sysfs_paths = { .StormIRQMetricsPath = "/sys/kernel/metrics/irq/storm_irq_metrics", .IRQStatsResetPath = "/sys/kernel/metrics/irq/stats_reset", .ModemPcieLinkStatsPath = "/sys/devices/platform/11920000.pcie/link_stats", - .WifiPcieLinkStatsPath = "/sys/devices/platform/14520000.pcie/link_stats" + .WifiPcieLinkStatsPath = "/sys/devices/platform/14520000.pcie/link_stats", + .GMSRPath = "/sys/class/power_supply/maxfg/gmsr", + .TotalCallCountPath = "/sys/devices/platform/audiometrics/call_count" }; const struct UeventListener::UeventPaths ueventPaths = { diff --git a/preinstalled-packages-product-gs201-device-debug.xml b/preinstalled-packages-product-gs201-device-debug.xml index a0b67c36..58eb9dbc 100644 --- a/preinstalled-packages-product-gs201-device-debug.xml +++ b/preinstalled-packages-product-gs201-device-debug.xml @@ -22,6 +22,7 @@ +