summaryrefslogtreecommitdiffstats
path: root/libs/gui/include
diff options
context:
space:
mode:
authorJayant Chowdhary <jchowdhary@google.com>2019-03-07 22:36:06 -0800
committerJayant Chowdhary <jchowdhary@google.com>2019-03-08 16:11:47 -0800
commitad9fe277ea967b27ce7b748bc51ff15ff011f488 (patch)
treee0bae8546bb9b90d5c22a040dc79603ca8e97d81 /libs/gui/include
parent5ff2b63c7f52605b454ceb51492139b518cd7262 (diff)
downloadandroid_frameworks_native-ad9fe277ea967b27ce7b748bc51ff15ff011f488.tar.gz
android_frameworks_native-ad9fe277ea967b27ce7b748bc51ff15ff011f488.tar.bz2
android_frameworks_native-ad9fe277ea967b27ce7b748bc51ff15ff011f488.zip
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/include')
-rw-r--r--libs/gui/include/private/gui/BufferQueueThreadState.h30
1 files changed, 30 insertions, 0 deletions
diff --git a/libs/gui/include/private/gui/BufferQueueThreadState.h b/libs/gui/include/private/gui/BufferQueueThreadState.h
new file mode 100644
index 000000000..67dcf621c
--- /dev/null
+++ b/libs/gui/include/private/gui/BufferQueueThreadState.h
@@ -0,0 +1,30 @@
+/*
+ * Copyright 2019 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <stdint.h>
+#include <sys/types.h>
+#include <unistd.h>
+
+namespace android {
+
+// TODO: Replace this with b/127962003
+class BufferQueueThreadState {
+public:
+ static pid_t getCallingPid();
+ static uid_t getCallingUid();
+};
+
+} // namespace android