summaryrefslogtreecommitdiff
path: root/services/surfaceflinger/SurfaceFlinger.cpp
diff options
context:
space:
mode:
author TreeHugger Robot <treehugger-gerrit@google.com> 2019-06-13 16:25:07 +0000
committer Android (Google) Code Review <android-gerrit@google.com> 2019-06-13 16:25:07 +0000
commit2f3b6776871df035e182b450af0c94435eb4571e (patch)
tree73a34e824a989937cea8bcc21db74517e461dcbc /services/surfaceflinger/SurfaceFlinger.cpp
parent4f65d3377b9f3b83fa75b94ccc7b459b98376b11 (diff)
parentf384e05f26d78f95b28f30d4f83e72dad16dba10 (diff)
Merge "TransactionCallbacks: don't send callbacks until applied" into qt-dev
Diffstat (limited to 'services/surfaceflinger/SurfaceFlinger.cpp')
-rw-r--r--services/surfaceflinger/SurfaceFlinger.cpp9
1 files changed, 8 insertions, 1 deletions
diff --git a/services/surfaceflinger/SurfaceFlinger.cpp b/services/surfaceflinger/SurfaceFlinger.cpp
index dd75868443..e795ba123a 100644
--- a/services/surfaceflinger/SurfaceFlinger.cpp
+++ b/services/surfaceflinger/SurfaceFlinger.cpp
@@ -2133,7 +2133,14 @@ void SurfaceFlinger::postComposition()
}
mTransactionCompletedThread.addPresentFence(mPreviousPresentFences[0]);
- mTransactionCompletedThread.sendCallbacks();
+
+ // Lock the mStateLock in case SurfaceFlinger is in the middle of applying a transaction.
+ // If we do not lock here, a callback could be sent without all of its SurfaceControls and
+ // metrics.
+ {
+ Mutex::Autolock _l(mStateLock);
+ mTransactionCompletedThread.sendCallbacks();
+ }
if (mLumaSampling && mRegionSamplingThread) {
mRegionSamplingThread->notifyNewContent();