summaryrefslogtreecommitdiff
path: root/libs/hwui/RenderNode.h
diff options
context:
space:
mode:
authorJohn Reck <jreck@google.com>2019-06-12 15:01:51 -0700
committerJohn Reck <jreck@google.com>2019-06-12 15:41:50 -0700
commit097e1d333088cb01dddacd235a6e654d4002a2b3 (patch)
tree71da611125f97456dd4e88ac8214b64ccfa67d8e /libs/hwui/RenderNode.h
parent471a6643753b3ce9fa7573032c81d4b6fb2b0688 (diff)
Fix setPositionListener race condition
Fixes: 131625115 Test: atest android.view.cts.SystemGestureExclusionRectsTest android.view.cts.SurfaceViewSyncTest android.uirendering.cts.testclasses.SurfaceViewTests Change-Id: Ia357ff6fa5d5fe1e152abc23bbd6d8051cfd7aa7
Diffstat (limited to 'libs/hwui/RenderNode.h')
-rw-r--r--libs/hwui/RenderNode.h8
1 files changed, 4 insertions, 4 deletions
diff --git a/libs/hwui/RenderNode.h b/libs/hwui/RenderNode.h
index 23e7a0e60554..c6db7f1ba60d 100644
--- a/libs/hwui/RenderNode.h
+++ b/libs/hwui/RenderNode.h
@@ -188,11 +188,9 @@ public:
virtual void onPositionLost(RenderNode& node, const TreeInfo* info) = 0;
};
- // Note this is not thread safe, this needs to be called
- // before the RenderNode is used for drawing.
- // RenderNode takes ownership of the pointer
ANDROID_API void setPositionListener(PositionListener* listener) {
- mPositionListener = listener;
+ mStagingPositionListener = listener;
+ mPositionListenerDirty = true;
}
// This is only modified in MODE_FULL, so it can be safely accessed
@@ -275,6 +273,8 @@ private:
// mDisplayList, not mStagingDisplayList.
uint32_t mParentCount;
+ bool mPositionListenerDirty = false;
+ sp<PositionListener> mStagingPositionListener;
sp<PositionListener> mPositionListener;
UsageHint mUsageHint = UsageHint::Unknown;