summaryrefslogtreecommitdiff
path: root/libs/gui/BufferQueueProducer.cpp
diff options
context:
space:
mode:
author Jayant Chowdhary <jchowdhary@google.com> 2019-03-07 22:36:06 -0800
committer Jayant Chowdhary <jchowdhary@google.com> 2019-03-08 16:11:47 -0800
commitad9fe277ea967b27ce7b748bc51ff15ff011f488 (patch)
treee0bae8546bb9b90d5c22a040dc79603ca8e97d81 /libs/gui/BufferQueueProducer.cpp
parent5ff2b63c7f52605b454ceb51492139b518cd7262 (diff)
BufferQueueProducer: use the correct IPCThreadState.
The system variant of libgui maybe be double loaded. Also IGraphicBufferProducer functions may be called from hwbinder threads due to the presence of TWGraphicBufferProducer wrappers (hybrid interfaces). Therefore, we should use the correct IPCThreadState/ hardware::IPCThreadState to query callingPids. This also avoids access to /dev/binder in vendor processes, in case the system variant of the library is loaded, for eg: in libmediandk. Bug: 124128212 Test: Selinux denials realted to/dev/binder acccess are not present when AImageReader from libmediandk is used in a vendor process. Test: Play Youtube movies on Chrome, use camera to take pictures/ record videos (sanity). Change-Id: I27d78e30e16b7df5e3dfbb130121f3d7078671a3 Signed-off-by: Jayant Chowdhary <jchowdhary@google.com>
Diffstat (limited to 'libs/gui/BufferQueueProducer.cpp')
-rw-r--r--libs/gui/BufferQueueProducer.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/libs/gui/BufferQueueProducer.cpp b/libs/gui/BufferQueueProducer.cpp
index 5e250a4185..a462b0362f 100644
--- a/libs/gui/BufferQueueProducer.cpp
+++ b/libs/gui/BufferQueueProducer.cpp
@@ -35,6 +35,7 @@
#include <gui/GLConsumer.h>
#include <gui/IConsumerListener.h>
#include <gui/IProducerListener.h>
+#include <private/gui/BufferQueueThreadState.h>
#include <utils/Log.h>
#include <utils/Trace.h>
@@ -1210,7 +1211,7 @@ status_t BufferQueueProducer::connect(const sp<IProducerListener>& listener,
status = BAD_VALUE;
break;
}
- mCore->mConnectedPid = IPCThreadState::self()->getCallingPid();
+ mCore->mConnectedPid = BufferQueueThreadState::getCallingPid();
mCore->mBufferHasBeenQueued = false;
mCore->mDequeueBufferCannotBlock = false;
if (mDequeueTimeout < 0) {
@@ -1233,7 +1234,7 @@ status_t BufferQueueProducer::disconnect(int api, DisconnectMode mode) {
Mutex::Autolock lock(mCore->mMutex);
if (mode == DisconnectMode::AllLocal) {
- if (IPCThreadState::self()->getCallingPid() != mCore->mConnectedPid) {
+ if (BufferQueueThreadState::getCallingPid() != mCore->mConnectedPid) {
return NO_ERROR;
}
api = BufferQueueCore::CURRENTLY_CONNECTED_API;