Replace SurfaceControl#destroy with #remove

Because there may be other references, #destroy does
not actually destroy a Surface. We try and make this more clear
in the naming.

Bug: 111297488
Test: Builds
Change-Id: I3a395abf4449de27fac298e37a96eb54c204c42f
This commit is contained in:
Robert Carr
2019-02-04 16:04:55 -08:00
parent cc6d483974
commit 5ea304db74
13 changed files with 27 additions and 28 deletions

View File

@@ -868,12 +868,11 @@ public final class SurfaceControl implements Parcelable {
}
/**
* Free all server-side state associated with this surface and
* release this object's reference. This method can only be
* called from the process that created the service.
* Release the local resources like {@link #release} but also
* remove the Surface from the screen.
* @hide
*/
public void destroy() {
public void remove() {
if (mNativeObject != 0) {
nativeDestroy(mNativeObject);
mNativeObject = 0;

View File

@@ -334,7 +334,7 @@ public class SurfaceView extends View implements ViewRootImpl.WindowStoppedCallb
updateSurface();
if (mSurfaceControl != null) {
mSurfaceControl.destroy();
mSurfaceControl.remove();
}
mSurfaceControl = null;
@@ -502,11 +502,11 @@ public class SurfaceView extends View implements ViewRootImpl.WindowStoppedCallb
private void releaseSurfaces() {
if (mSurfaceControl != null) {
mSurfaceControl.destroy();
mSurfaceControl.remove();
mSurfaceControl = null;
}
if (mBackgroundControl != null) {
mBackgroundControl.destroy();
mBackgroundControl.remove();
mBackgroundControl = null;
}
}
@@ -816,7 +816,7 @@ public class SurfaceView extends View implements ViewRootImpl.WindowStoppedCallb
}
if (mDeferredDestroySurfaceControl != null) {
mDeferredDestroySurfaceControl.destroy();
mDeferredDestroySurfaceControl.remove();
mDeferredDestroySurfaceControl = null;
}

View File

@@ -1596,7 +1596,7 @@ public final class ViewRootImpl implements ViewParent,
mSurfaceSession = null;
if (mBoundsSurfaceControl != null) {
mBoundsSurfaceControl.destroy();
mBoundsSurfaceControl.remove();
mBoundsSurface.release();
mBoundsSurfaceControl = null;
}

View File

@@ -1013,7 +1013,7 @@ public final class Magnifier {
}
synchronized (mLock) {
mRenderer.destroy();
mSurfaceControl.destroy();
mSurfaceControl.remove();
mSurfaceSession.kill();
mHandler.removeCallbacks(mMagnifierUpdater);
if (mBitmap != null) {

View File

@@ -629,7 +629,7 @@ final class ColorFade {
mSurfaceLayout = null;
SurfaceControl.openTransaction();
try {
mSurfaceControl.destroy();
mSurfaceControl.remove();
mSurface.release();
} finally {
SurfaceControl.closeTransaction();

View File

@@ -143,7 +143,7 @@ class AppWindowThumbnail implements Animatable {
void destroy() {
mSurfaceAnimator.cancelAnimation();
mSurfaceControl.destroy();
mSurfaceControl.remove();
}
/**

View File

@@ -153,7 +153,7 @@ public class BlackFrame {
if (mBlackSurfaces[i] != null) {
if (SHOW_TRANSACTIONS || SHOW_SURFACE_ALLOC) Slog.i(TAG_WM,
" BLACK " + mBlackSurfaces[i].surface + ": DESTROY");
mBlackSurfaces[i].surface.destroy();
mBlackSurfaces[i].surface.remove();
mBlackSurfaces[i] = null;
}
}

View File

@@ -4417,13 +4417,13 @@ class DisplayContent extends WindowContainer<DisplayContent.DisplayChildWindowCo
.show(mSplitScreenDividerAnchor);
scheduleAnimation();
} else {
mAppAnimationLayer.destroy();
mAppAnimationLayer.remove();
mAppAnimationLayer = null;
mBoostedAppAnimationLayer.destroy();
mBoostedAppAnimationLayer.remove();
mBoostedAppAnimationLayer = null;
mHomeAppAnimationLayer.destroy();
mHomeAppAnimationLayer.remove();
mHomeAppAnimationLayer = null;
mSplitScreenDividerAnchor.destroy();
mSplitScreenDividerAnchor.remove();
mSplitScreenDividerAnchor = null;
}
}

View File

@@ -107,10 +107,10 @@ public class Letterbox {
mOuter.setEmpty();
mInner.setEmpty();
mTop.destroy();
mLeft.destroy();
mBottom.destroy();
mRight.destroy();
mTop.remove();
mLeft.remove();
mBottom.remove();
mRight.remove();
}
/** Returns whether a call to {@link #applySurfaceChanges} would change the surface. */
@@ -154,9 +154,9 @@ public class Letterbox {
mSurface.setColor(new float[]{0, 0, 0});
}
public void destroy() {
public void remove() {
if (mSurface != null) {
mSurface.destroy();
mSurface.remove();
mSurface = null;
}
}

View File

@@ -626,7 +626,7 @@ class ScreenRotationAnimation {
if (SHOW_TRANSACTIONS ||
SHOW_SURFACE_ALLOC) Slog.i(TAG_WM,
" FREEZE " + mSurfaceControl + ": DESTROY");
mSurfaceControl.destroy();
mSurfaceControl.remove();
mSurfaceControl = null;
}
if (mCustomBlackFrame != null) {

View File

@@ -1006,7 +1006,7 @@ public class TaskStack extends WindowContainer<Task> implements
EventLog.writeEvent(EventLogTags.WM_STACK_REMOVED, mStackId);
if (mAnimationBackgroundSurface != null) {
mAnimationBackgroundSurface.destroy();
mAnimationBackgroundSurface.remove();
mAnimationBackgroundSurface = null;
}

View File

@@ -161,7 +161,7 @@ class WindowSurfaceController {
}
try {
if (mSurfaceControl != null) {
mSurfaceControl.destroy();
mSurfaceControl.remove();
}
} catch (RuntimeException e) {
Slog.w(TAG, "Error destroying surface in: " + this, e);

View File

@@ -166,7 +166,7 @@ public class DimmerTests extends WindowTestsBase {
mDimmer.updateDims(mTransaction, new Rect());
verify(mTransaction).show(getDimLayer());
verify(dimLayer, never()).destroy();
verify(dimLayer, never()).remove();
}
@Test
@@ -228,7 +228,7 @@ public class DimmerTests extends WindowTestsBase {
mDimmer.updateDims(mTransaction, new Rect());
verify(mTransaction).show(dimLayer);
verify(dimLayer, never()).destroy();
verify(dimLayer, never()).remove();
}
@Test