diff --git a/Android.bp b/Android.bp index 9b83b174..150a519c 100644 --- a/Android.bp +++ b/Android.bp @@ -34,3 +34,11 @@ license { "NOTICE", ], } + +prebuilt_etc { + name: "preinstalled-packages-product-gs201-device-debug.xml", + src: "preinstalled-packages-product-gs201-device-debug.xml", + product_specific: true, + sub_dir: "sysconfig", + filename_from_src: true, +} diff --git a/BoardConfig-common.mk b/BoardConfig-common.mk index 35cc0e50..92dab880 100644 --- a/BoardConfig-common.mk +++ b/BoardConfig-common.mk @@ -196,6 +196,7 @@ BOARD_USE_ENC_SW_CSC := true BOARD_SUPPORT_MFC_ENC_RGB := true BOARD_USE_BLOB_ALLOCATOR := false BOARD_SUPPORT_MFC_ENC_BT2020 := true +BOARD_SUPPORT_FLEXIBLE_P010 := true ######################## @@ -251,12 +252,15 @@ endif # SoundTriggerHAL Configuration #BOARD_USE_SOUNDTRIGGER_HAL := false +# Vibrator HAL actuator model and adaptive haptics configuration +$(call soong_config_set,haptics,actuator_model,$(ACTUATOR_MODEL)) +$(call soong_config_set,haptics,adaptive_haptics_feature,$(ADAPTIVE_HAPTICS_FEATURE)) + # HWComposer BOARD_HWC_VERSION := hwc3 TARGET_RUNNING_WITHOUT_SYNC_FRAMEWORK := false BOARD_HDMI_INCAPABLE := true TARGET_USES_HWC2 := true -HWC_SKIP_VALIDATE := true HWC_SUPPORT_RENDER_INTENT := true HWC_SUPPORT_COLOR_TRANSFORM := true #BOARD_USES_DISPLAYPORT := true diff --git a/OWNERS b/OWNERS new file mode 100644 index 00000000..1cbf9196 --- /dev/null +++ b/OWNERS @@ -0,0 +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 diff --git a/aoc/conf/init.aoc.daemon.rc b/aoc/conf/init.aoc.daemon.rc deleted file mode 100644 index 1cf204e1..00000000 --- a/aoc/conf/init.aoc.daemon.rc +++ /dev/null @@ -1 +0,0 @@ -# AoC firmware will be loaded by Daemon \ No newline at end of file diff --git a/aoc/conf/init.aoc.nodaemon.rc b/aoc/conf/init.aoc.nodaemon.rc deleted file mode 100644 index 329d7d34..00000000 --- a/aoc/conf/init.aoc.nodaemon.rc +++ /dev/null @@ -1,3 +0,0 @@ -# Load AoC firmware and boot -on property:vendor.all.modules.ready=1 - write /sys/devices/platform/19000000.aoc/firmware aoc.bin \ No newline at end of file diff --git a/aoc/device.mk b/aoc/device.mk deleted file mode 100644 index 3c04b09f..00000000 --- a/aoc/device.mk +++ /dev/null @@ -1,26 +0,0 @@ -PRODUCT_PACKAGES += \ - aocd - -BOARD_VENDOR_SEPOLICY_DIRS += device/google/gs201-sepolicy/aoc - -ifeq (,$(filter aosp_%,$(TARGET_PRODUCT))) -# IAudioMetricExt HIDL -PRODUCT_PACKAGES += \ - vendor.google.audiometricext@1.0-service-vendor -endif - -# If AoC Daemon is not present on this build, load firmware at boot via rc -ifeq ($(wildcard vendor/google/whitechapel/aoc/aocd),) -PRODUCT_COPY_FILES += \ - device/google/gs201/aoc/conf/init.aoc.nodaemon.rc:$(TARGET_COPY_OUT_VENDOR)/etc/init/init.aoc.rc -else -PRODUCT_COPY_FILES += \ - device/google/gs201/aoc/conf/init.aoc.daemon.rc:$(TARGET_COPY_OUT_VENDOR)/etc/init/init.aoc.rc -endif - -# AoC debug support -PRODUCT_PACKAGES_DEBUG += \ - aocdump \ - aocutil \ - aoc_audio_cfg \ - vp_util diff --git a/battery_mitigation/Android.bp b/battery_mitigation/Android.bp deleted file mode 100644 index f9d429fb..00000000 --- a/battery_mitigation/Android.bp +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Copyright (C) 2022 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package { - default_applicable_licenses: [ - "//device/google/gs201:device_google_gs201_license", - ], -} - -cc_binary { - name: "battery_mitigation", - relative_install_path: "hw", - proprietary: true, - init_rc: ["battery_mitigation.rc"], - shared_libs: [ - "libpixelmitigation", - "libbase", - "libbinder_ndk", - "libcutils", - "libhardware", - "libhidlbase", - "liblog", - "libutils", - "android.hardware.thermal@2.0" - ], - srcs: [ - "battery_mitigation.cpp", - ], - cflags: [ - "-Wall", - "-Werror", - ], -} diff --git a/battery_mitigation/battery_mitigation.cpp b/battery_mitigation/battery_mitigation.cpp deleted file mode 100644 index 70e8188d..00000000 --- a/battery_mitigation/battery_mitigation.cpp +++ /dev/null @@ -1,109 +0,0 @@ -/* - * Copyright (C) 2022 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#define LOG_TAG "battery-mitigation" - -#include - -using android::hardware::google::pixel::BatteryMitigation; -using android::hardware::google::pixel::MitigationConfig; - -android::sp bmSp; - -const struct MitigationConfig::Config cfg = { - .SystemPath = { - "/dev/thermal/tz-by-name/batoilo/temp", - "/dev/thermal/tz-by-name/smpl_gm/temp", - "/dev/thermal/tz-by-name/soc/temp", - "/dev/thermal/tz-by-name/vdroop1/temp", - "/dev/thermal/tz-by-name/vdroop2/temp", - "/dev/thermal/tz-by-name/ocp_gpu/temp", - "/dev/thermal/tz-by-name/ocp_tpu/temp", - "/dev/thermal/tz-by-name/soft_ocp_cpu2/temp", - "/dev/thermal/tz-by-name/soft_ocp_cpu1/temp", - "/dev/thermal/tz-by-name/battery/temp", - "/dev/thermal/tz-by-name/battery_cycle/temp", - "/sys/bus/iio/devices/iio:device0/lpf_power", - "/sys/bus/iio/devices/iio:device1/lpf_power", - "/dev/thermal/cdev-by-name/thermal-cpufreq-2/cur_state", - "/dev/thermal/cdev-by-name/thermal-cpufreq-1/cur_state", - "/dev/thermal/cdev-by-name/thermal-gpufreq-0/cur_state", - "/dev/thermal/cdev-by-name/tpu_cooling/cur_state", - "/dev/thermal/cdev-by-name/CAM/cur_state", - "/dev/thermal/cdev-by-name/DISP/cur_state", - "/dev/thermal/cdev-by-name/gxp-cooling/cur_state", - "/sys/class/power_supply/battery/voltage_now", - "/sys/class/power_supply/battery/current_now", - }, - .FilteredZones = { - "batoilo", - "vdroop1", - "vdroop2", - "smpl_gm", - }, - .SystemName = { - "batoilo", "smpl_gm", "soc", "vdroop1", "vdroop2", "ocp_gpu", - "ocp_tpu", "soft_ocp_cpu2", "soft_ocp_cpu1", "battery", "battery_cycle", - "main", "sub", "CPU2", "CPU1", "GPU", "TPU", "CAM", "DISP", "NPU", - "voltage_now", "current_now", - }, - .LogFilePath = "/data/vendor/mitigation/thismeal.txt", - .TimestampFormat = "%Y-%m-%d %H:%M:%S", -}; - -const char kReadyFilePath[] = "/sys/devices/virtual/pmic/mitigation/instruction/ready"; -const char kReadyProperty[] = "vendor.brownout.mitigation.ready"; -const char kLastMealPath[] = "/data/vendor/mitigation/lastmeal.txt"; -const char kBRRequestedProperty[] = "vendor.brownout_reason"; -const std::regex kTimestampRegex("^\\S+\\s[0-9]+:[0-9]+:[0-9]+\\S+$"); - -int main(int /*argc*/, char ** /*argv*/) { - auto batteryMitigationStartTime = std::chrono::system_clock::now(); - bmSp = new BatteryMitigation(cfg); - if (!bmSp) { - return 0; - } - bool mitigationLogTimeValid = bmSp->isMitigationLogTimeValid(batteryMitigationStartTime, - cfg.LogFilePath, - cfg.TimestampFormat, - kTimestampRegex); - std::string reason = android::base::GetProperty(kBRRequestedProperty, ""); - if (!reason.empty() && mitigationLogTimeValid) { - std::ifstream src(cfg.LogFilePath, std::ios::in); - std::ofstream dst(kLastMealPath, std::ios::out); - dst << src.rdbuf(); - } - bool isBatteryMitigationReady = false; - std::string ready_str; - int val = 0; - while (!isBatteryMitigationReady) { - if (!android::base::ReadFileToString(kReadyFilePath, &ready_str)) { - continue; - } - ready_str = android::base::Trim(ready_str); - if (!android::base::ParseInt(ready_str, &val)) { - continue; - } - if (val == 1) { - isBatteryMitigationReady = true; - } - } - android::base::SetProperty(kReadyProperty, "1"); - while (true) { - pause(); - } - return 0; -} diff --git a/battery_mitigation/battery_mitigation.rc b/battery_mitigation/battery_mitigation.rc deleted file mode 100644 index fcc9a4f6..00000000 --- a/battery_mitigation/battery_mitigation.rc +++ /dev/null @@ -1,93 +0,0 @@ -on property:vendor.thermal.link_ready=1 - mkdir /data/vendor/mitigation 0755 system system - chown system system /data/vendor/mitigation - start vendor.battery_mitigation - -on property:ro.boot.bootreason=reboot,uvlo,pmic,if && property:sys.boot.reason=reboot,uvlo,pmic,if - setprop vendor.brownout_reason "uvlo,pmic,if" - -on property:ro.boot.bootreason=reboot,ocp,pmic,if && property:sys.boot.reason=reboot,ocp,pmic,if - setprop vendor.brownout_reason "ocp,pmic,if" - -on property:ro.boot.bootreason=reboot,uvlo,pmic,main && property:sys.boot.reason=reboot,uvlo,pmic,main - setprop vendor.brownout_reason "uvlo,pmic,main" - -on property:ro.boot.bootreason=reboot,uvlo,pmic,sub && property:sys.boot.reason=reboot,uvlo,pmic,sub - setprop vendor.brownout_reason "uvlo,pmic,sub" - -on property:ro.boot.bootreason=reboot,ocp,buck1m && property:sys.boot.reason=reboot,ocp,buck1m - setprop vendor.brownout_reason "ocp,buck1m" - -on property:ro.boot.bootreason=reboot,ocp,buck2m && property:sys.boot.reason=reboot,ocp,buck2m - setprop vendor.brownout_reason "ocp,buck2m" - -on property:ro.boot.bootreason=reboot,ocp,buck3m && property:sys.boot.reason=reboot,ocp,buck3m - setprop vendor.brownout_reason "ocp,buck3m" - -on property:ro.boot.bootreason=reboot,ocp,buck4m && property:sys.boot.reason=reboot,ocp,buck4m - setprop vendor.brownout_reason "ocp,buck4m" - -on property:ro.boot.bootreason=reboot,ocp,buck5m && property:sys.boot.reason=reboot,ocp,buck5m - setprop vendor.brownout_reason "ocp,buck5m" - -on property:ro.boot.bootreason=reboot,ocp,buck6m && property:sys.boot.reason=reboot,ocp,buck6m - setprop vendor.brownout_reason "ocp,buck6m" - -on property:ro.boot.bootreason=reboot,ocp,buck7m && property:sys.boot.reason=reboot,ocp,buck7m - setprop vendor.brownout_reason "ocp,buck7m" - -on property:ro.boot.bootreason=reboot,ocp,buck8m && property:sys.boot.reason=reboot,ocp,buck8m - setprop vendor.brownout_reason "ocp,buck8m" - -on property:ro.boot.bootreason=reboot,ocp,buck9m && property:sys.boot.reason=reboot,ocp,buck9m - setprop vendor.brownout_reason "ocp,buck9m" - -on property:ro.boot.bootreason=reboot,ocp,buck10m && property:sys.boot.reason=reboot,ocp,buck10m - setprop vendor.brownout_reason "ocp,buck10m" - -on property:ro.boot.bootreason=reboot,ocp,buck1s && property:sys.boot.reason=reboot,ocp,buck1s - setprop vendor.brownout_reason "ocp,buck1s" - -on property:ro.boot.bootreason=reboot,ocp,buck2s && property:sys.boot.reason=reboot,ocp,buck2s - setprop vendor.brownout_reason "ocp,buck2s" - -on property:ro.boot.bootreason=reboot,ocp,buck3s && property:sys.boot.reason=reboot,ocp,buck3s - setprop vendor.brownout_reason "ocp,buck3s" - -on property:ro.boot.bootreason=reboot,ocp,buck4s && property:sys.boot.reason=reboot,ocp,buck4s - setprop vendor.brownout_reason "ocp,buck4s" - -on property:ro.boot.bootreason=reboot,ocp,buck5s && property:sys.boot.reason=reboot,ocp,buck5s - setprop vendor.brownout_reason "ocp,buck5s" - -on property:ro.boot.bootreason=reboot,ocp,buck6s && property:sys.boot.reason=reboot,ocp,buck6s - setprop vendor.brownout_reason "ocp,buck6s" - -on property:ro.boot.bootreason=reboot,ocp,buck7s && property:sys.boot.reason=reboot,ocp,buck7s - setprop vendor.brownout_reason "ocp,buck7s" - -on property:ro.boot.bootreason=reboot,ocp,buck8s && property:sys.boot.reason=reboot,ocp,buck8s - setprop vendor.brownout_reason "ocp,buck8s" - -on property:ro.boot.bootreason=reboot,ocp,buck9s && property:sys.boot.reason=reboot,ocp,buck9s - setprop vendor.brownout_reason "ocp,buck9s" - -on property:ro.boot.bootreason=reboot,ocp,buck10s && property:sys.boot.reason=reboot,ocp,buck10s - setprop vendor.brownout_reason "ocp,buck10s" - -on property:ro.boot.bootreason=reboot,ocp,buckds && property:sys.boot.reason=reboot,ocp,buckds - setprop vendor.brownout_reason "ocp,buckds" - -on property:ro.boot.bootreason=reboot,ocp,buckas && property:sys.boot.reason=reboot,ocp,buckas - setprop vendor.brownout_reason "ocp,buckas" - -on property:ro.boot.bootreason=reboot,ocp,buckcs && property:sys.boot.reason=reboot,ocp,buckcs - setprop vendor.brownout_reason "ocp,buckcs" - -on property:ro.boot.bootreason=reboot,ocp,buckbs && property:sys.boot.reason=reboot,ocp,buckbs - setprop vendor.brownout_reason "ocp,buckbs" - -service vendor.battery_mitigation /vendor/bin/hw/battery_mitigation - user system - group system - capabilities WAKE_ALARM BLOCK_SUSPEND diff --git a/conf/init.debug.rc b/conf/init.debug.rc index d98e9bc8..d609d7ec 100644 --- a/conf/init.debug.rc +++ b/conf/init.debug.rc @@ -17,12 +17,6 @@ on init chown system system /sys/devices/platform/sjtag_gsa/interface/dbg_itvl chown system system /sys/devices/platform/sjtag_gsa/interface/end chown system system /sys/devices/platform/sjtag_gsa/interface/pubkey - chown system system /d/maxfg/fg_model - chown system system /d/maxfg/registers - chown system system /d/maxfg_base/fg_model - chown system system /d/maxfg_base/registers - chown system system /d/maxfg_flip/registers - chown system system /d/maxfg_flip/nv_registers on property:vendor.debug.ramdump.force_crash=true write /sys/kernel/pixel_debug/trigger "null" @@ -39,6 +33,15 @@ on post-fs-data chown bluetooth system /dev/logbuffer_btpower chown bluetooth system /dev/logbuffer_tty18 +# pKVM performance is different on A0 and B0 chips. +# Add extra tag to metrics collected on A0 to separate the results. +on property:ro.revision=PROTO1.0 + setprop debug.hypervisor.metrics_tag "hwrev_a0" +on property:ro.revision=PROTO1.1 + setprop debug.hypervisor.metrics_tag "hwrev_a0" +on property:ro.revision=EVT1.0 + setprop debug.hypervisor.metrics_tag "hwrev_a0" + # Enable etm/etm2dram when ramdump is enabled. on property:ro.boot.ramdump=enabled write /sys/devices/platform/exynos-etm/etm_on 1 diff --git a/conf/init.gs201.rc b/conf/init.gs201.rc index 0f0f128b..ea2d57b3 100644 --- a/conf/init.gs201.rc +++ b/conf/init.gs201.rc @@ -65,6 +65,14 @@ on init chown system system /sys/devices/system/cpu/cpufreq/policy6/sched_pixel/spc_threshold chown system system /sys/devices/system/cpu/cpufreq/policy6/sched_pixel/limit_frequency chown system system /sys/devices/system/cpu/cpufreq/policy6/sched_pixel/pmu_limit_enable + chown system system /sys/class/devfreq/gs_memlat_devfreq:devfreq_mif_cpu0_memlat@17000010/memlat_cpuidle_state_aware + chown system system /sys/class/devfreq/gs_memlat_devfreq:devfreq_mif_cpu1_memlat@17000010/memlat_cpuidle_state_aware + chown system system /sys/class/devfreq/gs_memlat_devfreq:devfreq_mif_cpu2_memlat@17000010/memlat_cpuidle_state_aware + chown system system /sys/class/devfreq/gs_memlat_devfreq:devfreq_mif_cpu3_memlat@17000010/memlat_cpuidle_state_aware + chown system system /sys/class/devfreq/gs_memlat_devfreq:devfreq_mif_cpu4_memlat@17000010/memlat_cpuidle_state_aware + chown system system /sys/class/devfreq/gs_memlat_devfreq:devfreq_mif_cpu5_memlat@17000010/memlat_cpuidle_state_aware + 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 @@ -124,7 +132,7 @@ on init symlink /data/app /factory # Apply network parameters for high data performance. - write /proc/sys/net/core/rmem_default 327680 + write /proc/sys/net/core/rmem_default 1310720 write /proc/sys/net/core/rmem_max 8388608 write /proc/sys/net/core/wmem_default 327680 write /proc/sys/net/core/wmem_max 8388608 @@ -174,6 +182,16 @@ on init write /sys/devices/system/cpu/cpu6/cpufreq/sched_pixel/up_rate_limit_us 500 write /sys/devices/system/cpu/cpu6/cpufreq/sched_pixel/down_rate_limit_us 20000 + # memlat cpuidle awareness setting + write /sys/class/devfreq/gs_memlat_devfreq:devfreq_mif_cpu0_memlat@17000010/memlat_cpuidle_state_aware 2 + write /sys/class/devfreq/gs_memlat_devfreq:devfreq_mif_cpu1_memlat@17000010/memlat_cpuidle_state_aware 2 + write /sys/class/devfreq/gs_memlat_devfreq:devfreq_mif_cpu2_memlat@17000010/memlat_cpuidle_state_aware 2 + write /sys/class/devfreq/gs_memlat_devfreq:devfreq_mif_cpu3_memlat@17000010/memlat_cpuidle_state_aware 2 + write /sys/class/devfreq/gs_memlat_devfreq:devfreq_mif_cpu4_memlat@17000010/memlat_cpuidle_state_aware 2 + write /sys/class/devfreq/gs_memlat_devfreq:devfreq_mif_cpu5_memlat@17000010/memlat_cpuidle_state_aware 2 + write /sys/class/devfreq/gs_memlat_devfreq:devfreq_mif_cpu6_memlat@17000010/memlat_cpuidle_state_aware 2 + write /sys/class/devfreq/gs_memlat_devfreq:devfreq_mif_cpu7_memlat@17000010/memlat_cpuidle_state_aware 2 + # RT uclamp setting write /proc/sys/kernel/sched_util_clamp_min_rt_default 0 @@ -223,9 +241,10 @@ on init chown system system /sys/devices/platform/10da0000.hsi2c/i2c-5/5-0050/eeprom chown system system /sys/devices/platform/10da0000.hsi2c/i2c-6/6-0050/eeprom chown system system /sys/devices/platform/10da0000.hsi2c/i2c-7/7-0050/eeprom + chown system system /sys/devices/platform/10da0000.hsi2c/i2c-9/9-0050/eeprom # Loading common kernel modules in background - start insmod_sh_common + start init_display # Charge stats (write 0) chown system system /sys/class/power_supply/battery/charge_stats @@ -302,9 +321,6 @@ on init # Power Stats HAL chown system system /dev/bbd_pwrstat - # start watchdogd - start watchdogd - # Add a boost for NNAPI HAL write /proc/vendor_sched/nnapi_prefer_idle 0 write /proc/vendor_sched/nnapi_uclamp_min 512 @@ -327,6 +343,9 @@ on init write /sys/class/devfreq/gs_memlat_devfreq:devfreq_mif_cpu6_memlat@17000010/mem_latency/ratio_ceil 3200 write /sys/class/devfreq/gs_memlat_devfreq:devfreq_mif_cpu7_memlat@17000010/mem_latency/ratio_ceil 3200 + # Set boost_adpf_prio, -1 by default + write /proc/vendor_sched/boost_adpf_prio ${persist.device_config.vendor_system_native_boot.boost_adpf_prio:--1} + on late-fs # Start bootanimation class before mount start bootanim @@ -361,8 +380,6 @@ on post-fs-data chmod 0664 /sys/devices/platform/1c2c0000.drmdsim/hs_clock chmod 0664 /sys/devices/platform/1c2d0000.drmdsim/hs_clock - setprop vold.post_fs_data_done 1 - # IPSEC PIDDIR for VoWiFi mkdir /data/vendor/misc 0771 root system mkdir /data/vendor/misc/vpn 0771 root system @@ -488,8 +505,6 @@ on early-boot chown system system /dev/logbuffer_cpm chown system system /dev/logbuffer_bd chown system system /dev/logbuffer_dual_batt - chown system system /dev/logbuffer_pcie0 - chown system system /dev/logbuffer_pcie1 on boot @@ -626,38 +641,6 @@ service abox /vendor/bin/main_abox 17c50000.abox group audioserver seclabel u:r:abox:s0 -# GPS -service lhd /vendor/bin/hw/lhd /vendor/etc/gnss/lhd.conf - class main - user gps - group system inet net_raw sdcard_rw - ioprio be 0 - -service gpsd /vendor/bin/hw/gpsd -c /vendor/etc/gnss/gps.xml - class main - user gps - group system gps radio inet wakelock sdcard_rw net_raw - ioprio be 0 - -service scd /vendor/bin/hw/scd /vendor/etc/gnss/scd.conf - class main - user gps - group system inet net_raw wakelock - ioprio be 0 - -service gnss_service /vendor/bin/hw/android.hardware.gnss@2.1-service-brcm - class hal - user gps - group system gps radio - ioprio be 0 - priority -1 - -# disable gps service if no gps h/w -on property:vendor.ril.cbd.svc=0 - stop gpsd - stop lhd - stop scd - # on userdebug and eng builds, enable kgdb on the serial console on property:ro.debuggable=1 write /sys/module/kgdboc/parameters/kgdboc ttyFIQ1 @@ -675,13 +658,6 @@ on property:vendor.device.modules.ready=1 chown system system /sys/devices/virtual/sec/tsp/cmd chown system system /sys/devices/virtual/sec/tsp/cmd_result chown system system /sys/devices/virtual/sec/tsp/status - chown system system /proc/goog_touch_interface/gti.0 - chown system system /proc/goog_touch_interface/gti.0/ms_base - chown system system /proc/goog_touch_interface/gti.0/ms_diff - chown system system /proc/goog_touch_interface/gti.0/ms_raw - chown system system /proc/goog_touch_interface/gti.0/ss_base - chown system system /proc/goog_touch_interface/gti.0/ss_diff - chown system system /proc/goog_touch_interface/gti.0/ss_raw # Allow access to touch chown system input /dev/touch_offload chmod 660 /dev/touch_offload @@ -744,7 +720,7 @@ on property:sys.boot_completed=1 # Setup final cpuset write /dev/cpuset/top-app/cpus ${persist.device_config.vendor_system_native.top-app_cpuset:-0-7} write /dev/cpuset/foreground/cpus ${persist.device_config.vendor_system_native.foreground_cpuset:-0-3,4-5} - write /dev/cpuset/background/cpus ${persist.device_config.vendor_system_native.background_cpuset:-0-1} + write /dev/cpuset/background/cpus ${persist.device_config.vendor_system_native.background_cpuset:-0-3} write /dev/cpuset/system-background/cpus ${persist.device_config.vendor_system_native.system-background_cpuset:-0-3} write /dev/cpuset/restricted/cpus ${persist.device_config.vendor_system_native.restricted_cpuset:-0-3} write /dev/cpuset/camera-daemon/cpus ${persist.device_config.vendor_system_native.camera-daemon_cpuset:-0-7} @@ -754,15 +730,22 @@ on property:sys.boot_completed=1 write /proc/vendor_sched/ta_uclamp_min 1 write /proc/vendor_sched/fg_uclamp_min 0 write /proc/vendor_sched/sys_prefer_idle 0 - # cfs_rq clamp is using tg->uclamp setting - # align it with the vendor_group setting + + # 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 + + # 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 /dev/cpuctl/background/cpu.uclamp.max 50 write /proc/vendor_sched/sysbg_uclamp_max 512 - write /dev/cpuctl/system-background/cpu.uclamp.max 50 + write /proc/vendor_sched/ota_uclamp_max 512 write /proc/vendor_sched/dex2oat_uclamp_max 615 - write /dev/cpuctl/dex2oat/cpu.uclamp.max 60 - write /proc/vendor_sched/ota_uclamp_max 410 # Set PMU freq limit parameters write /sys/devices/system/cpu/cpufreq/policy0/sched_pixel/lcpi_threshold 2 @@ -797,12 +780,6 @@ on property:sys.boot_completed=1 write /sys/devices/platform/18062080.pd-hsi0/power/async "enabled" write /sys/devices/platform/14460000.pinctrl/power/async "enabled" - # Setup groups for SF (RT used for SF RE, SF used for SF main) - write /proc/vendor_sched/rt_uclamp_min 236 - write /proc/vendor_sched/rt_prefer_idle 1 - write /proc/vendor_sched/sf_uclamp_min 39 - write /proc/vendor_sched/sf_prefer_idle 1 - # Setup cpu.shares to throttle background groups (bg ~ 5% sysbg ~ 5% dex2oat ~2.5%) write /dev/cpuctl/background/cpu.shares 1024 write /dev/cpuctl/system-background/cpu.shares 1024 @@ -899,19 +876,13 @@ on property:persist.sys.test_harness=1 && property:persist.vendor.testing_batte on property:ro.debuggable=1 write /sys/module/scsi_mod/parameters/scsi_logging_level 63 -service insmod_sh_common /vendor/bin/init.insmod.sh /vendor/etc/init.insmod.gs201.cfg +service init_display /vendor/bin/init.display.sh class main user root group root system disabled oneshot -# Set watchdog timer to 30 seconds and pet it every 10 seconds to get a 20 second margin -service watchdogd /system/bin/watchdogd 10 20 - class core - oneshot - seclabel u:r:watchdogd:s0 - # bugreport is triggered by holding down volume down, volume up and power service bugreport /system/bin/dumpstate -d -p -z class main @@ -928,13 +899,15 @@ on post-fs-data symlink /mnt/vendor/persist/ss /data/vendor/ss/persist chown root system /data/vendor/ss/persist chmod 0770 /data/vendor/ss/persist + chown system system /data/vendor/ss/persist/nsp restart storageproxyd service storageproxyd /vendor/bin/storageproxyd -d /dev/trusty-ipc-dev0 \ -r /dev/sg1 -p /data/vendor/ss -t ufs class early_hal - user root + user system + group system # Write build info to kdebuginfo on property:ro.build.fingerprint=* @@ -952,6 +925,9 @@ on post-fs-data on post-fs-data mkdir /data/vendor/powerstats 0771 system system chown system system /data/vendor/powerstats + # Thermal Residency Stats (write 1 to reset) + chown system system /sys/kernel/metrics/thermal/tr_by_group/tmu/stats_reset + chown system system /sys/kernel/metrics/thermal/tr_by_group/spmic/stats_reset on property:vendor.brownout.mitigation.ready=1 # BCL @@ -1010,16 +986,26 @@ on property:vendor.thermal.link_ready=1 chown system system /dev/thermal/tz-by-name/usb_pwr_therm2/trip_point_0_hyst chown system system /dev/thermal/tz-by-name/usb_pwr_therm/trip_point_0_temp chown system system /dev/thermal/tz-by-name/usb_pwr_therm/trip_point_0_hyst + chmod 664 /dev/thermal/cdev-by-name/thermal-cpufreq-0/user_vote chown system system /dev/thermal/cdev-by-name/thermal-cpufreq-0/user_vote + chmod 664 /dev/thermal/cdev-by-name/thermal-cpufreq-1/user_vote chown system system /dev/thermal/cdev-by-name/thermal-cpufreq-1/user_vote + chmod 664 /dev/thermal/cdev-by-name/thermal-cpufreq-2/user_vote chown system system /dev/thermal/cdev-by-name/thermal-cpufreq-2/user_vote + chmod 664 /dev/thermal/cdev-by-name/thermal-gpufreq-0/user_vote chown system system /dev/thermal/cdev-by-name/thermal-gpufreq-0/user_vote + chmod 664 /dev/thermal/cdev-by-name/tpu_cooling/user_vote chown system system /dev/thermal/cdev-by-name/gxp-cooling/user_vote chown system system /dev/thermal/cdev-by-name/tpu_cooling/user_vote + chmod 664 /dev/thermal/cdev-by-name/fcc/cur_state chown system system /dev/thermal/cdev-by-name/fcc/cur_state + chmod 664 /dev/thermal/cdev-by-name/dc_icl/cur_state chown system system /dev/thermal/cdev-by-name/dc_icl/cur_state + chmod 664 /dev/thermal/cdev-by-name/wlc_fcc/cur_state chown system system /dev/thermal/cdev-by-name/wlc_fcc/cur_state + chmod 664 /dev/thermal/cdev-by-name/chg_mdis/cur_state chown system system /dev/thermal/cdev-by-name/chg_mdis/cur_state + chmod 664 /dev/thermal/cdev-by-name/usbc-port/cur_state chown system system /dev/thermal/cdev-by-name/usbc-port/cur_state on charger @@ -1075,7 +1061,7 @@ on property:persist.device_config.vendor_system_native.top-app_cpuset=* on property:persist.device_config.vendor_system_native.foreground_cpuset=* write /dev/cpuset/foreground/cpus ${persist.device_config.vendor_system_native.foreground_cpuset:-0-3,4-5} on property:persist.device_config.vendor_system_native.background_cpuset=* - write /dev/cpuset/background/cpus ${persist.device_config.vendor_system_native.background_cpuset:-0-1} + write /dev/cpuset/background/cpus ${persist.device_config.vendor_system_native.background_cpuset:-0-3} on property:persist.device_config.vendor_system_native.system-background_cpuset=* write /dev/cpuset/system-background/cpus ${persist.device_config.vendor_system_native.system-background_cpuset:-0-3} on property:persist.device_config.vendor_system_native.restricted_cpuset=* diff --git a/conf/init.gs201.usb.rc b/conf/init.gs201.usb.rc index c57e2c56..78356dfd 100644 --- a/conf/init.gs201.usb.rc +++ b/conf/init.gs201.usb.rc @@ -71,6 +71,46 @@ on early-boot # acm function for uwb mkdir /config/usb_gadget/g1/functions/acm.uwb0 + # uvc function + mkdir /config/usb_gadget/g1/functions/uvc.0 + write /config/usb_gadget/g1/functions/uvc.0/function_name "Android Webcam" + write /config/usb_gadget/g1/functions/uvc.0/streaming_maxpacket 3072 + # write /config/usb_gadget/g1/functions/uvc.0/streaming_maxburst 5 + # write /config/usb_gadget/g1/functions/uvc.0/streaming_interval 2 + # setup control params + mkdir /config/usb_gadget/g1/functions/uvc.0/control/header/h + symlink /config/usb_gadget/g1/functions/uvc.0/control/header/h /config/usb_gadget/g1/functions/uvc.0/control/class/fs/h + symlink /config/usb_gadget/g1/functions/uvc.0/control/header/h /config/usb_gadget/g1/functions/uvc.0/control/class/ss/h + # advertise 720p resolution for webcam encoded as mjpeg + mkdir /config/usb_gadget/g1/functions/uvc.0/streaming/mjpeg/m + mkdir /config/usb_gadget/g1/functions/uvc.0/streaming/mjpeg/m/720p + write /config/usb_gadget/g1/functions/uvc.0/streaming/mjpeg/m/720p/wHeight 720 + write /config/usb_gadget/g1/functions/uvc.0/streaming/mjpeg/m/720p/wWidth 1280 + write /config/usb_gadget/g1/functions/uvc.0/streaming/mjpeg/m/720p/dwMaxVideoFrameBufferSize 1843200 + write /config/usb_gadget/g1/functions/uvc.0/streaming/mjpeg/m/720p/dwDefaultFrameInterval 333333 + write /config/usb_gadget/g1/functions/uvc.0/streaming/mjpeg/m/720p/dwFrameInterval "166666 +333333 +416666 +666666" + # advertise 1080p resolution for webcam encoded as mjpeg + mkdir /config/usb_gadget/g1/functions/uvc.0/streaming/mjpeg/m/1080p + write /config/usb_gadget/g1/functions/uvc.0/streaming/mjpeg/m/1080p/wHeight 1080 + write /config/usb_gadget/g1/functions/uvc.0/streaming/mjpeg/m/1080p/wWidth 1920 + write /config/usb_gadget/g1/functions/uvc.0/streaming/mjpeg/m/1080p/dwMaxVideoFrameBufferSize 4147200 + write /config/usb_gadget/g1/functions/uvc.0/streaming/mjpeg/m/1080p/dwDefaultFrameInterval 333333 + write /config/usb_gadget/g1/functions/uvc.0/streaming/mjpeg/m/1080p/dwFrameInterval "166666 +333333 +416666 +666666" + # TODO: Add uncompressed streams + # setup streaming params + mkdir /config/usb_gadget/g1/functions/uvc.0/streaming/header/h + symlink /config/usb_gadget/g1/functions/uvc.0/streaming/mjpeg/m /config/usb_gadget/g1/functions/uvc.0/streaming/header/h/m + symlink /config/usb_gadget/g1/functions/uvc.0/streaming/header/h /config/usb_gadget/g1/functions/uvc.0/streaming/class/fs/h + symlink /config/usb_gadget/g1/functions/uvc.0/streaming/header/h /config/usb_gadget/g1/functions/uvc.0/streaming/class/hs/h + symlink /config/usb_gadget/g1/functions/uvc.0/streaming/header/h /config/usb_gadget/g1/functions/uvc.0/streaming/class/ss/h + + # chown file/folder permission chown system system /config/usb_gadget/ chown system system /config/usb_gadget/g1 @@ -135,6 +175,99 @@ on early-boot chown system system /config/usb_gadget/g1/functions/rndis.gs4/protocol chown system system /config/usb_gadget/g1/functions/rndis.gs4/qmult chown system system /config/usb_gadget/g1/functions/rndis.gs4/subclass + chown system system /config/usb_gadget/g1/functions/uvc.0 + chown system system /config/usb_gadget/g1/functions/uvc.0/control + chown system system /config/usb_gadget/g1/functions/uvc.0/control/bInterfaceNumber + chown system system /config/usb_gadget/g1/functions/uvc.0/control/class + chown system system /config/usb_gadget/g1/functions/uvc.0/control/class/fs + chown system system /config/usb_gadget/g1/functions/uvc.0/control/class/fs/h + chown system system /config/usb_gadget/g1/functions/uvc.0/control/class/ss + chown system system /config/usb_gadget/g1/functions/uvc.0/control/class/ss/h + chown system system /config/usb_gadget/g1/functions/uvc.0/control/header + chown system system /config/usb_gadget/g1/functions/uvc.0/control/header/h + chown system system /config/usb_gadget/g1/functions/uvc.0/control/header/h/bcdUVC + chown system system /config/usb_gadget/g1/functions/uvc.0/control/header/h/dwClockFrequency + chown system system /config/usb_gadget/g1/functions/uvc.0/control/processing + chown system system /config/usb_gadget/g1/functions/uvc.0/control/processing/default + chown system system /config/usb_gadget/g1/functions/uvc.0/control/processing/default/bmControls + chown system system /config/usb_gadget/g1/functions/uvc.0/control/processing/default/bSourceID + chown system system /config/usb_gadget/g1/functions/uvc.0/control/processing/default/bUnitID + chown system system /config/usb_gadget/g1/functions/uvc.0/control/processing/default/iProcessing + chown system system /config/usb_gadget/g1/functions/uvc.0/control/processing/default/wMaxMultiplier + chown system system /config/usb_gadget/g1/functions/uvc.0/control/terminal + chown system system /config/usb_gadget/g1/functions/uvc.0/control/terminal/camera + chown system system /config/usb_gadget/g1/functions/uvc.0/control/terminal/camera/default + chown system system /config/usb_gadget/g1/functions/uvc.0/control/terminal/camera/default/bAssocTerminal + chown system system /config/usb_gadget/g1/functions/uvc.0/control/terminal/camera/default/bmControls + chown system system /config/usb_gadget/g1/functions/uvc.0/control/terminal/camera/default/bTerminalID + chown system system /config/usb_gadget/g1/functions/uvc.0/control/terminal/camera/default/iTerminal + chown system system /config/usb_gadget/g1/functions/uvc.0/control/terminal/camera/default/wObjectiveFocalLengthMax + chown system system /config/usb_gadget/g1/functions/uvc.0/control/terminal/camera/default/wObjectiveFocalLengthMin + chown system system /config/usb_gadget/g1/functions/uvc.0/control/terminal/camera/default/wOcularFocalLength + chown system system /config/usb_gadget/g1/functions/uvc.0/control/terminal/camera/default/wTerminalType + chown system system /config/usb_gadget/g1/functions/uvc.0/control/terminal/output + chown system system /config/usb_gadget/g1/functions/uvc.0/control/terminal/output/default + chown system system /config/usb_gadget/g1/functions/uvc.0/control/terminal/output/default/bAssocTerminal + chown system system /config/usb_gadget/g1/functions/uvc.0/control/terminal/output/default/bSourceID + chown system system /config/usb_gadget/g1/functions/uvc.0/control/terminal/output/default/bTerminalID + chown system system /config/usb_gadget/g1/functions/uvc.0/control/terminal/output/default/iTerminal + chown system system /config/usb_gadget/g1/functions/uvc.0/control/terminal/output/default/wTerminalType + chown system system /config/usb_gadget/g1/functions/uvc.0/function_name + chown system system /config/usb_gadget/g1/functions/uvc.0/streaming + chown system system /config/usb_gadget/g1/functions/uvc.0/streaming_interval + chown system system /config/usb_gadget/g1/functions/uvc.0/streaming_maxburst + chown system system /config/usb_gadget/g1/functions/uvc.0/streaming_maxpacket + chown system system /config/usb_gadget/g1/functions/uvc.0/streaming/bInterfaceNumber + chown system system /config/usb_gadget/g1/functions/uvc.0/streaming/class + chown system system /config/usb_gadget/g1/functions/uvc.0/streaming/class/fs + chown system system /config/usb_gadget/g1/functions/uvc.0/streaming/class/fs/h + chown system system /config/usb_gadget/g1/functions/uvc.0/streaming/class/hs + chown system system /config/usb_gadget/g1/functions/uvc.0/streaming/class/hs/h + chown system system /config/usb_gadget/g1/functions/uvc.0/streaming/class/ss + chown system system /config/usb_gadget/g1/functions/uvc.0/streaming/class/ss/h + chown system system /config/usb_gadget/g1/functions/uvc.0/streaming/color_matching + chown system system /config/usb_gadget/g1/functions/uvc.0/streaming/color_matching/default + chown system system /config/usb_gadget/g1/functions/uvc.0/streaming/color_matching/default/bColorPrimaries + chown system system /config/usb_gadget/g1/functions/uvc.0/streaming/color_matching/default/bMatrixCoefficients + chown system system /config/usb_gadget/g1/functions/uvc.0/streaming/color_matching/default/bTransferCharacteristics + chown system system /config/usb_gadget/g1/functions/uvc.0/streaming/header + chown system system /config/usb_gadget/g1/functions/uvc.0/streaming/header/h + chown system system /config/usb_gadget/g1/functions/uvc.0/streaming/header/h/bmInfo + chown system system /config/usb_gadget/g1/functions/uvc.0/streaming/header/h/bStillCaptureMethod + chown system system /config/usb_gadget/g1/functions/uvc.0/streaming/header/h/bTerminalLink + chown system system /config/usb_gadget/g1/functions/uvc.0/streaming/header/h/bTriggerSupport + chown system system /config/usb_gadget/g1/functions/uvc.0/streaming/header/h/bTriggerUsage + chown system system /config/usb_gadget/g1/functions/uvc.0/streaming/header/h/m + chown system system /config/usb_gadget/g1/functions/uvc.0/streaming/mjpeg + chown system system /config/usb_gadget/g1/functions/uvc.0/streaming/mjpeg/m + chown system system /config/usb_gadget/g1/functions/uvc.0/streaming/mjpeg/m/1080p + chown system system /config/usb_gadget/g1/functions/uvc.0/streaming/mjpeg/m/1080p/bFrameIndex + chown system system /config/usb_gadget/g1/functions/uvc.0/streaming/mjpeg/m/1080p/bmCapabilities + chown system system /config/usb_gadget/g1/functions/uvc.0/streaming/mjpeg/m/1080p/dwDefaultFrameInterval + chown system system /config/usb_gadget/g1/functions/uvc.0/streaming/mjpeg/m/1080p/dwFrameInterval + chown system system /config/usb_gadget/g1/functions/uvc.0/streaming/mjpeg/m/1080p/dwMaxBitRate + chown system system /config/usb_gadget/g1/functions/uvc.0/streaming/mjpeg/m/1080p/dwMaxVideoFrameBufferSize + chown system system /config/usb_gadget/g1/functions/uvc.0/streaming/mjpeg/m/1080p/dwMinBitRate + chown system system /config/usb_gadget/g1/functions/uvc.0/streaming/mjpeg/m/1080p/wHeight + chown system system /config/usb_gadget/g1/functions/uvc.0/streaming/mjpeg/m/1080p/wWidth + chown system system /config/usb_gadget/g1/functions/uvc.0/streaming/mjpeg/m/720p + chown system system /config/usb_gadget/g1/functions/uvc.0/streaming/mjpeg/m/720p/bFrameIndex + chown system system /config/usb_gadget/g1/functions/uvc.0/streaming/mjpeg/m/720p/bmCapabilities + chown system system /config/usb_gadget/g1/functions/uvc.0/streaming/mjpeg/m/720p/dwDefaultFrameInterval + chown system system /config/usb_gadget/g1/functions/uvc.0/streaming/mjpeg/m/720p/dwFrameInterval + chown system system /config/usb_gadget/g1/functions/uvc.0/streaming/mjpeg/m/720p/dwMaxBitRate + chown system system /config/usb_gadget/g1/functions/uvc.0/streaming/mjpeg/m/720p/dwMaxVideoFrameBufferSize + chown system system /config/usb_gadget/g1/functions/uvc.0/streaming/mjpeg/m/720p/dwMinBitRate + chown system system /config/usb_gadget/g1/functions/uvc.0/streaming/mjpeg/m/720p/wHeight + chown system system /config/usb_gadget/g1/functions/uvc.0/streaming/mjpeg/m/720p/wWidth + chown system system /config/usb_gadget/g1/functions/uvc.0/streaming/mjpeg/m/bAspectRatioX + chown system system /config/usb_gadget/g1/functions/uvc.0/streaming/mjpeg/m/bAspectRatioY + chown system system /config/usb_gadget/g1/functions/uvc.0/streaming/mjpeg/m/bDefaultFrameIndex + chown system system /config/usb_gadget/g1/functions/uvc.0/streaming/mjpeg/m/bFormatIndex + chown system system /config/usb_gadget/g1/functions/uvc.0/streaming/mjpeg/m/bmaControls + chown system system /config/usb_gadget/g1/functions/uvc.0/streaming/mjpeg/m/bmFlags + chown system system /config/usb_gadget/g1/functions/uvc.0/streaming/mjpeg/m/bmInterlaceFlags + chown system system /config/usb_gadget/g1/functions/uvc.0/streaming/uncompressed chown system system /config/usb_gadget/g1/idProduct chown system system /config/usb_gadget/g1/idVendor chown system system /config/usb_gadget/g1/max_speed diff --git a/conf/init.modem.rc b/conf/init.modem.rc index 96ed0678..6c89e3b2 100644 --- a/conf/init.modem.rc +++ b/conf/init.modem.rc @@ -16,6 +16,9 @@ on post-fs-data # Modem MDS log folder mkdir /data/vendor/radio/mds 0771 radio system + # Modem OTA UECap folder + mkdir /data/vendor/radio/ota_uecap 0773 radio system + # Unzipped modem images folder mkdir /data/vendor/radio/image 0771 radio system diff --git a/conf/ueventd.gs201.rc b/conf/ueventd.gs201.rc index 6a33ec9f..03308f7c 100644 --- a/conf/ueventd.gs201.rc +++ b/conf/ueventd.gs201.rc @@ -75,8 +75,8 @@ /dev/hdcp2 0660 media media # jpeg -/dev/m2m1shot_jpeg 0660 media media -/dev/video12 0660 cameraserver media +/dev/m2m1shot_jpeg 0660 media media +/dev/video12 0660 system system # audio /dev/seiren 0660 system audio @@ -94,7 +94,9 @@ /dev/acd-debug 0660 system audio /dev/acd-audio_tap* 0660 system audio /dev/acd-audio_dcdoff_ref 0660 system audio +/dev/acd-mel_processor 0660 system audio /dev/amcs 0660 system audio +/dev/acd-audio_rtp_* 0660 system radio # Secure MEM driver /dev/s5p-smem 0660 drm drmrpc @@ -142,6 +144,9 @@ # AoC /dev/aoc 0660 system system +# AoC stats (UmfwStat) +/dev/acd-com.google.umfw_stat 0660 system system + # Sensors (USF) /dev/acd-com.google.usf 0660 system system /dev/acd-com.google.usf.non_wake_up 0660 system system @@ -222,3 +227,9 @@ # ODPM /sys/bus/iio/devices/iio:device* enabled_rails 0660 system system + +# sysfs LED nodes for external USB devices +/sys/devices/platform/11210000.usb/11210000.dwc3/xhci-hcd-exynos.5.auto/usb2/2-1* brightness 0664 system system +/sys/devices/platform/11210000.usb/11210000.dwc3/xhci-hcd-exynos.5.auto/usb2/2-1* multi_intensity 0664 system system +/sys/devices/platform/11210000.usb/11210000.dwc3/xhci-hcd-exynos.4.auto/usb2/2-1* brightness 0664 system system +/sys/devices/platform/11210000.usb/11210000.dwc3/xhci-hcd-exynos.4.auto/usb2/2-1* multi_intensity 0664 system system diff --git a/default-permissions.xml b/default-permissions.xml index 3e308ea9..baee102a 100644 --- a/default-permissions.xml +++ b/default-permissions.xml @@ -85,8 +85,6 @@ - - diff --git a/device.mk b/device.mk index 3b7da76e..6de71d5d 100644 --- a/device.mk +++ b/device.mk @@ -15,6 +15,23 @@ # include device/google/gs-common/device.mk +include device/google/gs-common/gs_watchdogd/watchdog.mk +include device/google/gs-common/ramdump/ramdump.mk +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/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/gps/dump/log.mk +include device/google/gs-common/radio/dump.mk +include device/google/gs-common/umfw_stat/umfw_stat.mk +include device/google/gs-common/gear/dumpstate/aidl.mk +include device/google/gs-common/widevine/widevine.mk TARGET_BOARD_PLATFORM := gs201 @@ -34,19 +51,19 @@ BOOT_SECURITY_PATCH = $(PLATFORM_SECURITY_PATCH) USE_PIXEL_GRALLOC := false ifeq ($(USE_PIXEL_GRALLOC),true) PRODUCT_SOONG_NAMESPACES += hardware/google/gchips/GrallocHAL -else - PRODUCT_SOONG_NAMESPACES += hardware/google/gchips/gralloc4 endif PRODUCT_SOONG_NAMESPACES += \ hardware/google/av \ hardware/google/gchips \ + hardware/google/gchips/gralloc4 \ hardware/google/graphics/common \ hardware/google/graphics/gs201 \ hardware/google/interfaces \ hardware/google/pixel \ device/google/gs201 \ device/google/gs201/powerstats \ + system/chre/host/hal_generic \ vendor/google/whitechapel/tools \ vendor/google/interfaces \ vendor/google_devices/common/proprietary/confirmatioui_hal \ @@ -98,8 +115,8 @@ endif # From system.property PRODUCT_PROPERTY_OVERRIDES += \ ro.telephony.default_network=27 \ - persist.vendor.ril.use.iccid_to_plmn=1 \ - persist.vendor.ril.emergencynumber.mode=5 + persist.vendor.ril.db_ecc.use.iccid_to_plmn=1 \ + persist.vendor.ril.db_ecc.id.type=5 #rild.libpath=/system/lib64/libsec-ril.so \ #rild.libargs=-d /dev/umts_ipc0 @@ -183,13 +200,14 @@ USES_LASSEN_MODEM := true ifeq ($(USES_GOOGLE_DIALER_CARRIER_SETTINGS),true) USE_GOOGLE_DIALER := true USE_GOOGLE_CARRIER_SETTINGS := true -USES_GAUDIO := true endif -ifeq (,$(filter aosp_%,$(TARGET_PRODUCT))) +ifeq ($(USES_GOOGLE_PREBUILT_MODEM_SVC),true) +USE_GOOGLE_PREBUILT_MODEM_SVC := true +endif + # Audio client implementation for RIL USES_GAUDIO := true -endif # ###################### # GRAPHICS - GPU (begin) @@ -217,6 +235,15 @@ PRODUCT_PACKAGES += \ PRODUCT_VENDOR_PROPERTIES += \ ro.hardware.vulkan=mali +# Mali Configuration Properties +# b/221255664 prevents setting PROTECTED_MAX_CORE_COUNT=2 +PRODUCT_VENDOR_PROPERTIES += \ + vendor.mali.platform.config=/vendor/etc/mali/platform.config \ + vendor.mali.debug.config=/vendor/etc/mali/debug.config \ + vendor.mali.base_protected_max_core_count=1 \ + vendor.mali.base_protected_tls_max=67108864 \ + vendor.mali.platform_agt_frequency_khz=24576 + ifeq ($(USE_SWIFTSHADER),true) PRODUCT_PACKAGES += \ libGLESv1_CM_swiftshader \ @@ -229,8 +256,8 @@ PRODUCT_COPY_FILES += \ frameworks/native/data/etc/android.hardware.vulkan.version-1_3.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.vulkan.version.xml \ frameworks/native/data/etc/android.hardware.vulkan.level-1.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.vulkan.level.xml \ frameworks/native/data/etc/android.hardware.vulkan.compute-0.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.vulkan.compute.xml \ - frameworks/native/data/etc/android.software.vulkan.deqp.level-2022-03-01.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.software.vulkan.deqp.level.xml \ - frameworks/native/data/etc/android.software.opengles.deqp.level-2022-03-01.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.software.opengles.deqp.level.xml + 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_VENDOR_PROPERTIES += \ @@ -240,10 +267,15 @@ PRODUCT_VENDOR_PROPERTIES += \ ro.hardware.egl = mali endif +# Configure EGL blobcache +PRODUCT_VENDOR_PROPERTIES += \ + ro.egl.blobcache.multifile=true \ + ro.egl.blobcache.multifile_limit=33554432 \ + PRODUCT_VENDOR_PROPERTIES += \ ro.opengles.version=196610 \ graphics.gpu.profiler.support=true \ - debug.renderengine.backend=skiaglthreaded \ + debug.renderengine.backend=skiaglthreaded # GRAPHICS - GPU (end) # #################### @@ -312,12 +344,10 @@ PRODUCT_COPY_FILES += \ # Shell scripts PRODUCT_COPY_FILES += \ - device/google/gs201/init.insmod.sh:$(TARGET_COPY_OUT_VENDOR)/bin/init.insmod.sh \ + device/google/gs201/init.display.sh:$(TARGET_COPY_OUT_VENDOR)/bin/init.display.sh \ device/google/gs201/disable_contaminant_detection.sh:$(TARGET_COPY_OUT_VENDOR)/bin/hw/disable_contaminant_detection.sh -# insmod files -PRODUCT_COPY_FILES += \ - device/google/gs201/init.insmod.gs201.cfg:$(TARGET_COPY_OUT_VENDOR)/etc/init.insmod.gs201.cfg +include device/google/gs-common/insmod/insmod.mk # For creating dtbo image PRODUCT_HOST_PACKAGES += \ @@ -397,8 +427,8 @@ PRODUCT_COPY_FILES += \ frameworks/native/data/etc/android.hardware.sensor.proximity.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.sensor.proximity.xml endif -# Add sensor HAL 2.1 product packages -PRODUCT_PACKAGES += android.hardware.sensors@2.1-service.multihal +# Add sensor HAL AIDL product packages +PRODUCT_PACKAGES += android.hardware.sensors-service.multihal # USB HAL PRODUCT_PACKAGES += \ @@ -435,13 +465,6 @@ include hardware/google/pixel/rebalance_interrupts/rebalance_interrupts.mk PRODUCT_PACKAGES += \ android.hardware.power.stats-service.pixel -# dumpstate HAL -PRODUCT_PACKAGES += \ - android.hardware.dumpstate-service.gs201 - -# AoC support -include device/google/gs201/aoc/device.mk - # # Audio HALs # @@ -506,8 +529,8 @@ PANTHER_PRODUCT := %panther CHEETAH_PRODUCT := %cheetah LYNX_PRODUCT := %lynx FELIX_PRODUCT := %felix -TANGOR_PRODUCT := %tangorpro CLOUDRIPPER_PRODUCT := %cloudripper +TANGOR_PRODUCT := %tangorpro ifneq (,$(filter $(PANTHER_PRODUCT), $(TARGET_PRODUCT))) LOCAL_TARGET_PRODUCT := panther else ifneq (,$(filter $(CHEETAH_PRODUCT), $(TARGET_PRODUCT))) @@ -516,10 +539,10 @@ else ifneq (,$(filter $(LYNX_PRODUCT), $(TARGET_PRODUCT))) LOCAL_TARGET_PRODUCT := lynx else ifneq (,$(filter $(FELIX_PRODUCT), $(TARGET_PRODUCT))) LOCAL_TARGET_PRODUCT := felix -else ifneq (,$(filter $(TANGOR_PRODUCT), $(TARGET_PRODUCT))) - LOCAL_TARGET_PRODUCT := tangorpro else ifneq (,$(filter $(CLOUDRIPPER_PRODUCT), $(TARGET_PRODUCT))) LOCAL_TARGET_PRODUCT := cloudripper +else ifneq (,$(filter $(TANGOR_PRODUCT), $(TARGET_PRODUCT))) + LOCAL_TARGET_PRODUCT := tangorpro else # WAR: continue defaulting to slider build on gs201 to not # break dev targets such as ravenclaw @@ -541,7 +564,7 @@ endif # WiFi PRODUCT_PACKAGES += \ - android.hardware.wifi@1.0-service \ + android.hardware.wifi-service \ wificond \ libwpa_client @@ -549,25 +572,21 @@ PRODUCT_PACKAGES += \ PRODUCT_PACKAGES += \ ConnectivityOverlay -# Battery Mitigation -PRODUCT_PACKAGES += \ - battery_mitigation - - -ifneq (,$(filter userdebug eng, $(TARGET_BUILD_VARIANT))) -PRODUCT_PACKAGES += BrownoutDetection -endif - PRODUCT_PACKAGES_DEBUG += \ f2fs_io \ check_f2fs \ f2fs.fibmap \ dump.f2fs +# Storage dump +include device/google/gs-common/storage/storage.mk + # Storage health HAL PRODUCT_PACKAGES += \ android.hardware.health.storage-service.default +# Battery Mitigation +include device/google/gs-common/battery_mitigation/bcl.mk # storage pixelstats -include hardware/google/pixel/pixelstats/device.mk @@ -582,7 +601,7 @@ $(call inherit-product, $(SRC_TARGET_DIR)/product/generic_ramdisk.mk) # Titan-M ifeq (,$(filter true, $(BOARD_WITHOUT_DTLS))) -include hardware/google/pixel/dauntless/dauntless.mk +include device/google/gs-common/dauntless/gsc.mk endif PRODUCT_PACKAGES_DEBUG += \ @@ -622,7 +641,6 @@ PRODUCT_COPY_FILES += \ frameworks/native/data/etc/android.hardware.camera.full.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.camera.full.xml\ frameworks/native/data/etc/android.hardware.camera.raw.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.camera.raw.xml\ vendor/google/services/LyricCameraHAL/src/vendor.android.hardware.camera.preview-dis.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/vendor.android.hardware.camera.preview-dis.xml\ - vendor/google/services/LyricCameraHAL/src/vendor.android.hardware.camera.stream-usecase.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/vendor.android.hardware.camera.stream-usecase.xml\ #PRODUCT_COPY_FILES += \ frameworks/native/data/etc/handheld_core_hardware.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/handheld_core_hardware.xml \ @@ -795,9 +813,14 @@ endif $(call inherit-product, system/core/trusty/trusty-storage.mk) $(call inherit-product, system/core/trusty/trusty-base.mk) +# Trusty dump +include device/google/gs-common/trusty/trusty.mk + # Trusty unit test tool -PRODUCT_PACKAGES_DEBUG += trusty-ut-ctrl \ - tipc-test +PRODUCT_PACKAGES_DEBUG += \ + trusty-ut-ctrl \ + tipc-test \ + trusty_stats_test \ include device/google/gs101/confirmationui/confirmationui.mk @@ -806,11 +829,11 @@ PRODUCT_PACKAGES += \ securedpud.slider # Trusty Metrics Daemon -#PRODUCT_SOONG_NAMESPACES += \ -# vendor/google/trusty/common -# -#PRODUCT_PACKAGES += \ -# trusty_metricsd +PRODUCT_SOONG_NAMESPACES += \ + vendor/google/trusty/common + +PRODUCT_PACKAGES += \ + trusty_metricsd $(call soong_config_set,google_displaycolor,displaycolor_platform,gs201) PRODUCT_PACKAGES += \ @@ -821,11 +844,6 @@ PRODUCT_PACKAGES += \ PRODUCT_PROPERTY_OVERRIDES += \ ro.frp.pst=/dev/block/by-name/frp -# Bluetooth -PRODUCT_COPY_FILES += \ - frameworks/native/data/etc/android.hardware.bluetooth.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.bluetooth.xml \ - frameworks/native/data/etc/android.hardware.bluetooth_le.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.bluetooth_le.xml - # System props to enable Bluetooth Quality Report (BQR) feature ifneq (,$(filter userdebug eng, $(TARGET_BUILD_VARIANT))) PRODUCT_PRODUCT_PROPERTIES += \ @@ -851,6 +869,10 @@ PRODUCT_USE_DYNAMIC_PARTITIONS := true PRODUCT_PRODUCT_PROPERTIES += \ persist.sys.fuse.passthrough.enable=true +# Use FUSE BPF +PRODUCT_PRODUCT_PROPERTIES += \ + ro.fuse.bpf.enabled=true + # Use /product/etc/fstab.postinstall to mount system_other PRODUCT_PRODUCT_PROPERTIES += \ ro.postinstall.fstab.prefix=/product @@ -893,6 +915,7 @@ PRODUCT_PACKAGES += ShannonIms #RCS Test Messaging App PRODUCT_PACKAGES_DEBUG += \ + preinstalled-packages-product-gs201-device-debug.xml \ TestRcsApp PRODUCT_PACKAGES += ShannonRcs @@ -913,6 +936,8 @@ SUPPORT_NR := true SUPPORT_NR_DS := true # Using IRadio 2.0 USE_RADIO_HAL_2_0 := true +# Support SecureElement HAL for HIDL +USE_SE_HIDL := true # Using Early Send Device Info USE_EARLY_SEND_DEVICE_INFO := true @@ -952,22 +977,19 @@ PRODUCT_PROPERTY_OVERRIDES += \ PRODUCT_COPY_FILES += \ device/google/$(TARGET_BOARD_PLATFORM)/conf/init.modem.rc:$(TARGET_COPY_OUT_VENDOR)/etc/init/init.modem.rc \ device/google/$(TARGET_BOARD_PLATFORM)/conf/fstab.modem:$(TARGET_COPY_OUT_VENDOR)/etc/fstab.modem \ + device/google/gs201/location/gps.cer:$(TARGET_COPY_OUT_VENDOR)/etc/gnss/gps.cer -#GPS HAL -include device/google/gs201/gnss/device-gnss.mk + +include device/google/gs-common/gps/brcm/device.mk endif -BOARD_VENDOR_SEPOLICY_DIRS += device/google/gs201-sepolicy/gps + $(call inherit-product, $(SRC_TARGET_DIR)/product/core_64_bit_only.mk) #$(call inherit-product, hardware/google_devices/exynos5/exynos5.mk) #$(call inherit-product-if-exists, hardware/google_devices/gs201/gs201.mk) #$(call inherit-product-if-exists, vendor/google_devices/common/exynos-vendor.mk) #$(call inherit-product-if-exists, hardware/broadcom/wlan/bcmdhd/firmware/bcm4375/device-bcm.mk) -ifeq ($(wildcard vendor/google/sensors/usf),) -$(call inherit-product-if-exists, vendor/google_devices/gs201/proprietary/usf/usf_product.mk) -else -$(call inherit-product-if-exists, vendor/google/sensors/usf/android/usf_efw_product.mk) -endif +include device/google/gs-common/sensors/sensors.mk $(call inherit-product-if-exists, vendor/google/services/LyricCameraHAL/src/build/device-vendor.mk) $(call inherit-product-if-exists, vendor/google/camera/devices/whi/device-vendor.mk) @@ -1001,63 +1023,7 @@ PRODUCT_PACKAGES += \ # Audio # Audio HAL Server & Default Implementations -PRODUCT_PACKAGES += \ - android.hardware.audio.service \ - android.hardware.audio@7.1-impl \ - android.hardware.audio.effect@7.0-impl \ - android.hardware.soundtrigger@2.3-impl \ - vendor.google.whitechapel.audio.audioext@4.0-impl \ - android.hardware.bluetooth.audio-impl \ - -# -##Audio HAL libraries -PRODUCT_PACKAGES += \ - audio.primary.$(TARGET_BOARD_PLATFORM) \ - audio.platform.aoc \ - audio_tunnel_aoc \ - aoc_aud_ext \ - libaoctuningdecoder \ - liboffloadeffect \ - audio_bt_aoc \ - audio_waves_aoc \ - audio_fortemedia_aoc \ - audio_bluenote_aoc \ - audio_usb_aoc \ - audio_cca_aoc \ - libamcsextfile \ - audio_amcs_ext \ - audio.usb.default \ - audio.usbv2.default \ - audio.bluetooth.default \ - audio.r_submix.default \ - audio_spk_35l41 \ - sound_trigger.primary.$(TARGET_BOARD_PLATFORM) -# libaoc_waves \ -# - -##Audio Vendor libraries -PRODUCT_PACKAGES += \ - libfvsam_prm_parser \ - libmahalcontroller \ - libAlgFx_HiFi3z -# -## AudioHAL Configurations -PRODUCT_COPY_FILES += \ - frameworks/av/services/audiopolicy/config/a2dp_audio_policy_configuration_7_0.xml:$(TARGET_COPY_OUT_VENDOR)/etc/a2dp_audio_policy_configuration_7_0.xml \ - frameworks/av/services/audiopolicy/config/a2dp_in_audio_policy_configuration_7_0.xml:$(TARGET_COPY_OUT_VENDOR)/etc/a2dp_in_audio_policy_configuration_7_0.xml \ - frameworks/av/services/audiopolicy/config/hearing_aid_audio_policy_configuration_7_0.xml:$(TARGET_COPY_OUT_VENDOR)/etc/hearing_aid_audio_policy_configuration_7_0.xml \ - frameworks/av/services/audiopolicy/config/r_submix_audio_policy_configuration.xml:$(TARGET_COPY_OUT_VENDOR)/etc/r_submix_audio_policy_configuration.xml \ - frameworks/av/services/audiopolicy/config/usb_audio_policy_configuration.xml:$(TARGET_COPY_OUT_VENDOR)/etc/usb_audio_policy_configuration.xml \ - frameworks/av/services/audiopolicy/config/audio_policy_volumes.xml:$(TARGET_COPY_OUT_VENDOR)/etc/audio_policy_volumes.xml \ - frameworks/av/services/audiopolicy/config/default_volume_tables.xml:$(TARGET_COPY_OUT_VENDOR)/etc/default_volume_tables.xml \ - frameworks/av/services/audiopolicy/config/bluetooth_audio_policy_configuration_7_0.xml:$(TARGET_COPY_OUT_VENDOR)/etc/bluetooth_audio_policy_configuration_7_0.xml - -##Audio soong -PRODUCT_SOONG_NAMESPACES += \ - vendor/google/whitechapel/audio/hal \ - vendor/google/whitechapel/audio/interfaces - -$(call soong_config_set,aoc_audio_board,platform,$(TARGET_BOARD_PLATFORM)) +include device/google/gs-common/audio/hidl_gs201.mk ## AoC soong PRODUCT_SOONG_NAMESPACES += \ @@ -1118,10 +1084,13 @@ 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 -$(call soong_config_set,thermal_hal_feature,pid,apply_2_0) -## TPU packages -include device/google/gs201/edgetpu/edgetpu.mk +# EdgeTPU +include device/google/gs-common/edgetpu/edgetpu.mk +# Config variables for TPU chip on device. +$(call soong_config_set,edgetpu_config,chip,janeiro) +# TPU firmware +PRODUCT_PACKAGES += edgetpu-janeiro.fw # Connectivity Thermal Power Manager PRODUCT_PACKAGES += \ @@ -1153,7 +1122,7 @@ PRODUCT_PROPERTY_OVERRIDES += \ # Suspend properties PRODUCT_PROPERTY_OVERRIDES += \ - suspend.short_suspend_threshold_millis=5000 + suspend.short_suspend_threshold_millis=2000 # Enable Incremental on the device PRODUCT_PROPERTY_OVERRIDES += \ @@ -1176,11 +1145,12 @@ include hardware/google/pixel/wifi_ext/device.mk # Battery Stats Viewer PRODUCT_PACKAGES_DEBUG += BatteryStatsViewer +PRODUCT_PACKAGES += dump_power_gs201.sh # Install product specific framework compatibility matrix # (TODO: b/169535506) This includes the FCM for system_ext and product partition. # It must be split into the FCM of each partition. -DEVICE_PRODUCT_COMPATIBILITY_MATRIX_FILE := device/google/gs201/device_framework_matrix_product.xml +DEVICE_PRODUCT_COMPATIBILITY_MATRIX_FILE += device/google/gs201/device_framework_matrix_product.xml # Preopt SystemUI PRODUCT_DEXPREOPT_SPEED_APPS += SystemUIGoogle # For internal @@ -1197,3 +1167,9 @@ PRODUCT_COPY_FILES += \ # Call deleteAllKeys if vold detects a factory reset PRODUCT_VENDOR_PROPERTIES += ro.crypto.metadata_init_delete_all_keys.enabled?=true + +# Hardware Info +include hardware/google/pixel/HardwareInfo/HardwareInfo.mk + +# UFS: the script is used to select the corresponding firmware to run FFU. +PRODUCT_PACKAGES += ufs_firmware_update.sh diff --git a/device_framework_matrix_product.xml b/device_framework_matrix_product.xml index 47ca07a9..d7b2406d 100644 --- a/device_framework_matrix_product.xml +++ b/device_framework_matrix_product.xml @@ -47,6 +47,10 @@ IDebugHost default + + IDebugManager + default + com.google.edgetpu @@ -56,9 +60,17 @@ default + + com.google.edgetpu.dba + 1 + + IDevice + default + + com.google.hardware.pixel.display - 7 + 8 IDisplay default @@ -66,6 +78,7 @@ com.google.input + 2 ITouchContextService default @@ -87,38 +100,6 @@ default - - hardware.google.bluetooth.bt_channel_avoidance - 1.0 - - IBTChannelAvoidance - default - - - - hardware.google.bluetooth.sar - 1.1 - - IBluetoothSar - default - - - - hardware.google.bluetooth.ext - 1.0 - - IBluetoothExt - default - - - - hardware.google.bluetooth.ewp - 1.0 - - IBluetoothEwp - default - - vendor.google.google_battery 2 @@ -135,30 +116,14 @@ default - - vendor.google.whitechapel.audio.audioext - 4.0 - - IAudioExt - default - - - + vendor.google.wifi_ext - 1.3 + 1 IWifiExt default - - vendor.google.wireless_charger - 1.3 - - IWirelessCharger - default - - vendor.samsung_slsi.telephony.hardware.oemservice 1.0 @@ -177,12 +142,4 @@ rilExternal - - vendor.google.audiometricext - 1.0 - - IAudioMetricExt - default - - diff --git a/dumpstate/Android.bp b/dumpstate/Android.bp new file mode 100644 index 00000000..a325151d --- /dev/null +++ b/dumpstate/Android.bp @@ -0,0 +1,10 @@ +package { + default_applicable_licenses: ["Android-Apache-2.0"], +} + +sh_binary { + name: "dump_power_gs201.sh", + src: "dump_power_gs201.sh", + vendor: true, + sub_dir: "dump", +} diff --git a/dumpstate/Android.mk b/dumpstate/Android.mk deleted file mode 100644 index 76202ce5..00000000 --- a/dumpstate/Android.mk +++ /dev/null @@ -1,44 +0,0 @@ -# -# Copyright 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. -# - -LOCAL_PATH:= $(call my-dir) -include $(CLEAR_VARS) -LOCAL_MODULE := android.hardware.dumpstate-service.gs201 -LOCAL_LICENSE_KINDS := SPDX-license-identifier-Apache-2.0 -LOCAL_LICENSE_CONDITIONS := notice -LOCAL_NOTICE_FILE := $(LOCAL_PATH)/../NOTICE -LOCAL_INIT_RC := android.hardware.dumpstate@1.1-service.gs201.rc -LOCAL_MODULE_RELATIVE_PATH := hw - -LOCAL_SRC_FILES := \ - Dumpstate.cpp \ - service.cpp - -LOCAL_SHARED_LIBRARIES := \ - libbase \ - libbinder_ndk \ - libcutils \ - libdumpstateutil \ - liblog \ - libutils \ - android.hardware.dumpstate-V1-ndk - -LOCAL_CFLAGS := -Werror -Wall - -LOCAL_MODULE_TAGS := optional -LOCAL_PROPRIETARY_MODULE := true - -include $(BUILD_EXECUTABLE) diff --git a/dumpstate/Dumpstate.cpp b/dumpstate/Dumpstate.cpp deleted file mode 100644 index 98cfeb2c..00000000 --- a/dumpstate/Dumpstate.cpp +++ /dev/null @@ -1,1470 +0,0 @@ -/* - * Copyright 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 "dumpstate_device" - -#include - -#include -#include -#include -#include -#include -#include - -#include "Dumpstate.h" - -#include "DumpstateUtil.h" - -#define MODEM_LOG_DIRECTORY "/data/vendor/radio/logs/always-on" -#define MODEM_LOG_HISTORY_DIRECTORY "data/vendor/radio/logs/history" -#define MODEM_EXTENDED_LOG_DIRECTORY "/data/vendor/radio/extended_logs" -#define RIL_LOG_DIRECTORY "/data/vendor/radio" -#define RIL_LOG_DIRECTORY_PROPERTY "persist.vendor.ril.log.base_dir" -#define RIL_LOG_NUMBER_PROPERTY "persist.vendor.ril.log.num_file" -#define MODEM_LOGGING_PERSIST_PROPERTY "persist.vendor.sys.modem.logging.enable" -#define MODEM_LOGGING_PROPERTY "vendor.sys.modem.logging.enable" -#define MODEM_LOGGING_STATUS_PROPERTY "vendor.sys.modem.logging.status" -#define MODEM_LOGGING_NUMBER_BUGREPORT_PROPERTY "persist.vendor.sys.modem.logging.br_num" -#define MODEM_LOGGING_PATH_PROPERTY "vendor.sys.modem.logging.log_path" -#define GPS_LOG_DIRECTORY "/data/vendor/gps/logs" -#define GPS_LOG_NUMBER_PROPERTY "persist.vendor.gps.aol.log_num" -#define GPS_LOGGING_STATUS_PROPERTY "vendor.gps.aol.enabled" - -#define UFS_BOOTDEVICE "ro.boot.bootdevice" - -#define TCPDUMP_LOG_DIRECTORY "/data/vendor/tcpdump_logger/logs" -#define TCPDUMP_NUMBER_BUGREPORT "persist.vendor.tcpdump.log.br_num" -#define TCPDUMP_PERSIST_PROPERTY "persist.vendor.tcpdump.log.alwayson" - -#define HW_REVISION "ro.boot.hardware.revision" - -using android::os::dumpstate::CommandOptions; -using android::os::dumpstate::DumpFileToFd; -using android::os::dumpstate::PropertiesHelper; -using android::os::dumpstate::RunCommandToFd; - -namespace aidl { -namespace android { -namespace hardware { -namespace dumpstate { - -#define GPS_LOG_PREFIX "gl-" -#define GPS_MCU_LOG_PREFIX "esw-" -#define MODEM_LOG_PREFIX "sbuff_" -#define EXTENDED_LOG_PREFIX "extended_log_" -#define RIL_LOG_PREFIX "rild.log." -#define BUFSIZE 65536 -#define TCPDUMP_LOG_PREFIX "tcpdump" - -typedef std::chrono::time_point timepoint_t; - -const char kVerboseLoggingProperty[] = "persist.vendor.verbose_logging_enabled"; - -void Dumpstate::dumpLogs(int fd, std::string srcDir, std::string destDir, int maxFileNum, - const char *logPrefix) { - struct dirent **dirent_list = NULL; - int num_entries = scandir(srcDir.c_str(), - &dirent_list, - 0, - (int (*)(const struct dirent **, const struct dirent **)) alphasort); - if (!dirent_list) { - return; - } else if (num_entries <= 0) { - return; - } - - int copiedFiles = 0; - - for (int i = num_entries - 1; i >= 0; i--) { - ALOGD("Found %s\n", dirent_list[i]->d_name); - - if (0 != strncmp(dirent_list[i]->d_name, logPrefix, strlen(logPrefix))) { - continue; - } - - if ((copiedFiles >= maxFileNum) && (maxFileNum != -1)) { - ALOGD("Skipped %s\n", dirent_list[i]->d_name); - continue; - } - - copiedFiles++; - - CommandOptions options = CommandOptions::WithTimeout(120).Build(); - std::string srcLogFile = srcDir + "/" + dirent_list[i]->d_name; - std::string destLogFile = destDir + "/" + dirent_list[i]->d_name; - - std::string copyCmd = "/vendor/bin/cp " + srcLogFile + " " + destLogFile; - - ALOGD("Copying %s to %s\n", srcLogFile.c_str(), destLogFile.c_str()); - RunCommandToFd(fd, "CP LOGS", { "/vendor/bin/sh", "-c", copyCmd.c_str() }, options); - } - - while (num_entries--) { - free(dirent_list[num_entries]); - } - - free(dirent_list); -} - -void Dumpstate::dumpRilLogs(int fd, std::string destDir) { - std::string rilLogDir = - ::android::base::GetProperty(RIL_LOG_DIRECTORY_PROPERTY, RIL_LOG_DIRECTORY); - - int maxFileNum = ::android::base::GetIntProperty(RIL_LOG_NUMBER_PROPERTY, 50); - - const std::string currentLogDir = rilLogDir + "/cur"; - const std::string previousLogDir = rilLogDir + "/prev"; - const std::string currentDestDir = destDir + "/cur"; - const std::string previousDestDir = destDir + "/prev"; - - RunCommandToFd(fd, "MKDIR RIL CUR LOG", {"/vendor/bin/mkdir", "-p", currentDestDir.c_str()}, - CommandOptions::WithTimeout(2).Build()); - RunCommandToFd(fd, "MKDIR RIL PREV LOG", {"/vendor/bin/mkdir", "-p", previousDestDir.c_str()}, - CommandOptions::WithTimeout(2).Build()); - - dumpLogs(fd, currentLogDir, currentDestDir, maxFileNum, RIL_LOG_PREFIX); - dumpLogs(fd, previousLogDir, previousDestDir, maxFileNum, RIL_LOG_PREFIX); -} - -void copyFile(std::string srcFile, std::string destFile) { - uint8_t buffer[BUFSIZE]; - ssize_t size; - - int fdSrc = open(srcFile.c_str(), O_RDONLY); - if (fdSrc < 0) { - ALOGD("Failed to open source file %s\n", srcFile.c_str()); - return; - } - - int fdDest = open(destFile.c_str(), O_WRONLY | O_CREAT, 0666); - if (fdDest < 0) { - ALOGD("Failed to open destination file %s\n", destFile.c_str()); - close(fdSrc); - return; - } - - ALOGD("Copying %s to %s\n", srcFile.c_str(), destFile.c_str()); - while ((size = TEMP_FAILURE_RETRY(read(fdSrc, buffer, BUFSIZE))) > 0) { - TEMP_FAILURE_RETRY(write(fdDest, buffer, size)); - } - - close(fdDest); - close(fdSrc); -} - -void dumpNetmgrLogs(std::string destDir) { - const std::vector netmgrLogs - { - "/data/vendor/radio/metrics_data", - "/data/vendor/radio/omadm_logs.txt", - "/data/vendor/radio/power_anomaly_data.txt", - }; - for (const auto& logFile : netmgrLogs) { - copyFile(logFile, destDir + "/" + basename(logFile.c_str())); - } -} - -/** Dumps last synced NV data into bugreports */ -void dumpModemEFS(std::string destDir) { - const std::string EFS_DIRECTORY = "/mnt/vendor/efs/"; - const std::vector nv_files - { - EFS_DIRECTORY+"nv_normal.bin", - EFS_DIRECTORY+"nv_protected.bin", - }; - for (const auto& logFile : nv_files) { - copyFile(logFile, destDir + "/" + basename(logFile.c_str())); - } -} - -timepoint_t startSection(int fd, const std::string §ionName) { - ::android::base::WriteStringToFd( - "\n" - "------ Section start: " + sectionName + " ------\n" - "\n", fd); - return std::chrono::steady_clock::now(); -} - -void endSection(int fd, const std::string §ionName, timepoint_t startTime) { - auto endTime = std::chrono::steady_clock::now(); - auto elapsedMsec = std::chrono::duration_cast - (endTime - startTime).count(); - - ::android::base::WriteStringToFd( - "\n" - "------ Section end: " + sectionName + " ------\n" - "Elapsed msec: " + std::to_string(elapsedMsec) + "\n" - "\n", fd); -} - -// If you are adding a single RunCommandToFd() or DumpFileToFd() call, please -// add it to dumpMiscSection(). But if you are adding multiple items that are -// related to each other - for instance, for a Foo peripheral - please add them -// to a new dump function and include it in this table so it can be accessed from the -// command line, e.g.: -// dumpsys android.hardware.dumpstate.IDumpstateDevice/default foo -// -// However, if your addition generates attachments and/or binary data for the -// bugreport (i.e. if it requires two file descriptors to execute), it must not be -// added to this table and should instead be added to dumpstateBoard() below. - -Dumpstate::Dumpstate() - : mTextSections{ - { "wlan", [this](int fd) { dumpWlanSection(fd); } }, - { "modem", [this](int fd) { dumpModemSection(fd); } }, - { "soc", [this](int fd) { dumpSocSection(fd); } }, - { "storage", [this](int fd) { dumpStorageSection(fd); } }, - { "memory", [this](int fd) { dumpMemorySection(fd); } }, - { "Devfreq", [this](int fd) { dumpDevfreqSection(fd); } }, - { "cpu", [this](int fd) { dumpCpuSection(fd); } }, - { "power", [this](int fd) { dumpPowerSection(fd); } }, - { "thermal", [this](int fd) { dumpThermalSection(fd); } }, - { "touch", [this](int fd) { dumpTouchSection(fd); } }, - { "display", [this](int fd) { dumpDisplaySection(fd); } }, - { "sensors-usf", [this](int fd) { dumpSensorsUSFSection(fd); } }, - { "aoc", [this](int fd) { dumpAoCSection(fd); } }, - { "ramdump", [this](int fd) { dumpRamdumpSection(fd); } }, - { "misc", [this](int fd) { dumpMiscSection(fd); } }, - { "gsc", [this](int fd) { dumpGscSection(fd); } }, - { "trusty", [this](int fd) { dumpTrustySection(fd); } }, - { "led", [this](int fd) { dumpLEDSection(fd); } }, - { "pixel-trace", [this](int fd) { dumpPixelTraceSection(fd); } }, - { "perf-metrics", [this](int fd) { dumpPerfMetricsSection(fd); } }, - { "pcie", [this](int fd) { dumpPCIeSection(fd); } }, - }, - mLogSections{ - { "modem", [this](int fd, const std::string &destDir) { dumpModemLogs(fd, destDir); } }, - { "radio", [this](int fd, const std::string &destDir) { dumpRadioLogs(fd, destDir); } }, - { "camera", [this](int fd, const std::string &destDir) { dumpCameraLogs(fd, destDir); } }, - { "gps", [this](int fd, const std::string &destDir) { dumpGpsLogs(fd, destDir); } }, - { "gxp", [this](int fd, const std::string &destDir) { dumpGxpLogs(fd, destDir); } }, - } { -} - -// Dump data requested by an argument to the "dump" interface, or help info -// if the specified section is not supported. -void Dumpstate::dumpTextSection(int fd, const std::string §ionName) { - bool dumpAll = (sectionName == kAllSections); - - for (const auto §ion : mTextSections) { - if (dumpAll || sectionName == section.first) { - auto startTime = startSection(fd, section.first); - section.second(fd); - endSection(fd, section.first, startTime); - - if (!dumpAll) { - return; - } - } - } - - if (dumpAll) { - return; - } - - // An unsupported section was requested on the command line - ::android::base::WriteStringToFd("Unrecognized text section: " + sectionName + "\n", fd); - ::android::base::WriteStringToFd("Try \"" + kAllSections + "\" or one of the following:", fd); - for (const auto §ion : mTextSections) { - ::android::base::WriteStringToFd(" " + section.first, fd); - } - ::android::base::WriteStringToFd("\nNote: sections with attachments (e.g. modem) are" - "not avalable from the command line.\n", fd); -} - -// Dump items related to wlan -void Dumpstate::dumpWlanSection(int fd) { - // Dump firmware symbol table for firmware log decryption - DumpFileToFd(fd, "WLAN FW Log Symbol Table", "/vendor/firmware/Data.msc"); - RunCommandToFd(fd, "WLAN TWT Dump", {"/vendor/bin/sh", "-c", - "cat /sys/wlan_ptracker/twt/*"}); -} - -// Dump items related to power and battery -void Dumpstate::dumpPowerSection(int fd) { - struct stat buffer; - - RunCommandToFd(fd, "Power Stats Times", {"/vendor/bin/sh", "-c", - "echo -n \"Boot: \" && /vendor/bin/uptime -s && " - "echo -n \"Now: \" && date"}); - - RunCommandToFd(fd, "ACPM stats", {"/vendor/bin/sh", "-c", - "for f in /sys/devices/platform/acpm_stats/*_stats ; do " - "echo \"\\n\\n$f\" ; cat $f ; " - "done"}); - - DumpFileToFd(fd, "CPU PM stats", "/sys/devices/system/cpu/cpupm/cpupm/time_in_state"); - - DumpFileToFd(fd, "GENPD summary", "/d/pm_genpd/pm_genpd_summary"); - - DumpFileToFd(fd, "Power supply property battery", "/sys/class/power_supply/battery/uevent"); - DumpFileToFd(fd, "Power supply property dc", "/sys/class/power_supply/dc/uevent"); - DumpFileToFd(fd, "Power supply property gcpm", "/sys/class/power_supply/gcpm/uevent"); - DumpFileToFd(fd, "Power supply property gcpm_pps", "/sys/class/power_supply/gcpm_pps/uevent"); - DumpFileToFd(fd, "Power supply property main-charger", "/sys/class/power_supply/main-charger/uevent"); - if (!stat("/sys/class/power_supply/pca9468-mains/uevent", &buffer)) { - DumpFileToFd(fd, "Power supply property pca9468-mains", "/sys/class/power_supply/pca9468-mains/uevent"); - } else { - DumpFileToFd(fd, "Power supply property pca94xx-mains", "/sys/class/power_supply/pca94xx-mains/uevent"); - } - DumpFileToFd(fd, "Power supply property tcpm", "/sys/class/power_supply/tcpm-source-psy-i2c-max77759tcpc/uevent"); - DumpFileToFd(fd, "Power supply property usb", "/sys/class/power_supply/usb/uevent"); - DumpFileToFd(fd, "Power supply property wireless", "/sys/class/power_supply/wireless/uevent"); - if (!stat("/sys/class/power_supply/maxfg", &buffer)) { - DumpFileToFd(fd, "Power supply property maxfg", "/sys/class/power_supply/maxfg/uevent"); - DumpFileToFd(fd, "m5_state", "/sys/class/power_supply/maxfg/m5_model_state"); - DumpFileToFd(fd, "maxfg", "/dev/logbuffer_maxfg"); - DumpFileToFd(fd, "maxfg", "/dev/logbuffer_maxfg_monitor"); - } else { - DumpFileToFd(fd, "Power supply property maxfg_base", "/sys/class/power_supply/maxfg_base/uevent"); - DumpFileToFd(fd, "Power supply property maxfg_secondary", "/sys/class/power_supply/maxfg_secondary/uevent"); - DumpFileToFd(fd, "m5_state", "/sys/class/power_supply/maxfg_base/m5_model_state"); - DumpFileToFd(fd, "maxfg_base", "/dev/logbuffer_maxfg_base"); - DumpFileToFd(fd, "maxfg_secondary", "/dev/logbuffer_maxfg_secondary"); - DumpFileToFd(fd, "maxfg_base", "/dev/logbuffer_maxfg_base_monitor"); - DumpFileToFd(fd, "maxfg_secondary", "/dev/logbuffer_maxfg_secondary_monitor"); - DumpFileToFd(fd, "google_dual_batt", "/dev/logbuffer_dual_batt"); - } - - if (!stat("/dev/maxfg_history", &buffer)) { - DumpFileToFd(fd, "Maxim FG History", "/dev/maxfg_history"); - } - - if (!stat("/sys/class/power_supply/dock", &buffer)) { - DumpFileToFd(fd, "Power supply property dock", "/sys/class/power_supply/dock/uevent"); - } - - if (!stat("/dev/logbuffer_tcpm", &buffer)) { - DumpFileToFd(fd, "Logbuffer TCPM", "/dev/logbuffer_tcpm"); - } else if (!PropertiesHelper::IsUserBuild()) { - if (!stat("/sys/kernel/debug/tcpm", &buffer)) { - RunCommandToFd(fd, "TCPM logs", {"/vendor/bin/sh", "-c", "cat /sys/kernel/debug/tcpm/*"}); - } else { - RunCommandToFd(fd, "TCPM logs", {"/vendor/bin/sh", "-c", "cat /sys/kernel/debug/usb/tcpm*"}); - } - } - - RunCommandToFd(fd, "TCPC", {"/vendor/bin/sh", "-c", - "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"}); - - DumpFileToFd(fd, "PD Engine", "/dev/logbuffer_usbpd"); - DumpFileToFd(fd, "POGO Transport", "/dev/logbuffer_pogo_transport"); - DumpFileToFd(fd, "PPS-google_cpm", "/dev/logbuffer_cpm"); - DumpFileToFd(fd, "PPS-dc", "/dev/logbuffer_pca9468"); - - DumpFileToFd(fd, "Battery Health", "/sys/class/power_supply/battery/health_index_stats"); - DumpFileToFd(fd, "BMS", "/dev/logbuffer_ssoc"); - DumpFileToFd(fd, "TTF", "/dev/logbuffer_ttf"); - DumpFileToFd(fd, "TTF details", "/sys/class/power_supply/battery/ttf_details"); - DumpFileToFd(fd, "TTF stats", "/sys/class/power_supply/battery/ttf_stats"); - DumpFileToFd(fd, "aacr_state", "/sys/class/power_supply/battery/aacr_state"); - DumpFileToFd(fd, "maxq", "/dev/logbuffer_maxq"); - DumpFileToFd(fd, "TEMP/DOCK-DEFEND", "/dev/logbuffer_bd"); - - RunCommandToFd(fd, "TRICKLE-DEFEND Config", {"/vendor/bin/sh", "-c", - " cd /sys/devices/platform/google,battery/power_supply/battery/;" - " for f in `ls bd_*` ; do echo \"$f: `cat $f`\" ; done"}); - - RunCommandToFd(fd, "DWELL-DEFEND Config", {"/vendor/bin/sh", "-c", - " cd /sys/devices/platform/google,charger/;" - " for f in `ls charge_s*` ; do echo \"$f: `cat $f`\" ; done"}); - - RunCommandToFd(fd, "TEMP-DEFEND Config", {"/vendor/bin/sh", "-c", - " cd /sys/devices/platform/google,charger/;" - " for f in `ls bd_*` ; do echo \"$f: `cat $f`\" ; done"}); - - if (!PropertiesHelper::IsUserBuild()) { - DumpFileToFd(fd, "DC_registers dump", "/sys/class/power_supply/pca94xx-mains/device/registers_dump"); - DumpFileToFd(fd, "max77759_chg registers dump", "/d/max77759_chg/registers"); - DumpFileToFd(fd, "max77729_pmic registers dump", "/d/max77729_pmic/registers"); - DumpFileToFd(fd, "Charging table dump", "/d/google_battery/chg_raw_profile"); - - RunCommandToFd(fd, "fg_model", {"/vendor/bin/sh", "-c", - "for f in /d/maxfg* ; do " - "regs=`cat $f/fg_model`; echo $f: ;" - "echo \"$regs\"; done"}); - - RunCommandToFd(fd, "fg_alo_ver", {"/vendor/bin/sh", "-c", - "for f in /d/maxfg* ; do " - "regs=`cat $f/algo_ver`; echo $f: ;" - "echo \"$regs\"; done"}); - - RunCommandToFd(fd, "fg_model_ok", {"/vendor/bin/sh", "-c", - "for f in /d/maxfg* ; do " - "regs=`cat $f/model_ok`; echo $f: ;" - "echo \"$regs\"; done"}); - - /* FG Registers */ - RunCommandToFd(fd, "fg registers", {"/vendor/bin/sh", "-c", - "for f in /d/maxfg* ; do " - "regs=`cat $f/registers`; echo $f: ;" - "echo \"$regs\"; done"}); - - RunCommandToFd(fd, "Maxim FG NV RAM", {"/vendor/bin/sh", "-c", - "for f in /d/maxfg* ; do " - "regs=`cat $f/nv_registers`; echo $f: ;" - "echo \"$regs\"; done"}); - } - - /* EEPROM State */ - if (!stat("/sys/devices/platform/10970000.hsi2c/i2c-4/4-0050/eeprom", &buffer)) { - RunCommandToFd(fd, "Battery EEPROM", {"/vendor/bin/sh", "-c", "xxd /sys/devices/platform/10970000.hsi2c/i2c-4/4-0050/eeprom"}); - } else if (!stat("/sys/devices/platform/10970000.hsi2c/i2c-5/5-0050/eeprom", &buffer)) { - RunCommandToFd(fd, "Battery EEPROM", {"/vendor/bin/sh", "-c", "xxd /sys/devices/platform/10970000.hsi2c/i2c-5/5-0050/eeprom"}); - } else if (!stat("/sys/devices/platform/10da0000.hsi2c/i2c-5/5-0050/eeprom", &buffer)) { - RunCommandToFd(fd, "Battery EEPROM", {"/vendor/bin/sh", "-c", "xxd /sys/devices/platform/10da0000.hsi2c/i2c-5/5-0050/eeprom"}); - } else if (!stat("/sys/devices/platform/10da0000.hsi2c/i2c-6/6-0050/eeprom", &buffer)) { - RunCommandToFd(fd, "Battery EEPROM", {"/vendor/bin/sh", "-c", "xxd /sys/devices/platform/10da0000.hsi2c/i2c-6/6-0050/eeprom"}); - } else if (!stat("/sys/devices/platform/10da0000.hsi2c/i2c-7/7-0050/eeprom", &buffer)) { - RunCommandToFd(fd, "Battery EEPROM", {"/vendor/bin/sh", "-c", "xxd /sys/devices/platform/10da0000.hsi2c/i2c-7/7-0050/eeprom"}); - } - - DumpFileToFd(fd, "Charger Stats", "/sys/class/power_supply/battery/charge_details"); - if (!PropertiesHelper::IsUserBuild()) { - RunCommandToFd(fd, "Google Charger", {"/vendor/bin/sh", "-c", "cd /sys/kernel/debug/google_charger/; " - "for f in `ls pps_*` ; do echo \"$f: `cat $f`\" ; done"}); - RunCommandToFd(fd, "Google Battery", {"/vendor/bin/sh", "-c", "cd /sys/kernel/debug/google_battery/; " - "for f in `ls ssoc_*` ; do echo \"$f: `cat $f`\" ; done"}); - } - - DumpFileToFd(fd, "WLC logs", "/dev/logbuffer_wireless"); - DumpFileToFd(fd, "WLC VER", "/sys/class/power_supply/wireless/device/version"); - DumpFileToFd(fd, "WLC STATUS", "/sys/class/power_supply/wireless/device/status"); - DumpFileToFd(fd, "WLC FW Version", "/sys/class/power_supply/wireless/device/fw_rev"); - DumpFileToFd(fd, "RTX", "/dev/logbuffer_rtx"); - - if (!PropertiesHelper::IsUserBuild()) { - RunCommandToFd(fd, "gvotables", {"/vendor/bin/sh", "-c", "cat /sys/kernel/debug/gvotables/*/status"}); - } - DumpFileToFd(fd, "Lastmeal", "/data/vendor/mitigation/lastmeal.txt"); - DumpFileToFd(fd, "Thismeal", "/data/vendor/mitigation/thismeal.txt"); - RunCommandToFd(fd, "Mitigation Stats", {"/vendor/bin/sh", "-c", "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"}); - RunCommandToFd(fd, "Clock Divider Ratio", {"/vendor/bin/sh", "-c", "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"}); - RunCommandToFd(fd, "Clock Stats", {"/vendor/bin/sh", "-c", "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"}); - RunCommandToFd(fd, "Triggered Level", {"/vendor/bin/sh", "-c", "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"}); - RunCommandToFd(fd, "Instruction", {"/vendor/bin/sh", "-c", - "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"}); - -} - -// Dump items related to thermal -void Dumpstate::dumpThermalSection(int fd) { - RunCommandToFd(fd, "Temperatures", {"/vendor/bin/sh", "-c", - "for f in /sys/class/thermal/thermal* ; do " - "type=`cat $f/type` ; temp=`cat $f/temp` ; echo \"$type: $temp\" ; " - "done"}); - RunCommandToFd(fd, "Cooling Device Current State", {"/vendor/bin/sh", "-c", - "for f in /sys/class/thermal/cooling* ; do " - "type=`cat $f/type` ; temp=`cat $f/cur_state` ; echo \"$type: $temp\" ; " - "done"}); - RunCommandToFd(fd, "Cooling Device User Vote State", {"/vendor/bin/sh", "-c", - "for f in /sys/class/thermal/cooling* ; do " - "if [ ! -f $f/user_vote ]; then continue; fi; " - "type=`cat $f/type` ; temp=`cat $f/user_vote` ; echo \"$type: $temp\" ; " - "done"}); - RunCommandToFd(fd, "Cooling Device Time in State", {"/vendor/bin/sh", "-c", "for f in /sys/class/thermal/cooling* ; " - "do type=`cat $f/type` ; temp=`cat $f/stats/time_in_state_ms` ; echo \"$type:\n$temp\" ; done"}); - RunCommandToFd(fd, "Cooling Device Trans Table", {"/vendor/bin/sh", "-c", "for f in /sys/class/thermal/cooling* ; " - "do type=`cat $f/type` ; temp=`cat $f/stats/trans_table` ; echo \"$type:\n$temp\" ; done"}); - RunCommandToFd(fd, "Cooling Device State2Power Table", {"/vendor/bin/sh", "-c", - "for f in /sys/class/thermal/cooling* ; do " - "if [ ! -f $f/state2power_table ]; then continue; fi; " - "type=`cat $f/type` ; state2power_table=`cat $f/state2power_table` ; echo \"$type: $state2power_table\" ; " - "done"}); - DumpFileToFd(fd, "TMU state:", "/sys/module/gs_thermal/parameters/tmu_reg_dump_state"); - DumpFileToFd(fd, "TMU current temperature:", "/sys/module/gs_thermal/parameters/tmu_reg_dump_current_temp"); - DumpFileToFd(fd, "TMU_TOP rise thresholds:", "/sys/module/gs_thermal/parameters/tmu_top_reg_dump_rise_thres"); - DumpFileToFd(fd, "TMU_TOP fall thresholds:", "/sys/module/gs_thermal/parameters/tmu_top_reg_dump_fall_thres"); - DumpFileToFd(fd, "TMU_SUB rise thresholds:", "/sys/module/gs_thermal/parameters/tmu_sub_reg_dump_rise_thres"); - DumpFileToFd(fd, "TMU_SUB fall thresholds:", "/sys/module/gs_thermal/parameters/tmu_sub_reg_dump_fall_thres"); - DumpFileToFd(fd, "Temperature Residency Metrics:", "/sys/kernel/metrics/temp_residency/temp_residency_all/stats"); -} - -// Dump items related to touch -void Dumpstate::dumpTouchSection(int fd) { - const char stm_cmd_path[4][50] = {"/sys/class/spi_master/spi11/spi11.0", - "/proc/fts/driver_test", - "/sys/class/spi_master/spi6/spi6.0", - "/proc/fts_ext/driver_test"}; - const char fst2_cmd_path[2][50] = {"/sys/class/spi_master/spi0/spi0.0", - "/proc/fts/driver_test"}; - const char lsi_spi_path[] = "/sys/devices/virtual/sec/tsp"; - const char syna_cmd_path[] = "/sys/class/spi_master/spi0/spi0.0/synaptics_tcm.0/sysfs"; - const char focaltech_cmd_path[] = "/proc/focaltech_touch"; - const char gti0_cmd_path[] = "/sys/devices/virtual/goog_touch_interface/gti.0"; - const char gti0_procfs_path[] = "/proc/goog_touch_interface/gti.0"; - char cmd[256]; - - if (!access(focaltech_cmd_path, R_OK)) { - ::android::base::WriteStringToFd("\n<<<<<< FOCALTECH >>>>>>\n\n", fd); - - // Enable: force touch active - snprintf(cmd, sizeof(cmd), "echo 21 > %s/force_active", focaltech_cmd_path); - RunCommandToFd(fd, "Enable Force Touch Active", {"/vendor/bin/sh", "-c", cmd}); - - // Touch Firmware Version - snprintf(cmd, sizeof(cmd), "%s/FW_Version", focaltech_cmd_path); - DumpFileToFd(fd, "Touch Firmware Version", cmd); - - // Touch INT PIN Test - snprintf(cmd, sizeof(cmd), "%s/INT_PIN", focaltech_cmd_path); - DumpFileToFd(fd, "Touch INT PIN Test", cmd); - - // Get Raw Data - Delta - snprintf(cmd, sizeof(cmd), "%s/selftest/Panel_Differ", focaltech_cmd_path); - DumpFileToFd(fd, "Get Raw Data - Panel_Differ", cmd); - - // Get Raw Data - Raw - snprintf(cmd, sizeof(cmd), "%s/selftest/Rawdata", focaltech_cmd_path); - DumpFileToFd(fd, "Get Raw Data - Raw", cmd); - - // Get Raw Data - Baseline - snprintf(cmd, sizeof(cmd), "%s/selftest/Baseline", focaltech_cmd_path); - DumpFileToFd(fd, "Get Raw Data - Baseline", cmd); - - // Get Raw Data - Noise - snprintf(cmd, sizeof(cmd), "%s/selftest/Noise", focaltech_cmd_path); - DumpFileToFd(fd, "Get Raw Data - Noise", cmd); - - // Get Raw Data - Uniformity - snprintf(cmd, sizeof(cmd), "%s/selftest/Rawdata_Uniformity", focaltech_cmd_path); - DumpFileToFd(fd, "Get Raw Data - Uniformity", cmd); - - // Get Scap_CB - snprintf(cmd, sizeof(cmd), "%s/selftest/Scap_CB", focaltech_cmd_path); - DumpFileToFd(fd, "Get Scap_CB", cmd); - - // Get Scap_CB - Raw - snprintf(cmd, sizeof(cmd), "%s/selftest/Scap_Rawdata", focaltech_cmd_path); - DumpFileToFd(fd, "Get Scap_Rawdata", cmd); - - // Get Short Test - snprintf(cmd, sizeof(cmd), "%s/selftest/Short", focaltech_cmd_path); - DumpFileToFd(fd, "Get Short Test", cmd); - - // Get HeatMap(ms,ss) - snprintf(cmd, sizeof(cmd), "%s/selftest/Strength", focaltech_cmd_path); - DumpFileToFd(fd, "Get HeatMap(ms,ss)", cmd); - - // Disable: force touch active - snprintf(cmd, sizeof(cmd), "echo 20 > %s/force_active", focaltech_cmd_path); - RunCommandToFd(fd, "Disable Force Touch Active", {"/vendor/bin/sh", "-c", cmd}); - } - - if (!access(syna_cmd_path, R_OK)) { - ::android::base::WriteStringToFd("\n<<<<<< SYNA >>>>>>\n\n", fd); - - // Enable: force touch active - snprintf(cmd, sizeof(cmd), "echo 21 > %s/force_active", syna_cmd_path); - RunCommandToFd(fd, "Enable Force Touch Active", {"/vendor/bin/sh", "-c", cmd}); - - // Touch Firmware Information - snprintf(cmd, sizeof(cmd), "%s/info", syna_cmd_path); - DumpFileToFd(fd, "Touch Firmware Information", cmd); - - // Get Raw Data - Delta - snprintf(cmd, sizeof(cmd), - "echo 12 > %s/get_raw_data && cat %s/get_raw_data", syna_cmd_path, syna_cmd_path); - RunCommandToFd(fd, "Get Raw Data - Delta", {"/vendor/bin/sh", "-c", cmd}); - - // Get Raw Data - Raw - snprintf(cmd, sizeof(cmd), - "echo 13 > %s/get_raw_data && cat %s/get_raw_data", syna_cmd_path, syna_cmd_path); - RunCommandToFd(fd, "Get Raw Data - Raw", {"/vendor/bin/sh", "-c", cmd}); - - // Get Raw Data - Baseline - snprintf(cmd, sizeof(cmd), - "echo 14 > %s/get_raw_data && cat %s/get_raw_data", syna_cmd_path, syna_cmd_path); - RunCommandToFd(fd, "Get Raw Data - Baseline", {"/vendor/bin/sh", "-c", cmd}); - - // Disable: force touch active - snprintf(cmd, sizeof(cmd), "echo 20 > %s/force_active", syna_cmd_path); - RunCommandToFd(fd, "Disable Force Touch Active", {"/vendor/bin/sh", "-c", cmd}); - } - - for (int i = 0; i < 4; i += 2) { // ftm5 - snprintf(cmd, sizeof(cmd), "%s", stm_cmd_path[i]); - if (access(cmd, R_OK)) - continue; - ::android::base::WriteStringToFd("\n<<<<<< FTM5 >>>>>>\n\n", fd); - - snprintf(cmd, sizeof(cmd), "%s", stm_cmd_path[i + 1]); - if (!access(cmd, R_OK)) { - snprintf(cmd, sizeof(cmd), "echo A0 01 01 > %s", stm_cmd_path[i + 1]); - RunCommandToFd(fd, "Force Set AP as Bus Owner with Bugreport Flag", - {"/vendor/bin/sh", "-c", cmd}); - } - - snprintf(cmd, sizeof(cmd), "%s/appid", stm_cmd_path[i]); - if (!access(cmd, R_OK)) { - // Touch firmware version - DumpFileToFd(fd, "STM touch firmware version", cmd); - - // Touch controller status - snprintf(cmd, sizeof(cmd), "%s/status", stm_cmd_path[i]); - DumpFileToFd(fd, "STM touch status", cmd); - - // Mutual raw data - snprintf(cmd, sizeof(cmd), - "echo 13 00 01 > %s/stm_fts_cmd && cat %s/stm_fts_cmd", - stm_cmd_path[i], stm_cmd_path[i]); - RunCommandToFd(fd, "Mutual Raw", {"/vendor/bin/sh", "-c", cmd}); - - // Mutual strength data - snprintf(cmd, sizeof(cmd), - "echo 17 01 > %s/stm_fts_cmd && cat %s/stm_fts_cmd", - stm_cmd_path[i], stm_cmd_path[i]); - RunCommandToFd(fd, "Mutual Strength", {"/vendor/bin/sh", "-c", cmd}); - - // Self raw data - snprintf(cmd, sizeof(cmd), - "echo 15 00 01 > %s/stm_fts_cmd && cat %s/stm_fts_cmd", - stm_cmd_path[i], stm_cmd_path[i]); - RunCommandToFd(fd, "Self Raw", {"/vendor/bin/sh", "-c", cmd}); - } - - snprintf(cmd, sizeof(cmd), "%s", stm_cmd_path[i + 1]); - if (!access(cmd, R_OK)) { - snprintf(cmd, sizeof(cmd), "echo 23 00 > %s && cat %s", - stm_cmd_path[i + 1], stm_cmd_path[i + 1]); - RunCommandToFd(fd, "Mutual Raw Data", - {"/vendor/bin/sh", "-c", cmd}); - - snprintf(cmd, sizeof(cmd), "echo 23 03 > %s && cat %s", - stm_cmd_path[i + 1], stm_cmd_path[i + 1]); - RunCommandToFd(fd, "Mutual Baseline Data", - {"/vendor/bin/sh", "-c", cmd}); - - snprintf(cmd, sizeof(cmd), "echo 23 02 > %s && cat %s", - stm_cmd_path[i + 1], stm_cmd_path[i + 1]); - RunCommandToFd(fd, "Mutual Strength Data", - {"/vendor/bin/sh", "-c", cmd}); - - snprintf(cmd, sizeof(cmd), "echo 24 00 > %s && cat %s", - stm_cmd_path[i + 1], stm_cmd_path[i + 1]); - RunCommandToFd(fd, "Self Raw Data", - {"/vendor/bin/sh", "-c", cmd}); - - snprintf(cmd, sizeof(cmd), "echo 24 03 > %s && cat %s", - stm_cmd_path[i + 1], stm_cmd_path[i + 1]); - RunCommandToFd(fd, "Self Baseline Data", - {"/vendor/bin/sh", "-c", cmd}); - - snprintf(cmd, sizeof(cmd), "echo 24 02 > %s && cat %s", - stm_cmd_path[i + 1], stm_cmd_path[i + 1]); - RunCommandToFd(fd, "Self Strength Data", - {"/vendor/bin/sh", "-c", cmd}); - - snprintf(cmd, sizeof(cmd), "echo 32 10 > %s && cat %s", - stm_cmd_path[i + 1], stm_cmd_path[i + 1]); - RunCommandToFd(fd, "Mutual Compensation", - {"/vendor/bin/sh", "-c", cmd}); - - snprintf(cmd, sizeof(cmd), "echo 32 11 > %s && cat %s", - stm_cmd_path[i + 1], stm_cmd_path[i + 1]); - RunCommandToFd(fd, "Mutual Low Power Compensation", - {"/vendor/bin/sh", "-c", cmd}); - - snprintf(cmd, sizeof(cmd), "echo 33 12 > %s && cat %s", - stm_cmd_path[i + 1], stm_cmd_path[i + 1]); - RunCommandToFd(fd, "Self Compensation", - {"/vendor/bin/sh", "-c", cmd}); - - snprintf(cmd, sizeof(cmd), "echo 34 > %s && cat %s", - stm_cmd_path[i + 1], stm_cmd_path[i + 1]); - RunCommandToFd(fd, "Golden Mutual Raw Data", - {"/vendor/bin/sh", "-c", cmd}); - - snprintf(cmd, sizeof(cmd), "echo 01 FA 20 00 00 24 80 > %s", - stm_cmd_path[i + 1]); - RunCommandToFd(fd, "Packaging Plant - HW reset", - {"/vendor/bin/sh", "-c", cmd}); - snprintf(cmd, sizeof(cmd), "echo 01 FA 20 00 00 68 08 > %s", - stm_cmd_path[i + 1]); - RunCommandToFd(fd, "Packaging Plant - Hibernate Memory", - {"/vendor/bin/sh", "-c", cmd}); - snprintf(cmd, sizeof(cmd), - "echo 02 FB 00 04 3F D8 00 10 01 > %s && cat %s", - stm_cmd_path[i + 1], stm_cmd_path[i + 1]); - RunCommandToFd(fd, "Packaging Plant - Read 16 bytes from Address 0x00041FD8", - {"/vendor/bin/sh", "-c", cmd}); - } - - snprintf(cmd, sizeof(cmd), "%s/stm_fts_cmd", stm_cmd_path[i]); - if (!access(cmd, R_OK)) { - // ITO raw data - snprintf(cmd, sizeof(cmd), - "echo 01 > %s/stm_fts_cmd && cat %s/stm_fts_cmd", - stm_cmd_path[i], stm_cmd_path[i]); - RunCommandToFd(fd, "ITO Raw", {"/vendor/bin/sh", "-c", cmd}); - } - - snprintf(cmd, sizeof(cmd), "%s", stm_cmd_path[i + 1]); - if (!access(cmd, R_OK)) { - snprintf(cmd, sizeof(cmd), "echo A0 00 01 > %s", stm_cmd_path[i + 1]); - RunCommandToFd(fd, "Restore Bus Owner", - {"/vendor/bin/sh", "-c", cmd}); - } - } - - for (int i = 0; i < 2; i += 2) { // fst2 - snprintf(cmd, sizeof(cmd), "%s", fst2_cmd_path[i]); - if (!access(cmd, R_OK)) { - ::android::base::WriteStringToFd("\n<<<<<< FST2 >>>>>>\n\n", fd); - - snprintf(cmd, sizeof(cmd), "%s", fst2_cmd_path[i + 1]); - if (!access(cmd, R_OK)) { - // Enable: force touch active - snprintf(cmd, sizeof(cmd), "echo 21 01 > %s", fst2_cmd_path[i + 1]); - RunCommandToFd(fd, "Force Set AP as Bus Owner with Bugreport Flag", - {"/vendor/bin/sh", "-c", cmd}); - - // Golden Mutual Raw Data - snprintf(cmd, sizeof(cmd), "echo 0B 00 23 40 > %s;" - "echo 02 B7 00 10 04 E0 01 > %s ; cat %s;" - "echo 02 B7 04 F0 04 E0 01 > %s ; cat %s;", - fst2_cmd_path[i + 1], fst2_cmd_path[i + 1], fst2_cmd_path[i + 1], - fst2_cmd_path[i + 1], fst2_cmd_path[i + 1]); - RunCommandToFd(fd, "Golden Mutual Raw Data", {"/vendor/bin/sh", "-c", cmd}); - - // Restore Bus Owner - snprintf(cmd, sizeof(cmd), "echo 21 00 > %s", fst2_cmd_path[i + 1]); - RunCommandToFd(fd, "Restore Bus Owner", {"/vendor/bin/sh", "-c", cmd}); - } - } - } - - if (!access(lsi_spi_path, R_OK)) { - ::android::base::WriteStringToFd("\n<<<<<< LSI >>>>>>\n\n", fd); - - // Enable: force touch active - snprintf(cmd, sizeof(cmd), - "echo %s > %s/cmd && cat %s/cmd_result", - "force_touch_active,1", - lsi_spi_path, lsi_spi_path); - RunCommandToFd(fd, "Force Touch Active", {"/vendor/bin/sh", "-c", cmd}); - - // Firmware info - snprintf(cmd, sizeof(cmd), "%s/fw_version", lsi_spi_path); - DumpFileToFd(fd, "LSI firmware version", cmd); - - // Touch status - snprintf(cmd, sizeof(cmd), "%s/status", lsi_spi_path); - DumpFileToFd(fd, "LSI touch status", cmd); - - // Calibration info - snprintf(cmd, sizeof(cmd), - "echo %s > %s/cmd && cat %s/cmd_result", - "get_mis_cal_info", - lsi_spi_path, lsi_spi_path); - RunCommandToFd(fd, "Calibration info", {"/vendor/bin/sh", "-c", cmd}); - - // Mutual strength - snprintf(cmd, sizeof(cmd), - "echo %s > %s/cmd && cat %s/cmd_result", - "run_delta_read_all", - lsi_spi_path, lsi_spi_path); - RunCommandToFd(fd, "Mutual Strength", {"/vendor/bin/sh", "-c", cmd}); - - // Self strength - snprintf(cmd, sizeof(cmd), - "echo %s > %s/cmd && cat %s/cmd_result", - "run_self_delta_read_all", - lsi_spi_path, lsi_spi_path); - RunCommandToFd(fd, "Self Strength", {"/vendor/bin/sh", "-c", cmd}); - - // Raw cap - snprintf(cmd, sizeof(cmd), - "echo %s > %s/cmd && cat %s/cmd_result", - "run_rawcap_read_all", - lsi_spi_path, lsi_spi_path); - RunCommandToFd(fd, "Mutual Raw Cap", {"/vendor/bin/sh", "-c", cmd}); - - // Self raw cap - snprintf(cmd, sizeof(cmd), - "echo %s > %s/cmd && cat %s/cmd_result", - "run_self_rawcap_read_all", - lsi_spi_path, lsi_spi_path); - RunCommandToFd(fd, "Self Raw Cap", {"/vendor/bin/sh", "-c", cmd}); - - // TYPE_AMBIENT_DATA - snprintf(cmd, sizeof(cmd), - "echo %s > %s/cmd && cat %s/cmd_result", - "run_rawdata_read_type,3", - lsi_spi_path, lsi_spi_path); - RunCommandToFd(fd, "TYPE_AMBIENT_DATA", {"/vendor/bin/sh", "-c", cmd}); - - // TYPE_DECODED_DATA - snprintf(cmd, sizeof(cmd), - "echo %s > %s/cmd && cat %s/cmd_result", - "run_rawdata_read_type,5", - lsi_spi_path, lsi_spi_path); - RunCommandToFd(fd, "TYPE_DECODED_DATA", {"/vendor/bin/sh", "-c", cmd}); - - // TYPE_NOI_P2P_MIN - snprintf(cmd, sizeof(cmd), - "echo %s > %s/cmd && cat %s/cmd_result", - "run_rawdata_read_type,30", - lsi_spi_path, lsi_spi_path); - RunCommandToFd(fd, "TYPE_NOI_P2P_MIN", {"/vendor/bin/sh", "-c", cmd}); - - // TYPE_NOI_P2P_MAX - snprintf(cmd, sizeof(cmd), - "echo %s > %s/cmd && cat %s/cmd_result", - "run_rawdata_read_type,31", - lsi_spi_path, lsi_spi_path); - RunCommandToFd(fd, "TYPE_NOI_P2P_MAX", {"/vendor/bin/sh", "-c", cmd}); - - // Disable: force touch active - snprintf(cmd, sizeof(cmd), - "echo %s > %s/cmd && cat %s/cmd_result", - "force_touch_active,0", - lsi_spi_path, lsi_spi_path); - RunCommandToFd(fd, "Force Touch Active", {"/vendor/bin/sh", "-c", cmd}); - } - - if (!access(gti0_cmd_path, R_OK)) { - const char *heatmap_path = gti0_cmd_path; - - if (!access(gti0_procfs_path, R_OK)) - heatmap_path = gti0_procfs_path; - ::android::base::WriteStringToFd("\n<<<<<< GTI0 >>>>>>\n\n", fd); - - // Enable: force touch active - snprintf(cmd, sizeof(cmd), "echo 1 > %s/force_active", gti0_cmd_path); - RunCommandToFd(fd, "Force Touch Active", {"/vendor/bin/sh", "-c", cmd}); - - // Touch Firmware Version - snprintf(cmd, sizeof(cmd), "%s/fw_ver", gti0_cmd_path); - DumpFileToFd(fd, "Touch Firmware Version", cmd); - - // Get Mutual Sensing Data - Baseline - snprintf(cmd, sizeof(cmd), "cat %s/ms_base", heatmap_path); - RunCommandToFd(fd, "Get Mutual Sensing Data - Baseline", {"/vendor/bin/sh", "-c", cmd}); - - // Get Mutual Sensing Data - Delta - snprintf(cmd, sizeof(cmd), "cat %s/ms_diff", heatmap_path); - RunCommandToFd(fd, "Get Mutual Sensing Data - Delta", {"/vendor/bin/sh", "-c", cmd}); - - // Get Mutual Sensing Data - Raw - snprintf(cmd, sizeof(cmd), "cat %s/ms_raw", heatmap_path); - RunCommandToFd(fd, "Get Mutual Sensing Data - Raw", {"/vendor/bin/sh", "-c", cmd}); - - // Get Self Sensing Data - Baseline - snprintf(cmd, sizeof(cmd), "cat %s/ss_base", heatmap_path); - RunCommandToFd(fd, "Get Self Sensing Data - Baseline", {"/vendor/bin/sh", "-c", cmd}); - - // Get Self Sensing Data - Delta - snprintf(cmd, sizeof(cmd), "cat %s/ss_diff", heatmap_path); - RunCommandToFd(fd, "Get Self Sensing Data - Delta", {"/vendor/bin/sh", "-c", cmd}); - - // Get Self Sensing Data - Raw - snprintf(cmd, sizeof(cmd), "cat %s/ss_raw", heatmap_path); - RunCommandToFd(fd, "Get Self Sensing Data - Raw", {"/vendor/bin/sh", "-c", cmd}); - - // Self Test - snprintf(cmd, sizeof(cmd), "cat %s/self_test", gti0_cmd_path); - RunCommandToFd(fd, "Self Test", {"/vendor/bin/sh", "-c", cmd}); - - // Disable: force touch active - snprintf(cmd, sizeof(cmd), "echo 0 > %s/force_active", gti0_cmd_path); - RunCommandToFd(fd, "Disable Force Touch Active", {"/vendor/bin/sh", "-c", cmd}); - } -} - -// Dump items related to SoC -void Dumpstate::dumpSocSection(int fd) { - DumpFileToFd(fd, "AP HW TUNE", "/sys/devices/system/chip-id/ap_hw_tune_str"); - DumpFileToFd(fd, "EVT VERSION", "/sys/devices/system/chip-id/evt_ver"); - DumpFileToFd(fd, "LOT ID", "/sys/devices/system/chip-id/lot_id"); - DumpFileToFd(fd, "PRODUCT ID", "/sys/devices/system/chip-id/product_id"); - DumpFileToFd(fd, "REVISION", "/sys/devices/system/chip-id/revision"); - DumpFileToFd(fd, "RAW STR", "/sys/devices/system/chip-id/raw_str"); -} - -// Dump items related to CPUs -void Dumpstate::dumpCpuSection(int fd) { - DumpFileToFd(fd, "CPU present", "/sys/devices/system/cpu/present"); - DumpFileToFd(fd, "CPU online", "/sys/devices/system/cpu/online"); - RunCommandToFd(fd, "CPU time-in-state", {"/vendor/bin/sh", "-c", - "for cpu in /sys/devices/system/cpu/cpu*; do " - "f=$cpu/cpufreq/stats/time_in_state; " - "if [ ! -f $f ]; then continue; fi; " - "echo $f:; cat $f; " - "done"}); - RunCommandToFd(fd, "CPU cpuidle", {"/vendor/bin/sh", "-c", - "for cpu in /sys/devices/system/cpu/cpu*; do " - "for d in $cpu/cpuidle/state*; do " - "if [ ! -d $d ]; then continue; fi; " - "echo \"$d: `cat $d/name` `cat $d/desc` `cat $d/time` `cat $d/usage`\"; " - "done; " - "done"}); - DumpFileToFd(fd, "INTERRUPTS", "/proc/interrupts"); -} - -// Dump items related to Devfreq & BTS -void Dumpstate::dumpDevfreqSection(int fd) { - DumpFileToFd(fd, "MIF DVFS", - "/sys/devices/platform/17000010.devfreq_mif/devfreq/17000010.devfreq_mif/time_in_state"); - DumpFileToFd(fd, "INT DVFS", - "/sys/devices/platform/17000020.devfreq_int/devfreq/17000020.devfreq_int/time_in_state"); - DumpFileToFd(fd, "INTCAM DVFS", - "/sys/devices/platform/17000030.devfreq_intcam/devfreq/17000030.devfreq_intcam/time_in_state"); - DumpFileToFd(fd, "DISP DVFS", - "/sys/devices/platform/17000040.devfreq_disp/devfreq/17000040.devfreq_disp/time_in_state"); - DumpFileToFd(fd, "CAM DVFS", - "/sys/devices/platform/17000050.devfreq_cam/devfreq/17000050.devfreq_cam/time_in_state"); - DumpFileToFd(fd, "TNR DVFS", - "/sys/devices/platform/17000060.devfreq_tnr/devfreq/17000060.devfreq_tnr/time_in_state"); - DumpFileToFd(fd, "MFC DVFS", - "/sys/devices/platform/17000070.devfreq_mfc/devfreq/17000070.devfreq_mfc/time_in_state"); - DumpFileToFd(fd, "BO DVFS", - "/sys/devices/platform/17000080.devfreq_bo/devfreq/17000080.devfreq_bo/time_in_state"); - DumpFileToFd(fd, "BTS stats", "/sys/devices/platform/exynos-bts/bts_stats"); -} - -// Dump items related to memory -void Dumpstate::dumpMemorySection(int fd) { - RunCommandToFd(fd, "ION HEAPS", {"/vendor/bin/sh", "-c", - "for d in $(ls -d /d/ion/*); do " - "if [ -f $d ]; then " - "echo --- $d; cat $d; " - "else " - "for f in $(ls $d); do " - "echo --- $d/$f; cat $d/$f; " - "done; " - "fi; " - "done"}); - DumpFileToFd(fd, "dmabuf info", "/d/dma_buf/bufinfo"); - DumpFileToFd(fd, "Page Pinner - longterm pin", "/sys/kernel/debug/page_pinner/buffer"); - RunCommandToFd(fd, "CMA info", {"/vendor/bin/sh", "-c", - "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"}); -} - -static void DumpF2FS(int fd) { - DumpFileToFd(fd, "F2FS", "/sys/kernel/debug/f2fs/status"); - RunCommandToFd(fd, "F2FS - fsck time (ms)", {"/vendor/bin/sh", "-c", "getprop ro.boottime.init.fsck.data"}); - RunCommandToFd(fd, "F2FS - checkpoint=disable time (ms)", {"/vendor/bin/sh", "-c", "getprop ro.boottime.init.mount.data"}); -} - -static void DumpUFS(int fd) { - DumpFileToFd(fd, "UFS model", "/sys/block/sda/device/model"); - DumpFileToFd(fd, "UFS rev", "/sys/block/sda/device/rev"); - DumpFileToFd(fd, "UFS size", "/sys/block/sda/size"); - - DumpFileToFd(fd, "UFS Slow IO Read", "/dev/sys/block/bootdevice/slowio_read_cnt"); - DumpFileToFd(fd, "UFS Slow IO Write", "/dev/sys/block/bootdevice/slowio_write_cnt"); - DumpFileToFd(fd, "UFS Slow IO Unmap", "/dev/sys/block/bootdevice/slowio_unmap_cnt"); - DumpFileToFd(fd, "UFS Slow IO Sync", "/dev/sys/block/bootdevice/slowio_sync_cnt"); - - RunCommandToFd(fd, "UFS err_stats", {"/vendor/bin/sh", "-c", - "path=\"/dev/sys/block/bootdevice/err_stats\"; " - "for node in `ls $path/* | grep -v reset_err_status`; do " - "printf \"%s:%d\\n\" $(basename $node) $(cat $node); done;"}); - - - RunCommandToFd(fd, "UFS io_stats", {"/vendor/bin/sh", "-c", - "path=\"/dev/sys/block/bootdevice/io_stats\"; " - "printf \"\\t\\t%-10s %-10s %-10s %-10s %-10s %-10s\\n\" " - "ReadCnt ReadBytes WriteCnt WriteBytes RWCnt RWBytes; " - "str=$(cat $path/*_start); arr=($str); " - "printf \"Started: \\t%-10s %-10s %-10s %-10s %-10s %-10s\\n\" " - "${arr[1]} ${arr[0]} ${arr[5]} ${arr[4]} ${arr[3]} ${arr[2]}; " - "str=$(cat $path/*_complete); arr=($str); " - "printf \"Completed: \\t%-10s %-10s %-10s %-10s %-10s %-10s\\n\" " - "${arr[1]} ${arr[0]} ${arr[5]} ${arr[4]} ${arr[3]} ${arr[2]}; " - "str=$(cat $path/*_maxdiff); arr=($str); " - "printf \"MaxDiff: \\t%-10s %-10s %-10s %-10s %-10s %-10s\\n\\n\" " - "${arr[1]} ${arr[0]} ${arr[5]} ${arr[4]} ${arr[3]} ${arr[2]}; "}); - - RunCommandToFd(fd, "UFS req_stats", {"/vendor/bin/sh", "-c", - "path=\"/dev/sys/block/bootdevice/req_stats\"; " - "printf \"\\t%-10s %-10s %-10s %-10s %-10s %-10s\\n\" " - "All Write Read Security Flush Discard; " - "str=$(cat $path/*_min); arr=($str); " - "printf \"Min:\\t%-10s %-10s %-10s %-10s %-10s %-10s\\n\" " - "${arr[0]} ${arr[5]} ${arr[3]} ${arr[4]} ${arr[2]} ${arr[1]}; " - "str=$(cat $path/*_max); arr=($str); " - "printf \"Max:\\t%-10s %-10s %-10s %-10s %-10s %-10s\\n\" " - "${arr[0]} ${arr[5]} ${arr[3]} ${arr[4]} ${arr[2]} ${arr[1]}; " - "str=$(cat $path/*_avg); arr=($str); " - "printf \"Avg.:\\t%-10s %-10s %-10s %-10s %-10s %-10s\\n\" " - "${arr[0]} ${arr[5]} ${arr[3]} ${arr[4]} ${arr[2]} ${arr[1]}; " - "str=$(cat $path/*_sum); arr=($str); " - "printf \"Count:\\t%-10s %-10s %-10s %-10s %-10s %-10s\\n\\n\" " - "${arr[0]} ${arr[5]} ${arr[3]} ${arr[4]} ${arr[2]} ${arr[1]};"}); - - std::string ufs_health = "for f in $(find /dev/sys/block/bootdevice/health_descriptor -type f); do if [[ -r $f && -f $f ]]; then echo --- $f; cat $f; echo ''; fi; done"; - RunCommandToFd(fd, "UFS health", {"/vendor/bin/sh", "-c", ufs_health.c_str()}); -} - -// Dump items related to storage -void Dumpstate::dumpStorageSection(int fd) { - DumpF2FS(fd); - DumpUFS(fd); -} - -// Dump items related to display -void Dumpstate::dumpDisplaySection(int fd) { - // Dump counters for decon drivers - const std::string decon_device_sysfs_path("/sys/class/drm/card0/device/"); - for(int i = 0; i <= 2; ++i){ - const std::string decon_num_str = std::to_string(i); - const std::string decon_counter_path = decon_device_sysfs_path + - "decon" + decon_num_str + - "/counters"; - if (access(decon_counter_path.c_str(), R_OK) == 0){ - DumpFileToFd(fd, "DECON-" + decon_num_str + " counters", - decon_counter_path); - } - else{ - ::android::base::WriteStringToFd("No counters for DECON-" + - decon_num_str + " found at path (" + decon_counter_path + ")\n", - fd); - } - } - DumpFileToFd(fd, "CRTC-0 event log", "/sys/kernel/debug/dri/0/crtc-0/event"); - DumpFileToFd(fd, "CRTC-1 event log", "/sys/kernel/debug/dri/0/crtc-1/event"); - RunCommandToFd(fd, "libdisplaycolor", {"/vendor/bin/dumpsys", "displaycolor", "-v"}, - CommandOptions::WithTimeout(2).Build()); - DumpFileToFd(fd, "Primary panel name", "/sys/devices/platform/exynos-drm/primary-panel/panel_name"); - DumpFileToFd(fd, "Primary panel extra info", "/sys/devices/platform/exynos-drm/primary-panel/panel_extinfo"); - DumpFileToFd(fd, "Secondary panel name", "/sys/devices/platform/exynos-drm/secondary-panel/panel_name"); - DumpFileToFd(fd, "Secondary panel extra info", "/sys/devices/platform/exynos-drm/secondary-panel/panel_extinfo"); -} - -// Dump items related to AoC -void Dumpstate::dumpAoCSection(int fd) { - DumpFileToFd(fd, "AoC Service Status", "/sys/devices/platform/19000000.aoc/services"); - DumpFileToFd(fd, "AoC Restarts", "/sys/devices/platform/19000000.aoc/restart_count"); - DumpFileToFd(fd, "AoC Coredumps", "/sys/devices/platform/19000000.aoc/coredump_count"); - DumpFileToFd(fd, "AoC ring buf wake", "/sys/devices/platform/19000000.aoc/control/ring_buffer_wakeup"); - DumpFileToFd(fd, "AoC host ipc wake", "/sys/devices/platform/19000000.aoc/control/host_ipc_wakeup"); - DumpFileToFd(fd, "AoC usf wake", "/sys/devices/platform/19000000.aoc/control/usf_wakeup"); - DumpFileToFd(fd, "AoC audio wake", "/sys/devices/platform/19000000.aoc/control/audio_wakeup"); - DumpFileToFd(fd, "AoC logging wake", "/sys/devices/platform/19000000.aoc/control/logging_wakeup"); - DumpFileToFd(fd, "AoC hotword wake", "/sys/devices/platform/19000000.aoc/control/hotword_wakeup"); - RunCommandToFd(fd, "AoC memory exception wake", - {"/vendor/bin/sh", "-c", "cat /sys/devices/platform/19000000.aoc/control/memory_exception"}, - CommandOptions::WithTimeout(2).Build()); - RunCommandToFd(fd, "AoC memory votes A32", - {"/vendor/bin/sh", "-c", "cat /sys/devices/platform/19000000.aoc/control/memory_votes_a32"}, - CommandOptions::WithTimeout(2).Build()); - RunCommandToFd(fd, "AoC memory votes FF1", - {"/vendor/bin/sh", "-c", "cat /sys/devices/platform/19000000.aoc/control/memory_votes_ff1"}, - CommandOptions::WithTimeout(2).Build()); - RunCommandToFd(fd, "AoC Heap Stats (A32)", - {"/vendor/bin/sh", "-c", "echo 'dbg heap -c 1' > /dev/acd-debug; timeout 0.1 cat /dev/acd-debug"}, - CommandOptions::WithTimeout(1).Build()); - RunCommandToFd(fd, "AoC Heap Stats (F1)", - {"/vendor/bin/sh", "-c", "echo 'dbg heap -c 2' > /dev/acd-debug; timeout 0.1 cat /dev/acd-debug"}, - CommandOptions::WithTimeout(1).Build()); - RunCommandToFd(fd, "AoC Heap Stats (HF0)", - {"/vendor/bin/sh", "-c", "echo 'dbg heap -c 3' > /dev/acd-debug; timeout 0.1 cat /dev/acd-debug"}, - CommandOptions::WithTimeout(1).Build()); - RunCommandToFd(fd, "AoC Heap Stats (HF1)", - {"/vendor/bin/sh", "-c", "echo 'dbg heap -c 4' > /dev/acd-debug; timeout 0.1 cat /dev/acd-debug"}, - CommandOptions::WithTimeout(1).Build()); -} - -// Dump items related to sensors usf. -void Dumpstate::dumpSensorsUSFSection(int fd) { - CommandOptions options = CommandOptions::WithTimeout(2).Build(); - RunCommandToFd(fd, "USF statistics", - {"/vendor/bin/sh", "-c", "usf_stats get --all"}, - options); - if (!PropertiesHelper::IsUserBuild()) { - // Not a user build, if this is also not a production device dump the USF registry. - std::string hwRev = ::android::base::GetProperty(HW_REVISION, ""); - if (hwRev.find("PROTO") != std::string::npos || - hwRev.find("EVT") != std::string::npos || - hwRev.find("DVT") != std::string::npos) { - RunCommandToFd(fd, "USF Registry", - {"/vendor/bin/sh", "-c", "usf_reg_edit save -"}, - options); - RunCommandToFd(fd, "USF Last Stat Buffer", - {"/vendor/bin/sh", "-c", "cat /data/vendor/sensors/debug/stats.history"}, - options); - } - } -} - -// Gzip binary data and dump to fd in base64 format. Cmd to decode is also attached. -void dumpGzippedFileInBase64ToFd(int fd, const char* title, const char* file_path) { - auto cmd = ::android::base::StringPrintf("echo 'base64 -d <i, header->size, std::string(header->buf, header->i).c_str()), fd); - } else { - ::android::base::WriteStringToFd("*** Ramdump misc file: abl.log: File not found\n", fd); - } - dumpGzippedFileInBase64ToFd( - fd, "Ramdump misc file: acpm.lst (gzipped in base64)", "/mnt/vendor/ramdump/acpm.lst"); - dumpGzippedFileInBase64ToFd( - fd, "Ramdump misc file: s2d.lst (gzipped in base64)", "/mnt/vendor/ramdump/s2d.lst"); -} - -// Dump items that don't fit well into any other section -void Dumpstate::dumpMiscSection(int fd) { - RunCommandToFd(fd, "VENDOR PROPERTIES", {"/vendor/bin/getprop"}); - DumpFileToFd(fd, "VENDOR PROC DUMP", "/proc/vendor_sched/dump_task"); -} - -// Dump items related to GSC -void Dumpstate::dumpGscSection(int fd) { - RunCommandToFd(fd, "Citadel VERSION", {"vendor/bin/hw/citadel_updater", "-lv"}); - RunCommandToFd(fd, "Citadel STATS", {"vendor/bin/hw/citadel_updater", "--stats"}); - RunCommandToFd(fd, "GSC DEBUG DUMP", {"vendor/bin/hw/citadel_updater", "-D"}); -} - -void Dumpstate::dumpTrustySection(int fd) { - RunCommandToFd(fd, "Trusty TEE0 Logs", {"/vendor/bin/sh", "-c", "cat /dev/trusty-log0"}, CommandOptions::WithTimeout(1).Build()); -} - -// Dump items related to LED -void Dumpstate::dumpLEDSection(int fd) { - struct stat buffer; - - if (!PropertiesHelper::IsUserBuild()) { - if (!stat("/sys/class/leds/green", &buffer)) { - DumpFileToFd(fd, "Green LED Brightness", "/sys/class/leds/green/brightness"); - DumpFileToFd(fd, "Green LED Max Brightness", "/sys/class/leds/green/max_brightness"); - } - if (!stat("/mnt/vendor/persist/led/led_calibration_LUT.txt", &buffer)) { - DumpFileToFd(fd, "LED Calibration Data", "/mnt/vendor/persist/led/led_calibration_LUT.txt"); - } - } -} - -void Dumpstate::dumpPCIeSection(int fd) { - DumpFileToFd(fd, "PCIe0 Logs", "/dev/logbuffer_pcie0"); - DumpFileToFd(fd, "PCIe1 Logs", "/dev/logbuffer_pcie1"); - RunCommandToFd(fd, "PCIe Link Statistics", {"/vendor/bin/sh", "-c", - "for f in ls /sys/devices/platform/14520000.pcie/link_stats/* " - " /sys/devices/platform/11920000.pcie/link_stats/*; do " - " echo \"$f: `cat $f`\"; done"}); -} - -void Dumpstate::dumpModemSection(int fd) { - DumpFileToFd(fd, "Modem Stat", "/data/vendor/modem_stat/debug.txt"); - RunCommandToFd(fd, "Modem SSR history", {"/vendor/bin/sh", "-c", - "for f in $(ls /data/vendor/ssrdump/crashinfo_modem*); do " - "echo $f ; cat $f ; done"}, - CommandOptions::WithTimeout(2).Build()); - RunCommandToFd(fd, "RFSD error log", {"/vendor/bin/sh", "-c", - "for f in $(ls /data/vendor/log/rfsd/rfslog_*); do " - "echo $f ; cat $f ; done"}, - CommandOptions::WithTimeout(2).Build()); -} - -void Dumpstate::dumpModemLogs(int fd, const std::string &destDir) { - std::string extendedLogDir = MODEM_EXTENDED_LOG_DIRECTORY; - std::string modemLogHistoryDir = MODEM_LOG_HISTORY_DIRECTORY; - - dumpLogs(fd, extendedLogDir, destDir, 20, EXTENDED_LOG_PREFIX); - dumpLogs(fd, modemLogHistoryDir, destDir, 2, "Logging"); - dumpModemEFS(destDir); -} - -void Dumpstate::dumpRadioLogs(int fd, const std::string &destDir) { - std::string tcpdumpLogDir = TCPDUMP_LOG_DIRECTORY; - bool tcpdumpEnabled = ::android::base::GetBoolProperty(TCPDUMP_PERSIST_PROPERTY, false); - - if (tcpdumpEnabled) { - dumpLogs(fd, tcpdumpLogDir, destDir, ::android::base::GetIntProperty(TCPDUMP_NUMBER_BUGREPORT, 5), TCPDUMP_LOG_PREFIX); - } - dumpRilLogs(fd, destDir); - dumpNetmgrLogs(destDir); -} - -void Dumpstate::dumpGpsLogs(int fd, const std::string &destDir) { - bool gpsLogEnabled = ::android::base::GetBoolProperty(GPS_LOGGING_STATUS_PROPERTY, false); - if (!gpsLogEnabled) { - ALOGD("gps logging is not running\n"); - return; - } - const std::string gpsLogDir = GPS_LOG_DIRECTORY; - const std::string gpsTmpLogDir = gpsLogDir + "/.tmp"; - const std::string gpsDestDir = destDir + "/gps"; - - int maxFileNum = ::android::base::GetIntProperty(GPS_LOG_NUMBER_PROPERTY, 20); - - RunCommandToFd(fd, "MKDIR GPS LOG", {"/vendor/bin/mkdir", "-p", gpsDestDir.c_str()}, - CommandOptions::WithTimeout(2).Build()); - - dumpLogs(fd, gpsTmpLogDir, gpsDestDir, 1, GPS_LOG_PREFIX); - dumpLogs(fd, gpsLogDir, gpsDestDir, 3, GPS_MCU_LOG_PREFIX); - dumpLogs(fd, gpsLogDir, gpsDestDir, maxFileNum, GPS_LOG_PREFIX); -} - -void Dumpstate::dumpCameraLogs(int fd, const std::string &destDir) { - bool cameraLogsEnabled = ::android::base::GetBoolProperty( - "vendor.camera.debug.camera_performance_analyzer.attach_to_bugreport", true); - if (!cameraLogsEnabled) { - return; - } - - static const std::string kCameraLogDir = "/data/vendor/camera/profiler"; - const std::string cameraDestDir = destDir + "/camera"; - - RunCommandToFd(fd, "MKDIR CAMERA LOG", {"/vendor/bin/mkdir", "-p", cameraDestDir.c_str()}, - CommandOptions::WithTimeout(2).Build()); - // Attach multiple latest sessions (in case the user is running concurrent - // sessions or starts a new session after the one with performance issues). - dumpLogs(fd, kCameraLogDir, cameraDestDir, 10, "session-ended-"); - dumpLogs(fd, kCameraLogDir, cameraDestDir, 5, "high-drop-rate-"); - dumpLogs(fd, kCameraLogDir, cameraDestDir, 5, "watchdog-"); - dumpLogs(fd, kCameraLogDir, cameraDestDir, 5, "camera-ended-"); -} - -void Dumpstate::dumpGxpLogs(int fd, const std::string &destDir) { - bool gxpDumpEnabled = ::android::base::GetBoolProperty("vendor.gxp.attach_to_bugreport", false); - - if (gxpDumpEnabled) { - const int maxGxpDebugDumps = 8; - const std::string gxpCoredumpOutputDir = destDir + "/gxp_ssrdump"; - const std::string gxpCoredumpInputDir = "/data/vendor/ssrdump"; - - RunCommandToFd(fd, "MKDIR GXP COREDUMP", {"/vendor/bin/mkdir", "-p", gxpCoredumpOutputDir}, CommandOptions::WithTimeout(2).Build()); - - // Copy GXP coredumps and crashinfo to the output directory. - dumpLogs(fd, gxpCoredumpInputDir + "/coredump", gxpCoredumpOutputDir, maxGxpDebugDumps, "coredump_gxp_platform"); - dumpLogs(fd, gxpCoredumpInputDir, gxpCoredumpOutputDir, maxGxpDebugDumps, "crashinfo_gxp_platform"); - } -} - -void Dumpstate::dumpLogSection(int fd, int fd_bin) -{ - std::string logDir = MODEM_LOG_DIRECTORY; - const std::string logCombined = logDir + "/combined_logs.tar"; - const std::string logAllDir = logDir + "/all_logs"; - - RunCommandToFd(fd, "MKDIR LOG", {"/vendor/bin/mkdir", "-p", logAllDir.c_str()}, CommandOptions::WithTimeout(2).Build()); - - static const std::string sectionName = "modem DM log"; - auto startTime = startSection(fd, sectionName); - bool modemLogEnabled = ::android::base::GetBoolProperty(MODEM_LOGGING_PERSIST_PROPERTY, false); - if (modemLogEnabled && ::android::base::GetProperty(MODEM_LOGGING_PATH_PROPERTY, "") == MODEM_LOG_DIRECTORY) { - bool modemLogStarted = ::android::base::GetBoolProperty(MODEM_LOGGING_STATUS_PROPERTY, false); - int maxFileNum = ::android::base::GetIntProperty(MODEM_LOGGING_NUMBER_BUGREPORT_PROPERTY, 100); - - if (modemLogStarted) { - ::android::base::SetProperty(MODEM_LOGGING_PROPERTY, "false"); - ALOGD("Stopping modem logging...\n"); - } else { - ALOGD("modem logging is not running\n"); - } - - for (int i = 0; i < 15; i++) { - if (!::android::base::GetBoolProperty(MODEM_LOGGING_STATUS_PROPERTY, false)) { - ALOGD("modem logging stopped\n"); - sleep(1); - break; - } - sleep(1); - } - - dumpLogs(fd, logDir, logAllDir, maxFileNum, MODEM_LOG_PREFIX); - - if (modemLogStarted) { - ALOGD("Restarting modem logging...\n"); - ::android::base::SetProperty(MODEM_LOGGING_PROPERTY, "true"); - } - } - endSection(fd, sectionName, startTime); - - // Dump all module logs - if (!PropertiesHelper::IsUserBuild()) { - for (const auto §ion : mLogSections) { - auto startTime = startSection(fd, section.first); - section.second(fd, logAllDir); - endSection(fd, section.first, startTime); - } - } - - RunCommandToFd(fd, "TAR LOG", {"/vendor/bin/tar", "cvf", logCombined.c_str(), "-C", logAllDir.c_str(), "."}, CommandOptions::WithTimeout(20).Build()); - RunCommandToFd(fd, "CHG PERM", {"/vendor/bin/chmod", "a+w", logCombined.c_str()}, CommandOptions::WithTimeout(2).Build()); - - std::vector buffer(65536); - ::android::base::unique_fd fdLog(TEMP_FAILURE_RETRY(open(logCombined.c_str(), O_RDONLY | O_CLOEXEC | O_NONBLOCK))); - - if (fdLog >= 0) { - while (1) { - ssize_t bytes_read = TEMP_FAILURE_RETRY(read(fdLog, buffer.data(), buffer.size())); - - if (bytes_read == 0) { - break; - } else if (bytes_read < 0) { - ALOGD("read(%s): %s\n", logCombined.c_str(), strerror(errno)); - break; - } - - ssize_t result = TEMP_FAILURE_RETRY(write(fd_bin, buffer.data(), bytes_read)); - - if (result != bytes_read) { - ALOGD("Failed to write %ld bytes, actually written: %ld", bytes_read, result); - break; - } - } - } - - RunCommandToFd(fd, "RM LOG DIR", { "/vendor/bin/rm", "-r", logAllDir.c_str()}, CommandOptions::WithTimeout(2).Build()); - RunCommandToFd(fd, "RM LOG", { "/vendor/bin/rm", logCombined.c_str()}, CommandOptions::WithTimeout(2).Build()); -} - -void Dumpstate::dumpPixelTraceSection(int fd) { - DumpFileToFd(fd, "Pixel trace", "/sys/kernel/tracing/instances/pixel/trace"); -} - -void Dumpstate::dumpPerfMetricsSection(int fd) { - DumpFileToFd(fd, "Long running IRQ metrics", "/sys/kernel/metrics/irq/long_irq_metrics"); - DumpFileToFd(fd, "Resume latency metrics", "/sys/kernel/metrics/resume_latency/resume_latency_metrics"); -} - -ndk::ScopedAStatus Dumpstate::dumpstateBoard(const std::vector<::ndk::ScopedFileDescriptor>& in_fds, - IDumpstateDevice::DumpstateMode in_mode, - int64_t in_timeoutMillis) { - // Unused arguments. - (void) in_timeoutMillis; - - if (in_fds.size() < 1) { - ALOGE("no FDs\n"); - return ndk::ScopedAStatus::fromExceptionCodeWithMessage(EX_ILLEGAL_ARGUMENT, - "No file descriptor"); - } - - int fd = in_fds[0].get(); - if (fd < 0) { - ALOGE("invalid FD: %d\n", fd); - return ndk::ScopedAStatus::fromExceptionCodeWithMessage(EX_ILLEGAL_ARGUMENT, - "Invalid file descriptor"); - } - - if (in_mode == IDumpstateDevice::DumpstateMode::WEAR) { - // We aren't a Wear device. - ALOGE("Unsupported mode: %d\n", in_mode); - return ndk::ScopedAStatus::fromServiceSpecificErrorWithMessage(ERROR_UNSUPPORTED_MODE, - "Unsupported mode"); - } else if (in_mode < IDumpstateDevice::DumpstateMode::FULL || in_mode > IDumpstateDevice::DumpstateMode::PROTO) { - ALOGE("Invalid mode: %d\n", in_mode); - return ndk::ScopedAStatus::fromExceptionCodeWithMessage(EX_ILLEGAL_ARGUMENT, - "Invalid mode"); - } - - if (in_fds.size() < 2) { - ALOGE("no FD for dumpstate_board binary\n"); - } else { - int fd_bin = in_fds[1].get(); - dumpLogSection(fd, fd_bin); - } - - dumpTextSection(fd, kAllSections); - - return ndk::ScopedAStatus::ok(); -} - -ndk::ScopedAStatus Dumpstate::setVerboseLoggingEnabled(bool in_enable) { - ::android::base::SetProperty(kVerboseLoggingProperty, in_enable ? "true" : "false"); - return ndk::ScopedAStatus::ok(); -} - -ndk::ScopedAStatus Dumpstate::getVerboseLoggingEnabled(bool* _aidl_return) { - *_aidl_return = ::android::base::GetBoolProperty(kVerboseLoggingProperty, false); - return ndk::ScopedAStatus::ok(); -} - -// Since AIDLs that support the dump() interface are automatically invoked during -// bugreport generation and we don't want to generate a second copy of the same -// data that will go into dumpstate_board.txt, this function will only do -// something if it is called with an option, e.g. -// dumpsys android.hardware.dumpstate.IDumpstateDevice/default all -// -// Also, note that sections which generate attachments and/or binary data when -// included in a bugreport are not available through the dump() interface. -binder_status_t Dumpstate::dump(int fd, const char** args, uint32_t numArgs) { - - if (numArgs != 1) { - return STATUS_OK; - } - - dumpTextSection(fd, static_cast(args[0])); - - fsync(fd); - return STATUS_OK; -} - -} // namespace dumpstate -} // namespace hardware -} // namespace android -} // namespace aidl diff --git a/dumpstate/Dumpstate.h b/dumpstate/Dumpstate.h deleted file mode 100644 index b13061fa..00000000 --- a/dumpstate/Dumpstate.h +++ /dev/null @@ -1,96 +0,0 @@ -/* - * Copyright (C) 2022 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#pragma once - -#include -#include -#include - -namespace aidl { -namespace android { -namespace hardware { -namespace dumpstate { - -class Dumpstate : public BnDumpstateDevice { - public: - Dumpstate(); - - ::ndk::ScopedAStatus dumpstateBoard(const std::vector<::ndk::ScopedFileDescriptor>& in_fds, - IDumpstateDevice::DumpstateMode in_mode, - int64_t in_timeoutMillis) override; - - ::ndk::ScopedAStatus getVerboseLoggingEnabled(bool* _aidl_return) override; - - ::ndk::ScopedAStatus setVerboseLoggingEnabled(bool in_enable) override; - - binder_status_t dump(int fd, const char** args, uint32_t numArgs) override; - - private: - const std::string kAllSections = "all"; - - std::vector>> mTextSections; - std::vector>> mLogSections; - - void dumpLogs(int fd, std::string srcDir, std::string destDir, int maxFileNum, - const char *logPrefix); - - void dumpTextSection(int fd, std::string const& sectionName); - - // Text sections that can be dumped individually on the command line in - // addition to being included in full dumps - void dumpWlanSection(int fd); - void dumpModemSection(int fd); - void dumpPowerSection(int fd); - void dumpThermalSection(int fd); - void dumpTouchSection(int fd); - void dumpSocSection(int fd); - void dumpCpuSection(int fd); - void dumpDevfreqSection(int fd); - void dumpMemorySection(int fd); - void dumpStorageSection(int fd); - void dumpDisplaySection(int fd); - void dumpSensorsUSFSection(int fd); - void dumpAoCSection(int fd); - void dumpRamdumpSection(int fd); - void dumpMiscSection(int fd); - void dumpGscSection(int fd); - void dumpTrustySection(int fd); - void dumpLEDSection(int fd); - void dumpPixelTraceSection(int fd); - void dumpPerfMetricsSection(int fd); - void dumpPCIeSection(int fd); - - void dumpLogSection(int fd, int fdModem); - - // Log sections to be dumped individually into dumpstate_board.bin - void dumpModemLogs(int fd, const std::string &destDir); - void dumpRadioLogs(int fd, const std::string &destDir); - void dumpCameraLogs(int fd, const std::string &destDir); - void dumpGpsLogs(int fd, const std::string &destDir); - void dumpGxpLogs(int fd, const std::string &destDir); - - // Hybrid and binary sections that require an additional file descriptor - void dumpRilLogs(int fd, std::string destDir); - - //bool getVerboseLoggingEnabledImpl(); - //::ndk::ScopedAStatus dumpstateBoardImpl(const int fd, const bool full); -}; - -} // namespace dumpstate -} // namespace hardware -} // namespace android -} // namespace aidl diff --git a/dumpstate/OWNERS b/dumpstate/OWNERS new file mode 100644 index 00000000..233e1058 --- /dev/null +++ b/dumpstate/OWNERS @@ -0,0 +1,10 @@ +aaronding@google.com +rurumihong@google.com +adamshih@google.com +wilsonsung@google.com +lucaswei@google.com +cyanhsieh@google.com +rogerliao@google.com +cyuanjen@google.com +robinpeng@google.com +pattjin@google.com diff --git a/dumpstate/README.txt b/dumpstate/README.txt new file mode 100644 index 00000000..b279bdaf --- /dev/null +++ b/dumpstate/README.txt @@ -0,0 +1 @@ +Please refer to go/pixel-recycle to modularize your code in this space. diff --git a/dumpstate/android.hardware.dumpstate@1.1-service.gs201.rc b/dumpstate/android.hardware.dumpstate@1.1-service.gs201.rc deleted file mode 100644 index 65456d11..00000000 --- a/dumpstate/android.hardware.dumpstate@1.1-service.gs201.rc +++ /dev/null @@ -1,5 +0,0 @@ -service vendor.dumpstate-default /vendor/bin/hw/android.hardware.dumpstate-service.gs201 - class hal - user system - group system - interface aidl android.hardware.dumpstate.IDumpstateDevice/default diff --git a/dumpstate/dump_power_gs201.sh b/dumpstate/dump_power_gs201.sh new file mode 100644 index 00000000..19c52e76 --- /dev/null +++ b/dumpstate/dump_power_gs201.sh @@ -0,0 +1,339 @@ +#!/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" + +if [ -d "/sys/class/power_supply/pca9468-mains/uevent" ] +then + echo "\n------ Power supply property pca9468-mains ------" + cat "/sys/class/power_supply/pca9468-mains/uevent" +else + echo "\n------ Power supply property pca94xx-mains ------" + cat "/sys/class/power_supply/pca94xx-mains/uevent" +fi + +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_monitor ------" + 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_secondary ------" + cat "/sys/class/power_supply/maxfg_secondary/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_secondary ------" + cat "/dev/logbuffer_maxfg_secondary" + echo "\n------ maxfg_base_monitor ------" + cat "/dev/logbuffer_maxfg_base_monitor" + echo "\n------ maxfg_secondary_monitor ------" + cat "/dev/logbuffer_maxfg_secondary_monitor" + echo "\n------ google_dual_batt ------" + cat "/dev/logbuffer_dual_batt" +fi + +if [ -e "/dev/maxfg_history" ] +then + echo "\n------ Maxim FG History ------" + xxd "/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" +elif [ $build_type = "userdebug" ] +then + echo "\n------ TCPM logs ------" + if [ -d "/sys/kernel/debug/tcpm" ] + then + cat /sys/kernel/debug/tcpm/* + else + 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 "\nPOGO Transport" +cat "/dev/logbuffer_pogo_transport" +echo "\n------ PPS-google_cpm ------" +cat "/dev/logbuffer_cpm" +echo "\n------ PPS-dc ------" +cat "/dev/logbuffer_pca9468" + +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/pca94xx-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-5/5-0050/eeprom" ] +then + xxd /sys/devices/platform/10da0000.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/10da0000.hsi2c/i2c-9/9-0050/eeprom" ] +then + xxd /sys/devices/platform/10da0000.hsi2c/i2c-9/9-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 + diff --git a/dumpstate/service.cpp b/dumpstate/service.cpp deleted file mode 100644 index 9b4e0fb4..00000000 --- a/dumpstate/service.cpp +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Copyright (C) 2022 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -#define LOG_TAG "android.hardware.dumpstate-service.gs201" - -#include "Dumpstate.h" - -#include -#include -#include - -using aidl::android::hardware::dumpstate::Dumpstate; - -int main() { - ABinderProcess_setThreadPoolMaxThreadCount(0); - std::shared_ptr dumpstate = ndk::SharedRefBase::make(); - - const std::string instance = std::string() + Dumpstate::descriptor + "/default"; - binder_status_t status = - AServiceManager_addService(dumpstate->asBinder().get(), instance.c_str()); - CHECK_EQ(status, STATUS_OK); - - ABinderProcess_joinThreadPool(); - return EXIT_FAILURE; // Unreachable -} diff --git a/edgetpu/OWNERS b/edgetpu/OWNERS deleted file mode 100644 index 9eb92a96..00000000 --- a/edgetpu/OWNERS +++ /dev/null @@ -1,6 +0,0 @@ -# Devs who work on EdgeTPU on Android. -hsuy@google.com -yuchicheng@google.com -iayara@google.com -qinyiyan@google.com -macwang@google.com \ No newline at end of file diff --git a/edgetpu/edgetpu.mk b/edgetpu/edgetpu.mk deleted file mode 100644 index c97b5abc..00000000 --- a/edgetpu/edgetpu.mk +++ /dev/null @@ -1,28 +0,0 @@ -# Edgetpu packages - -# Config variables for TPU chip on device. -$(call soong_config_set,edgetpu_config,chip,janeiro) - -# TPU logging service -PRODUCT_PACKAGES += \ - android.hardware.edgetpu.logging@service-edgetpu-logging -# TPU firmware -PRODUCT_PACKAGES += \ - edgetpu-janeiro.fw -# TPU NN AIDL HAL -PRODUCT_PACKAGES += \ - android.hardware.neuralnetworks@service-darwinn-aidl -# TPU application service -PRODUCT_PACKAGES += \ - vendor.google.edgetpu_app_service@1.0-service -# TPU vendor service -PRODUCT_PACKAGES += \ - vendor.google.edgetpu_vendor_service@1.0-service -# TPU HAL client library -PRODUCT_PACKAGES += \ - libedgetpu_client.google -# TPU metrics logger library -PRODUCT_PACKAGES += \ - libmetrics_logger -BOARD_VENDOR_SEPOLICY_DIRS += device/google/gs101-sepolicy/edgetpu/ -BOARD_VENDOR_SEPOLICY_DIRS += device/google/gs201-sepolicy/edgetpu/ diff --git a/gnss/47765/Android.bp b/gnss/47765/Android.bp deleted file mode 100644 index c30cb32c..00000000 --- a/gnss/47765/Android.bp +++ /dev/null @@ -1,232 +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. - -soong_namespace { -} - -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_prebuilt_library_shared { - name: "android.hardware.gnss@2.1-impl-google", - arch: { - arm64: { - srcs: ["bin/android.hardware.gnss@2.1-impl-google.so"], - shared_libs: [ - "liblog", - "libhidlbase", - // "libhidltransport", - "libutils", - "android.hardware.gnss@1.0", - "android.hardware.gnss@1.1", - "android.hardware.gnss@2.0", - "android.hardware.gnss@2.1", - "android.hardware.gnss.measurement_corrections@1.0", - "android.hardware.gnss.visibility_control@1.0", - "android.hardware.gnss-V2-ndk", - "libhardware", - "libc++", - "libc", - "libm", - "libdl", - ], - }, - }, - compile_multilib: "64", - vendor: true, - relative_install_path: "hw", - strip: { - none: true, - }, - // Bypass because libhidltransport is deprecated - check_elf_files: false, -} - -cc_prebuilt_binary { - name: "android.hardware.gnss@2.1-service-brcm", - arch: { - arm64: { - srcs: ["bin/android.hardware.gnss@2.1-service-brcm"], - shared_libs: [ - "liblog", - "libutils", - "libhardware", - "android.hardware.gnss@1.0", - "libhidlbase", - // "libhidltransport", - // "libhwbinder", - "android.hardware.gnss@1.1", - "android.hardware.gnss@2.0", - "android.hardware.gnss@2.1", - "android.hardware.gnss-V2-ndk", - "libc++", - "libc", - "libm", - "libdl", - ], - }, - }, - compile_multilib: "64", - vendor: true, - relative_install_path: "hw", - strip: { - none: true, - }, - // Bypass because libhidltransport is deprecated - // Bypass because libhwbinder is deprecated - check_elf_files: false, - vintf_fragments: ["android.hardware.gnss@2.1-service-brcm.xml"] -} - -cc_prebuilt_library_shared { - name: "flp.default", - arch: { - arm64: { - srcs: ["bin/flp.default.so"], - shared_libs: [ - "liblog", - "libcutils", - "libutils", - "libc++", - "libc", - "libm", - "libdl", - ], - }, - }, - compile_multilib: "64", - vendor: true, - relative_install_path: "hw", - strip: { - none: true, - }, - // Bypass because soname mismatch - check_elf_files: false, -} - -cc_prebuilt_binary { - name: "gpsd", - arch: { - arm64: { - srcs: ["bin/gpsd"], - shared_libs: [ - "liblog", - "libutils", - "libhardware_legacy", - "libcutils", - "libssl", - "libcrypto", - // "libsitril-gps", - "android.frameworks.sensorservice@1.0", - "libhidlbase", - "libandroid_net", - "libc++", - "libc", - "libm", - "libdl", - ], - }, - }, - compile_multilib: "64", - vendor: true, - relative_install_path: "hw", - strip: { - none: true, - }, - // Bypass because libsitril-gps is Android.mk module - check_elf_files: false, -} - -cc_prebuilt_library_shared { - name: "gps.default", - arch: { - arm64: { - srcs: ["bin/gps.default.so"], - shared_libs: [ - "liblog", - "libcutils", - "libutils", - "libc++", - "libc", - "libm", - "libdl", - ], - }, - }, - compile_multilib: "64", - vendor: true, - relative_install_path: "hw", - strip: { - none: true, - }, - // Bypass because soname mismatch - check_elf_files: false, -} - -cc_prebuilt_binary { - name: "lhd", - arch: { - arm64: { - srcs: ["bin/lhd"], - shared_libs: [ - "liblog", - "libutils", - "libhardware_legacy", - "libc++", - "libc", - "libm", - "libz", - "android.hardware.contexthub@1.0", - "libhidlbase", - "libdl", - ], - }, - }, - compile_multilib: "64", - vendor: true, - relative_install_path: "hw", - strip: { - none: true, - }, -} - -cc_prebuilt_binary { - name: "scd", - arch: { - arm64: { - srcs: ["bin/scd"], - shared_libs: [ - "liblog", - "libutils", - "libssl", - "libcrypto", - "libandroid_net", - ], - }, - }, - compile_multilib: "64", - vendor: true, - relative_install_path: "hw", - strip: { - none: true, - }, -} diff --git a/gnss/47765/android.hardware.gnss@2.1-service-brcm.xml b/gnss/47765/android.hardware.gnss@2.1-service-brcm.xml deleted file mode 100644 index 97538b88..00000000 --- a/gnss/47765/android.hardware.gnss@2.1-service-brcm.xml +++ /dev/null @@ -1,7 +0,0 @@ - - - android.hardware.gnss - 2 - IGnss/default - - diff --git a/gnss/47765/bin/android.hardware.gnss@2.1-impl-google.so b/gnss/47765/bin/android.hardware.gnss@2.1-impl-google.so deleted file mode 100755 index 8ca5739d..00000000 Binary files a/gnss/47765/bin/android.hardware.gnss@2.1-impl-google.so and /dev/null differ diff --git a/gnss/47765/bin/android.hardware.gnss@2.1-service-brcm b/gnss/47765/bin/android.hardware.gnss@2.1-service-brcm deleted file mode 100755 index bca71c54..00000000 Binary files a/gnss/47765/bin/android.hardware.gnss@2.1-service-brcm and /dev/null differ diff --git a/gnss/47765/bin/flp.default.so b/gnss/47765/bin/flp.default.so deleted file mode 100755 index ea0a36c5..00000000 Binary files a/gnss/47765/bin/flp.default.so and /dev/null differ diff --git a/gnss/47765/bin/gps.default.so b/gnss/47765/bin/gps.default.so deleted file mode 100755 index 139d1f45..00000000 Binary files a/gnss/47765/bin/gps.default.so and /dev/null differ diff --git a/gnss/47765/bin/gpsd b/gnss/47765/bin/gpsd deleted file mode 100755 index d0a963da..00000000 Binary files a/gnss/47765/bin/gpsd and /dev/null differ diff --git a/gnss/47765/bin/lhd b/gnss/47765/bin/lhd deleted file mode 100755 index b31f3611..00000000 Binary files a/gnss/47765/bin/lhd and /dev/null differ diff --git a/gnss/47765/bin/scd b/gnss/47765/bin/scd deleted file mode 100755 index e5e7d96e..00000000 Binary files a/gnss/47765/bin/scd and /dev/null differ diff --git a/gnss/47765/firmware/SensorHub.patch b/gnss/47765/firmware/SensorHub.patch deleted file mode 100644 index fad12159..00000000 --- a/gnss/47765/firmware/SensorHub.patch +++ /dev/null @@ -1,7050 +0,0 @@ - - - - - - - - - - - - - - diff --git a/gnss/Android.mk b/gnss/Android.mk deleted file mode 100644 index 12f46b76..00000000 --- a/gnss/Android.mk +++ /dev/null @@ -1,40 +0,0 @@ -# Copyright (C) 2010 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. - - -# We're moving the emulator-specific platform libs to -# development.git/tools/emulator/. The following test is to ensure -# smooth builds even if the tree contains both versions. -# - -ifeq ($(BOARD_USES_EXYNOS_GNSS_DUMMY), true) - -LOCAL_PATH := $(call my-dir) - -# HAL module implemenation stored in -# hw/..so -include $(CLEAR_VARS) - -LOCAL_MODULE_RELATIVE_PATH := hw -LOCAL_SHARED_LIBRARIES := liblog libcutils libhardware -LOCAL_SRC_FILES := gps_dummy.c -LOCAL_MODULE := gps.$(TARGET_BOARD_PLATFORM) -LOCAL_LICENSE_KINDS := SPDX-license-identifier-Apache-2.0 -LOCAL_LICENSE_CONDITIONS := notice -LOCAL_NOTICE_FILE := $(LOCAL_PATH)/../NOTICE -LOCAL_PROPRIETARY_MODULE := true - -include $(BUILD_SHARED_LIBRARY) - -endif diff --git a/gnss/device-gnss.mk b/gnss/device-gnss.mk deleted file mode 100644 index 5c5c2606..00000000 --- a/gnss/device-gnss.mk +++ /dev/null @@ -1,19 +0,0 @@ -PRODUCT_COPY_FILES += \ - frameworks/native/data/etc/android.hardware.location.gps.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.location.gps.xml \ - device/google/gs201/gnss/47765/config/gps.cer:$(TARGET_COPY_OUT_VENDOR)/etc/gnss/gps.cer \ - device/google/gs201/gnss/47765/firmware/SensorHub.patch:$(TARGET_COPY_OUT_VENDOR)/firmware/SensorHub.patch - -PRODUCT_SOONG_NAMESPACES += \ - device/google/gs201/gnss/47765 - -PRODUCT_PACKAGES += \ - android.hardware.gnss@2.1-impl-google \ - gps.default \ - flp.default \ - gpsd \ - lhd \ - scd \ - android.hardware.gnss@2.1-service-brcm - -PRODUCT_PACKAGES_DEBUG += \ - init.gps_log.rc diff --git a/gnss/gps_dummy.c b/gnss/gps_dummy.c deleted file mode 100644 index 9ccde1d3..00000000 --- a/gnss/gps_dummy.c +++ /dev/null @@ -1,158 +0,0 @@ -/* - * Copyright (C) 2010 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. - */ - -/* this implements a GPS hardware library for the Android emulator. - * the following code should be built as a shared library that will be - * placed into /system/lib/hw/gps.goldfish.so - * - * it will be loaded by the code in hardware/libhardware/hardware.c - * which is itself called from android_location_GpsLocationProvider.cpp - */ - - -#include -#include -#include -#include -#include -#include -#include -#include - -#define LOG_TAG "gps_dummy" -#include -//#include -#include - -#define GPS_DEBUG 0 - -#if GPS_DEBUG -# define D(...) ALOGD(__VA_ARGS__) -#else -# define D(...) ((void)0) -#endif - -static int -dummy_gps_init(GpsCallbacks* callbacks) -{ - return 0; -} - -static void -dummy_gps_cleanup(void) -{ -} - - -static int -dummy_gps_start() -{ - return 0; -} - - -static int -dummy_gps_stop() -{ - return 0; -} - - -static int -dummy_gps_inject_time(GpsUtcTime __unused time, - int64_t __unused timeReference, - int __unused uncertainty) -{ - return 0; -} - -static int -dummy_gps_inject_location(double __unused latitude, - double __unused longitude, - float __unused accuracy) -{ - return 0; -} - -static void -dummy_gps_delete_aiding_data(GpsAidingData __unused flags) -{ -} - -static int dummy_gps_set_position_mode(GpsPositionMode __unused mode, - GpsPositionRecurrence __unused recurrence, - uint32_t __unused min_interval, - uint32_t __unused preferred_accuracy, - uint32_t __unused preferred_time) -{ - // FIXME - support fix_frequency - return 0; -} - -static const void* -dummy_gps_get_extension(const char* __unused name) -{ - // no extensions supported - return NULL; -} - -static const GpsInterface dummyGpsInterface = { - sizeof(GpsInterface), - dummy_gps_init, - dummy_gps_start, - dummy_gps_stop, - dummy_gps_cleanup, - dummy_gps_inject_time, - dummy_gps_inject_location, - dummy_gps_delete_aiding_data, - dummy_gps_set_position_mode, - dummy_gps_get_extension, -}; - -const GpsInterface* gps__get_gps_interface(struct gps_device_t* __unused dev) -{ - return &dummyGpsInterface; -} - -static int open_gps(const struct hw_module_t* module, - char const* __unused name, - struct hw_device_t** device) -{ - struct gps_device_t *dev = (struct gps_device_t *)malloc(sizeof(struct gps_device_t)); - memset(dev, 0, sizeof(*dev)); - - dev->common.tag = HARDWARE_DEVICE_TAG; - dev->common.version = 0; - dev->common.module = (struct hw_module_t*)module; - dev->get_gps_interface = gps__get_gps_interface; - - *device = (struct hw_device_t*)dev; - return 0; -} - -static struct hw_module_methods_t gps_module_methods = { - .open = open_gps -}; - -struct hw_module_t HAL_MODULE_INFO_SYM = { - .tag = HARDWARE_MODULE_TAG, - .version_major = 1, - .version_minor = 0, - .id = GPS_HARDWARE_MODULE_ID, - .name = "Dummy GPS Module", - .author = "The Android Open Source Project", - .methods = &gps_module_methods, -}; diff --git a/init.display.sh b/init.display.sh new file mode 100755 index 00000000..bb942e3f --- /dev/null +++ b/init.display.sh @@ -0,0 +1,22 @@ +#!/vendor/bin/sh +modules_dir= + +for f in /vendor/lib/modules/*/modules.dep /vendor/lib/modules/modules.dep; do + if [[ -f "$f" ]]; then + modules_dir="$(dirname "$f")" + break + fi +done + +if [[ -z "${modules_dir}" ]]; then + echo "Unable to locate kernel modules directory" 2>&1 + exit 1 +fi + +panel_drv=`getprop ro.boot.primary_panel_drv` +if [[ -z "$panel_drv" ]]; then + panel_drv="panel-samsung-emul" +fi +modprobe -d "${modules_dir}" exynos-drm.ko +modprobe -d "${modules_dir}" $panel_drv.ko + diff --git a/init.insmod.gs201.cfg b/init.insmod.gs201.cfg deleted file mode 100644 index 1eb29b9a..00000000 --- a/init.insmod.gs201.cfg +++ /dev/null @@ -1,12 +0,0 @@ -#################################################### -# init.insmod.common.cfg # -# This file contains common kernel modules to load # -# at init time by init.insmod.sh script # -#################################################### - -# Load common kernel modules -# Modules here will be loaded *before* device specific modules -install_display_drivers -modprobe|-b * -# All common modules loaded -setprop|vendor.common.modules.ready diff --git a/init.insmod.sh b/init.insmod.sh deleted file mode 100755 index 645391af..00000000 --- a/init.insmod.sh +++ /dev/null @@ -1,78 +0,0 @@ -#!/vendor/bin/sh - -############################################################# -### init.insmod.cfg format: ### -### ----------------------------------------------------- ### -### [insmod|setprop|enable/moprobe|wait] [path|prop name] ### -### ... ### -############################################################# - -modules_dir= - -for f in /vendor/lib/modules/*/modules.dep /vendor/lib/modules/modules.dep; do - if [[ -f "$f" ]]; then - modules_dir="$(dirname "$f")" - break - fi -done - -if [[ -z "${modules_dir}" ]]; then - echo "Unable to locate kernel modules directory" 2>&1 - exit 1 -fi - -# imitates wait_for_file() in init -wait_for_file() -{ - filename="${1}" - timeout="${2:-5}" - - expiry=$(($(date "+%s")+timeout)) - while [[ ! -e "${filename}" ]] && [[ "$(date "+%s")" -le "${expiry}" ]] - do - sleep 0.01 - done -} - -install_display_drivers() -{ - panel_drv=`getprop ro.boot.primary_panel_drv` - if [[ -z "$panel_drv" ]]; then - panel_drv="panel-samsung-emul" - fi - modprobe -d "${modules_dir}" exynos-drm.ko - modprobe -d "${modules_dir}" $panel_drv.ko -} - -if [ $# -eq 1 ]; then - cfg_file=$1 -else - # Set property even if there is no insmod config - # to unblock early-boot trigger - setprop vendor.common.modules.ready - setprop vendor.device.modules.ready - setprop vendor.all.modules.ready - setprop vendor.all.devices.ready - exit 1 -fi - -if [ -f $cfg_file ]; then - while IFS="|" read -r action arg - do - case $action in - "insmod") insmod $arg ;; - "setprop") setprop $arg 1 ;; - "enable") echo 1 > $arg ;; - "modprobe") - case ${arg} in - "-b *" | "-b") - arg="-b --all=${modules_dir}/modules.load" ;; - "*" | "") - arg="--all=${modules_dir}/modules.load" ;; - esac - modprobe -a -d "${modules_dir}" $arg ;; - "wait") wait_for_file $arg ;; - "install_display_drivers") install_display_drivers ;; - esac - done < $cfg_file -fi diff --git a/interfaces/boot/1.2/BootControl.cpp b/interfaces/boot/1.2/BootControl.cpp index 70b95940..a28be05a 100644 --- a/interfaces/boot/1.2/BootControl.cpp +++ b/interfaces/boot/1.2/BootControl.cpp @@ -162,7 +162,7 @@ static bool DevInfoSync() { return false; } - android::base::unique_fd fd(open(DEVINFO_PATH, O_WRONLY)); + android::base::unique_fd fd(open(DEVINFO_PATH, O_WRONLY | O_DSYNC)); return android::base::WriteFully(fd, &devinfo, sizeof devinfo); } @@ -270,13 +270,13 @@ Return BootControl::setActiveBootSlot(uint32_t slot, setActiveBootSlot_cb 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); + 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); + 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(); diff --git a/gnss/47765/config/gps.cer b/location/gps.cer similarity index 100% rename from gnss/47765/config/gps.cer rename to location/gps.cer diff --git a/manifest-gralloc3.xml b/manifest-gralloc3.xml index 9ecea758..196d1aca 100644 --- a/manifest-gralloc3.xml +++ b/manifest-gralloc3.xml @@ -1,31 +1,4 @@ - - android.hardware.audio - hwbinder - 7.1 - - IDevicesFactory - default - - - - android.hardware.audio.effect - hwbinder - 7.0 - - IEffectsFactory - default - - - - android.hardware.soundtrigger - hwbinder - 2.3 - - ISoundTriggerHw - default - - android.hardware.graphics.allocator hwbinder @@ -126,6 +99,7 @@ com.google.input + 2 ITouchContextService default @@ -139,22 +113,4 @@ default - - vendor.google.whitechapel.audio.audioext - hwbinder - 4.0 - - IAudioExt - default - - - - vendor.google.audiometricext - hwbinder - 1.0 - - IAudioMetricExt - default - - diff --git a/manifest.xml b/manifest.xml index 902aaa60..7814e22e 100644 --- a/manifest.xml +++ b/manifest.xml @@ -1,31 +1,4 @@ - - android.hardware.audio - hwbinder - 7.1 - - IDevicesFactory - default - - - - android.hardware.audio.effect - hwbinder - 7.0 - - IEffectsFactory - default - - - - android.hardware.soundtrigger - hwbinder - 2.3 - - ISoundTriggerHw - default - - android.hardware.graphics.mapper passthrough @@ -35,13 +8,6 @@ default - - android.hardware.dumpstate - - IDumpstateDevice - default - - android.hardware.boot hwbinder @@ -59,27 +25,10 @@ com.google.input + 2 ITouchContextService default - - vendor.google.whitechapel.audio.audioext - hwbinder - 4.0 - - IAudioExt - default - - - - vendor.google.audiometricext - hwbinder - 1.0 - - IAudioMetricExt - default - - diff --git a/media_codecs_aosp_c2.xml b/media_codecs_aosp_c2.xml index ea96e21b..6846cbe3 100644 --- a/media_codecs_aosp_c2.xml +++ b/media_codecs_aosp_c2.xml @@ -49,11 +49,11 @@ - + - - + + @@ -176,12 +176,13 @@ + - + diff --git a/media_codecs_performance_c2.xml b/media_codecs_performance_c2.xml index 08dfd5d1..21381a94 100644 --- a/media_codecs_performance_c2.xml +++ b/media_codecs_performance_c2.xml @@ -155,29 +155,25 @@ - - - - - - - - - - + + + + + - - - - - - - - - - + + + + + + + + + + + @@ -251,5 +247,13 @@ + + + + + + + + diff --git a/overlay/frameworks/base/core/res/res/values/config.xml b/overlay/frameworks/base/core/res/res/values/config.xml index b6a8951e..1f1bceac 100644 --- a/overlay/frameworks/base/core/res/res/values/config.xml +++ b/overlay/frameworks/base/core/res/res/values/config.xml @@ -289,10 +289,4 @@ "com.shannon.imsservice" "com.android.phone" - - - - com.facebook.orca - com.skype.raider - diff --git a/overlay/frameworks/base/packages/SystemUI/res/values/config.xml b/overlay/frameworks/base/packages/SystemUI/res/values/config.xml index 67dcdc54..269450ee 100644 --- a/overlay/frameworks/base/packages/SystemUI/res/values/config.xml +++ b/overlay/frameworks/base/packages/SystemUI/res/values/config.xml @@ -26,5 +26,5 @@ false - M21,0C19.94,0.01 18.83,0.04 17.73,0.11C16.91,0.17 16.09,0.25 15.3,0.36C14.5,0.48 13.72,0.62 12.95,0.81C11.42,1.19 9.97,1.72 8.65,2.43C7.32,3.14 6.12,4.02 5.08,5.07C4.04,6.11 3.15,7.31 2.44,8.64C1.73,9.97 1.19,11.42 0.82,12.94C0.63,13.7 0.48,14.49 0.37,15.29C0.25,16.09 0.17,16.9 0.12,17.72C0.05,18.82 0.02,19.93 0.01,21.55 + M21,0C19.94,0.01 18.83,0.04 17.73,0.11C16.91,0.17 16.09,0.25 15.3,0.36C14.5,0.48 13.72,0.62 12.95,0.81C11.42,1.19 9.97,1.72 8.65,2.43C7.32,3.14 6.12,4.02 5.08,5.07C4.04,6.11 3.15,7.31 2.44,8.64C1.73,9.97 1.19,11.42 0.82,12.94C0.63,13.7 0.48,14.49 0.37,15.29C0.25,16.09 0.17,16.9 0.12,17.72C0.05,18.82 0.02,19.93 0.01,21.55 diff --git a/pixelstats/service.cpp b/pixelstats/service.cpp index 445d222a..d9f65e93 100644 --- a/pixelstats/service.cpp +++ b/pixelstats/service.cpp @@ -68,7 +68,16 @@ const struct SysfsCollector::SysfsPaths sysfs_paths = { "/sys/devices/platform/100b0000.AUR/trip_counter", }, .CCARatePath = "/sys/devices/platform/audiometrics/cca_rate_read_once", - .TempResidencyPath = "/sys/kernel/metrics/temp_residency/temp_residency_all/stats", + .TempResidencyAndResetPaths = { + { + "/sys/kernel/metrics/thermal/tr_by_group/tmu/stats", + "/sys/kernel/metrics/thermal/tr_by_group/tmu/stats_reset" + }, + { + "/sys/kernel/metrics/thermal/tr_by_group/spmic/stats", + "/sys/kernel/metrics/thermal/tr_by_group/spmic/stats_reset" + } + }, .ResumeLatencyMetricsPath = "/sys/kernel/metrics/resume_latency/resume_latency_metrics", .LongIRQMetricsPath = "/sys/kernel/metrics/irq/long_irq_metrics", .ModemPcieLinkStatsPath = "/sys/devices/platform/11920000.pcie/link_stats", @@ -77,7 +86,6 @@ const struct SysfsCollector::SysfsPaths sysfs_paths = { const struct UeventListener::UeventPaths ueventPaths = { .AudioUevent = "/devices/virtual/amcs/amcs", - .WirelessChargerPtmcPath = "/sys/class/power_supply/wireless/device/ptmc_id", .TypeCPartnerUevent = "PRODUCT_TYPE="}; int main() { diff --git a/powerstats/Gs201CommonDataProviders.cpp b/powerstats/Gs201CommonDataProviders.cpp index a3249357..d6f1af58 100644 --- a/powerstats/Gs201CommonDataProviders.cpp +++ b/powerstats/Gs201CommonDataProviders.cpp @@ -16,6 +16,7 @@ #include #include +#include #include #include #include @@ -33,6 +34,7 @@ #include #include +using aidl::android::hardware::power::stats::AdaptiveDvfsStateResidencyDataProvider; using aidl::android::hardware::power::stats::AocTimedStateResidencyDataProvider; using aidl::android::hardware::power::stats::DevfreqStateResidencyDataProvider; using aidl::android::hardware::power::stats::DvfsStateResidencyDataProvider; @@ -166,6 +168,15 @@ void addAoC(std::shared_ptr p) { void addDvfsStats(std::shared_ptr p) { // A constant to represent the number of nanoseconds in one millisecond const int NS_TO_MS = 1000000; + std::string path = "/sys/devices/platform/acpm_stats/fvp_stats"; + + std::vector> adpCfgs = { + std::make_pair("CL0", "/sys/devices/system/cpu/cpufreq/policy0/stats"), + std::make_pair("CL1", "/sys/devices/system/cpu/cpufreq/policy4/stats"), + std::make_pair("CL2", "/sys/devices/system/cpu/cpufreq/policy6/stats") + }; + p->addStateResidencyDataProvider(std::make_unique( + path, NS_TO_MS, adpCfgs)); std::vector cfgs; @@ -187,7 +198,7 @@ void addDvfsStats(std::shared_ptr p) { }}); p->addStateResidencyDataProvider(std::make_unique( - "/sys/devices/platform/acpm_stats/fvp_stats", NS_TO_MS, cfgs)); + path, NS_TO_MS, cfgs)); } void addSoC(std::shared_ptr p) { @@ -523,18 +534,6 @@ void addPowerDomains(std::shared_ptr p) { } void addDevfreq(std::shared_ptr p) { - p->addStateResidencyDataProvider(std::make_unique( - "CL0", - "/sys/devices/system/cpu/cpufreq/policy0/stats")); - - p->addStateResidencyDataProvider(std::make_unique( - "CL1", - "/sys/devices/system/cpu/cpufreq/policy4/stats")); - - p->addStateResidencyDataProvider(std::make_unique( - "CL2", - "/sys/devices/system/cpu/cpufreq/policy6/stats")); - p->addStateResidencyDataProvider(std::make_unique( "MIF", "/sys/devices/platform/17000010.devfreq_mif/devfreq/17000010.devfreq_mif")); @@ -601,6 +600,14 @@ void addPixelStateResidencyDataProvider(std::shared_ptr p) { p->addStateResidencyDataProvider(std::move(pixelSdp)); } +void addCamera(std::shared_ptr p) { + p->addEnergyConsumer(PowerStatsEnergyConsumer::createMeterConsumer( + p, + EnergyConsumerType::CAMERA, + "CAMERA", + {"VSYS_PWR_CAM"})); +} + void addGs201CommonDataProviders(std::shared_ptr p) { setEnergyMeter(p); @@ -618,6 +625,7 @@ void addGs201CommonDataProviders(std::shared_ptr p) { addPowerDomains(p); addDevfreq(p); addTPU(p); + addCamera(p); } void addNFC(std::shared_ptr p, const std::string& path) { diff --git a/powerstats/include/Gs201CommonDataProviders.h b/powerstats/include/Gs201CommonDataProviders.h index 5ee8108f..97a70668 100644 --- a/powerstats/include/Gs201CommonDataProviders.h +++ b/powerstats/include/Gs201CommonDataProviders.h @@ -22,6 +22,7 @@ using aidl::android::hardware::power::stats::PowerStats; void addAoC(std::shared_ptr p); void addCPUclusters(std::shared_ptr p); +void addCamera(std::shared_ptr p); void addDevfreq(std::shared_ptr p); void addDvfsStats(std::shared_ptr p); void addGNSS(std::shared_ptr p); diff --git a/preinstalled-packages-product-gs201-device-debug.xml b/preinstalled-packages-product-gs201-device-debug.xml new file mode 100644 index 00000000..a0b67c36 --- /dev/null +++ b/preinstalled-packages-product-gs201-device-debug.xml @@ -0,0 +1,35 @@ + + + + + + + + + + + + + + + + + + + diff --git a/radio/config/default.nprf b/radio/config/default.nprf index a59dd2df..e245700e 100644 Binary files a/radio/config/default.nprf and b/radio/config/default.nprf differ diff --git a/radio/config/logging.conf b/radio/config/logging.conf index d57c82aa..e852dd57 100644 --- a/radio/config/logging.conf +++ b/radio/config/logging.conf @@ -1 +1 @@ -modem_logging_control START -o /data/vendor/radio/logs/always-on -n 10 -s 20 -m /vendor/etc/modem/default.cfg --enable_exmetric --enable_exmetric_internal \ No newline at end of file +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 \ No newline at end of file diff --git a/sensorhal/sensorlist.cpp b/sensorhal/sensorlist.cpp deleted file mode 100644 index fb621822..00000000 --- a/sensorhal/sensorlist.cpp +++ /dev/null @@ -1,578 +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. - */ - -#include "sensorlist.h" - -#include - -#include "hubdefs.h" - -using namespace android; - -const int kVersion = 1; - -const float kMinSampleRateHzAccel = 6.250f; -const float kMaxSampleRateHzAccel = 400.0f; -const float kAccelRangeG = 16.0f; -extern const float kScaleAccel = (kAccelRangeG * 9.81f / 32768.0f); - -const float kMinSampleRateHzGyro = 6.250f; -const float kMaxSampleRateHzGyro = 400.0f; - -const float kMinSampleRateHzMag = 3.125f; -const float kMaxSampleRateHzMag = 50.0f; -extern const float kScaleMag = 0.15f; - -const float kMinSampleRateHzPolling = 0.1f; -const float kMaxSampleRateHzPolling = 25.0f; - -const float kMinSampleRateHzPressure = 0.1f; -const float kMaxSampleRateHzPressure = 10.0f; - -const float kMinSampleRateHzTemperature = kMinSampleRateHzPolling; -const float kMaxSampleRateHzTemperature = kMaxSampleRateHzPolling; - -const float kMinSampleRateHzProximity = kMinSampleRateHzPolling; -const float kMaxSampleRateHzProximity = 5.0; - -const float kMinSampleRateHzLight = kMinSampleRateHzPolling; -const float kMaxSampleRateHzLight = 5.0; - -const float kMinSampleRateHzOrientation = 12.5f; -const float kMaxSampleRateHzOrientation = 200.0f; - -#ifdef DIRECT_REPORT_ENABLED -constexpr uint32_t kDirectReportFlagAccel = ( - // support up to rate level fast (nominal 200Hz); - (SENSOR_DIRECT_RATE_FAST << SENSOR_FLAG_SHIFT_DIRECT_REPORT) - // support ashmem and gralloc direct channel - | SENSOR_FLAG_DIRECT_CHANNEL_ASHMEM - | SENSOR_FLAG_DIRECT_CHANNEL_GRALLOC); -constexpr uint32_t kDirectReportFlagGyro = ( - // support up to rate level fast (nominal 200Hz); - (SENSOR_DIRECT_RATE_FAST << SENSOR_FLAG_SHIFT_DIRECT_REPORT) - // support ashmem and gralloc direct channel - | SENSOR_FLAG_DIRECT_CHANNEL_ASHMEM - | SENSOR_FLAG_DIRECT_CHANNEL_GRALLOC); -constexpr uint32_t kDirectReportFlagMag = ( - // support up to rate level normal (nominal 50Hz); - (SENSOR_DIRECT_RATE_NORMAL << SENSOR_FLAG_SHIFT_DIRECT_REPORT) - // support ashmem and gralloc direct channel - | SENSOR_FLAG_DIRECT_CHANNEL_ASHMEM - | SENSOR_FLAG_DIRECT_CHANNEL_GRALLOC); -#else -constexpr uint32_t kDirectReportFlagAccel = 0; -constexpr uint32_t kDirectReportFlagGyro = 0; -constexpr uint32_t kDirectReportFlagMag = 0; -#endif - -/* - * The fowllowing max count is determined by the total number of blocks - * avaliable in the shared nanohub buffer and number of samples each type of - * event can hold within a buffer block. - * For marlin's case, there are 239 blocks in the shared sensor buffer and - * each block can hold 30 OneAxis Samples, 15 ThreeAxis Samples or 24 - * RawThreeAxies Samples. - */ -const int kMaxOneAxisEventCount = 7170; -const int kMaxThreeAxisEventCount = 3585; -const int kMaxRawThreeAxisEventCount = 5736; - -const int kMinFifoReservedEventCount = 20; - -const char SENSOR_STRING_TYPE_INTERNAL_TEMPERATURE[] = - "com.google.sensor.internal_temperature"; -const char SENSOR_STRING_TYPE_SYNC[] = - "com.google.sensor.sync"; -const char SENSOR_STRING_TYPE_DOUBLE_TWIST[] = - "com.google.sensor.double_twist"; -const char SENSOR_STRING_TYPE_DOUBLE_TAP[] = - "com.google.sensor.double_tap"; -const char SENSOR_STRING_TYPE_DOUBLE_TOUCH[] = - "com.google.sensor.double_touch"; - -extern const sensor_t kSensorList[] = { - { - "TMD4903 Proximity Sensor", - "AMS", - kVersion, - COMMS_SENSOR_PROXIMITY, - SENSOR_TYPE_PROXIMITY, - 5.0f, // maxRange (cm) - 1.0f, // resolution (cm) - 0.0f, // XXX power - (int32_t)(1.0E6f / kMaxSampleRateHzProximity), // minDelay - 300, // XXX fifoReservedEventCount - kMaxOneAxisEventCount, // XXX fifoMaxEventCount - SENSOR_STRING_TYPE_PROXIMITY, - "", // requiredPermission - (long)(1.0E6f / kMinSampleRateHzProximity), // maxDelay - SENSOR_FLAG_WAKE_UP | SENSOR_FLAG_ON_CHANGE_MODE, - { NULL, NULL } - }, - { - "TMD4903 Light Sensor", - "AMS", - kVersion, - COMMS_SENSOR_LIGHT, - SENSOR_TYPE_LIGHT, - 43000.0f, // maxRange (lx) - 10.0f, // XXX resolution (lx) - 0.0f, // XXX power - (int32_t)(1.0E6f / kMaxSampleRateHzLight), // minDelay - kMinFifoReservedEventCount, // XXX fifoReservedEventCount - kMaxOneAxisEventCount, // XXX fifoMaxEventCount - SENSOR_STRING_TYPE_LIGHT, - "", // requiredPermission - (long)(1.0E6f / kMinSampleRateHzLight), // maxDelay - SENSOR_FLAG_ON_CHANGE_MODE, - { NULL, NULL } - }, - { - "BMI160 accelerometer", - "Bosch", - kVersion, - COMMS_SENSOR_ACCEL, - SENSOR_TYPE_ACCELEROMETER, - GRAVITY_EARTH * kAccelRangeG, // maxRange - GRAVITY_EARTH * kAccelRangeG / 32768.0f, // resolution - 0.0f, // XXX power - (int32_t)(1.0E6f / kMaxSampleRateHzAccel), // minDelay - 3000, // XXX fifoReservedEventCount - kMaxRawThreeAxisEventCount, // XXX fifoMaxEventCount - SENSOR_STRING_TYPE_ACCELEROMETER, - "", // requiredPermission - (long)(1.0E6f / kMinSampleRateHzAccel), // maxDelay - SENSOR_FLAG_CONTINUOUS_MODE | kDirectReportFlagAccel, - { NULL, NULL } - }, - { - "BMI160 gyroscope", - "Bosch", - kVersion, - COMMS_SENSOR_GYRO, - SENSOR_TYPE_GYROSCOPE, - 1000.0f * M_PI / 180.0f, // maxRange - 1000.0f * M_PI / (180.0f * 32768.0f), // resolution - 0.0f, // XXX power - (int32_t)(1.0E6f / kMaxSampleRateHzGyro), // minDelay - kMinFifoReservedEventCount, // XXX fifoReservedEventCount - kMaxThreeAxisEventCount, // XXX fifoMaxEventCount - SENSOR_STRING_TYPE_GYROSCOPE, - "", // requiredPermission - (long)(1.0E6f / kMinSampleRateHzGyro), // maxDelay - SENSOR_FLAG_CONTINUOUS_MODE | kDirectReportFlagGyro, - { NULL, NULL } - }, - { - "BMI160 gyroscope (uncalibrated)", - "Bosch", - kVersion, - COMMS_SENSOR_GYRO_UNCALIBRATED, - SENSOR_TYPE_GYROSCOPE_UNCALIBRATED, - 1000.0f * M_PI / 180.0f, // maxRange - 1000.0f * M_PI / (180.0f * 32768.0f), // resolution - 0.0f, // XXX power - (int32_t)(1.0E6f / kMaxSampleRateHzGyro), // minDelay - kMinFifoReservedEventCount, // XXX fifoReservedEventCount - kMaxThreeAxisEventCount, // XXX fifoMaxEventCount - SENSOR_STRING_TYPE_GYROSCOPE_UNCALIBRATED, - "", // requiredPermission - (long)(1.0E6f / kMinSampleRateHzGyro), // maxDelay - SENSOR_FLAG_CONTINUOUS_MODE | kDirectReportFlagGyro, - { NULL, NULL } - }, - { - "AK09915 magnetometer", - "AKM", - kVersion, - COMMS_SENSOR_MAG, - SENSOR_TYPE_MAGNETIC_FIELD, - 1300.0f, // XXX maxRange - 0.0f, // XXX resolution - 0.0f, // XXX power - (int32_t)(1.0E6f / kMaxSampleRateHzMag), // minDelay - 600, // XXX fifoReservedEventCount - kMaxThreeAxisEventCount, // XXX fifoMaxEventCount - SENSOR_STRING_TYPE_MAGNETIC_FIELD, - "", // requiredPermission - (long)(1.0E6f / kMinSampleRateHzMag), // maxDelay - SENSOR_FLAG_CONTINUOUS_MODE | kDirectReportFlagMag, - { NULL, NULL } - }, - { - "AK09915 magnetometer (uncalibrated)", - "AKM", - kVersion, - COMMS_SENSOR_MAG_UNCALIBRATED, - SENSOR_TYPE_MAGNETIC_FIELD_UNCALIBRATED, - 1300.0f, // XXX maxRange - 0.0f, // XXX resolution - 0.0f, // XXX power - (int32_t)(1.0E6f / kMaxSampleRateHzMag), // minDelay - 600, // XXX fifoReservedEventCount - kMaxThreeAxisEventCount, // XXX fifoMaxEventCount - SENSOR_STRING_TYPE_MAGNETIC_FIELD_UNCALIBRATED, - "", // requiredPermission - (long)(1.0E6f / kMinSampleRateHzMag), // maxDelay - SENSOR_FLAG_CONTINUOUS_MODE | kDirectReportFlagMag, - { NULL, NULL } - }, - { - "BMP285 pressure", - "Bosch", - kVersion, - COMMS_SENSOR_PRESSURE, - SENSOR_TYPE_PRESSURE, - 1100.0f, // maxRange (hPa) - 0.005f, // resolution (hPa) - 0.0f, // XXX power - (int32_t)(1.0E6f / kMaxSampleRateHzPressure), // minDelay - 300, // XXX fifoReservedEventCount - kMaxOneAxisEventCount, // XXX fifoMaxEventCount - SENSOR_STRING_TYPE_PRESSURE, - "", // requiredPermission - (long)(1.0E6f / kMinSampleRateHzPressure), // maxDelay - SENSOR_FLAG_CONTINUOUS_MODE, - { NULL, NULL } - }, - { - "BMP285 temperature", - "Bosch", - kVersion, - COMMS_SENSOR_TEMPERATURE, - SENSOR_TYPE_INTERNAL_TEMPERATURE, - 85.0f, // maxRange (degC) - 0.01, // resolution (degC) - 0.0f, // XXX power - (int32_t)(1.0E6f / kMaxSampleRateHzTemperature), // minDelay - kMinFifoReservedEventCount, // XXX fifoReservedEventCount - kMaxOneAxisEventCount, // XXX fifoMaxEventCount - SENSOR_STRING_TYPE_INTERNAL_TEMPERATURE, - "", // requiredPermission - (long)(1.0E6f / kMinSampleRateHzTemperature), // maxDelay - SENSOR_FLAG_CONTINUOUS_MODE, - { NULL, NULL } - }, - { - "Orientation", - "Google", - kVersion, - COMMS_SENSOR_ORIENTATION, - SENSOR_TYPE_ORIENTATION, - 360.0f, // maxRange (deg) - 1.0f, // XXX resolution (deg) - 0.0f, // XXX power - (int32_t)(1.0E6f / kMaxSampleRateHzOrientation), // minDelay - kMinFifoReservedEventCount, // XXX fifoReservedEventCount - kMaxThreeAxisEventCount, // XXX fifoMaxEventCount - SENSOR_STRING_TYPE_ORIENTATION, - "", // requiredPermission - (long)(1.0E6f / kMinSampleRateHzOrientation), // maxDelay - SENSOR_FLAG_CONTINUOUS_MODE, - { NULL, NULL } - }, - { - "BMI160 Step detector", - "Bosch", - kVersion, - COMMS_SENSOR_STEP_DETECTOR, - SENSOR_TYPE_STEP_DETECTOR, - 1.0f, // maxRange - 1.0f, // XXX resolution - 0.0f, // XXX power - 0, // minDelay - 100, // XXX fifoReservedEventCount - kMaxOneAxisEventCount, // XXX fifoMaxEventCount - SENSOR_STRING_TYPE_STEP_DETECTOR, - "", // requiredPermission - 0, // maxDelay - SENSOR_FLAG_SPECIAL_REPORTING_MODE, - { NULL, NULL } - }, - { - "BMI160 Step counter", - "Bosch", - kVersion, - COMMS_SENSOR_STEP_COUNTER, - SENSOR_TYPE_STEP_COUNTER, - 1.0f, // XXX maxRange - 1.0f, // resolution - 0.0f, // XXX power - 0, // minDelay - kMinFifoReservedEventCount, // XXX fifoReservedEventCount - kMaxOneAxisEventCount, // XXX fifoMaxEventCount - SENSOR_STRING_TYPE_STEP_COUNTER, - "", // requiredPermission - 0, // maxDelay - SENSOR_FLAG_ON_CHANGE_MODE, - { NULL, NULL } - }, - { - "Significant motion", - "Google", - kVersion, - COMMS_SENSOR_SIGNIFICANT_MOTION, - SENSOR_TYPE_SIGNIFICANT_MOTION, - 1.0f, // maxRange - 1.0f, // XXX resolution - 0.0f, // XXX power - -1, // minDelay - 0, // XXX fifoReservedEventCount - 0, // XXX fifoMaxEventCount - SENSOR_STRING_TYPE_SIGNIFICANT_MOTION, - "", // requiredPermission - 0, // maxDelay - SENSOR_FLAG_WAKE_UP | SENSOR_FLAG_ONE_SHOT_MODE, - { NULL, NULL } - }, - { - "Gravity", - "Google", - kVersion, - COMMS_SENSOR_GRAVITY, - SENSOR_TYPE_GRAVITY, - 1000.0f, // maxRange - 1.0f, // XXX resolution - 0.0f, // XXX power - (int32_t)(1.0E6f / kMaxSampleRateHzOrientation), // minDelay - kMinFifoReservedEventCount, // XXX fifoReservedEventCount - kMaxThreeAxisEventCount, // XXX fifoMaxEventCount - SENSOR_STRING_TYPE_GRAVITY, - "", // requiredPermission - (long)(1.0E6f / kMinSampleRateHzOrientation), // maxDelay - SENSOR_FLAG_CONTINUOUS_MODE, - { NULL, NULL } - }, - { - "Linear Acceleration", - "Google", - kVersion, - COMMS_SENSOR_LINEAR_ACCEL, - SENSOR_TYPE_LINEAR_ACCELERATION, - 1000.0f, // maxRange - 1.0f, // XXX resolution - 0.0f, // XXX power - (int32_t)(1.0E6f / kMaxSampleRateHzOrientation), // minDelay - kMinFifoReservedEventCount, // XXX fifoReservedEventCount - kMaxThreeAxisEventCount, // XXX fifoMaxEventCount - SENSOR_STRING_TYPE_LINEAR_ACCELERATION, - "", // requiredPermission - (long)(1.0E6f / kMinSampleRateHzOrientation), // maxDelay - SENSOR_FLAG_CONTINUOUS_MODE, - { NULL, NULL } - }, - { - "Rotation Vector", - "Google", - kVersion, - COMMS_SENSOR_ROTATION_VECTOR, - SENSOR_TYPE_ROTATION_VECTOR, - 1000.0f, // maxRange - 1.0f, // XXX resolution - 0.0f, // XXX power - (int32_t)(1.0E6f / kMaxSampleRateHzOrientation), // minDelay - kMinFifoReservedEventCount, // XXX fifoReservedEventCount - kMaxThreeAxisEventCount, // XXX fifoMaxEventCount - SENSOR_STRING_TYPE_ROTATION_VECTOR, - "", // requiredPermission - (long)(1.0E6f / kMinSampleRateHzOrientation), // maxDelay - SENSOR_FLAG_CONTINUOUS_MODE, - { NULL, NULL } - }, - { - "Geomagnetic Rotation Vector", - "Google", - kVersion, - COMMS_SENSOR_GEO_MAG, - SENSOR_TYPE_GEOMAGNETIC_ROTATION_VECTOR, - 1000.0f, // maxRange - 1.0f, // XXX resolution - 0.0f, // XXX power - (int32_t)(1.0E6f / kMaxSampleRateHzOrientation), // minDelay - kMinFifoReservedEventCount, // XXX fifoReservedEventCount - kMaxThreeAxisEventCount, // XXX fifoMaxEventCount - SENSOR_STRING_TYPE_GEOMAGNETIC_ROTATION_VECTOR, - "", // requiredPermission - (long)(1.0E6f / kMinSampleRateHzOrientation), // maxDelay - SENSOR_FLAG_CONTINUOUS_MODE, - { NULL, NULL } - }, - { - "Game Rotation Vector", - "Google", - kVersion, - COMMS_SENSOR_GAME_ROTATION_VECTOR, - SENSOR_TYPE_GAME_ROTATION_VECTOR, - 1000.0f, // maxRange - 1.0f, // XXX resolution - 0.0f, // XXX power - (int32_t)(1.0E6f / kMaxSampleRateHzOrientation), // minDelay - 300, // XXX fifoReservedEventCount - kMaxThreeAxisEventCount, // XXX fifoMaxEventCount - SENSOR_STRING_TYPE_GAME_ROTATION_VECTOR, - "", // requiredPermission - (long)(1.0E6f / kMinSampleRateHzOrientation), // maxDelay - SENSOR_FLAG_CONTINUOUS_MODE, - { NULL, NULL } - }, - { - "Tilt Detector", - "Google", - kVersion, - COMMS_SENSOR_TILT, - SENSOR_TYPE_TILT_DETECTOR, - 1.0f, // maxRange - 1.0f, // XXX resolution - 0.0f, // XXX power - 0, // minDelay - kMinFifoReservedEventCount, // XXX fifoReservedEventCount - kMaxOneAxisEventCount, // XXX fifoMaxEventCount - SENSOR_STRING_TYPE_TILT_DETECTOR, - "", // requiredPermission - 0, // maxDelay - SENSOR_FLAG_WAKE_UP | SENSOR_FLAG_SPECIAL_REPORTING_MODE, - { NULL, NULL } - }, - { - "Pickup Gesture", - "Google", - kVersion, - COMMS_SENSOR_GESTURE, - SENSOR_TYPE_PICK_UP_GESTURE, - 1.0f, // maxRange - 1.0f, // XXX resolution - 0.0f, // XXX power - -1, // minDelay - 0, // XXX fifoReservedEventCount - 0, // XXX fifoMaxEventCount - SENSOR_STRING_TYPE_PICK_UP_GESTURE, - "", // requiredPermission - 0, // maxDelay - SENSOR_FLAG_WAKE_UP | SENSOR_FLAG_ONE_SHOT_MODE, - { NULL, NULL } - }, - { - "Sensors Sync", - "Google", - kVersion, - COMMS_SENSOR_SYNC, - SENSOR_TYPE_SYNC, - 1.0f, // maxRange - 1.0f, // XXX resolution - 0.1f, // XXX power - 0, // minDelay - kMinFifoReservedEventCount, // XXX fifoReservedEventCount - kMaxOneAxisEventCount, // XXX fifoMaxEventCount - SENSOR_STRING_TYPE_SYNC, - "", // requiredPermission - 0, // maxDelay - SENSOR_FLAG_SPECIAL_REPORTING_MODE, - { NULL, NULL } - }, - { - "Double Twist", - "Google", - kVersion, - COMMS_SENSOR_DOUBLE_TWIST, - SENSOR_TYPE_DOUBLE_TWIST, - 1.0f, // maxRange - 1.0f, // XXX resolution - 0.1f, // XXX power - 0, // minDelay - kMinFifoReservedEventCount, // XXX fifoReservedEventCount - kMaxOneAxisEventCount, // XXX fifoMaxEventCount - SENSOR_STRING_TYPE_DOUBLE_TWIST, - "", // requiredPermission - 0, // maxDelay - SENSOR_FLAG_WAKE_UP | SENSOR_FLAG_SPECIAL_REPORTING_MODE, - { NULL, NULL } - }, - { - "Double Tap", - "Google", - kVersion, - COMMS_SENSOR_DOUBLE_TAP, - SENSOR_TYPE_DOUBLE_TAP, - 1.0f, // maxRange - 1.0f, // XXX resolution - 0.1f, // XXX power - 0, // minDelay - kMinFifoReservedEventCount, // XXX fifoReservedEventCount - kMaxOneAxisEventCount, // XXX fifoMaxEventCount - SENSOR_STRING_TYPE_DOUBLE_TAP, - "", // requiredPermission - 0, // maxDelay - SENSOR_FLAG_SPECIAL_REPORTING_MODE, - { NULL, NULL } - }, - { - "Device Orientation", - "Google", - kVersion, - COMMS_SENSOR_WINDOW_ORIENTATION, - SENSOR_TYPE_DEVICE_ORIENTATION, - 3.0f, // maxRange - 1.0f, // XXX resolution - 0.1f, // XXX power - 0, // minDelay - kMinFifoReservedEventCount, // XXX fifoReservedEventCount - kMaxOneAxisEventCount, // XXX fifoMaxEventCount - SENSOR_STRING_TYPE_DEVICE_ORIENTATION, - "", // requiredPermission - 0, // maxDelay - SENSOR_FLAG_ON_CHANGE_MODE, - { NULL, NULL } - }, - { - "Double Touch", - "Google", - kVersion, - COMMS_SENSOR_DOUBLE_TOUCH, - SENSOR_TYPE_DOUBLE_TOUCH, - 1.0f, // maxRange - 1.0f, // XXX resolution - 0.0f, // XXX power - -1, // minDelay - 0, // XXX fifoReservedEventCount - 0, // XXX fifoMaxEventCount - SENSOR_STRING_TYPE_DOUBLE_TOUCH, - "", // requiredPermission - 0, // maxDelay - SENSOR_FLAG_WAKE_UP | SENSOR_FLAG_ONE_SHOT_MODE, - { NULL, NULL } - }, - { - "BMI160 accelerometer (uncalibrated)", - "Bosch", - kVersion, - COMMS_SENSOR_ACCEL_UNCALIBRATED, - SENSOR_TYPE_ACCELEROMETER_UNCALIBRATED, - GRAVITY_EARTH * kAccelRangeG, // maxRange - GRAVITY_EARTH * kAccelRangeG / 32768.0f, // resolution - 0.0f, // XXX power - (int32_t)(1.0E6f / kMaxSampleRateHzAccel), // minDelay - 3000, // XXX fifoReservedEventCount - kMaxRawThreeAxisEventCount, // XXX fifoMaxEventCount - SENSOR_STRING_TYPE_ACCELEROMETER_UNCALIBRATED, - "", // requiredPermission - (long)(1.0E6f / kMinSampleRateHzAccel), // maxDelay - SENSOR_FLAG_CONTINUOUS_MODE | kDirectReportFlagAccel, - { NULL, NULL } - }, -}; - -extern const size_t kSensorCount = sizeof(kSensorList) / sizeof(sensor_t); diff --git a/sensors/Android.mk b/sensors/Android.mk deleted file mode 100644 index 996e03fd..00000000 --- a/sensors/Android.mk +++ /dev/null @@ -1,34 +0,0 @@ -# Copyright (C) 2009 The Android Open Source Project -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -ifeq ($(BOARD_USES_EXYNOS_SENSORS_DUMMY), true) - -LOCAL_PATH := $(call my-dir) - -# HAL module implemenation stored in -# hw/..so -include $(CLEAR_VARS) - -LOCAL_MODULE_RELATIVE_PATH := hw -LOCAL_SHARED_LIBRARIES := liblog libcutils libhardware -LOCAL_SRC_FILES := sensors_dummy.c -LOCAL_MODULE := sensors.gs201 -LOCAL_LICENSE_KINDS := SPDX-license-identifier-Apache-2.0 -LOCAL_LICENSE_CONDITIONS := notice -LOCAL_NOTICE_FILE := $(LOCAL_PATH)/../NOTICE -LOCAL_PROPRIETARY_MODULE := true - -include $(BUILD_SHARED_LIBRARY) - -endif diff --git a/sensors/sensors_dummy.c b/sensors/sensors_dummy.c deleted file mode 100644 index b1edd562..00000000 --- a/sensors/sensors_dummy.c +++ /dev/null @@ -1,409 +0,0 @@ -/* - * Copyright (C) 2009 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/* this implements a sensors hardware library for the Android emulator. - * the following code should be built as a shared library that will be - * placed into /system/lib/hw/sensors.goldfish.so - * - * it will be loaded by the code in hardware/libhardware/hardware.c - * which is itself called from com_android_server_SensorService.cpp - */ - -#define SENSORS_SERVICE_NAME "sensors" - -#define LOG_TAG "Dummy_Sensors" - -#include -#include -#include -#include -#include -#include -#include -#include - -#if 0 -#define D(...) ALOGD(__VA_ARGS__) -#else -#define D(...) ((void)0) -#endif - -#define E(...) ALOGE(__VA_ARGS__) - -/** SENSOR IDS AND NAMES - **/ - -#define MAX_NUM_SENSORS 8 - -#define SUPPORTED_SENSORS ((1<"; -} - -static int -_sensorIdFromName( const char* name ) -{ - int nn; - - if (name == NULL) - return -1; - - for (nn = 0; nn < MAX_NUM_SENSORS; nn++) - if (!strcmp(name, _sensorIds[nn].name)) - return _sensorIds[nn].id; - - return -1; -} - -/* return the current time in nanoseconds */ -static int64_t now_ns(void) { - struct timespec ts; - clock_gettime(CLOCK_MONOTONIC, &ts); - return (int64_t)ts.tv_sec * 1000000000 + ts.tv_nsec; -} - -/** SENSORS POLL DEVICE - ** - ** This one is used to read sensor data from the hardware. - ** We implement this by simply reading the data from the - ** emulator through the QEMUD channel. - **/ - -typedef struct SensorDevice { - struct sensors_poll_device_1 device; - sensors_event_t sensors[MAX_NUM_SENSORS]; - uint32_t pendingSensors; - int64_t timeStart; - int64_t timeOffset; - uint32_t active_sensors; - int fd; - pthread_mutex_t lock; -} SensorDevice; - -/* Grab the file descriptor to the emulator's sensors service pipe. - * This function returns a file descriptor on success, or -errno on - * failure, and assumes the SensorDevice instance's lock is held. - * - * This is needed because set_delay(), poll() and activate() can be called - * from different threads, and poll() is blocking. - * - * 1) On a first thread, de-activate() all sensors first, then call poll(), - * which results in the thread blocking. - * - * 2) On a second thread, slightly later, call set_delay() then activate() - * to enable the acceleration sensor. - * - * The system expects this to unblock the first thread which will receive - * new sensor events after the activate() call in 2). - * - * This cannot work if both threads don't use the same connection. - * - * TODO(digit): This protocol is brittle, implement another control channel - * for set_delay()/activate()/batch() when supporting HAL 1.3 - */ -static int sensor_device_get_fd_locked(SensorDevice* dev) { - /* Create connection to service on first call */ - if (dev->fd < 0) { - int ret = -errno; - E("%s: Could not open connection to service: %s", __FUNCTION__, - strerror(-ret)); - return ret; - } - return dev->fd; -} - -/* Pick up one pending sensor event. On success, this returns the sensor - * id, and sets |*event| accordingly. On failure, i.e. if there are no - * pending events, return -EINVAL. - * - * Note: The device's lock must be acquired. - */ -static int sensor_device_pick_pending_event_locked(SensorDevice* d, - sensors_event_t* event) -{ - uint32_t mask = SUPPORTED_SENSORS & d->pendingSensors; - - if (mask) { - uint32_t i = 31 - __builtin_clz(mask); - - pthread_mutex_lock(&d->lock); - d->pendingSensors &= ~(1U << i); - *event = d->sensors[i]; - event->sensor = i; - event->version = sizeof(*event); - pthread_mutex_unlock(&d->lock); - D("%s: %d [%f, %f, %f]", __FUNCTION__, - i, - event->data[0], - event->data[1], - event->data[2]); - return i; - } - E("No sensor to return!!! pendingSensors=0x%08x", d->pendingSensors); - // we may end-up in a busy loop, slow things down, just in case. - usleep(1000); - return -EINVAL; -} - -static int sensor_device_close(struct hw_device_t* dev0) -{ - SensorDevice* dev = (void*)dev0; - // Assume that there are no other threads blocked on poll() - if (dev->fd >= 0) { - close(dev->fd); - dev->fd = -1; - } - pthread_mutex_destroy(&dev->lock); - free(dev); - return 0; -} - -/* Return an array of sensor data. This function blocks until there is sensor - * related events to report. On success, it will write the events into the - * |data| array, which contains |count| items. The function returns the number - * of events written into the array, which shall never be greater than |count|. - * On error, return -errno code. - * - * Note that according to the sensor HAL [1], it shall never return 0! - * - * [1] http://source.android.com/devices/sensors/hal-interface.html - */ -static int sensor_device_poll(struct sensors_poll_device_t *dev0, - sensors_event_t* data, int count) -{ - return -EIO; -} - -static int sensor_device_activate(struct sensors_poll_device_t *dev0, - int handle, - int enabled) -{ - SensorDevice* dev = (void*)dev0; - - D("%s: handle=%s (%d) enabled=%d", __FUNCTION__, - _sensorIdToName(handle), handle, enabled); - - /* Sanity check */ - if (!ID_CHECK(handle)) { - E("%s: bad handle ID", __FUNCTION__); - return -EINVAL; - } - - /* Exit early if sensor is already enabled/disabled. */ - uint32_t mask = (1U << handle); - uint32_t sensors = enabled ? mask : 0; - - pthread_mutex_lock(&dev->lock); - - uint32_t active = dev->active_sensors; - uint32_t new_sensors = (active & ~mask) | (sensors & mask); - uint32_t changed = active ^ new_sensors; - - if (changed) - dev->active_sensors = new_sensors; - - pthread_mutex_unlock(&dev->lock); - return 0; -} - -static int sensor_device_default_flush( - struct sensors_poll_device_1* dev0, - int handle) { - - SensorDevice* dev = (void*)dev0; - - D("%s: handle=%s (%d)", __FUNCTION__, - _sensorIdToName(handle), handle); - - /* Sanity check */ - if (!ID_CHECK(handle)) { - E("%s: bad handle ID", __FUNCTION__); - return -EINVAL; - } - - pthread_mutex_lock(&dev->lock); - dev->sensors[handle].version = META_DATA_VERSION; - dev->sensors[handle].type = SENSOR_TYPE_META_DATA; - dev->sensors[handle].sensor = 0; - dev->sensors[handle].timestamp = 0; - dev->sensors[handle].meta_data.what = META_DATA_FLUSH_COMPLETE; - dev->pendingSensors |= (1U << handle); - pthread_mutex_unlock(&dev->lock); - - return 0; -} - -static int sensor_device_set_delay(struct sensors_poll_device_t *dev0, - int handle __unused, - int64_t ns) -{ - return 0; -} - -static int sensor_device_default_batch( - struct sensors_poll_device_1* dev, - int sensor_handle, - int flags, - int64_t sampling_period_ns, - int64_t max_report_latency_ns) { - return sensor_device_set_delay(dev, sensor_handle, sampling_period_ns); -} - -/** MODULE REGISTRATION SUPPORT - ** - ** This is required so that hardware/libhardware/hardware.c - ** will dlopen() this library appropriately. - **/ - -/* - * the following is the list of all supported sensors. - * this table is used to build sSensorList declared below - * according to which hardware sensors are reported as - * available from the emulator (see get_sensors_list below) - * - * note: numerical values for maxRange/resolution/power for - * all sensors but light, pressure and humidity were - * taken from the reference AK8976A implementation - */ -static const struct sensor_t sSensorListInit[] = { - { .name = "Accelerometer", - .vendor = "The Android Open Source Project", - .version = 1, - .handle = ID_ACCELERATION, - .type = SENSOR_TYPE_ACCELEROMETER, - .maxRange = 2.8f, - .resolution = 1.0f/4032.0f, - .power = 3.0f, - .minDelay = 10000, - .maxDelay = 60 * 1000 * 1000, - .fifoReservedEventCount = 0, - .fifoMaxEventCount = 0, - .stringType = 0, - .requiredPermission = 0, - .flags = SENSOR_FLAG_CONTINUOUS_MODE, - .reserved = {} - }, -}; - -static struct sensor_t sSensorList[1]; - -static int sensors__get_sensors_list(struct sensors_module_t* module __unused, - struct sensor_t const** list) -{ - *list = sSensorList; - - return 0; -} - -static int -open_sensors(const struct hw_module_t* module, - const char* name, - struct hw_device_t* *device) -{ - int status = -EINVAL; - - D("%s: name=%s", __FUNCTION__, name); - - if (!strcmp(name, SENSORS_HARDWARE_POLL)) { - SensorDevice *dev = malloc(sizeof(*dev)); - - memset(dev, 0, sizeof(*dev)); - - dev->device.common.tag = HARDWARE_DEVICE_TAG; - dev->device.common.version = SENSORS_DEVICE_API_VERSION_1_3; - dev->device.common.module = (struct hw_module_t*) module; - dev->device.common.close = sensor_device_close; - dev->device.poll = sensor_device_poll; - dev->device.activate = sensor_device_activate; - dev->device.setDelay = sensor_device_set_delay; - - // Version 1.3-specific functions - dev->device.batch = sensor_device_default_batch; - dev->device.flush = sensor_device_default_flush; - - dev->fd = -1; - pthread_mutex_init(&dev->lock, NULL); - - *device = &dev->device.common; - status = 0; - } - return status; -} - - -static struct hw_module_methods_t sensors_module_methods = { - .open = open_sensors -}; - -struct sensors_module_t HAL_MODULE_INFO_SYM = { - .common = { - .tag = HARDWARE_MODULE_TAG, - .version_major = 1, - .version_minor = 0, - .id = SENSORS_HARDWARE_MODULE_ID, - .name = "Dummy SENSORS Module", - .author = "The Android Open Source Project", - .methods = &sensors_module_methods, - }, - .get_sensors_list = sensors__get_sensors_list -}; diff --git a/storage/Android.bp b/storage/Android.bp new file mode 100644 index 00000000..90a919b8 --- /dev/null +++ b/storage/Android.bp @@ -0,0 +1,27 @@ +// +// Copyright (C) 2017 The Android Open Source Project +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package { + default_applicable_licenses: [ + "//device/google/gs201:device_google_gs201_license", + ], +} + +sh_binary { + name: "ufs_firmware_update.sh", + src: "ufs_firmware_update.sh", + init_rc: ["storage.gs201.rc"], + vendor: true, +} diff --git a/storage/storage.gs201.rc b/storage/storage.gs201.rc new file mode 100644 index 00000000..9873325d --- /dev/null +++ b/storage/storage.gs201.rc @@ -0,0 +1,7 @@ +on property:sys.boot_completed=1 + # Copy ufs firmware to disk + start ufs_firmware_update + +service ufs_firmware_update /vendor/bin/ufs_firmware_update.sh + disabled + oneshot diff --git a/storage/ufs_firmware_update.sh b/storage/ufs_firmware_update.sh new file mode 100755 index 00000000..d118115f --- /dev/null +++ b/storage/ufs_firmware_update.sh @@ -0,0 +1,19 @@ +#!/vendor/bin/sh +# +# The script belongs to the feature of UFS FFU via OTA: go/p23-ffu-ota +# Its purpose is to copy the corresponding firmware into partition for UFS FFU. + +ufs_dev="/dev/sys/block/bootdevice" +fw_dir="/vendor/firmware" +blk_dev="/dev/block/by-name/fips" + +vendor=$(cat ${ufs_dev}/vendor | tr -d "[:space:]") +model=$(cat ${ufs_dev}/model | tr -d "[:space:]") +rev=$(cat ${ufs_dev}/rev | tr -d "[:space:]") + +file=$(find ${fw_dir} -name "*${vendor}${model}${rev}*" | head -n 1) +if [ -n "$file" ]; then + # The first 4KB block at fips partition has been occupied, and unused space begins from 4 KB + # Refer to: go/pixel-mp-ffu-ota-1p + dd if="$file" of=$blk_dev bs=4k seek=1 +fi diff --git a/task_profiles.json b/task_profiles.json index 4bcfe412..961857de 100644 --- a/task_profiles.json +++ b/task_profiles.json @@ -287,7 +287,7 @@ }, { "Name": "OtaProfiles", - "Profiles": [ "OtaPerformance", "ServiceCapacityLow", "LowIoPriority", "TimerSlackHigh" ] + "Profiles": [ "OtaPerformance", "ProcessCapacityNormal", "LowIoPriority", "TimerSlackHigh" ] } ] } diff --git a/thermal/Android.mk b/thermal/Android.mk deleted file mode 100644 index e69de29b..00000000 diff --git a/thermal/thermal.c b/thermal/thermal.c deleted file mode 100644 index e69de29b..00000000 diff --git a/usb/gadget/Android.bp b/usb/gadget/Android.bp index 502c339f..518a7357 100644 --- a/usb/gadget/Android.bp +++ b/usb/gadget/Android.bp @@ -29,19 +29,21 @@ cc_binary { vintf_fragments: [ "android.hardware.usb.gadget-service.xml", ], + vendor: true, srcs: ["service_gadget.cpp", "UsbGadget.cpp"], cflags: ["-Wall", "-Werror"], shared_libs: [ "libbase", - "libhidlbase", "liblog", "libutils", - "libhardware", - "android.hardware.usb.gadget@1.0", - "android.hardware.usb.gadget@1.1", - "android.hardware.usb.gadget@1.2", + "android.frameworks.stats-V1-ndk", + "android.hardware.usb.gadget-V1-ndk", "libcutils", + "libbinder_ndk", ], - static_libs: ["libpixelusb"], + static_libs: ["libpixelusb-aidl"], proprietary: true, + export_shared_lib_headers: [ + "android.frameworks.stats-V1-ndk", + ], } diff --git a/usb/gadget/UsbGadget.cpp b/usb/gadget/UsbGadget.cpp index fed3a565..5da4dd9b 100644 --- a/usb/gadget/UsbGadget.cpp +++ b/usb/gadget/UsbGadget.cpp @@ -14,7 +14,7 @@ * limitations under the License. */ -#define LOG_TAG "android.hardware.usb.gadget@1.2-service.gs201" +#define LOG_TAG "android.hardware.usb.gadget.aidl-service" #include "UsbGadget.h" #include @@ -26,12 +26,18 @@ #include #include +#include + +#include + +namespace aidl { namespace android { namespace hardware { namespace usb { namespace gadget { -namespace V1_2 { -namespace implementation { + +using ::android::base::GetBoolProperty; +using ::android::hardware::google::pixel::usb::kUvcEnabled; string enabledPath; constexpr char kHsi2cPath[] = "/sys/devices/platform/10d60000.hsi2c"; @@ -46,7 +52,7 @@ UsbGadget::UsbGadget() : mGadgetIrqPath("") { } } -V1_0::Status UsbGadget::getUsbGadgetIrqPath() { +Status UsbGadget::getUsbGadgetIrqPath() { std::string irqs; size_t read_pos = 0; size_t found_pos = 0; @@ -93,17 +99,20 @@ void currentFunctionsAppliedCallback(bool functionsApplied, void *payload) { gadget->mCurrentUsbFunctionsApplied = functionsApplied; } -Return UsbGadget::getCurrentUsbFunctions(const sp &callback) { - Return ret = callback->getCurrentUsbFunctionsCb( +ScopedAStatus UsbGadget::getCurrentUsbFunctions(const shared_ptr &callback, + int64_t in_transactionId) { + ScopedAStatus ret = callback->getCurrentUsbFunctionsCb( mCurrentUsbFunctions, - mCurrentUsbFunctionsApplied ? Status::FUNCTIONS_APPLIED : Status::FUNCTIONS_NOT_APPLIED); + mCurrentUsbFunctionsApplied ? Status::FUNCTIONS_APPLIED : Status::FUNCTIONS_NOT_APPLIED, + in_transactionId); if (!ret.isOk()) - ALOGE("Call to getCurrentUsbFunctionsCb failed %s", ret.description().c_str()); + ALOGE("Call to getCurrentUsbFunctionsCb failed %s", ret.getDescription().c_str()); - return Void(); + return ScopedAStatus::ok(); } -Return UsbGadget::getUsbSpeed(const sp &callback) { +ScopedAStatus UsbGadget::getUsbSpeed(const shared_ptr &callback, + int64_t in_transactionId) { std::string current_speed; if (ReadFileToString(SPEED_PATH, ¤t_speed)) { current_speed = Trim(current_speed); @@ -121,25 +130,26 @@ Return UsbGadget::getUsbSpeed(const sp &callback else if (current_speed == "UNKNOWN") mUsbSpeed = UsbSpeed::UNKNOWN; else - mUsbSpeed = UsbSpeed::RESERVED_SPEED; + mUsbSpeed = UsbSpeed::UNKNOWN; } else { ALOGE("Fail to read current speed"); mUsbSpeed = UsbSpeed::UNKNOWN; } if (callback) { - Return ret = callback->getUsbSpeedCb(mUsbSpeed); + ScopedAStatus ret = callback->getUsbSpeedCb(mUsbSpeed, in_transactionId); if (!ret.isOk()) - ALOGE("Call to getUsbSpeedCb failed %s", ret.description().c_str()); + ALOGE("Call to getUsbSpeedCb failed %s", ret.getDescription().c_str()); } - return Void(); + return ScopedAStatus::ok(); } -V1_0::Status UsbGadget::tearDownGadget() { - if (resetGadget() != Status::SUCCESS) +Status UsbGadget::tearDownGadget() { + if (Status(resetGadget()) != Status::SUCCESS){ return Status::ERROR; + } if (monitorFfs.isMonitorRunning()) { monitorFfs.reset(); @@ -149,137 +159,174 @@ V1_0::Status UsbGadget::tearDownGadget() { return Status::SUCCESS; } -static V1_0::Status validateAndSetVidPid(uint64_t functions) { - V1_0::Status ret = Status::SUCCESS; +static Status validateAndSetVidPid(uint64_t functions) { + Status ret = Status::SUCCESS; std::string vendorFunctions = getVendorFunctions(); switch (functions) { - case static_cast(GadgetFunction::MTP): + case GadgetFunction::MTP: if (!(vendorFunctions == "user" || vendorFunctions == "")) { ALOGE("Invalid vendorFunctions set: %s", vendorFunctions.c_str()); ret = Status::CONFIGURATION_NOT_SUPPORTED; } else { - ret = setVidPid("0x18d1", "0x4ee1"); + ret = Status(setVidPid("0x18d1", "0x4ee1")); } break; - case GadgetFunction::ADB | GadgetFunction::MTP: + case GadgetFunction::ADB | + GadgetFunction::MTP: if (!(vendorFunctions == "user" || vendorFunctions == "")) { ALOGE("Invalid vendorFunctions set: %s", vendorFunctions.c_str()); ret = Status::CONFIGURATION_NOT_SUPPORTED; } else { - ret = setVidPid("0x18d1", "0x4ee2"); + ret = Status(setVidPid("0x18d1", "0x4ee2")); } break; - case static_cast(GadgetFunction::RNDIS): + case GadgetFunction::RNDIS: + case GadgetFunction::RNDIS | + GadgetFunction::NCM: if (!(vendorFunctions == "user" || vendorFunctions == "")) { ALOGE("Invalid vendorFunctions set: %s", vendorFunctions.c_str()); ret = Status::CONFIGURATION_NOT_SUPPORTED; } else { - ret = setVidPid("0x18d1", "0x4ee3"); + ret = Status(setVidPid("0x18d1", "0x4ee3")); } break; - case GadgetFunction::ADB | GadgetFunction::RNDIS: + case GadgetFunction::ADB | + GadgetFunction::RNDIS: + case GadgetFunction::ADB | + GadgetFunction::RNDIS | + GadgetFunction::NCM: if (vendorFunctions == "dm") { - ret = setVidPid("0x04e8", "0x6862"); + ret = Status(setVidPid("0x04e8", "0x6862")); } else { if (!(vendorFunctions == "user" || vendorFunctions == "")) { ALOGE("Invalid vendorFunctions set: %s", vendorFunctions.c_str()); ret = Status::CONFIGURATION_NOT_SUPPORTED; } else { - ret = setVidPid("0x18d1", "0x4ee4"); + ret = Status(setVidPid("0x18d1", "0x4ee4")); } } break; - case static_cast(GadgetFunction::PTP): + case GadgetFunction::PTP: if (!(vendorFunctions == "user" || vendorFunctions == "")) { ALOGE("Invalid vendorFunctions set: %s", vendorFunctions.c_str()); ret = Status::CONFIGURATION_NOT_SUPPORTED; } else { - ret = setVidPid("0x18d1", "0x4ee5"); + ret = Status(setVidPid("0x18d1", "0x4ee5")); } break; - case GadgetFunction::ADB | GadgetFunction::PTP: + case GadgetFunction::ADB | + GadgetFunction::PTP: if (!(vendorFunctions == "user" || vendorFunctions == "")) { ALOGE("Invalid vendorFunctions set: %s", vendorFunctions.c_str()); ret = Status::CONFIGURATION_NOT_SUPPORTED; } else { - ret = setVidPid("0x18d1", "0x4ee6"); + ret = Status(setVidPid("0x18d1", "0x4ee6")); } break; - case static_cast(GadgetFunction::ADB): + case GadgetFunction::ADB: if (vendorFunctions == "dm") { - ret = setVidPid("0x04e8", "0x6862"); + ret = Status(setVidPid("0x04e8", "0x6862")); } else if (vendorFunctions == "etr_miu") { - ret = setVidPid("0x18d1", "0x4ee2"); - } else if (vendorFunctions == "uwb_acm") { - ret = setVidPid("0x18d1", "0x4ee2"); + ret = Status(setVidPid("0x18d1", "0x4ee2")); + } else if (vendorFunctions == "uwb_acm"){ + ret = Status(setVidPid("0x18d1", "0x4ee2")); } else { if (!(vendorFunctions == "user" || vendorFunctions == "")) { ALOGE("Invalid vendorFunctions set: %s", vendorFunctions.c_str()); ret = Status::CONFIGURATION_NOT_SUPPORTED; } else { - ret = setVidPid("0x18d1", "0x4ee7"); + ret = Status(setVidPid("0x18d1", "0x4ee7")); } } break; - case static_cast(GadgetFunction::MIDI): + case GadgetFunction::MIDI: if (!(vendorFunctions == "user" || vendorFunctions == "")) { ALOGE("Invalid vendorFunctions set: %s", vendorFunctions.c_str()); ret = Status::CONFIGURATION_NOT_SUPPORTED; } else { - ret = setVidPid("0x18d1", "0x4ee8"); + ret = Status(setVidPid("0x18d1", "0x4ee8")); } break; - case GadgetFunction::ADB | GadgetFunction::MIDI: + case GadgetFunction::ADB | + GadgetFunction::MIDI: if (!(vendorFunctions == "user" || vendorFunctions == "")) { ALOGE("Invalid vendorFunctions set: %s", vendorFunctions.c_str()); ret = Status::CONFIGURATION_NOT_SUPPORTED; } else { - ret = setVidPid("0x18d1", "0x4ee9"); + ret = Status(setVidPid("0x18d1", "0x4ee9")); } break; - case static_cast(GadgetFunction::ACCESSORY): + case GadgetFunction::ACCESSORY: if (!(vendorFunctions == "user" || vendorFunctions == "")) ALOGE("Invalid vendorFunctions set: %s", vendorFunctions.c_str()); - ret = setVidPid("0x18d1", "0x2d00"); + ret = Status(setVidPid("0x18d1", "0x2d00")); break; - case GadgetFunction::ADB | GadgetFunction::ACCESSORY: + case GadgetFunction::ADB | + GadgetFunction::ACCESSORY: if (!(vendorFunctions == "user" || vendorFunctions == "")) ALOGE("Invalid vendorFunctions set: %s", vendorFunctions.c_str()); - ret = setVidPid("0x18d1", "0x2d01"); + ret = Status(setVidPid("0x18d1", "0x2d01")); break; - case static_cast(GadgetFunction::AUDIO_SOURCE): + case GadgetFunction::AUDIO_SOURCE: if (!(vendorFunctions == "user" || vendorFunctions == "")) ALOGE("Invalid vendorFunctions set: %s", vendorFunctions.c_str()); - ret = setVidPid("0x18d1", "0x2d02"); + ret = Status(setVidPid("0x18d1", "0x2d02")); break; - case GadgetFunction::ADB | GadgetFunction::AUDIO_SOURCE: + case GadgetFunction::ADB | + GadgetFunction::AUDIO_SOURCE: if (!(vendorFunctions == "user" || vendorFunctions == "")) ALOGE("Invalid vendorFunctions set: %s", vendorFunctions.c_str()); - ret = setVidPid("0x18d1", "0x2d03"); + ret = Status(setVidPid("0x18d1", "0x2d03")); break; - case GadgetFunction::ACCESSORY | GadgetFunction::AUDIO_SOURCE: + case GadgetFunction::ACCESSORY | + GadgetFunction::AUDIO_SOURCE: if (!(vendorFunctions == "user" || vendorFunctions == "")) ALOGE("Invalid vendorFunctions set: %s", vendorFunctions.c_str()); - ret = setVidPid("0x18d1", "0x2d04"); + ret = Status(setVidPid("0x18d1", "0x2d04")); break; - case GadgetFunction::ADB | GadgetFunction::ACCESSORY | GadgetFunction::AUDIO_SOURCE: + case GadgetFunction::ADB | + GadgetFunction::ACCESSORY | + GadgetFunction::AUDIO_SOURCE: if (!(vendorFunctions == "user" || vendorFunctions == "")) ALOGE("Invalid vendorFunctions set: %s", vendorFunctions.c_str()); - ret = setVidPid("0x18d1", "0x2d05"); + ret = Status(setVidPid("0x18d1", "0x2d05")); break; - case static_cast(GadgetFunction::NCM): + case GadgetFunction::NCM: if (!(vendorFunctions == "user" || vendorFunctions == "")) ALOGE("Invalid vendorFunctions set: %s", vendorFunctions.c_str()); - ret = setVidPid("0x18d1", "0x4eeb"); + ret = Status(setVidPid("0x18d1", "0x4eeb")); break; - case GadgetFunction::ADB | GadgetFunction::NCM: + case GadgetFunction::ADB | + GadgetFunction::NCM: if (vendorFunctions == "dm") { - ret = setVidPid("0x04e8", "0x6862"); + ret = Status(setVidPid("0x04e8", "0x6862")); } else { if (!(vendorFunctions == "user" || vendorFunctions == "")) ALOGE("Invalid vendorFunctions set: %s", vendorFunctions.c_str()); - ret = setVidPid("0x18d1", "0x4eec"); + ret = Status(setVidPid("0x18d1", "0x4eec")); + } + break; + case GadgetFunction::UVC: + if (!(vendorFunctions == "user" || vendorFunctions == "")) { + ALOGE("Invalid vendorFunctions set: %s", vendorFunctions.c_str()); + ret = Status::CONFIGURATION_NOT_SUPPORTED; + } else if (!GetBoolProperty(kUvcEnabled, false)) { + ALOGE("UVC function not enabled by config"); + ret = Status::CONFIGURATION_NOT_SUPPORTED; + } else { + ret = Status(setVidPid("0x18d1", "0x4eed")); + } + break; + case GadgetFunction::ADB | GadgetFunction::UVC: + if (!(vendorFunctions == "user" || vendorFunctions == "")) { + ALOGE("Invalid vendorFunctions set: %s", vendorFunctions.c_str()); + ret = Status::CONFIGURATION_NOT_SUPPORTED; + } else if (!GetBoolProperty(kUvcEnabled, false)) { + ALOGE("UVC function not enabled by config"); + ret = Status::CONFIGURATION_NOT_SUPPORTED; + } else { + ret = Status(setVidPid("0x18d1", "0x4eee")); } break; default: @@ -289,31 +336,40 @@ static V1_0::Status validateAndSetVidPid(uint64_t functions) { return ret; } -Return UsbGadget::reset() { +ScopedAStatus UsbGadget::reset(const shared_ptr &callback, + int64_t in_transactionId) { ALOGI("USB Gadget reset"); if (!WriteStringToFile("none", PULLUP_PATH)) { ALOGI("Gadget cannot be pulled down"); - return Status::ERROR; + if (callback) + callback->resetCb(Status::ERROR, in_transactionId); + return ScopedAStatus::fromServiceSpecificErrorWithMessage( + -1, "Gadget cannot be pulled down"); } usleep(kDisconnectWaitUs); if (!WriteStringToFile(kGadgetName, PULLUP_PATH)) { ALOGI("Gadget cannot be pulled up"); - return Status::ERROR; + if (callback) + callback->resetCb(Status::ERROR, in_transactionId); + return ScopedAStatus::fromServiceSpecificErrorWithMessage( + -1, "Gadget cannot be pulled up"); } + if (callback) + callback->resetCb(Status::SUCCESS, in_transactionId); - return Status::SUCCESS; + return ScopedAStatus::ok(); } -V1_0::Status UsbGadget::setupFunctions(uint64_t functions, - const sp &callback, - uint64_t timeout) { +Status UsbGadget::setupFunctions(long functions, + const shared_ptr &callback, uint64_t timeout, + int64_t in_transactionId) { bool ffsEnabled = false; int i = 0; - if (addGenericAndroidFunctions(&monitorFfs, functions, &ffsEnabled, &i) != + if (Status(addGenericAndroidFunctions(&monitorFfs, functions, &ffsEnabled, &i)) != Status::SUCCESS) return Status::ERROR; @@ -328,7 +384,7 @@ V1_0::Status UsbGadget::setupFunctions(uint64_t functions, ALOGI("enable usbradio debug functions"); if ((functions & GadgetFunction::RNDIS) != 0) { if (linkFunction("acm.gs6", i++)) - return Status::ERROR; + return Status::ERROR; if (linkFunction("dm.gs7", i++)) return Status::ERROR; } else { @@ -336,7 +392,7 @@ V1_0::Status UsbGadget::setupFunctions(uint64_t functions, return Status::ERROR; if (linkFunction("acm.gs6", i++)) return Status::ERROR; - } + } } else if (vendorFunctions == "etr_miu") { ALOGI("enable etr_miu functions"); if (linkFunction("etr_miu.gs11", i++)) @@ -349,7 +405,7 @@ V1_0::Status UsbGadget::setupFunctions(uint64_t functions, if ((functions & GadgetFunction::ADB) != 0) { ffsEnabled = true; - if (addAdb(&monitorFfs, &i) != Status::SUCCESS) + if (Status(addAdb(&monitorFfs, &i)) != Status::SUCCESS) return Status::ERROR; } @@ -364,7 +420,7 @@ V1_0::Status UsbGadget::setupFunctions(uint64_t functions, return Status::ERROR; mCurrentUsbFunctionsApplied = true; if (callback) - callback->setCurrentUsbFunctionsCb(functions, Status::SUCCESS); + callback->setCurrentUsbFunctionsCb(functions, Status::SUCCESS, in_transactionId); return Status::SUCCESS; } @@ -379,12 +435,13 @@ V1_0::Status UsbGadget::setupFunctions(uint64_t functions, if (callback) { bool pullup = monitorFfs.waitForPullUp(timeout); - Return ret = callback->setCurrentUsbFunctionsCb( - functions, pullup ? Status::SUCCESS : Status::ERROR); - if (!ret.isOk()) - ALOGE("setCurrentUsbFunctionsCb error %s", ret.description().c_str()); + ScopedAStatus ret = callback->setCurrentUsbFunctionsCb( + functions, pullup ? Status::SUCCESS : Status::ERROR, in_transactionId); + if (!ret.isOk()) { + ALOGE("setCurrentUsbFunctionsCb error %s", ret.getDescription().c_str()); + return Status::ERROR; + } } - return Status::SUCCESS; } @@ -411,9 +468,10 @@ Status getI2cBusHelper(string *name) { return Status::ERROR; } -Return UsbGadget::setCurrentUsbFunctions(uint64_t functions, - const sp &callback, - uint64_t timeout) { +ScopedAStatus UsbGadget::setCurrentUsbFunctions(long functions, + const shared_ptr &callback, + int64_t timeout, + int64_t in_transactionId) { std::unique_lock lk(mLockSetCurrentFunction); std::string current_usb_power_operation_mode, current_usb_type; std::string usb_limit_sink_enable; @@ -432,7 +490,7 @@ Return UsbGadget::setCurrentUsbFunctions(uint64_t functions, getUsbGadgetIrqPath(); // Unlink the gadget and stop the monitor if running. - V1_0::Status status = tearDownGadget(); + Status status = tearDownGadget(); if (status != Status::SUCCESS) { goto error; } @@ -442,13 +500,15 @@ Return UsbGadget::setCurrentUsbFunctions(uint64_t functions, // Leave the gadget pulled down to give time for the host to sense disconnect. usleep(kDisconnectWaitUs); - if (functions == static_cast(GadgetFunction::NONE)) { + if (functions == GadgetFunction::NONE) { if (callback == NULL) - return Void(); - Return ret = callback->setCurrentUsbFunctionsCb(functions, Status::SUCCESS); + return ScopedAStatus::fromServiceSpecificErrorWithMessage( + -1, "callback == NULL"); + ScopedAStatus ret = callback->setCurrentUsbFunctionsCb(functions, Status::SUCCESS, in_transactionId); if (!ret.isOk()) - ALOGE("Error while calling setCurrentUsbFunctionsCb %s", ret.description().c_str()); - return Void(); + ALOGE("Error while calling setCurrentUsbFunctionsCb %s", ret.getDescription().c_str()); + return ScopedAStatus::fromServiceSpecificErrorWithMessage( + -1, "Error while calling setCurrentUsbFunctionsCb"); } status = validateAndSetVidPid(functions); @@ -457,7 +517,7 @@ Return UsbGadget::setCurrentUsbFunctions(uint64_t functions, goto error; } - status = setupFunctions(functions, callback, timeout); + status = setupFunctions(functions, callback, timeout, in_transactionId); if (status != Status::SUCCESS) { goto error; } @@ -497,20 +557,21 @@ Return UsbGadget::setCurrentUsbFunctions(uint64_t functions, } ALOGI("Usb Gadget setcurrent functions called successfully"); - return Void(); + return ScopedAStatus::ok(); error: ALOGI("Usb Gadget setcurrent functions failed"); if (callback == NULL) - return Void(); - Return ret = callback->setCurrentUsbFunctionsCb(functions, status); + return ScopedAStatus::fromServiceSpecificErrorWithMessage( + -1, "Usb Gadget setcurrent functions failed"); + ScopedAStatus ret = callback->setCurrentUsbFunctionsCb(functions, status, in_transactionId); if (!ret.isOk()) - ALOGE("Error while calling setCurrentUsbFunctionsCb %s", ret.description().c_str()); - return Void(); + ALOGE("Error while calling setCurrentUsbFunctionsCb %s", ret.getDescription().c_str()); + return ScopedAStatus::fromServiceSpecificErrorWithMessage( + -1, "Error while calling setCurrentUsbFunctionsCb"); } -} // namespace implementation -} // namespace V1_2 } // namespace gadget } // namespace usb } // namespace hardware } // namespace android +} // aidl diff --git a/usb/gadget/UsbGadget.h b/usb/gadget/UsbGadget.h index f036c8e0..403f2cc7 100644 --- a/usb/gadget/UsbGadget.h +++ b/usb/gadget/UsbGadget.h @@ -21,11 +21,13 @@ #include #include #include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include +#include #include #include #include @@ -35,14 +37,17 @@ #include #include +namespace aidl { namespace android { namespace hardware { namespace usb { namespace gadget { -namespace V1_2 { -namespace implementation { -using ::android::sp; +using ::aidl::android::hardware::usb::gadget::GadgetFunction; +using ::aidl::android::hardware::usb::gadget::IUsbGadgetCallback; +using ::aidl::android::hardware::usb::gadget::IUsbGadget; +using ::aidl::android::hardware::usb::gadget::Status; +using ::aidl::android::hardware::usb::gadget::UsbSpeed; using ::android::base::GetProperty; using ::android::base::SetProperty; using ::android::base::ParseUint; @@ -50,12 +55,6 @@ using ::android::base::unique_fd; using ::android::base::ReadFileToString; using ::android::base::Trim; using ::android::base::WriteStringToFile; -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::hardware::google::pixel::usb::addAdb; using ::android::hardware::google::pixel::usb::addEpollFd; using ::android::hardware::google::pixel::usb::getVendorFunctions; @@ -66,10 +65,8 @@ using ::android::hardware::google::pixel::usb::MonitorFfs; using ::android::hardware::google::pixel::usb::resetGadget; using ::android::hardware::google::pixel::usb::setVidPid; using ::android::hardware::google::pixel::usb::unlinkFunctions; -using ::android::hardware::usb::gadget::V1_0::Status; -using ::android::hardware::usb::gadget::V1_0::IUsbGadgetCallback; -using ::android::hardware::usb::gadget::V1_2::IUsbGadget; -using ::android::hardware::usb::gadget::V1_2::GadgetFunction; +using ::ndk::ScopedAStatus; +using ::std::shared_ptr; using ::std::string; constexpr char kGadgetName[] = "11210000.dwc3"; @@ -79,9 +76,7 @@ constexpr char kSmpAffinityList[] = "/smp_affinity_list"; #ifndef UDC_PATH #define UDC_PATH "/sys/class/udc/11210000.dwc3/" #endif -constexpr char kExtconTypecState[] = "/sys/class/extcon/extcon0/cable.0/state"; -constexpr char kUsbGadgetState[] = "/sys/devices/platform/11210000.usb/dwc3_exynos_gadget_state"; -static MonitorFfs monitorFfs(kGadgetName, kExtconTypecState, kUsbGadgetState); +static MonitorFfs monitorFfs(kGadgetName); #define SPEED_PATH UDC_PATH "current_speed" @@ -95,36 +90,40 @@ static MonitorFfs monitorFfs(kGadgetName, kExtconTypecState, kUsbGadgetState); #define CURRENT_USB_TYPE_PATH POWER_SUPPLY_PATH "usb_type" #define CURRENT_USB_POWER_OPERATION_MODE_PATH USB_PORT0_PATH "power_operation_mode" -struct UsbGadget : public IUsbGadget { +struct UsbGadget : public BnUsbGadget { UsbGadget(); // Makes sure that only one request is processed at a time. std::mutex mLockSetCurrentFunction; std::string mGadgetIrqPath; - uint64_t mCurrentUsbFunctions; + long mCurrentUsbFunctions; bool mCurrentUsbFunctionsApplied; UsbSpeed mUsbSpeed; - Return setCurrentUsbFunctions(uint64_t functions, - const sp &callback, - uint64_t timeout) override; + ScopedAStatus setCurrentUsbFunctions(long functions, + const shared_ptr &callback, + int64_t timeout, int64_t in_transactionId) override; - Return getCurrentUsbFunctions(const sp &callback) override; + ScopedAStatus getCurrentUsbFunctions(const shared_ptr &callback, + int64_t in_transactionId) override; - Return reset() override; + ScopedAStatus reset(const shared_ptr &callback, + int64_t in_transactionId) override; - Return getUsbSpeed(const sp &callback) override; + ScopedAStatus getUsbSpeed(const shared_ptr &callback, + int64_t in_transactionId) override; + + ScopedAStatus setVidPid(const char *vid,const char *pid); private: Status tearDownGadget(); Status getUsbGadgetIrqPath(); - Status setupFunctions(uint64_t functions, const sp &callback, - uint64_t timeout); + Status setupFunctions(long functions, const shared_ptr &callback, + uint64_t timeout, int64_t in_transactionId); }; -} // namespace implementation -} // namespace V1_2 } // namespace gadget } // namespace usb } // namespace hardware } // namespace android +} // aidl diff --git a/usb/gadget/android.hardware.usb.gadget-service.rc b/usb/gadget/android.hardware.usb.gadget-service.rc index 0395862d..68fd3ae7 100644 --- a/usb/gadget/android.hardware.usb.gadget-service.rc +++ b/usb/gadget/android.hardware.usb.gadget-service.rc @@ -1,4 +1,4 @@ -service vendor.usb-gadget-hal-1-2 /vendor/bin/hw/android.hardware.usb.gadget-service +service vendor.usb-gadget-hal /vendor/bin/hw/android.hardware.usb.gadget-service class hal user system group system shell mtp @@ -10,7 +10,6 @@ on post-fs chown root system /sys/devices/platform/10d60000.hsi2c/i2c-2/i2c-max77759tcpc/contaminant_detection chown root system /sys/devices/platform/11210000.usb/dwc3_exynos_otg_b_sess chown root system /sys/devices/platform/11210000.usb/dwc3_exynos_otg_id - chown root system /sys/devices/platform/11210000.usb/dwc3_exynos_gadget_state chown root system /sys/devices/platform/11210000.usb/usb_data_enabled chmod 664 /sys/class/typec/port0/power_role chmod 664 /sys/class/typec/port0/data_role diff --git a/usb/gadget/android.hardware.usb.gadget-service.xml b/usb/gadget/android.hardware.usb.gadget-service.xml index 8557f6ff..e7eebc35 100644 --- a/usb/gadget/android.hardware.usb.gadget-service.xml +++ b/usb/gadget/android.hardware.usb.gadget-service.xml @@ -1,8 +1,7 @@ - + android.hardware.usb.gadget - hwbinder - 1.2 + 1 IUsbGadget default diff --git a/usb/gadget/service_gadget.cpp b/usb/gadget/service_gadget.cpp index 6339ebfb..3634b5d3 100644 --- a/usb/gadget/service_gadget.cpp +++ b/usb/gadget/service_gadget.cpp @@ -16,35 +16,27 @@ #define LOG_TAG "android.hardware.usb.gadget-service" -#include +#include +#include +#include +#include #include "UsbGadget.h" -using android::sp; - -// libhwbinder: -using android::hardware::configureRpcThreadpool; -using android::hardware::joinRpcThreadpool; - -// Generated HIDL files -using android::hardware::usb::gadget::V1_2::IUsbGadget; -using android::hardware::usb::gadget::V1_2::implementation::UsbGadget; - using android::OK; +using android::sp; using android::status_t; +using aidl::android::hardware::usb::gadget::UsbGadget; + int main() { - android::sp service = new UsbGadget(); - configureRpcThreadpool(2, true /*callerWillJoin*/); - status_t status = service->registerAsService(); + ABinderProcess_setThreadPoolMaxThreadCount(0); + std::shared_ptr usbgadget = ndk::SharedRefBase::make(); - if (status != OK) { - ALOGE("Cannot register USB Gadget HAL service"); - return 1; - } + const std::string instance = std::string() + UsbGadget::descriptor + "/default"; + binder_status_t status = AServiceManager_addService(usbgadget->asBinder().get(), instance.c_str()); + CHECK(status == STATUS_OK); - ALOGI("USB gadget HAL Ready."); - joinRpcThreadpool(); - // Under noraml cases, execution will not reach this line. - ALOGI("USB gadget HAL failed to join thread pool."); - return 1; + ALOGV("AIDL USB Gadget HAL about to start"); + ABinderProcess_joinThreadPool(); + return -1; // Should never be reached } diff --git a/usb/usb/Android.bp b/usb/usb/Android.bp index 961079dc..b9d6018d 100644 --- a/usb/usb/Android.bp +++ b/usb/usb/Android.bp @@ -40,21 +40,24 @@ cc_binary { "libbinder", "libhidlbase", "liblog", + "libusbhost", "libutils", "libhardware", "android.hardware.thermal@1.0", "android.hardware.thermal@2.0", - "android.hardware.usb.gadget@1.0", - "android.hardware.usb-V1-ndk", + "android.hardware.thermal-V1-ndk", + "android.hardware.usb.gadget@1.0", + "android.hardware.usb-V2-ndk", + "android.hardware.usb.gadget-V1-ndk", "libcutils", "android.frameworks.stats-V1-ndk", "pixelatoms-cpp", "libbinder_ndk", - ], static_libs: [ - "libpixelusb", + "libpixelusb-aidl", "libpixelstats", + "libthermalutils", ], export_shared_lib_headers: [ "android.frameworks.stats-V1-ndk", diff --git a/usb/usb/Usb.cpp b/usb/usb/Usb.cpp index f25ee347..e4f0b354 100644 --- a/usb/usb/Usb.cpp +++ b/usb/usb/Usb.cpp @@ -17,15 +17,18 @@ #define LOG_TAG "android.hardware.usb.aidl-service" #include +#include #include #include #include #include #include +#include #include #include #include #include +#include #include #include #include @@ -35,19 +38,23 @@ #include #include #include +#include #include "Usb.h" #include -#include +#include #include using aidl::android::frameworks::stats::IStats; using android::base::GetProperty; +using android::base::Tokenize; using android::base::Trim; using android::hardware::google::pixel::getStatsService; using android::hardware::google::pixel::PixelAtoms::VendorUsbPortOverheat; using android::hardware::google::pixel::reportUsbPortOverheat; +using android::String8; +using android::Vector; namespace aidl { namespace android { @@ -59,6 +66,11 @@ volatile bool destroyThread; string enabledPath; constexpr char kHsi2cPath[] = "/sys/devices/platform/10d60000.hsi2c"; constexpr char kI2CPath[] = "/sys/devices/platform/10d60000.hsi2c/i2c-"; +constexpr char kComplianceWarningsPath[] = "device/non_compliant_reasons"; +constexpr char kComplianceWarningBC12[] = "bc12"; +constexpr char kComplianceWarningDebugAccessory[] = "debug-accessory"; +constexpr char kComplianceWarningMissingRp[] = "missing_rp"; +constexpr char kComplianceWarningOther[] = "other"; constexpr char kContaminantDetectionPath[] = "i2c-max77759tcpc/contaminant_detection"; constexpr char kStatusPath[] = "i2c-max77759tcpc/contaminant_detection_status"; constexpr char kSinkLimitEnable[] = "i2c-max77759tcpc/usb_limit_sink_enable"; @@ -79,6 +91,15 @@ constexpr int kSamplingIntervalSec = 5; void queryVersionHelper(android::hardware::usb::Usb *usb, std::vector *currentPortStatus); +#define CTRL_TRANSFER_TIMEOUT_MSEC 1000 +#define GL852G_VENDOR_ID 0x05e3 +#define GL852G_PRODUCT_ID1 0x0608 +#define GL852G_PRODUCT_ID2 0x0610 +#define GL852G_VENDOR_CMD_REQ 0xe3 +// GL852G port 1 and port 2 JK level default settings +#define GL852G_VENDOR_CMD_VALUE_DEFAULT 0x0008 +#define GL852G_VENDOR_CMD_INDEX_DEFAULT 0x0404 + ScopedAStatus Usb::enableUsbData(const string& in_portName, bool in_enable, int64_t in_transactionId) { bool result = true; @@ -275,6 +296,49 @@ Status queryMoistureDetectionStatus(std::vector *currentPortStatus) return Status::SUCCESS; } +Status queryNonCompliantChargerStatus(std::vector *currentPortStatus) { + string reasons, path; + + for (int i = 0; i < currentPortStatus->size(); i++) { + (*currentPortStatus)[i].supportsComplianceWarnings = true; + path = string(kTypecPath) + "/" + (*currentPortStatus)[i].portName + "/" + + string(kComplianceWarningsPath); + if (ReadFileToString(path.c_str(), &reasons)) { + std::vector reasonsList = Tokenize(reasons.c_str(), "[], \n\0"); + for (string reason : reasonsList) { + if (!strncmp(reason.c_str(), kComplianceWarningDebugAccessory, + strlen(kComplianceWarningDebugAccessory))) { + (*currentPortStatus)[i].complianceWarnings.push_back(ComplianceWarning::DEBUG_ACCESSORY); + continue; + } + if (!strncmp(reason.c_str(), kComplianceWarningBC12, + strlen(kComplianceWarningBC12))) { + (*currentPortStatus)[i].complianceWarnings.push_back(ComplianceWarning::BC_1_2); + continue; + } + if (!strncmp(reason.c_str(), kComplianceWarningMissingRp, + strlen(kComplianceWarningMissingRp))) { + (*currentPortStatus)[i].complianceWarnings.push_back(ComplianceWarning::MISSING_RP); + continue; + } + if (!strncmp(reason.c_str(), kComplianceWarningOther, + strlen(kComplianceWarningOther))) { + (*currentPortStatus)[i].complianceWarnings.push_back(ComplianceWarning::OTHER); + continue; + } + } + if ((*currentPortStatus)[i].complianceWarnings.size() > 0 && + (*currentPortStatus)[i].currentPowerRole == PortPowerRole::NONE) { + (*currentPortStatus)[i].currentMode = PortMode::UFP; + (*currentPortStatus)[i].currentPowerRole = PortPowerRole::SINK; + (*currentPortStatus)[i].currentDataRole = PortDataRole::NONE; + (*currentPortStatus)[i].powerBrickStatus = PowerBrickStatus::CONNECTED; + } + } + } + return Status::SUCCESS; +} + string appendRoleNodeHelper(const string &portName, PortRole::Tag tag) { string node("/sys/class/typec/" + portName); @@ -393,6 +457,61 @@ bool switchMode(const string &portName, const PortRole &in_role, struct Usb *usb return roleSwitch; } +static int usbDeviceRemoved(const char *devname, void* client_data) { + return 0; +} + +static int usbDeviceAdded(const char *devname, void* client_data) { + uint16_t vendorId, productId; + struct usb_device *device; + ::aidl::android::hardware::usb::Usb *usb; + int value, index; + + device = usb_device_open(devname); + if (!device) { + ALOGE("usb_device_open failed\n"); + return 0; + } + + usb = (::aidl::android::hardware::usb::Usb *)client_data; + value = usb->mUsbHubVendorCmdValue; + index = usb->mUsbHubVendorCmdIndex; + + // The vendor cmd only applies to USB Hubs of Genesys Logic, Inc. + // The request field of vendor cmd is fixed to 0xe3. + vendorId = usb_device_get_vendor_id(device); + productId = usb_device_get_product_id(device); + if (vendorId == GL852G_VENDOR_ID && + (productId == GL852G_PRODUCT_ID1 || productId == GL852G_PRODUCT_ID2)) { + int ret = usb_device_control_transfer(device, + USB_DIR_OUT | USB_TYPE_VENDOR, GL852G_VENDOR_CMD_REQ, value, index, + NULL, 0, CTRL_TRANSFER_TIMEOUT_MSEC); + ALOGI("USB hub vendor cmd %s (wValue 0x%x, wIndex 0x%x, return %d)\n", + ret? "failed" : "succeeded", value, index, ret); + } + + usb_device_close(device); + + return 0; +} + +void *usbHostWork(void *param) { + struct usb_host_context *ctx; + + ALOGI("creating USB host thread\n"); + + ctx = usb_host_init(); + if (!ctx) { + ALOGE("usb_host_init failed\n"); + return NULL; + } + + // This will never return, it will keep monitoring USB sysfs inotify events + usb_host_run(ctx, usbDeviceAdded, usbDeviceRemoved, NULL, param); + + return NULL; +} + Usb::Usb() : mLock(PTHREAD_MUTEX_INITIALIZER), mRoleSwitchLock(PTHREAD_MUTEX_INITIALIZER), @@ -406,7 +525,9 @@ Usb::Usb() ThrottlingSeverity::NONE), ZoneInfo(TemperatureType::UNKNOWN, kThermalZoneForTempReadSecondary2, ThrottlingSeverity::NONE)}, kSamplingIntervalSec), - mUsbDataEnabled(true) { + mUsbDataEnabled(true), + mUsbHubVendorCmdValue(GL852G_VENDOR_CMD_VALUE_DEFAULT), + mUsbHubVendorCmdIndex(GL852G_VENDOR_CMD_INDEX_DEFAULT) { pthread_condattr_t attr; if (pthread_condattr_init(&attr)) { ALOGE("pthread_condattr_init failed: %s", strerror(errno)); @@ -424,6 +545,10 @@ Usb::Usb() ALOGE("pthread_condattr_destroy failed: %s", strerror(errno)); abort(); } + if (pthread_create(&mUsbHost, NULL, usbHostWork, this)) { + ALOGE("pthread creation failed %d\n", errno); + abort(); + } } ScopedAStatus Usb::switchRole(const string& in_portName, const PortRole& in_role, @@ -683,7 +808,7 @@ Status getPortStatusHelper(android::hardware::usb::Usb *usb, PortRole currentRole; currentRole.set(PortPowerRole::NONE); - if (getCurrentRoleHelper(port.first, port.second, ¤tRole) == Status::SUCCESS){ + if (getCurrentRoleHelper(port.first, port.second, ¤tRole) == Status::SUCCESS) { (*currentPortStatus)[i].currentPowerRole = currentRole.get(); } else { ALOGE("Error while retrieving portNames"); @@ -718,7 +843,13 @@ Status getPortStatusHelper(android::hardware::usb::Usb *usb, string pogoUsbActive = "0"; if (ReadFileToString(string(kPogoUsbActive), &pogoUsbActive) && stoi(Trim(pogoUsbActive)) == 1) { - (*currentPortStatus)[i].usbDataStatus.push_back(UsbDataStatus::DISABLED_DOCK); + /* + * Always signal USB device mode disabled irrespective of hub enabled while docked. + * Hub gets automatically enabled as needed. Signalling DISABLED_DOCK_HOST_MODE & + * DEVICE_MODE during pogo direct can cause notifications to show for brief windows + * when the state machine is still moving to steady state. + */ + (*currentPortStatus)[i].usbDataStatus.push_back(UsbDataStatus::DISABLED_DOCK_DEVICE_MODE); dataEnabled = false; } if (!usb->mUsbDataEnabled) { @@ -772,6 +903,7 @@ void queryVersionHelper(android::hardware::usb::Usb *usb, status = getPortStatusHelper(usb, currentPortStatus); queryMoistureDetectionStatus(currentPortStatus); queryPowerTransferStatus(currentPortStatus); + queryNonCompliantChargerStatus(currentPortStatus); if (usb->mCallback != NULL) { ScopedAStatus ret = usb->mCallback->notifyPortStatusChange(*currentPortStatus, status); @@ -1029,6 +1161,47 @@ ScopedAStatus Usb::setCallback(const shared_ptr& in_callback) { return ScopedAStatus::ok(); } +status_t Usb::handleShellCommand(int in, int out, int err, const char** argv, + uint32_t argc) { + uid_t uid = AIBinder_getCallingUid(); + if (uid != AID_ROOT && uid != AID_SHELL) { + return ::android::PERMISSION_DENIED; + } + + Vector utf8Args; + utf8Args.setCapacity(argc); + for (uint32_t i = 0; i < argc; i++) { + utf8Args.push(String8(argv[i])); + } + + if (argc >= 1) { + if (!utf8Args[0].compare(String8("hub-vendor-cmd"))) { + if (utf8Args.size() < 3) { + dprintf(out, "Incorrect number of argument supplied\n"); + return ::android::UNKNOWN_ERROR; + } + int value, index; + if (!::android::base::ParseInt(utf8Args[1].c_str(), &value) || + !::android::base::ParseInt(utf8Args[2].c_str(), &index)) { + dprintf(out, "Fail to parse arguments\n"); + return ::android::UNKNOWN_ERROR; + } + mUsbHubVendorCmdValue = value; + mUsbHubVendorCmdIndex = index; + ALOGI("USB hub vendor cmd update (wValue 0x%x, wIndex 0x%x)\n", + mUsbHubVendorCmdValue, mUsbHubVendorCmdIndex); + return ::android::NO_ERROR; + } + } + + dprintf(out, "usage: adb shell cmd hub-vendor-cmd VALUE INDEX\n" + " VALUE wValue field in hex format, e.g. 0xf321\n" + " INDEX wIndex field in hex format, e.g. 0xf321\n" + " The settings take effect next time the hub is enabled\n"); + + return ::android::NO_ERROR; +} + } // namespace usb } // namespace hardware } // namespace android diff --git a/usb/usb/Usb.h b/usb/usb/Usb.h index d8d6d001..e45a5ed0 100644 --- a/usb/usb/Usb.h +++ b/usb/usb/Usb.h @@ -43,6 +43,7 @@ using ::android::hardware::google::pixel::usb::ZoneInfo; using ::android::hardware::thermal::V2_0::TemperatureType; using ::android::hardware::thermal::V2_0::ThrottlingSeverity; using ::android::sp; +using ::android::status_t; using ::ndk::ScopedAStatus; using ::std::shared_ptr; using ::std::string; @@ -68,9 +69,12 @@ struct Usb : public BnUsb { ScopedAStatus enableUsbDataWhileDocked(const string& in_portName, int64_t in_transactionId) override; ScopedAStatus limitPowerTransfer(const string& in_portName, bool in_limit, - int64_t in_transactionId) override; + int64_t in_transactionId) override; ScopedAStatus resetUsbPort(const string& in_portName, int64_t in_transactionId) override; + status_t handleShellCommand(int in, int out, int err, const char** argv, + uint32_t argc) override; + std::shared_ptr<::aidl::android::hardware::usb::IUsbCallback> mCallback; // Protects mCallback variable pthread_mutex_t mLock; @@ -89,8 +93,12 @@ struct Usb : public BnUsb { float mPluggedTemperatureCelsius; // Usb Data status bool mUsbDataEnabled; + // Usb hub vendor command settings for JK level tuning + int mUsbHubVendorCmdValue; + int mUsbHubVendorCmdIndex; private: pthread_t mPoll; + pthread_t mUsbHost; }; } // namespace usb diff --git a/usb/usb/android.hardware.usb-service.rc b/usb/usb/android.hardware.usb-service.rc index 3ee952aa..818ffb0d 100644 --- a/usb/usb/android.hardware.usb-service.rc +++ b/usb/usb/android.hardware.usb-service.rc @@ -1,49 +1,133 @@ service vendor.usb /vendor/bin/hw/android.hardware.usb-service class hal user system - group system shell wakelock + group system shell wakelock usb capabilities WAKE_ALARM BLOCK_SUSPEND on post-fs 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/port_type + chown root system /sys/devices/platform/10d60000.hsi2c/i2c-0/i2c-max77759tcpc/contaminant_detection + chown root system /sys/devices/platform/10d60000.hsi2c/i2c-1/i2c-max77759tcpc/contaminant_detection + chown root system /sys/devices/platform/10d60000.hsi2c/i2c-2/i2c-max77759tcpc/contaminant_detection + chown root system /sys/devices/platform/10d60000.hsi2c/i2c-3/i2c-max77759tcpc/contaminant_detection chown root system /sys/devices/platform/10d60000.hsi2c/i2c-4/i2c-max77759tcpc/contaminant_detection chown root system /sys/devices/platform/10d60000.hsi2c/i2c-5/i2c-max77759tcpc/contaminant_detection chown root system /sys/devices/platform/10d60000.hsi2c/i2c-6/i2c-max77759tcpc/contaminant_detection + chown root system /sys/devices/platform/10d60000.hsi2c/i2c-7/i2c-max77759tcpc/contaminant_detection + chown root system /sys/devices/platform/10d60000.hsi2c/i2c-8/i2c-max77759tcpc/contaminant_detection + chown root system /sys/devices/platform/10d60000.hsi2c/i2c-9/i2c-max77759tcpc/contaminant_detection + chown root system /sys/devices/platform/10d60000.hsi2c/i2c-0/i2c-max77759tcpc/usb_limit_accessory_current + chown root system /sys/devices/platform/10d60000.hsi2c/i2c-1/i2c-max77759tcpc/usb_limit_accessory_current + chown root system /sys/devices/platform/10d60000.hsi2c/i2c-2/i2c-max77759tcpc/usb_limit_accessory_current + chown root system /sys/devices/platform/10d60000.hsi2c/i2c-3/i2c-max77759tcpc/usb_limit_accessory_current chown root system /sys/devices/platform/10d60000.hsi2c/i2c-4/i2c-max77759tcpc/usb_limit_accessory_current chown root system /sys/devices/platform/10d60000.hsi2c/i2c-5/i2c-max77759tcpc/usb_limit_accessory_current chown root system /sys/devices/platform/10d60000.hsi2c/i2c-6/i2c-max77759tcpc/usb_limit_accessory_current + chown root system /sys/devices/platform/10d60000.hsi2c/i2c-7/i2c-max77759tcpc/usb_limit_accessory_current + chown root system /sys/devices/platform/10d60000.hsi2c/i2c-8/i2c-max77759tcpc/usb_limit_accessory_current + chown root system /sys/devices/platform/10d60000.hsi2c/i2c-9/i2c-max77759tcpc/usb_limit_accessory_current + chown root system /sys/devices/platform/10d60000.hsi2c/i2c-0/i2c-max77759tcpc/usb_limit_accessory_enable + chown root system /sys/devices/platform/10d60000.hsi2c/i2c-1/i2c-max77759tcpc/usb_limit_accessory_enable + chown root system /sys/devices/platform/10d60000.hsi2c/i2c-2/i2c-max77759tcpc/usb_limit_accessory_enable + chown root system /sys/devices/platform/10d60000.hsi2c/i2c-3/i2c-max77759tcpc/usb_limit_accessory_enable chown root system /sys/devices/platform/10d60000.hsi2c/i2c-4/i2c-max77759tcpc/usb_limit_accessory_enable chown root system /sys/devices/platform/10d60000.hsi2c/i2c-5/i2c-max77759tcpc/usb_limit_accessory_enable chown root system /sys/devices/platform/10d60000.hsi2c/i2c-6/i2c-max77759tcpc/usb_limit_accessory_enable + chown root system /sys/devices/platform/10d60000.hsi2c/i2c-7/i2c-max77759tcpc/usb_limit_accessory_enable + chown root system /sys/devices/platform/10d60000.hsi2c/i2c-8/i2c-max77759tcpc/usb_limit_accessory_enable + chown root system /sys/devices/platform/10d60000.hsi2c/i2c-9/i2c-max77759tcpc/usb_limit_accessory_enable + chown root system /sys/devices/platform/10d60000.hsi2c/i2c-0/i2c-max77759tcpc/usb_limit_sink_current + chown root system /sys/devices/platform/10d60000.hsi2c/i2c-1/i2c-max77759tcpc/usb_limit_sink_current + chown root system /sys/devices/platform/10d60000.hsi2c/i2c-2/i2c-max77759tcpc/usb_limit_sink_current + chown root system /sys/devices/platform/10d60000.hsi2c/i2c-3/i2c-max77759tcpc/usb_limit_sink_current chown root system /sys/devices/platform/10d60000.hsi2c/i2c-4/i2c-max77759tcpc/usb_limit_sink_current chown root system /sys/devices/platform/10d60000.hsi2c/i2c-5/i2c-max77759tcpc/usb_limit_sink_current chown root system /sys/devices/platform/10d60000.hsi2c/i2c-6/i2c-max77759tcpc/usb_limit_sink_current + chown root system /sys/devices/platform/10d60000.hsi2c/i2c-7/i2c-max77759tcpc/usb_limit_sink_current + chown root system /sys/devices/platform/10d60000.hsi2c/i2c-8/i2c-max77759tcpc/usb_limit_sink_current + chown root system /sys/devices/platform/10d60000.hsi2c/i2c-9/i2c-max77759tcpc/usb_limit_sink_current + chown root system /sys/devices/platform/10d60000.hsi2c/i2c-0/i2c-max77759tcpc/usb_limit_sink_enable + chown root system /sys/devices/platform/10d60000.hsi2c/i2c-1/i2c-max77759tcpc/usb_limit_sink_enable + chown root system /sys/devices/platform/10d60000.hsi2c/i2c-2/i2c-max77759tcpc/usb_limit_sink_enable + chown root system /sys/devices/platform/10d60000.hsi2c/i2c-3/i2c-max77759tcpc/usb_limit_sink_enable chown root system /sys/devices/platform/10d60000.hsi2c/i2c-4/i2c-max77759tcpc/usb_limit_sink_enable chown root system /sys/devices/platform/10d60000.hsi2c/i2c-5/i2c-max77759tcpc/usb_limit_sink_enable chown root system /sys/devices/platform/10d60000.hsi2c/i2c-6/i2c-max77759tcpc/usb_limit_sink_enable + chown root system /sys/devices/platform/10d60000.hsi2c/i2c-7/i2c-max77759tcpc/usb_limit_sink_enable + chown root system /sys/devices/platform/10d60000.hsi2c/i2c-8/i2c-max77759tcpc/usb_limit_sink_enable + chown root system /sys/devices/platform/10d60000.hsi2c/i2c-9/i2c-max77759tcpc/usb_limit_sink_enable + chown root system /sys/devices/platform/10d60000.hsi2c/i2c-0/i2c-max77759tcpc/usb_limit_source_enable + chown root system /sys/devices/platform/10d60000.hsi2c/i2c-1/i2c-max77759tcpc/usb_limit_source_enable + chown root system /sys/devices/platform/10d60000.hsi2c/i2c-2/i2c-max77759tcpc/usb_limit_source_enable + chown root system /sys/devices/platform/10d60000.hsi2c/i2c-3/i2c-max77759tcpc/usb_limit_source_enable chown root system /sys/devices/platform/10d60000.hsi2c/i2c-4/i2c-max77759tcpc/usb_limit_source_enable chown root system /sys/devices/platform/10d60000.hsi2c/i2c-5/i2c-max77759tcpc/usb_limit_source_enable chown root system /sys/devices/platform/10d60000.hsi2c/i2c-6/i2c-max77759tcpc/usb_limit_source_enable + chown root system /sys/devices/platform/10d60000.hsi2c/i2c-7/i2c-max77759tcpc/usb_limit_source_enable + chown root system /sys/devices/platform/10d60000.hsi2c/i2c-8/i2c-max77759tcpc/usb_limit_source_enable + chown root system /sys/devices/platform/10d60000.hsi2c/i2c-9/i2c-max77759tcpc/usb_limit_source_enable chmod 664 /sys/class/typec/port0/power_role chmod 664 /sys/class/typec/port0/data_role chmod 664 /sys/class/typec/port0/port_type + chmod 664 /sys/devices/platform/10d60000.hsi2c/i2c-0/i2c-max77759tcpc/contaminant_detection + chmod 664 /sys/devices/platform/10d60000.hsi2c/i2c-1/i2c-max77759tcpc/contaminant_detection + chmod 664 /sys/devices/platform/10d60000.hsi2c/i2c-2/i2c-max77759tcpc/contaminant_detection + chmod 664 /sys/devices/platform/10d60000.hsi2c/i2c-3/i2c-max77759tcpc/contaminant_detection chmod 664 /sys/devices/platform/10d60000.hsi2c/i2c-4/i2c-max77759tcpc/contaminant_detection chmod 664 /sys/devices/platform/10d60000.hsi2c/i2c-5/i2c-max77759tcpc/contaminant_detection chmod 664 /sys/devices/platform/10d60000.hsi2c/i2c-6/i2c-max77759tcpc/contaminant_detection + chmod 664 /sys/devices/platform/10d60000.hsi2c/i2c-7/i2c-max77759tcpc/contaminant_detection + chmod 664 /sys/devices/platform/10d60000.hsi2c/i2c-8/i2c-max77759tcpc/contaminant_detection + chmod 664 /sys/devices/platform/10d60000.hsi2c/i2c-9/i2c-max77759tcpc/contaminant_detection + chmod 664 /sys/devices/platform/10d60000.hsi2c/i2c-0/i2c-max77759tcpc/usb_limit_accessory_current + chmod 664 /sys/devices/platform/10d60000.hsi2c/i2c-1/i2c-max77759tcpc/usb_limit_accessory_current + chmod 664 /sys/devices/platform/10d60000.hsi2c/i2c-2/i2c-max77759tcpc/usb_limit_accessory_current + chmod 664 /sys/devices/platform/10d60000.hsi2c/i2c-3/i2c-max77759tcpc/usb_limit_accessory_current chmod 664 /sys/devices/platform/10d60000.hsi2c/i2c-4/i2c-max77759tcpc/usb_limit_accessory_current chmod 664 /sys/devices/platform/10d60000.hsi2c/i2c-5/i2c-max77759tcpc/usb_limit_accessory_current chmod 664 /sys/devices/platform/10d60000.hsi2c/i2c-6/i2c-max77759tcpc/usb_limit_accessory_current + chmod 664 /sys/devices/platform/10d60000.hsi2c/i2c-7/i2c-max77759tcpc/usb_limit_accessory_current + chmod 664 /sys/devices/platform/10d60000.hsi2c/i2c-8/i2c-max77759tcpc/usb_limit_accessory_current + chmod 664 /sys/devices/platform/10d60000.hsi2c/i2c-9/i2c-max77759tcpc/usb_limit_accessory_current + chmod 664 /sys/devices/platform/10d60000.hsi2c/i2c-0/i2c-max77759tcpc/usb_limit_accessory_enable + chmod 664 /sys/devices/platform/10d60000.hsi2c/i2c-1/i2c-max77759tcpc/usb_limit_accessory_enable + chmod 664 /sys/devices/platform/10d60000.hsi2c/i2c-2/i2c-max77759tcpc/usb_limit_accessory_enable + chmod 664 /sys/devices/platform/10d60000.hsi2c/i2c-3/i2c-max77759tcpc/usb_limit_accessory_enable chmod 664 /sys/devices/platform/10d60000.hsi2c/i2c-4/i2c-max77759tcpc/usb_limit_accessory_enable chmod 664 /sys/devices/platform/10d60000.hsi2c/i2c-5/i2c-max77759tcpc/usb_limit_accessory_enable chmod 664 /sys/devices/platform/10d60000.hsi2c/i2c-6/i2c-max77759tcpc/usb_limit_accessory_enable + chmod 664 /sys/devices/platform/10d60000.hsi2c/i2c-7/i2c-max77759tcpc/usb_limit_accessory_enable + chmod 664 /sys/devices/platform/10d60000.hsi2c/i2c-8/i2c-max77759tcpc/usb_limit_accessory_enable + chmod 664 /sys/devices/platform/10d60000.hsi2c/i2c-9/i2c-max77759tcpc/usb_limit_accessory_enable + chmod 664 /sys/devices/platform/10d60000.hsi2c/i2c-0/i2c-max77759tcpc/usb_limit_sink_current + chmod 664 /sys/devices/platform/10d60000.hsi2c/i2c-1/i2c-max77759tcpc/usb_limit_sink_current + chmod 664 /sys/devices/platform/10d60000.hsi2c/i2c-2/i2c-max77759tcpc/usb_limit_sink_current + chmod 664 /sys/devices/platform/10d60000.hsi2c/i2c-3/i2c-max77759tcpc/usb_limit_sink_current chmod 664 /sys/devices/platform/10d60000.hsi2c/i2c-4/i2c-max77759tcpc/usb_limit_sink_current chmod 664 /sys/devices/platform/10d60000.hsi2c/i2c-5/i2c-max77759tcpc/usb_limit_sink_current chmod 664 /sys/devices/platform/10d60000.hsi2c/i2c-6/i2c-max77759tcpc/usb_limit_sink_current + chmod 664 /sys/devices/platform/10d60000.hsi2c/i2c-7/i2c-max77759tcpc/usb_limit_sink_current + chmod 664 /sys/devices/platform/10d60000.hsi2c/i2c-8/i2c-max77759tcpc/usb_limit_sink_current + chmod 664 /sys/devices/platform/10d60000.hsi2c/i2c-9/i2c-max77759tcpc/usb_limit_sink_current + chmod 664 /sys/devices/platform/10d60000.hsi2c/i2c-0/i2c-max77759tcpc/usb_limit_sink_enable + chmod 664 /sys/devices/platform/10d60000.hsi2c/i2c-1/i2c-max77759tcpc/usb_limit_sink_enable + chmod 664 /sys/devices/platform/10d60000.hsi2c/i2c-2/i2c-max77759tcpc/usb_limit_sink_enable + chmod 664 /sys/devices/platform/10d60000.hsi2c/i2c-3/i2c-max77759tcpc/usb_limit_sink_enable chmod 664 /sys/devices/platform/10d60000.hsi2c/i2c-4/i2c-max77759tcpc/usb_limit_sink_enable chmod 664 /sys/devices/platform/10d60000.hsi2c/i2c-5/i2c-max77759tcpc/usb_limit_sink_enable chmod 664 /sys/devices/platform/10d60000.hsi2c/i2c-6/i2c-max77759tcpc/usb_limit_sink_enable + chmod 664 /sys/devices/platform/10d60000.hsi2c/i2c-7/i2c-max77759tcpc/usb_limit_sink_enable + chmod 664 /sys/devices/platform/10d60000.hsi2c/i2c-8/i2c-max77759tcpc/usb_limit_sink_enable + chmod 664 /sys/devices/platform/10d60000.hsi2c/i2c-9/i2c-max77759tcpc/usb_limit_sink_enable + chmod 664 /sys/devices/platform/10d60000.hsi2c/i2c-0/i2c-max77759tcpc/usb_limit_source_enable + chmod 664 /sys/devices/platform/10d60000.hsi2c/i2c-1/i2c-max77759tcpc/usb_limit_source_enable + chmod 664 /sys/devices/platform/10d60000.hsi2c/i2c-2/i2c-max77759tcpc/usb_limit_source_enable + chmod 664 /sys/devices/platform/10d60000.hsi2c/i2c-3/i2c-max77759tcpc/usb_limit_source_enable chmod 664 /sys/devices/platform/10d60000.hsi2c/i2c-4/i2c-max77759tcpc/usb_limit_source_enable chmod 664 /sys/devices/platform/10d60000.hsi2c/i2c-5/i2c-max77759tcpc/usb_limit_source_enable chmod 664 /sys/devices/platform/10d60000.hsi2c/i2c-6/i2c-max77759tcpc/usb_limit_source_enable + chmod 664 /sys/devices/platform/10d60000.hsi2c/i2c-7/i2c-max77759tcpc/usb_limit_source_enable + chmod 664 /sys/devices/platform/10d60000.hsi2c/i2c-8/i2c-max77759tcpc/usb_limit_source_enable + chmod 664 /sys/devices/platform/10d60000.hsi2c/i2c-9/i2c-max77759tcpc/usb_limit_source_enable diff --git a/usb/usb/android.hardware.usb-service.xml b/usb/usb/android.hardware.usb-service.xml index 60881948..c3f07f52 100644 --- a/usb/usb/android.hardware.usb-service.xml +++ b/usb/usb/android.hardware.usb-service.xml @@ -1,7 +1,7 @@ android.hardware.usb - 1 + 2 IUsb default diff --git a/widevine/device.mk b/widevine/device.mk index 467aa386..c711f6f7 100644 --- a/widevine/device.mk +++ b/widevine/device.mk @@ -1,4 +1 @@ -PRODUCT_PACKAGES += \ - android.hardware.drm-service.clearkey \ - android.hardware.drm-service.widevine -BOARD_VENDOR_SEPOLICY_DIRS += device/google/gs201-sepolicy/widevine +BOARD_VENDOR_SEPOLICY_DIRS += device/google/gs201-sepolicy/widevine \ No newline at end of file