public Transaction reparent(@NonNull SurfaceControl sc,
@Nullable SurfaceControl newParent) {
checkPreconditions(sc);
long otherObject = 0;
if (newParent != null) {
newParent.checkNotReleased();
otherObject = newParent.mNativeObject;
}
nativeReparent(mNativeObject, sc.mNativeObject, otherObject);
mReparentedSurfaces.put(sc, newParent);
return this;
}
SurfaceControl.mNativeObject
是否是非零。newParent
不是空,获取 mNativeObject
。newParent
存到 mReparentedSurfaces
,在 Transaction.notifyReparentedSurfaces() 中遍历 mReparentedSurfaces
回调 onReparent()
。