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/libs/gui/SurfaceControl.cpp b/libs/gui/SurfaceControl.cpp
index b9c5ef9..d801d12 100644
--- a/libs/gui/SurfaceControl.cpp
+++ b/libs/gui/SurfaceControl.cpp
@@ -191,11 +191,10 @@
return mClient->reparentChildren(mHandle, newParentHandle);
}
-status_t SurfaceControl::reparentChild(const sp<IBinder>& newParentHandle,
- const sp<IBinder>& childHandle) {
+status_t SurfaceControl::reparent(const sp<IBinder>& newParentHandle) {
status_t err = validate();
if (err < 0) return err;
- return mClient->reparentChild(mHandle, newParentHandle, childHandle);
+ return mClient->reparent(mHandle, newParentHandle);
}
status_t SurfaceControl::detachChildren() {