From 6025b731e6a23fbe3231bba96f64884e90447583 Mon Sep 17 00:00:00 2001 From: Ytai Ben-Tsvi Date: Wed, 22 Apr 2020 10:42:44 -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: I39878b978b47a169c4fe446c43d7347809d15e06 --- toolbox/start.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/toolbox/start.cpp b/toolbox/start.cpp index 4b1a54d53..cffb89cc5 100644 --- a/toolbox/start.cpp +++ b/toolbox/start.cpp @@ -36,7 +36,13 @@ static void ControlService(bool start, const std::string& service) { } static void ControlDefaultServices(bool start) { - std::vector services = {"iorapd", "netd", "surfaceflinger", "zygote"}; + std::vector services = { + "iorapd", + "netd", + "surfaceflinger", + "audioserver", + "zygote", + }; // Only start zygote_secondary if not single arch. std::string zygote_configuration = GetProperty("ro.zygote", "");