Re-parent invoked on child instead of on parent.
The function to re-parent an individual child is now invoked on
the child instead of the parent. This ensures the child ends up with
the last parent set if multiple reparent requests are made in the same
transaction.
This also allows adding a parent to a layer that didn't have one
previously.
Test: Transaction_test -> Reparent, ReparentToNoParent,
ReparentFromNoParent
Change-Id: Idab429eb2dca5a4ae1b020a5a7629d719dd4d995
diff --git a/services/surfaceflinger/SurfaceFlinger.cpp b/services/surfaceflinger/SurfaceFlinger.cpp
index cae4dea..6ee14fe 100644
--- a/services/surfaceflinger/SurfaceFlinger.cpp
+++ b/services/surfaceflinger/SurfaceFlinger.cpp
@@ -3121,10 +3121,8 @@
// We don't trigger a traversal here because if no other state is
// changed, we don't want this to cause any more work
}
- // Always re-parent the children that explicitly requested to get
- // re-parented before the general re-parent of all children.
- if (what & layer_state_t::eReparentChild) {
- if (layer->reparentChild(s.parentHandleForChild, s.childHandle)) {
+ if (what & layer_state_t::eReparent) {
+ if (layer->reparent(s.parentHandleForChild)) {
flags |= eTransactionNeeded|eTraversalNeeded;
}
}