From 4da7af2ade2030f1beccaddc251b5c8ab23936c6 Mon Sep 17 00:00:00 2001 From: Ytai Ben-Tsvi Date: Thu, 23 Apr 2020 10:44:00 -0700 Subject: [PATCH] Control audio HAL services in start/stop Some system services (e.g. SoundTriggerMiddleware) assume that whenever they start, the audio HAL is in its default (reset) state. init.rc scripts tie the lifetimes of the audio HAL and system processes, but when using stop/start this is not the case, and this may cause spurious crashes in this case. stop/start is apparently being relied on in some test infrastructure, so this change is needed to avoid causing problems for those systems or false detection of problems, which are not actually present in production. Bug: 154029444 Test: Manually verify that the audio HAL is stopped on 'adb shell stop', restarted on 'adb shell start' and that the system boots correctly after. Change-Id: Icb6eeddfa48b1a49a4d48baae41f9086eb83a9ca --- media/audioserver/audioserver.rc | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/media/audioserver/audioserver.rc b/media/audioserver/audioserver.rc index f9bef5fbf9..38c2750a99 100644 --- a/media/audioserver/audioserver.rc +++ b/media/audioserver/audioserver.rc @@ -14,6 +14,20 @@ on property:vts.native_server.on=1 on property:vts.native_server.on=0 start audioserver +on property:init.svc.audioserver=stopped + stop vendor.audio-hal + stop vendor.audio-hal-4-0-msd + # Keep the original service names for backward compatibility + stop vendor.audio-hal-2-0 + stop audio-hal-2-0 + +on property:init.svc.audioserver=running + start vendor.audio-hal + start vendor.audio-hal-4-0-msd + # Keep the original service names for backward compatibility + start vendor.audio-hal-2-0 + start audio-hal-2-0 + on property:sys.audio.restart.hal=1 restart vendor.audio-hal restart vendor.audio-hal-4-0-msd