summaryrefslogtreecommitdiffstats
path: root/libs/audioflinger/AudioFlinger.h
diff options
context:
space:
mode:
authorEric Laurent <elaurent@google.com>2010-05-12 02:05:53 -0700
committerEric Laurent <elaurent@google.com>2010-05-12 06:29:16 -0700
commit4f0f17d2f10ceb22c2e23b593bab434fc899ecb7 (patch)
tree6c32547260c8783db72d1c8baf210adafbfda4c3 /libs/audioflinger/AudioFlinger.h
parent2cd841d485968181eb362338b9e66067767bd2eb (diff)
downloadframeworks_base-4f0f17d2f10ceb22c2e23b593bab434fc899ecb7.zip
frameworks_base-4f0f17d2f10ceb22c2e23b593bab434fc899ecb7.tar.gz
frameworks_base-4f0f17d2f10ceb22c2e23b593bab434fc899ecb7.tar.bz2
Fix issue 2678048: binder death detection in AudioFlinger is broken.
There is a bug in the way notification client list is managed when the client binder interface dies that makes that the dead client is not removed from the list: the week reference passed by binderDied() cannot be promoted and compared to the strong references in the list. The fix consists in creating a new NotificationClient class that implements the binder DeathRecipient and holds a strong reference to the IAudioFlingerClient interface. A new instance of this class is created for each cient and a strong reference to this object is added to the notification client list maintained by AudioFlinger. When binderDied() is called on this object, it is removed from the list preventing AudioFlinger to notify this client for further io changes. Also added code to disable LifeVibes effects when the client that has enabled the enhancements dies. Change-Id: Icedc4af171759e9ae9a575d82d44784b4e8267e8
Diffstat (limited to 'libs/audioflinger/AudioFlinger.h')
-rw-r--r--libs/audioflinger/AudioFlinger.h32
1 files changed, 27 insertions, 5 deletions
diff --git a/libs/audioflinger/AudioFlinger.h b/libs/audioflinger/AudioFlinger.h
index 739ec33..13aac8b 100644
--- a/libs/audioflinger/AudioFlinger.h
+++ b/libs/audioflinger/AudioFlinger.h
@@ -57,7 +57,7 @@ class AudioResampler;
static const nsecs_t kStandbyTimeInNsecs = seconds(3);
-class AudioFlinger : public BnAudioFlinger, public IBinder::DeathRecipient
+class AudioFlinger : public BnAudioFlinger
{
public:
static void instantiate();
@@ -139,9 +139,6 @@ public:
virtual status_t getRenderPosition(uint32_t *halFrames, uint32_t *dspFrames, int output);
- // IBinder::DeathRecipient
- virtual void binderDied(const wp<IBinder>& who);
-
enum hardware_call_state {
AUDIO_HW_IDLE = 0,
AUDIO_HW_INIT,
@@ -205,6 +202,27 @@ private:
pid_t mPid;
};
+ // --- Notification Client ---
+ class NotificationClient : public IBinder::DeathRecipient {
+ public:
+ NotificationClient(const sp<AudioFlinger>& audioFlinger,
+ const sp<IAudioFlingerClient>& client,
+ pid_t pid);
+ virtual ~NotificationClient();
+
+ sp<IAudioFlingerClient> client() { return mClient; }
+
+ // IBinder::DeathRecipient
+ virtual void binderDied(const wp<IBinder>& who);
+
+ private:
+ NotificationClient(const NotificationClient&);
+ NotificationClient& operator = (const NotificationClient&);
+
+ sp<AudioFlinger> mAudioFlinger;
+ pid_t mPid;
+ sp<IAudioFlingerClient> mClient;
+ };
class TrackHandle;
class RecordHandle;
@@ -685,6 +703,7 @@ private:
void removeClient_l(pid_t pid);
+ void removeNotificationClient(pid_t pid);
// record thread
@@ -796,8 +815,11 @@ private:
DefaultKeyedVector< int, sp<RecordThread> > mRecordThreads;
- SortedVector< sp<IBinder> > mNotificationClients;
+ DefaultKeyedVector< pid_t, sp<NotificationClient> > mNotificationClients;
int mNextThreadId;
+#ifdef LVMX
+ int mLifeVibesClientPid;
+#endif
};
// ----------------------------------------------------------------------------