Fix crash issue arising out of multiple hdmi connect/disconnects
Acquire mExtLock before proceeding further in
hwc_prepare_external to prevent crashes arising out
of updating ctx variables from two different
threads(composition and uevent threads)
Change-Id: I0f18c41b117f18aeb25572b53ef6eba3638bb826
diff --git a/libhwcomposer/hwc.cpp b/libhwcomposer/hwc.cpp
index 9bf0c45..7bfbf06 100644
--- a/libhwcomposer/hwc.cpp
+++ b/libhwcomposer/hwc.cpp
@@ -158,7 +158,9 @@
static int hwc_prepare_external(hwc_composer_device_1 *dev,
hwc_display_contents_1_t *list, int dpy) {
+
hwc_context_t* ctx = (hwc_context_t*)(dev);
+ Locker::Autolock _l(ctx->mExtLock);
if (LIKELY(list && list->numHwLayers > 1) &&
ctx->dpyAttr[dpy].isActive &&
@@ -398,7 +400,7 @@
{
ATRACE_CALL();
int ret = 0;
- Locker::Autolock _l(ctx->mExtSetLock);
+ Locker::Autolock _l(ctx->mExtLock);
if (LIKELY(list) && ctx->dpyAttr[dpy].isActive &&
!ctx->dpyAttr[dpy].isPause &&