-
Notifications
You must be signed in to change notification settings - Fork 13
/
service.sh
101 lines (88 loc) · 3.76 KB
/
service.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
#!/system/bin/sh
# sleep 31 secs needed for "settings" commands to become effective
# and make volume medial steps to be 100 if a volume steps facility is used
function which_resetprop_command()
{
type resetprop 1>"/dev/null" 2>&1
if [ $? -eq 0 ]; then
echo "resetprop"
else
type resetprop_phh 1>"/dev/null" 2>&1
if [ $? -eq 0 ]; then
echo "resetprop_phh"
else
return 1
fi
fi
return 0
}
function additionalSettings()
{
local force_restart_server=0
if [ "`getprop persist.sys.phh.disable_audio_effects`" = "0" ]; then
resetprop_command="`which_resetprop_command`"
if [ -n "$resetprop_command" ]; then
# Workaround for recent Pixel Firmwares (not to reboot when resetprop'ing)
"$resetprop_command" --delete ro.audio.ignore_effects 1>"/dev/null" 2>&1
# End of workaround
"$resetprop_command" ro.audio.ignore_effects true
force_restart_server=1
else
return 1
fi
fi
# Stop Tensor device's AOC daemon for reducing significant jitter
if [ "`getprop init.svc.aocd`" = "running" ]; then
setprop ctl.stop aocd
force_restart_server=1
fi
# Nullifying the volume listener for no compressing audio (maybe a peak limiter)
if [ "`getprop persist.sys.phh.disable_soundvolume_effect`" = "0" ]; then
if [ -r "/system/phh/empty" -a -r "/vendor/lib/soundfx/libvolumelistener.so" ]; then
mount -o bind "/system/phh/empty" "/vendor/lib/soundfx/libvolumelistener.so"
force_restart_server=1
fi
if [ -r "/system/phh/empty" -a -r "/vendor/lib64/soundfx/libvolumelistener.so" ]; then
mount -o bind "/system/phh/empty" "/vendor/lib64/soundfx/libvolumelistener.so"
force_restart_server=1
fi
elif [ "`getprop persist.sys.phh.disable_soundvolume_effect`" != "1" ]; then
# for non- phh GSI's (Qcomm devices only?)
if [ -r "/vendor/lib/soundfx/libvolumelistener.so" ]; then
mount -o bind "/dev/null" "/vendor/lib/soundfx/libvolumelistener.so"
force_restart_server=1
fi
if [ -r "/vendor/lib64/soundfx/libvolumelistener.so" ]; then
mount -o bind "/dev/null" "/vendor/lib64/soundfx/libvolumelistener.so"
force_restart_server=1
fi
fi
# Force disabling spatializer if OS reverted the spatializer setting during the booting process
if [ "`getprop ro.audio.spatializer_enabled`" = "true" ]; then
resetprop_command="`which_resetprop_command`"
if [ -n "$resetprop_command" ]; then
# Workaround for recent Pixel Firmwares (not to reboot when resetprop'ing)
"$resetprop_command" --delete ro.audio.spatializer_enabled 1>"/dev/null" 2>&1
# End of workaround
"$resetprop_command" ro.audio.spatializer_enabled false
force_restart_server=1
else
return 1
fi
fi
if [ "$force_restart_server" = "1" -o "`getprop ro.system.build.version.release`" -ge "12" ]; then
if [ -n "`getprop init.svc.audioserver`" ]; then
setprop ctl.restart audioserver
sleep 1.2
if [ "`getprop init.svc.audioserver`" != "running" ]; then
# workaround for Android 12 old devices hanging up the audioserver after "setprop ctl.restart audioserver" is executed
local pid="`getprop init.svc_debug_pid.audioserver`"
if [ -n "$pid" ]; then
kill -HUP $pid 1>"/dev/null" 2>&1
fi
fi
fi
fi
settings put system volume_steps_music 100
}
(((sleep 31; additionalSettings) 0<&- &>"/dev/null" &) &)