-
Notifications
You must be signed in to change notification settings - Fork 0
/
customize.sh
361 lines (326 loc) · 12.4 KB
/
customize.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
#!/bin/sh
# Revert from 3.0.5 (3.0.7 installs the module from the Scene7 app directly, so it is not needed when flashing this module manually)
# Scene 7 v3.7.0 modified by andalib
set_perm_recursive $MODPATH 0 0 0755 0644
PAGE_WORK_DIR=$MODPATH
module=$MODPATH
setprop persist.sys.oplus.wifi.sla.game_high_temperature 50 # Set Wi-Fi modem high temperature limit to 50°C
setprop persist.sys.environment.temp 16
setprop ro.oplus.radio.hide_nr_switch 0
setprop debug.hwui.renderer skiavk
# setprop persist.sys.horae.enable 0
# setprop persist.oplus.display.vrr 0
# module='extreme_gt'
# module='/data/adb/modules/extreme_gt' # Revert from 3.0.5 (3.0.7 installs the module from the Scene7 app directly, so it is not needed when flashing this module manually)
mkdir -p $module
cat $PAGE_WORK_DIR/extreme_gt/module.prop > $module/module.prop
cat $PAGE_WORK_DIR/extreme_gt/post-fs-data.sh > $module/post-fs-data.sh
if [[ -f $module/disable ]]; then
rm $module/disable
fi
dirs="/odm /my_product /vendor /system/vendor /product /system"
xml_override() {
mkdir -p $(dirname $module$1)
overrides="$2"
for file in $(find $dirs -name "$1")
do
mkdir -p $(dirname $module$file)
rows=$(cat $file)
for override in $overrides; do
key=$(echo $override | cut -f1 -d '=')
value=$(echo $override | cut -f2 -d '=')
rows=$(echo "$rows" | sed "s/<$key>.*</<$key>$value</")
done
echo "$rows" > $module$file
done
}
# sys_thermal_control_config.xml sys_thermal_control_config_gt.xml
boolValues="feature_enable_item feature_safety_test_enable_item aging_thermal_control_enable_item"
intValues="aging_cpu_level_item high_temp_safety_level_item game_high_perf_mode_item normal_mode_item ota_mode_item racing_mode_item"
for file in $(find $dirs -name "sys_thermal_control_config*.xml")
do
mkdir -p $(dirname $module$file)
rows=$(cat $file | grep -v -E '(<gear_config|cpu=|fps=|<scene_|</scene_|<category_|</category_|<subitem|<level|\.)')
for key in $boolValues; do
rows=$(echo "$rows" | sed "s/<$key.*\/>/<$key booleanVal=\"false\" \/>/")
done
for key in $intValues; do
rows=$(echo "$rows" | sed "s/<$key.*\/>/<$key intVal=\"-1\" \/>/")
done
echo "$rows" | tr -s '\n' > $module$file
done
# sys_thermal_config.xml
xml_override 'sys_thermal_config.xml' "isOpen=0
more_heat_threshold=550
heat_threshold=530
less_heat_threshold=500
preheat_threshold=480
preheat_dex_oat_threshold=460
thermal_battery_temp=0
is_feature_on=0
is_upload_log=0
is_upload_errlog=0"
# sys_high_temp_protect_*。xml
xml_override 'sys_high_temp_protect*xml' "isOpen=0
HighTemperatureProtectSwitch=false
HighTemperatureShutdownSwitch=false
HighTemperatureFirstStepSwitch=false
HighTemperatureProtectFirstStepIn=550
HighTemperatureProtectFirstStepOut=530
HighTemperatureProtectThresholdIn=570
HighTemperatureProtectThresholdOut=550
HighTemperatureProtectShutDown=750
MediumTemperatureProtectThreshold=10000
HighTemperatureDisableFlashSwitch=false
HighTemperatureDisableFlashLimit=480
HighTemperatureEnableFlashLimit=470
HighTemperatureDisableFlashChargeSwitch=false
HighTemperatureDisableFlashChargeLimit=480
HighTemperatureEnableFlashChargeLimit=470
camera_temperature_limit=520
HighTemperatureControlVideoRecordSwitch=false
HighTemperatureDisableVideoRecordLimit=550
HighTemperatureEnableVideoRecordLimit=520
ToleranceThreshold=50
ToleranceStart=480
ToleranceStop=460"
# refresh_rate_config.xml
for file in $(find $dirs -name "refresh_rate_config.xml"); do
mkdir -p $(dirname $module$file)
# 部分机型如9RT出现游戏锁帧,可能直接清空刷新率配置并不太好
# cat $file | grep -v -E '(<tpitem|<item|<record)' | tr -s '\n' > $module$file
# 有些配置出现换行符就炸了,例如:
# <item package="com.mf.xxyzgame.wpp.game.hlqsgdzz.nearme.gamecenter"
# rateId="2-2-2-2" /><!--欢乐切水果大作战-->
# cat $file | grep -v -E '(2-2-2-2|<record)' | tr -s '\n' > $module$file
# 不怕换行,但是生成的配置很臃肿
sed 's/<!--.*-->//' "$file" | grep -v -E '<item.*2-2-2-2.*/>' | sed 's/2-2-2-2/0-0-0-0/' | grep -v -E '<record' > $module$file
# echo -n '' > $module$file
# while read line
# do
# case "$line" in
# *"<item"*|*"<tpitem"*|*"<record"*)
# case "$line" in
# *"0-0-0-0"*|*"activity"*)
# echo " $line" >> $module$file
# ;;
# *"2-2-2-2"*)
# continue
# ;;
# esac
# ;;
# *)
# echo "$line" >> $module$file
# ;;
# esac
# done < $file
done
# thermallevel_to_fps.xml
for file in $(find $dirs -name "thermallevel_to_fps.xml")
do
mkdir -p $(dirname $module$file)
cat $file | sed "s/fps=\".*\"/fps=\"144\"/" > $module$file
done
# oppo_display_perf_list.xml
# multimedia_display_perf_list.xml
for file in $(find $dirs -name "oppo_display_perf_list.xml")
do
mkdir -p $(dirname $module$file)
echo -n '' > $module$file
skip=0
while read line; do
case "$line" in
*"<name>"*)
skip=0
case "$line" in
*"sf.dps.feature"*|*"com.android"*|*"system_server"*|*"/system"*|*"com.color"*|*"com.oppo"*|*"com.oplus"**"SmartVolume"*)
skip=0
echo " $line" >> $module$file
;;
*)
skip=1
;;
esac
;;
'<?xml version="1.0" encoding="UTF-8"?>'|'<filter-conf>'|'</filter-conf>')
echo "$line" >> $module$file
;;
*)
if [[ $skip == 0 ]]; then
echo " $line" >> $module$file
fi
;;
esac
done < $file
done
# sys_resolution_switch_config.xml
for file in $(find $dirs -name "sys_resolution_switch_config.xml")
do
mkdir -p $(dirname $module$file)
echo -n '' > $module$file
skip=0
while read line; do
case "$line" in
*"<item package="*|*"<switchop package="*)
echo "$line" > /dev/null
;;
*)
echo "$line" >> $module$file
;;
esac
done < $file
done
# game_thermal_config.xml
for file in $(find $dirs -name "game_thermal_config.xml")
do
mkdir -p $(dirname $module$file)
echo -n '' > $module$file
if [[ $(grep cluster3 $file) != '' ]];then
echo '<?xml version="1.0" encoding="utf-8"?>
<game_thermal_config>
<version>20230829</version>
<filter-name>game_thermal_config</filter-name>
<heavy_policy>
<game_control temp="520" cluster0="-1" cluster1="-1" cluster2="-1" cluster3="-1" fps="60"/>
</heavy_policy>
<default_policy>
<game_control temp="430" cluster0="-1" cluster1="-1" cluster2="-1" cluster3="-1" fps="0"/>
<game_control temp="440" cluster0="-1" cluster1="-1" cluster2="-1" cluster3="-1" fps="0"/>
<game_control temp="450" cluster0="-1" cluster1="-1" cluster2="-1" cluster3="-1" fps="0"/>
<game_control temp="460" cluster0="-1" cluster1="-1" cluster2="-1" cluster3="-1" fps="0"/>
<game_control temp="470" cluster0="-1" cluster1="-1" cluster2="-1" cluster3="-1" fps="0"/>
<game_control temp="480" cluster0="-1" cluster1="-1" cluster2="-1" cluster3="-1" fps="0"/>
<game_control temp="490" cluster0="-1" cluster1="-1" cluster2="-1" cluster3="-1" fps="0"/>
<game_control temp="510" cluster0="-1" cluster1="-1" cluster2="-1" cluster3="-1" fps="0"/>
</default_policy>
</game_thermal_config>' > $module$file
else
echo '<?xml version="1.0" encoding="utf-8"?>
<game_thermal_config>
<version>20230829</version>
<filter-name>game_thermal_config</filter-name>
<heavy_policy>
<game_control temp="520" cluster0="-1" cluster1="-1" cluster2="-1" fps="60"/>
</heavy_policy>
<default_policy>
<game_control temp="430" cluster0="-1" cluster1="-1" cluster2="-1" fps="0"/>
<game_control temp="440" cluster0="-1" cluster1="-1" cluster2="-1" fps="0"/>
<game_control temp="450" cluster0="-1" cluster1="-1" cluster2="-1" fps="0"/>
<game_control temp="460" cluster0="-1" cluster1="-1" cluster2="-1" fps="0"/>
<game_control temp="470" cluster0="-1" cluster1="-1" cluster2="-1" fps="0"/>
<game_control temp="480" cluster0="-1" cluster1="-1" cluster2="-1" fps="0"/>
<game_control temp="490" cluster0="-1" cluster1="-1" cluster2="-1" fps="0"/>
<game_control temp="510" cluster0="-1" cluster1="-1" cluster2="-1" fps="0"/>
</default_policy>
</game_thermal_config>' > $module$file
fi
done
# QEGA_Config.txt
for file in $(find $dirs -name "QEGA_Config.txt")
do
mkdir -p $(dirname $module$file)
echo "SkinTemperatureNode: battery
SkinNodeThrottleTemp: 55000
#GameID GameAPK MaxTemperature MaxCurrent AvgCurrent
100001 hok 52000 2000 1800
0 adaptive 55000 2000 1800" > $module$file
done
# devices_config.json
for file in $(find $dirs -name "devices_config.json")
do
mkdir -p $(dirname $module$file)
echo -n '' > $module$file
while read line; do
case "$line" in
*'"high.capacity.threshold": 100'*)
echo "$line" >> $module$file
;;
*'"battery.temperate.range":'*)
echo '"battery.temperate.range": "[100,500]",' >> $module$file
;;
# *'"high.capacity.battery.temperate.range":'*)
# echo '"high.capacity.battery.temperate.range": "[100,500]",' >> $module$file
# ;;
*'"high.capacity.threshold":'*)
echo '"high.capacity.threshold": 85' >> $module$file
;;
*)
echo "$line" >> $module$file
;;
esac
done < $file
done
# Disabled thermal customizations to prevent charging overheating (not needed unless you are an ultra-fast charging freak!!)
# charging_thermal_config_default.txt charging_hyper_mode_config.txt
#for file in $(find $dirs -name "charging_*txt")
#do
# mkdir -p $(dirname $module$file)
# echo -n '' > $module$file
# while read line; do
# case "$line" in
# *:=*)
# echo "$line" >> $module$file
# ;;
# *,*,*)
# temp=$(echo "$line" | awk -F, '{print $1}')
# current=$(echo "$line" | awk -F, '{print $2}')
# t=$(echo "$line" | awk -F, '{print $3}')
# temp=$((temp+50)) # + 5°C
# echo "$temp,$current,$t" >> $module$file
# ;;
# *)
# echo "$line" >> $module$file
# ;;
# esac
# done < $file
#done
# D1100/1200
soc=$(getprop ro.board.platform)
if [[ "$soc" == 'mt6891' ]] || [[ "$soc" == 'mt6893' ]] || [[ "$soc" == 'mt6889' ]]; then
mkdir -p $module/system/vendor/etc
mkdir -p $module/system/vendor/etc/.tp
if [[ -d /odm/etc/powerhal ]]; then
mkdir -p $module/odm/etc/powerhal
fi
for file in power_app_cfg.xml powercontable.xml powerscntbl.xml
do
cp -f $PAGE_WORK_DIR/extreme_gt/d1x00/$file $module/system/vendor/etc/$file
if [[ -d /odm/etc/powerhal ]]; then
cp -f $PAGE_WORK_DIR/extreme_gt/d1x00/$file $module/odm/etc/powerhal/$file
fi
done
cp -f $PAGE_WORK_DIR/extreme_gt/d1x00/tp/ht120.mtc $module/system/vendor/etc/.tp/.ht120.mtc
cp -f $PAGE_WORK_DIR/extreme_gt/d1x00/tp/thermal_policy_08 $module/system/vendor/etc/.tp/.thermal_policy_08
cp -f $PAGE_WORK_DIR/extreme_gt/d1x00/tp/thermal.conf $module/system/vendor/etc/.tp/thermal.conf
cp -f $PAGE_WORK_DIR/extreme_gt/d1x00/tp/thermal.off.conf $module/system/vendor/etc/.tp/thermal.off.conf
cat $PAGE_WORK_DIR/extreme_gt/d1x00/service.sh > $module/service.sh
else
cat $PAGE_WORK_DIR/extreme_gt/service.sh > $module/service.sh
fi
# manufacturer=$(getprop ro.product.odm.manufacturer)
soc=$(getprop ro.soc.model | tr 'a-z' 'A-Z')
echo 'persist.sys.horae.enable=0' > $module/system.prop
if [[ -f $START_DIR/orms_core_config.xml ]]; then
mkdir -p $module/odm/etc/orms
cp -f $START_DIR/orms_core_config.xml $module/odm/etc/orms/orms_core_config.xml
fi
handle_partition() {
# if /system/vendor is a symlink, we need to move it out of $MODPATH/system, otherwise it will be overlayed
# if /system/vendor is a normal directory, it is ok to overlay it and we don't need to overlay it separately.
if [ ! -e $module/system/$1 ]; then
# no partition found
return;
fi
if [ -L "/system/$1" ] && [ "$(readlink -f /system/$1)" = "/$1" ]; then
# we create a symlink if module want to access $module/system/$1
# but it doesn't always work(ie. write it in post-fs-data.sh would fail because it is readonly)
mv -f $module/system/$1 $module/$1 && ln -sf ../$1 $module/system/$1
fi
}
if [[ "$KSU" == "true" ]] || [[ $(which ksud) != "" ]]; then
handle_partition 'vendor'
handle_partition 'system_ext'
handle_partition 'product'
fi
echo 'OK ^_*' 1>&2
# Revert from 3.0.5 (3.0.7 installs the module from the Scene7 app directly, so it is not needed when flashing this module manually)