Loading libs/gui/Android.bp +16 −11 Original line number Diff line number Diff line Loading @@ -55,7 +55,11 @@ cc_library_shared { "DisplayEventReceiver.cpp", "GLConsumer.cpp", "GuiConfig.cpp", "IConsumerListener.cpp", "IDisplayEventConnection.cpp", "IGraphicBufferConsumer.cpp", "IGraphicBufferProducer.cpp", "IProducerListener.cpp", "IRegionSamplingListener.cpp", "ISurfaceComposer.cpp", "ISurfaceComposerClient.cpp", Loading @@ -63,22 +67,32 @@ cc_library_shared { "LayerDebugInfo.cpp", "LayerMetadata.cpp", "LayerState.cpp", "OccupancyTracker.cpp", "StreamSplitter.cpp", "Surface.cpp", "SurfaceControl.cpp", "SurfaceComposerClient.cpp", "SyncFeatures.cpp", "view/Surface.cpp", "bufferqueue/1.0/B2HProducerListener.cpp", "bufferqueue/1.0/H2BGraphicBufferProducer.cpp", "bufferqueue/2.0/B2HProducerListener.cpp", "bufferqueue/2.0/H2BGraphicBufferProducer.cpp", ], shared_libs: [ "android.frameworks.bufferhub@1.0", "libbinder", "libbufferhub", "libbufferhubqueue", // TODO(b/70046255): Remove this once BufferHub is integrated into libgui. "libinput", "libpdx_default_transport", ], export_shared_lib_headers: [ "libbinder", ], // bufferhub is not used when building libgui for vendors target: { vendor: { Loading Loading @@ -118,6 +132,7 @@ cc_library_static { cflags: [ "-DNO_BUFFERHUB", "-DNO_BINDER", ], defaults: ["libgui_bufferqueue-defaults"], Loading @@ -140,19 +155,11 @@ filegroup { "FrameTimestamps.cpp", "GLConsumerUtils.cpp", "HdrMetadata.cpp", "IConsumerListener.cpp", "IGraphicBufferConsumer.cpp", "IGraphicBufferProducer.cpp", "IProducerListener.cpp", "OccupancyTracker.cpp", "bufferqueue/1.0/B2HProducerListener.cpp", "QueueBufferInputOutput.cpp", "bufferqueue/1.0/Conversion.cpp", "bufferqueue/1.0/H2BGraphicBufferProducer.cpp", "bufferqueue/1.0/H2BProducerListener.cpp", "bufferqueue/1.0/WProducerListener.cpp", "bufferqueue/2.0/B2HGraphicBufferProducer.cpp", "bufferqueue/2.0/B2HProducerListener.cpp", "bufferqueue/2.0/H2BGraphicBufferProducer.cpp", "bufferqueue/2.0/H2BProducerListener.cpp", "bufferqueue/2.0/types.cpp", ], Loading Loading @@ -189,7 +196,6 @@ cc_defaults { "android.hardware.graphics.common@1.2", "android.hidl.token@1.0-utils", "libbase", "libbinder", "libcutils", "libEGL", "libGLESv2", Loading @@ -212,7 +218,6 @@ cc_defaults { ], export_shared_lib_headers: [ "libbinder", "libEGL", "libnativewindow", "libui", Loading libs/gui/BufferQueueConsumer.cpp +10 −2 Original line number Diff line number Diff line Loading @@ -66,6 +66,8 @@ namespace android { mCore->mUniqueId, mCore->mConnectedApi, mCore->mConnectedPid, (mCore->mUniqueId) >> 32, \ ##__VA_ARGS__) ConsumerListener::~ConsumerListener() = default; BufferQueueConsumer::BufferQueueConsumer(const sp<BufferQueueCore>& core) : mCore(core), mSlots(core->mSlots), Loading Loading @@ -291,8 +293,9 @@ status_t BufferQueueConsumer::acquireBuffer(BufferItem* outBuffer, ATRACE_INT(mCore->mConsumerName.string(), static_cast<int32_t>(mCore->mQueue.size())); #ifndef NO_BINDER mCore->mOccupancyTracker.registerOccupancyChange(mCore->mQueue.size()); #endif VALIDATE_CONSISTENCY(); } Loading Loading @@ -765,7 +768,12 @@ status_t BufferQueueConsumer::getSidebandStream(sp<NativeHandle>* outStream) con status_t BufferQueueConsumer::getOccupancyHistory(bool forceFlush, std::vector<OccupancyTracker::Segment>* outHistory) { std::lock_guard<std::mutex> lock(mCore->mMutex); #ifndef NO_BINDER *outHistory = mCore->mOccupancyTracker.getSegmentHistory(forceFlush); #else (void)forceFlush; outHistory->clear(); #endif return NO_ERROR; } Loading Loading @@ -798,7 +806,7 @@ status_t BufferQueueConsumer::dumpState(const String8& prefix, String8* outResul bool denied = false; const uid_t uid = BufferQueueThreadState::getCallingUid(); #ifndef __ANDROID_VNDK__ #if !defined(__ANDROID_VNDK__) && !defined(NO_BINDER) // permission check can't be done for vendors as vendors have no access to // the PermissionController. We need to do a runtime check as well, since // the system variant of libgui can be loaded in a vendor process. For eg: Loading libs/gui/BufferQueueProducer.cpp +7 −1 Original line number Diff line number Diff line Loading @@ -67,6 +67,7 @@ namespace android { ##__VA_ARGS__) static constexpr uint32_t BQ_LAYER_COUNT = 1; ProducerListener::~ProducerListener() = default; BufferQueueProducer::BufferQueueProducer(const sp<BufferQueueCore>& core, bool consumerIsSurfaceFlinger) : Loading Loading @@ -1005,8 +1006,9 @@ status_t BufferQueueProducer::queueBuffer(int slot, ATRACE_INT(mCore->mConsumerName.string(), static_cast<int32_t>(mCore->mQueue.size())); #ifndef NO_BINDER mCore->mOccupancyTracker.registerOccupancyChange(mCore->mQueue.size()); #endif // Take a ticket for the callback functions callbackTicket = mNextCallbackTicket++; Loading Loading @@ -1252,6 +1254,7 @@ status_t BufferQueueProducer::connect(const sp<IProducerListener>& listener, if (listener != nullptr) { // Set up a death notification so that we can disconnect // automatically if the remote producer dies #ifndef NO_BINDER if (IInterface::asBinder(listener)->remoteBinder() != nullptr) { status = IInterface::asBinder(listener)->linkToDeath( static_cast<IBinder::DeathRecipient*>(this)); Loading @@ -1261,6 +1264,7 @@ status_t BufferQueueProducer::connect(const sp<IProducerListener>& listener, } mCore->mLinkedToDeath = listener; } #endif mCore->mConnectedProducerListener = listener; mCore->mBufferReleasedCbEnabled = listener->needsReleaseNotify(); } Loading Loading @@ -1329,6 +1333,7 @@ status_t BufferQueueProducer::disconnect(int api, DisconnectMode mode) { if (mCore->mConnectedApi == api) { mCore->freeAllBuffersLocked(); #ifndef NO_BINDER // Remove our death notification callback if we have one if (mCore->mLinkedToDeath != nullptr) { sp<IBinder> token = Loading @@ -1338,6 +1343,7 @@ status_t BufferQueueProducer::disconnect(int api, DisconnectMode mode) { token->unlinkToDeath( static_cast<IBinder::DeathRecipient*>(this)); } #endif mCore->mSharedBufferSlot = BufferQueueCore::INVALID_BUFFER_SLOT; mCore->mLinkedToDeath = nullptr; Loading libs/gui/BufferQueueThreadState.cpp +10 −0 Original line number Diff line number Diff line Loading @@ -14,8 +14,10 @@ * limitations under the License. */ #ifndef NO_BINDER #include <binder/IPCThreadState.h> #include <binderthreadstate/CallerUtils.h> #endif // NO_BINDER #include <hwbinder/IPCThreadState.h> #include <private/gui/BufferQueueThreadState.h> #include <unistd.h> Loading @@ -23,17 +25,25 @@ namespace android { uid_t BufferQueueThreadState::getCallingUid() { #ifndef NO_BINDER if (getCurrentServingCall() == BinderCallType::HWBINDER) { return hardware::IPCThreadState::self()->getCallingUid(); } return IPCThreadState::self()->getCallingUid(); #else // NO_BINDER return hardware::IPCThreadState::self()->getCallingUid(); #endif // NO_BINDER } pid_t BufferQueueThreadState::getCallingPid() { #ifndef NO_BINDER if (getCurrentServingCall() == BinderCallType::HWBINDER) { return hardware::IPCThreadState::self()->getCallingPid(); } return IPCThreadState::self()->getCallingPid(); #else // NO_BINDER return hardware::IPCThreadState::self()->getCallingPid(); #endif // NO_BINDER } } // namespace android libs/gui/IConsumerListener.cpp +0 −1 Original line number Diff line number Diff line Loading @@ -90,7 +90,6 @@ public: // Out-of-line virtual method definitions to trigger vtable emission in this translation unit (see // clang warning -Wweak-vtables) BpConsumerListener::~BpConsumerListener() = default; ConsumerListener::~ConsumerListener() = default; IMPLEMENT_META_INTERFACE(ConsumerListener, "android.gui.IConsumerListener"); Loading Loading
libs/gui/Android.bp +16 −11 Original line number Diff line number Diff line Loading @@ -55,7 +55,11 @@ cc_library_shared { "DisplayEventReceiver.cpp", "GLConsumer.cpp", "GuiConfig.cpp", "IConsumerListener.cpp", "IDisplayEventConnection.cpp", "IGraphicBufferConsumer.cpp", "IGraphicBufferProducer.cpp", "IProducerListener.cpp", "IRegionSamplingListener.cpp", "ISurfaceComposer.cpp", "ISurfaceComposerClient.cpp", Loading @@ -63,22 +67,32 @@ cc_library_shared { "LayerDebugInfo.cpp", "LayerMetadata.cpp", "LayerState.cpp", "OccupancyTracker.cpp", "StreamSplitter.cpp", "Surface.cpp", "SurfaceControl.cpp", "SurfaceComposerClient.cpp", "SyncFeatures.cpp", "view/Surface.cpp", "bufferqueue/1.0/B2HProducerListener.cpp", "bufferqueue/1.0/H2BGraphicBufferProducer.cpp", "bufferqueue/2.0/B2HProducerListener.cpp", "bufferqueue/2.0/H2BGraphicBufferProducer.cpp", ], shared_libs: [ "android.frameworks.bufferhub@1.0", "libbinder", "libbufferhub", "libbufferhubqueue", // TODO(b/70046255): Remove this once BufferHub is integrated into libgui. "libinput", "libpdx_default_transport", ], export_shared_lib_headers: [ "libbinder", ], // bufferhub is not used when building libgui for vendors target: { vendor: { Loading Loading @@ -118,6 +132,7 @@ cc_library_static { cflags: [ "-DNO_BUFFERHUB", "-DNO_BINDER", ], defaults: ["libgui_bufferqueue-defaults"], Loading @@ -140,19 +155,11 @@ filegroup { "FrameTimestamps.cpp", "GLConsumerUtils.cpp", "HdrMetadata.cpp", "IConsumerListener.cpp", "IGraphicBufferConsumer.cpp", "IGraphicBufferProducer.cpp", "IProducerListener.cpp", "OccupancyTracker.cpp", "bufferqueue/1.0/B2HProducerListener.cpp", "QueueBufferInputOutput.cpp", "bufferqueue/1.0/Conversion.cpp", "bufferqueue/1.0/H2BGraphicBufferProducer.cpp", "bufferqueue/1.0/H2BProducerListener.cpp", "bufferqueue/1.0/WProducerListener.cpp", "bufferqueue/2.0/B2HGraphicBufferProducer.cpp", "bufferqueue/2.0/B2HProducerListener.cpp", "bufferqueue/2.0/H2BGraphicBufferProducer.cpp", "bufferqueue/2.0/H2BProducerListener.cpp", "bufferqueue/2.0/types.cpp", ], Loading Loading @@ -189,7 +196,6 @@ cc_defaults { "android.hardware.graphics.common@1.2", "android.hidl.token@1.0-utils", "libbase", "libbinder", "libcutils", "libEGL", "libGLESv2", Loading @@ -212,7 +218,6 @@ cc_defaults { ], export_shared_lib_headers: [ "libbinder", "libEGL", "libnativewindow", "libui", Loading
libs/gui/BufferQueueConsumer.cpp +10 −2 Original line number Diff line number Diff line Loading @@ -66,6 +66,8 @@ namespace android { mCore->mUniqueId, mCore->mConnectedApi, mCore->mConnectedPid, (mCore->mUniqueId) >> 32, \ ##__VA_ARGS__) ConsumerListener::~ConsumerListener() = default; BufferQueueConsumer::BufferQueueConsumer(const sp<BufferQueueCore>& core) : mCore(core), mSlots(core->mSlots), Loading Loading @@ -291,8 +293,9 @@ status_t BufferQueueConsumer::acquireBuffer(BufferItem* outBuffer, ATRACE_INT(mCore->mConsumerName.string(), static_cast<int32_t>(mCore->mQueue.size())); #ifndef NO_BINDER mCore->mOccupancyTracker.registerOccupancyChange(mCore->mQueue.size()); #endif VALIDATE_CONSISTENCY(); } Loading Loading @@ -765,7 +768,12 @@ status_t BufferQueueConsumer::getSidebandStream(sp<NativeHandle>* outStream) con status_t BufferQueueConsumer::getOccupancyHistory(bool forceFlush, std::vector<OccupancyTracker::Segment>* outHistory) { std::lock_guard<std::mutex> lock(mCore->mMutex); #ifndef NO_BINDER *outHistory = mCore->mOccupancyTracker.getSegmentHistory(forceFlush); #else (void)forceFlush; outHistory->clear(); #endif return NO_ERROR; } Loading Loading @@ -798,7 +806,7 @@ status_t BufferQueueConsumer::dumpState(const String8& prefix, String8* outResul bool denied = false; const uid_t uid = BufferQueueThreadState::getCallingUid(); #ifndef __ANDROID_VNDK__ #if !defined(__ANDROID_VNDK__) && !defined(NO_BINDER) // permission check can't be done for vendors as vendors have no access to // the PermissionController. We need to do a runtime check as well, since // the system variant of libgui can be loaded in a vendor process. For eg: Loading
libs/gui/BufferQueueProducer.cpp +7 −1 Original line number Diff line number Diff line Loading @@ -67,6 +67,7 @@ namespace android { ##__VA_ARGS__) static constexpr uint32_t BQ_LAYER_COUNT = 1; ProducerListener::~ProducerListener() = default; BufferQueueProducer::BufferQueueProducer(const sp<BufferQueueCore>& core, bool consumerIsSurfaceFlinger) : Loading Loading @@ -1005,8 +1006,9 @@ status_t BufferQueueProducer::queueBuffer(int slot, ATRACE_INT(mCore->mConsumerName.string(), static_cast<int32_t>(mCore->mQueue.size())); #ifndef NO_BINDER mCore->mOccupancyTracker.registerOccupancyChange(mCore->mQueue.size()); #endif // Take a ticket for the callback functions callbackTicket = mNextCallbackTicket++; Loading Loading @@ -1252,6 +1254,7 @@ status_t BufferQueueProducer::connect(const sp<IProducerListener>& listener, if (listener != nullptr) { // Set up a death notification so that we can disconnect // automatically if the remote producer dies #ifndef NO_BINDER if (IInterface::asBinder(listener)->remoteBinder() != nullptr) { status = IInterface::asBinder(listener)->linkToDeath( static_cast<IBinder::DeathRecipient*>(this)); Loading @@ -1261,6 +1264,7 @@ status_t BufferQueueProducer::connect(const sp<IProducerListener>& listener, } mCore->mLinkedToDeath = listener; } #endif mCore->mConnectedProducerListener = listener; mCore->mBufferReleasedCbEnabled = listener->needsReleaseNotify(); } Loading Loading @@ -1329,6 +1333,7 @@ status_t BufferQueueProducer::disconnect(int api, DisconnectMode mode) { if (mCore->mConnectedApi == api) { mCore->freeAllBuffersLocked(); #ifndef NO_BINDER // Remove our death notification callback if we have one if (mCore->mLinkedToDeath != nullptr) { sp<IBinder> token = Loading @@ -1338,6 +1343,7 @@ status_t BufferQueueProducer::disconnect(int api, DisconnectMode mode) { token->unlinkToDeath( static_cast<IBinder::DeathRecipient*>(this)); } #endif mCore->mSharedBufferSlot = BufferQueueCore::INVALID_BUFFER_SLOT; mCore->mLinkedToDeath = nullptr; Loading
libs/gui/BufferQueueThreadState.cpp +10 −0 Original line number Diff line number Diff line Loading @@ -14,8 +14,10 @@ * limitations under the License. */ #ifndef NO_BINDER #include <binder/IPCThreadState.h> #include <binderthreadstate/CallerUtils.h> #endif // NO_BINDER #include <hwbinder/IPCThreadState.h> #include <private/gui/BufferQueueThreadState.h> #include <unistd.h> Loading @@ -23,17 +25,25 @@ namespace android { uid_t BufferQueueThreadState::getCallingUid() { #ifndef NO_BINDER if (getCurrentServingCall() == BinderCallType::HWBINDER) { return hardware::IPCThreadState::self()->getCallingUid(); } return IPCThreadState::self()->getCallingUid(); #else // NO_BINDER return hardware::IPCThreadState::self()->getCallingUid(); #endif // NO_BINDER } pid_t BufferQueueThreadState::getCallingPid() { #ifndef NO_BINDER if (getCurrentServingCall() == BinderCallType::HWBINDER) { return hardware::IPCThreadState::self()->getCallingPid(); } return IPCThreadState::self()->getCallingPid(); #else // NO_BINDER return hardware::IPCThreadState::self()->getCallingPid(); #endif // NO_BINDER } } // namespace android
libs/gui/IConsumerListener.cpp +0 −1 Original line number Diff line number Diff line Loading @@ -90,7 +90,6 @@ public: // Out-of-line virtual method definitions to trigger vtable emission in this translation unit (see // clang warning -Wweak-vtables) BpConsumerListener::~BpConsumerListener() = default; ConsumerListener::~ConsumerListener() = default; IMPLEMENT_META_INTERFACE(ConsumerListener, "android.gui.IConsumerListener"); Loading