audioflinger: add watchdog on main mutex
Check every 10 seconds if main audioflinger mutex can be acquired and
trigger audioserver process restart if not.
This will allow to capture tombstones of locked up situations and avoid
the disruption of a system_server restart.
Bug: 30737845
Bug: 30388410
Change-Id: I8a78b8cf813982f70ea598a6d42affc0ecaa76c9
diff --git a/services/audioflinger/AudioFlinger.h b/services/audioflinger/AudioFlinger.h
index c56dcc1..e334d80 100644
--- a/services/audioflinger/AudioFlinger.h
+++ b/services/audioflinger/AudioFlinger.h
@@ -58,6 +58,7 @@
#include "SpdifStreamOut.h"
#include "AudioHwDevice.h"
#include "LinearMap.h"
+#include "LockWatch.h"
#include <powermanager/IPowerManager.h>
@@ -630,6 +631,7 @@
};
mutable Mutex mLock;
+ sp<LockWatch> mLockWatch;
// protects mClients and mNotificationClients.
// must be locked after mLock and ThreadBase::mLock if both must be locked
// avoids acquiring AudioFlinger::mLock from inside thread loop.