1on init
2    # Dump maxfg
3    chown system system /sys/class/power_supply/maxfg/m5_model_state
4    chown system system /sys/class/power_supply/maxfg_base/model_state
5    chown system system /sys/class/power_supply/max77779fg/model_state
6
7    # Dump eeprom
8    chown system system /sys/devices/platform/10c90000.hsi2c/i2c-9/9-0050/eeprom
9    chown system system /sys/devices/platform/10ca0000.hsi2c/i2c-10/10-0050/eeprom
10
11    chown system system /dev/battery_history
12    chmod 0644 /dev/battery_history
13
14    chown system system /dev/maxfg_history
15    chmod 0644 /dev/maxfg_history
16
17    # Charge stats (write 0)
18    chown system system /sys/class/power_supply/battery/charge_stats
19
20    # Pca Charge stats (write 0)
21    chown system system /sys/class/power_supply/dc-mains/device/chg_stats
22
23    # Wireless Charge stats (write 0)
24    chown system system /sys/class/power_supply/wireless/device/charge_stats
25
26    # Thermal Charge stats (write 0)
27    chown system system /sys/devices/platform/google,charger/thermal_stats
28
29    # Google Charger stats (write 0)
30    chown system system /sys/devices/platform/google,charger/charge_stats
31
32    # Permission for wireless charging
33    chown system system /sys/class/power_supply/wireless/capacity
34    chown system system /sys/class/power_supply/wireless/device/rtx
35    chown system system /sys/class/power_supply/wireless/device/rxdata
36    chown system system /sys/class/power_supply/wireless/device/txdata
37    chown system system /sys/class/power_supply/wireless/device/rxlen
38    chown system system /sys/class/power_supply/wireless/device/txlen
39    chown system system /sys/class/power_supply/wireless/device/ccreset
40    chown system system /sys/class/power_supply/wireless/device/status
41    chown system system /sys/class/power_supply/wireless/device/version
42    chown system system /sys/class/power_supply/wireless/device/features
43    chown system system /sys/class/power_supply/wireless/device/authtype
44    chown system system /sys/class/power_supply/wireless/device/authstart
45
46    # Adaptive charge
47    chown system system /sys/class/power_supply/battery/charge_deadline
48
49    # Charging policy
50    chown system system /sys/class/power_supply/battery/charging_policy
51
52    # BatteryHealthData
53    chown system system /sys/class/power_supply/battery/first_usage_date
54
55    # Battery Defender
56    chown system system /sys/devices/platform/google,battery/power_supply/battery/bd_trickle_cnt
57    chown system system /sys/devices/platform/google,battery/power_supply/battery/bd_trickle_dry_run
58    chown system system /sys/devices/platform/google,battery/power_supply/battery/bd_trickle_enable
59    chown system system /sys/devices/platform/google,battery/power_supply/battery/bd_trickle_recharge_soc
60    chown system system /sys/devices/platform/google,battery/power_supply/battery/bd_trickle_reset_sec
61    chown system system /sys/devices/platform/google,battery/power_supply/battery/bd_clear
62    chown system system /sys/devices/platform/google,battery/power_supply/battery/health_safety_margin
63    chown system system /sys/devices/platform/google,battery/power_supply/battery/swelling_data
64    chown system system /sys/devices/platform/google,charger/bd_drainto_soc
65    chown system system /sys/devices/platform/google,charger/bd_recharge_soc
66    chown system system /sys/devices/platform/google,charger/bd_recharge_voltage
67    chown system system /sys/devices/platform/google,charger/bd_resume_abs_temp
68    chown system system /sys/devices/platform/google,charger/bd_resume_soc
69    chown system system /sys/devices/platform/google,charger/bd_resume_temp
70    chown system system /sys/devices/platform/google,charger/bd_resume_time
71    chown system system /sys/devices/platform/google,charger/bd_temp_dry_run
72    chown system system /sys/devices/platform/google,charger/bd_temp_enable
73    chown system system /sys/devices/platform/google,charger/bd_trigger_temp
74    chown system system /sys/devices/platform/google,charger/bd_trigger_time
75    chown system system /sys/devices/platform/google,charger/bd_trigger_voltage
76    chown system system /sys/devices/platform/google,charger/bd_clear
77    chown system system /sys/devices/platform/google,charger/charge_start_level
78    chown system system /sys/devices/platform/google,charger/charge_stop_level
79    chown system system /sys/devices/platform/google,cpm/dc_ctl
80    # Important to include dd_state as it's used in battery defender in charger mode
81    chown system system /sys/devices/platform/google,charger/dd_state
82    chown system system /sys/devices/platform/google,charger/dd_settings
83
84    # for parsing thismeal.bin
85    chown system system /vendor/bin/hw/battery_mitigation
86
87on early-boot
88    # Wait for insmod_sh to finish all common modules
89    wait_for_prop vendor.common.modules.ready 1
90
91    # logbuffer
92    chown system system /dev/logbuffer_maxfg
93    chown system system /dev/logbuffer_maxfg_monitor
94    chown system system /dev/logbuffer_max77779fg
95    chown system system /dev/logbuffer_max77779fg_monitor
96    chown system system /dev/logbuffer_maxfg_base
97    chown system system /dev/logbuffer_maxfg_secondary
98    chown system system /dev/logbuffer_maxfg_base_monitor
99    chown system system /dev/logbuffer_maxfg_secondary_monitor
100    chown system system /dev/logbuffer_maxq
101    chown system system /dev/logbuffer_rtx
102    chown system system /dev/logbuffer_ssoc
103    chown system system /dev/logbuffer_ttf
104    chown system system /dev/logbuffer_tcpm
105    chown system system /dev/logbuffer_usbpd
106    chown system system /dev/logbuffer_pogo_transport
107    chown system system /dev/logbuffer_wireless
108    chown system system /dev/logbuffer_pca9468
109    chown system system /dev/logbuffer_ln8411
110    chown system system /dev/logbuffer_cpm
111    chown system system /dev/logbuffer_wc68
112    chown system system /dev/logbuffer_max77779_fwupdate
113
114on property:sys.boot_completed=1
115    # gvotables for dumpstate
116    chown system system /sys/kernel/debug/gvotables
117
118    # Permission for wireless charging
119    chown system system /sys/class/power_supply/wireless/capacity
120    chown system system /sys/class/power_supply/wireless/device/rtx
121    chown system system /sys/class/power_supply/wireless/device/rxdata
122    chown system system /sys/class/power_supply/wireless/device/txdata
123    chown system system /sys/class/power_supply/wireless/device/rxlen
124    chown system system /sys/class/power_supply/wireless/device/txlen
125    chown system system /sys/class/power_supply/wireless/device/ccreset
126    chown system system /sys/class/power_supply/wireless/device/status
127    chown system system /sys/class/power_supply/wireless/device/version
128    chown system system /sys/class/power_supply/wireless/device/authstart
129
130    # write serialno to battery path for pairing
131    write /sys/class/power_supply/battery/dev_sn ${ro.boot.serialno}
132