Always reparent SurfacePackage in setChildSurfacePackage.
Currently, SurfaceView#setChildSurfacePackage only reparents a provided SurfacePackage when there is no SurfaceControl already present. This can lead to the SurfacePackage potentially never being reparented. This changelist addresses the issue by always reparenting the SurfacePackage, following cleanup of the existing SurfaceControl. Bug: 197568243 Test: atest SurfaceControlViewHostTests#testCanReplaceSurfacePackage Change-Id: Ib0bcfee5cb9801e1b1c4f1f300af9862141b12f3
This commit is contained in:
@@ -1889,10 +1889,12 @@ public class SurfaceView extends View implements ViewRootImpl.SurfaceChangedCall
|
||||
public void setChildSurfacePackage(@NonNull SurfaceControlViewHost.SurfacePackage p) {
|
||||
final SurfaceControl lastSc = mSurfacePackage != null ?
|
||||
mSurfacePackage.getSurfaceControl() : null;
|
||||
if (mSurfaceControl != null && lastSc != null) {
|
||||
mTmpTransaction.reparent(lastSc, null).apply();
|
||||
mSurfacePackage.release();
|
||||
} else if (mSurfaceControl != null) {
|
||||
if (mSurfaceControl != null) {
|
||||
if (lastSc != null) {
|
||||
mTmpTransaction.reparent(lastSc, null);
|
||||
mSurfacePackage.release();
|
||||
}
|
||||
|
||||
reparentSurfacePackage(mTmpTransaction, p);
|
||||
mTmpTransaction.apply();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user