Loading core/java/android/view/SurfaceControlViewHost.java +10 −1 Original line number Diff line number Diff line Loading @@ -61,6 +61,11 @@ public class SurfaceControlViewHost { private final WindowlessWindowManager mWm; private SurfaceControl mSurfaceControl; // True if this SurfaceControlViewHost created mSurfaceControl and is responsible for releasing // it. private final boolean mOwnsSurfaceControl; private IAccessibilityEmbeddedConnection mAccessibilityEmbeddedConnection; private boolean mReleased = false; Loading Loading @@ -325,6 +330,7 @@ public class SurfaceControlViewHost { public SurfaceControlViewHost(@NonNull Context c, @NonNull Display d, @NonNull WindowlessWindowManager wwm, @NonNull String callsite) { mSurfaceControl = wwm.mRootSurface; mOwnsSurfaceControl = false; mWm = wwm; mViewRoot = new ViewRootImpl(c, d, mWm, new WindowlessWindowLayout()); mCloseGuard.openWithCallSite("release", callsite); Loading Loading @@ -393,6 +399,7 @@ public class SurfaceControlViewHost { .setName("SurfaceControlViewHost") .setCallsite("SurfaceControlViewHost[" + callsite + "]") .build(); mOwnsSurfaceControl = true; mWm = new WindowlessWindowManager(context.getResources().getConfiguration(), mSurfaceControl, hostToken); Loading Loading @@ -545,7 +552,6 @@ public class SurfaceControlViewHost { * and render the object unusable. */ public void release() { // ViewRoot will release mSurfaceControl for us. doRelease(true /* immediate */); } Loading @@ -557,6 +563,9 @@ public class SurfaceControlViewHost { mViewRoot.die(immediate); WindowManagerGlobal.getInstance().removeWindowlessRoot(mViewRoot); if (Flags.scvhSurfaceControlLifetimeFix() && mOwnsSurfaceControl) { mSurfaceControl.release(); } mReleased = true; mCloseGuard.close(); } Loading core/java/android/window/flags/window_surfaces.aconfig +11 −0 Original line number Diff line number Diff line Loading @@ -134,3 +134,14 @@ flag { purpose: PURPOSE_BUGFIX } } flag { name: "scvh_surface_control_lifetime_fix" namespace: "window_surfaces" description: "Fix lifetime issue with SurfaceControl's created by SCVH" is_fixed_read_only: true bug: "407989942" metadata { purpose: PURPOSE_BUGFIX } } Loading
core/java/android/view/SurfaceControlViewHost.java +10 −1 Original line number Diff line number Diff line Loading @@ -61,6 +61,11 @@ public class SurfaceControlViewHost { private final WindowlessWindowManager mWm; private SurfaceControl mSurfaceControl; // True if this SurfaceControlViewHost created mSurfaceControl and is responsible for releasing // it. private final boolean mOwnsSurfaceControl; private IAccessibilityEmbeddedConnection mAccessibilityEmbeddedConnection; private boolean mReleased = false; Loading Loading @@ -325,6 +330,7 @@ public class SurfaceControlViewHost { public SurfaceControlViewHost(@NonNull Context c, @NonNull Display d, @NonNull WindowlessWindowManager wwm, @NonNull String callsite) { mSurfaceControl = wwm.mRootSurface; mOwnsSurfaceControl = false; mWm = wwm; mViewRoot = new ViewRootImpl(c, d, mWm, new WindowlessWindowLayout()); mCloseGuard.openWithCallSite("release", callsite); Loading Loading @@ -393,6 +399,7 @@ public class SurfaceControlViewHost { .setName("SurfaceControlViewHost") .setCallsite("SurfaceControlViewHost[" + callsite + "]") .build(); mOwnsSurfaceControl = true; mWm = new WindowlessWindowManager(context.getResources().getConfiguration(), mSurfaceControl, hostToken); Loading Loading @@ -545,7 +552,6 @@ public class SurfaceControlViewHost { * and render the object unusable. */ public void release() { // ViewRoot will release mSurfaceControl for us. doRelease(true /* immediate */); } Loading @@ -557,6 +563,9 @@ public class SurfaceControlViewHost { mViewRoot.die(immediate); WindowManagerGlobal.getInstance().removeWindowlessRoot(mViewRoot); if (Flags.scvhSurfaceControlLifetimeFix() && mOwnsSurfaceControl) { mSurfaceControl.release(); } mReleased = true; mCloseGuard.close(); } Loading
core/java/android/window/flags/window_surfaces.aconfig +11 −0 Original line number Diff line number Diff line Loading @@ -134,3 +134,14 @@ flag { purpose: PURPOSE_BUGFIX } } flag { name: "scvh_surface_control_lifetime_fix" namespace: "window_surfaces" description: "Fix lifetime issue with SurfaceControl's created by SCVH" is_fixed_read_only: true bug: "407989942" metadata { purpose: PURPOSE_BUGFIX } }