1service audioserver /system/bin/audioserver
2    class core
3    user audioserver
4    # media gid needed for /dev/fm (radio) and for /data/misc/media (tee)
5    group audio camera drmrpc media mediadrm net_bt net_bt_admin net_bw_acct wakelock
6    capabilities BLOCK_SUSPEND
7    ioprio rt 4
8    task_profiles ProcessCapacityHigh HighPerformance
9    onrestart restart vendor.audio-hal
10    onrestart restart vendor.audio-hal-4-0-msd
11    onrestart restart audio_proxy_service
12    # Keep the original service names for backward compatibility
13    onrestart restart vendor.audio-hal-2-0
14    onrestart restart audio-hal-2-0
15
16on property:vts.native_server.on=1
17    stop audioserver
18on property:vts.native_server.on=0
19    start audioserver
20
21on property:init.svc.audioserver=stopped
22    stop vendor.audio-hal
23    stop vendor.audio-hal-4-0-msd
24    stop audio_proxy_service
25    # Keep the original service names for backward compatibility
26    stop vendor.audio-hal-2-0
27    stop audio-hal-2-0
28    # See b/155364397. Need to have HAL service running for VTS.
29    # Can't use 'restart' because then HAL service would restart
30    # audioserver bringing it back into running state.
31    start vendor.audio-hal
32    start vendor.audio-hal-4-0-msd
33    start audio_proxy_service
34    # Keep the original service names for backward compatibility
35    start vendor.audio-hal-2-0
36    start audio-hal-2-0
37
38on property:init.svc.audioserver=running
39    start vendor.audio-hal
40    start vendor.audio-hal-4-0-msd
41    start audio_proxy_service
42    # Keep the original service names for backward compatibility
43    start vendor.audio-hal-2-0
44    start audio-hal-2-0
45
46on property:sys.audio.restart.hal=1
47    # See b/159966243. Avoid restart loop between audioserver and HAL.
48    # Keep the original service names for backward compatibility
49    stop vendor.audio-hal
50    stop vendor.audio-hal-4-0-msd
51    stop audio_proxy_service
52    stop vendor.audio-hal-2-0
53    stop audio-hal-2-0
54    start vendor.audio-hal
55    start vendor.audio-hal-4-0-msd
56    start audio_proxy_service
57    start vendor.audio-hal-2-0
58    start audio-hal-2-0
59    # reset the property
60    setprop sys.audio.restart.hal 0
61
62on init
63    mkdir /dev/socket/audioserver 0775 audioserver audioserver
64