Pass surface control instead of handle as reference to layers in
LayerState
Allows us to have access to the layer id stored in surface control so that it can be dumped when tracing the transaction merges
Test: Existing tests
Change-Id: I3e466c69585937d8ce74a29a49fdbb7b3353a460
diff --git a/services/surfaceflinger/SurfaceFlinger.cpp b/services/surfaceflinger/SurfaceFlinger.cpp
index 152d872..ce90f1c 100644
--- a/services/surfaceflinger/SurfaceFlinger.cpp
+++ b/services/surfaceflinger/SurfaceFlinger.cpp
@@ -3298,7 +3298,7 @@
applyTransactionState(frameTimelineVsyncId, states, displays, flags, inputWindowCommands,
desiredPresentTime, uncacheBuffer, postTime, privileged,
hasListenerCallbacks, listenerCallbacks, originPid, originUid,
- /*isMainThread*/ false);
+ transactionId, /*isMainThread*/ false);
return NO_ERROR;
}
@@ -3591,7 +3591,8 @@
const auto& p = layer->getParent();
if (p == nullptr) {
ssize_t idx = mCurrentState.layersSortedByZ.indexOf(layer);
- if (layer->setRelativeLayer(s.relativeLayerHandle, s.z) && idx >= 0) {
+ if (layer->setRelativeLayer(s.relativeLayerSurfaceControl->getHandle(), s.z) &&
+ idx >= 0) {
mCurrentState.layersSortedByZ.removeAt(idx);
mCurrentState.layersSortedByZ.add(layer);
// we need traversal (state changed)
@@ -3599,7 +3600,7 @@
flags |= eTransactionNeeded|eTraversalNeeded;
}
} else {
- if (p->setChildRelativeLayer(layer, s.relativeLayerHandle, s.z)) {
+ if (p->setChildRelativeLayer(layer, s.relativeLayerSurfaceControl->getHandle(), s.z)) {
flags |= eTransactionNeeded|eTraversalNeeded;
}
}
@@ -3685,8 +3686,9 @@
}
}
if (what & layer_state_t::eDeferTransaction_legacy) {
- if (s.barrierHandle_legacy != nullptr) {
- layer->deferTransactionUntil_legacy(s.barrierHandle_legacy, s.barrierFrameNumber);
+ if (s.barrierSurfaceControl_legacy != nullptr) {
+ layer->deferTransactionUntil_legacy(s.barrierSurfaceControl_legacy->getHandle(),
+ s.barrierFrameNumber);
} else if (s.barrierGbp_legacy != nullptr) {
const sp<IGraphicBufferProducer>& gbp = s.barrierGbp_legacy;
if (authenticateSurfaceTextureLocked(gbp)) {
@@ -3702,7 +3704,7 @@
// changed, we don't want this to cause any more work
}
if (what & layer_state_t::eReparentChildren) {
- if (layer->reparentChildren(s.reparentHandle)) {
+ if (layer->reparentChildren(s.reparentSurfaceControl->getHandle())) {
flags |= eTransactionNeeded|eTraversalNeeded;
}
}
@@ -3789,7 +3791,10 @@
// lose its relative z order.
if (what & layer_state_t::eReparent) {
bool hadParent = layer->hasParent();
- if (layer->reparent(s.parentHandleForChild)) {
+ auto parentHandle = (s.parentSurfaceControlForChild)
+ ? s.parentSurfaceControlForChild->getHandle()
+ : nullptr;
+ if (layer->reparent(parentHandle)) {
if (!hadParent) {
mCurrentState.layersSortedByZ.remove(layer);
}