hwc: Define and Use mSecureLock
Define and Use mSecureLock in composition and binder
thread. This is to ensure both variables mSecureMode
and mSecuring are updated in binder thread without
any context switch to composition thread
Change-Id: Ibd701bd3363515e2f7e8a9711bbc5b66053cfa03
diff --git a/libhwcomposer/hwc_qclient.cpp b/libhwcomposer/hwc_qclient.cpp
index b27a88c..c20f5c1 100644
--- a/libhwcomposer/hwc_qclient.cpp
+++ b/libhwcomposer/hwc_qclient.cpp
@@ -71,6 +71,7 @@
}
void QClient::securing(uint32_t startEnd) {
+ Locker::Autolock _sl(mHwcContext->mSecureLock);
//The only way to make this class in this process subscribe to media
//player's death.
IMediaDeathNotifier::getMediaPlayerService();
@@ -84,6 +85,7 @@
}
void QClient::unsecuring(uint32_t startEnd) {
+ Locker::Autolock _sl(mHwcContext->mSecureLock);
mHwcContext->mSecuring = startEnd;
//We're done unsecuring
if(startEnd == IQService::END)
@@ -93,6 +95,7 @@
}
void QClient::MPDeathNotifier::died() {
+ Locker::Autolock _sl(mHwcContext->mSecureLock);
ALOGD_IF(QCLIENT_DEBUG, "Media Player died");
mHwcContext->mSecuring = false;
mHwcContext->mSecureMode = false;