Send 'closing=true' from StreamOutHalHidl::exit
Combine sending of 'closing=true' with 'exiting=1' for legacy
HALs. Historically, the remote submix HAL was using a separate
notification because initially 'closing=true' was only sent
for the A2DP output. Unify sending of these parameters as in
the AIDL HAL interface we only use the thread exiting condition
to notify the HAL about the need to stop its output.
Bug: 73175392
Test: manual check of A2DP connection, disconnection, switching
"Mono audio" on and off;
manual check of screen recording with audio
(cherry picked from https://googleplex-android-review.googlesource.com/q/commit:1579be6d8afe1d369744b0153b5254b655e993e0)
Merged-In: I722e5dadbab252ccae29eedad92e568ffe664b4d
Change-Id: I722e5dadbab252ccae29eedad92e568ffe664b4d
diff --git a/media/libaudiohal/impl/StreamHalHidl.cpp b/media/libaudiohal/impl/StreamHalHidl.cpp
index 2b0af49..82062cc 100644
--- a/media/libaudiohal/impl/StreamHalHidl.cpp
+++ b/media/libaudiohal/impl/StreamHalHidl.cpp
@@ -979,9 +979,10 @@
}
status_t StreamOutHalHidl::exit() {
- // Signal exiting to remote_submix HAL.
+ // Signal exiting to HALs that use intermediate pipes to close them.
AudioParameter param;
param.addInt(String8(AudioParameter::keyExiting), 1);
+ param.add(String8(AudioParameter::keyClosing), String8(AudioParameter::valueTrue));
return setParameters(param.toString());
}
diff --git a/media/libmediahelper/include/media/AudioParameter.h b/media/libmediahelper/include/media/AudioParameter.h
index 8568b8f..3eee854 100644
--- a/media/libmediahelper/include/media/AudioParameter.h
+++ b/media/libmediahelper/include/media/AudioParameter.h
@@ -51,8 +51,7 @@
static const char * const keyScreenState;
static const char * const keyScreenRotation;
- // TODO(b/73175392) consider improvement to AIDL StreamOut interface.
- // keyClosing: "true" when AudioOutputDescriptor is closing. Used by A2DP HAL.
+ // keyClosing: "true" on AudioFlinger Thread preExit. Used by A2DP HAL.
// keyExiting: "1" on AudioFlinger Thread preExit. Used by remote_submix and A2DP HAL.
static const char * const keyClosing;
static const char * const keyExiting;
diff --git a/services/audiopolicy/common/managerdefinitions/src/AudioOutputDescriptor.cpp b/services/audiopolicy/common/managerdefinitions/src/AudioOutputDescriptor.cpp
index be13340..329e0ca 100644
--- a/services/audiopolicy/common/managerdefinitions/src/AudioOutputDescriptor.cpp
+++ b/services/audiopolicy/common/managerdefinitions/src/AudioOutputDescriptor.cpp
@@ -674,12 +674,6 @@
}
}
- // TODO(b/73175392) consider improving the AIDL interface.
- // Signal closing to A2DP HAL.
- AudioParameter param;
- param.add(String8(AudioParameter::keyClosing), String8("true"));
- mClientInterface->setParameters(mIoHandle, param.toString());
-
mClientInterface->closeOutput(mIoHandle);
LOG_ALWAYS_FATAL_IF(mProfile->curOpenCount < 1, "%s profile open count %u",