aaudio: close MMAP stream if client dies
Notify client when audio service dies. Clear connection.
Notify AAudio service when client dies. Close client streams.
Use sp<> to track ServiceStreams.
Bug: 38267698
Test: test_no_close.cpp
Change-Id: I5f1699ed3b8b7bd960947c0028a89ca8419ce7a0
diff --git a/media/libaaudio/src/binding/IAAudioService.h b/media/libaaudio/src/binding/IAAudioService.h
index 071c5b8..30b3ead 100644
--- a/media/libaaudio/src/binding/IAAudioService.h
+++ b/media/libaaudio/src/binding/IAAudioService.h
@@ -28,18 +28,24 @@
#include "binding/AudioEndpointParcelable.h"
#include "binding/AAudioStreamRequest.h"
#include "binding/AAudioStreamConfiguration.h"
+#include "binding/IAAudioClient.h"
#include "utility/HandleTracker.h"
namespace android {
#define AAUDIO_SERVICE_NAME "media.aaudio"
-// Interface (our AIDL) - Shared by server and client
+// Interface (our AIDL) - service methods called by client
class IAAudioService : public IInterface {
public:
DECLARE_META_INTERFACE(AAudioService);
+ // Register an object to receive audio input/output change and track notifications.
+ // For a given calling pid, AAudio service disregards any registrations after the first.
+ // Thus the IAAudioClient must be a singleton per process.
+ virtual void registerClient(const sp<IAAudioClient>& client) = 0;
+
/**
* @param request info needed to create the stream
* @param configuration contains information about the created stream