From f1e5df1d266f70a508c7b520fd52feced8fbcf61 Mon Sep 17 00:00:00 2001 From: Patrick Williams Date: Mon, 17 Oct 2022 21:37:42 +0000 Subject: SF: Trigger ANR when buffer cache is full * Updates the transaction queue stall listener to take a string that contains the reason for hanging. * Updates ClientCache::add to indicate whether or not a failure is due to the cache being full * Calls the transaction queue stall listener when the ClientCache is full Bug: 244218818 Test: presubmits Change-Id: I5fdc9aef0f0a1601ace1c42cfac5024c3de8d299 --- libs/gui/SurfaceComposerClient.cpp | 29 +++++++++++++++-------------- 1 file changed, 15 insertions(+), 14 deletions(-) (limited to 'libs/gui/SurfaceComposerClient.cpp') diff --git a/libs/gui/SurfaceComposerClient.cpp b/libs/gui/SurfaceComposerClient.cpp index a5879a77e1..9efdd35a52 100644 --- a/libs/gui/SurfaceComposerClient.cpp +++ b/libs/gui/SurfaceComposerClient.cpp @@ -455,23 +455,24 @@ void TransactionCompletedListener::onTransactionCompleted(ListenerStats listener } } -void TransactionCompletedListener::onTransactionQueueStalled() { - std::unordered_map> callbackCopy; - { - std::scoped_lock lock(mMutex); - callbackCopy = mQueueStallListeners; - } - for (auto const& it : callbackCopy) { - it.second(); - } -} - -void TransactionCompletedListener::addQueueStallListener(std::function stallListener, - void* id) { +void TransactionCompletedListener::onTransactionQueueStalled(const String8& reason) { + std::unordered_map> callbackCopy; + { + std::scoped_lock lock(mMutex); + callbackCopy = mQueueStallListeners; + } + for (auto const& it : callbackCopy) { + it.second(reason.c_str()); + } +} + +void TransactionCompletedListener::addQueueStallListener( + std::function stallListener, void* id) { std::scoped_lock lock(mMutex); mQueueStallListeners[id] = stallListener; } -void TransactionCompletedListener::removeQueueStallListener(void *id) { + +void TransactionCompletedListener::removeQueueStallListener(void* id) { std::scoped_lock lock(mMutex); mQueueStallListeners.erase(id); } -- cgit v1.2.3-59-g8ed1b