Merge "Revert "Add logs to indicate why a surface is invalid"" into sc-dev

This commit is contained in:
Tiger Huang
2021-01-28 17:00:23 +00:00
committed by Android (Google) Code Review
2 changed files with 2 additions and 37 deletions

View File

@@ -339,8 +339,6 @@ public final class SurfaceControl implements Parcelable {
*/ */
public long mNativeObject; public long mNativeObject;
private long mNativeHandle; private long mNativeHandle;
private boolean mDebugRelease = false;
private Throwable mReleaseStack = null;
// TODO: Move width/height to native and fix locking through out. // TODO: Move width/height to native and fix locking through out.
private final Object mLock = new Object(); private final Object mLock = new Object();
@@ -588,13 +586,6 @@ public final class SurfaceControl implements Parcelable {
} }
mNativeObject = nativeObject; mNativeObject = nativeObject;
mNativeHandle = mNativeObject != 0 ? nativeGetHandle(nativeObject) : 0; mNativeHandle = mNativeObject != 0 ? nativeGetHandle(nativeObject) : 0;
if (mNativeObject == 0) {
if (mDebugRelease) {
mReleaseStack = new Throwable("assigned zero nativeObject here");
}
} else {
mReleaseStack = null;
}
} }
/** /**
@@ -605,7 +596,6 @@ public final class SurfaceControl implements Parcelable {
mWidth = other.mWidth; mWidth = other.mWidth;
mHeight = other.mHeight; mHeight = other.mHeight;
mLocalOwnerView = other.mLocalOwnerView; mLocalOwnerView = other.mLocalOwnerView;
mDebugRelease = other.mDebugRelease;
assignNativeObject(nativeCopyFromSurfaceControl(other.mNativeObject), callsite); assignNativeObject(nativeCopyFromSurfaceControl(other.mNativeObject), callsite);
} }
@@ -1435,7 +1425,6 @@ public final class SurfaceControl implements Parcelable {
mName = in.readString8(); mName = in.readString8();
mWidth = in.readInt(); mWidth = in.readInt();
mHeight = in.readInt(); mHeight = in.readInt();
mDebugRelease = in.readBoolean();
long object = 0; long object = 0;
if (in.readInt() != 0) { if (in.readInt() != 0) {
@@ -1454,12 +1443,8 @@ public final class SurfaceControl implements Parcelable {
dest.writeString8(mName); dest.writeString8(mName);
dest.writeInt(mWidth); dest.writeInt(mWidth);
dest.writeInt(mHeight); dest.writeInt(mHeight);
dest.writeBoolean(mDebugRelease);
if (mNativeObject == 0) { if (mNativeObject == 0) {
dest.writeInt(0); dest.writeInt(0);
if (mReleaseStack != null) {
Log.w(TAG, "Sending invalid " + this + " caused by:", mReleaseStack);
}
} else { } else {
dest.writeInt(1); dest.writeInt(1);
} }
@@ -1470,13 +1455,6 @@ public final class SurfaceControl implements Parcelable {
} }
} }
/**
* @hide
*/
public void setDebugRelease(boolean debug) {
mDebugRelease = debug;
}
/** /**
* Checks whether two {@link SurfaceControl} objects represent the same surface. * Checks whether two {@link SurfaceControl} objects represent the same surface.
* *
@@ -1547,9 +1525,6 @@ public final class SurfaceControl implements Parcelable {
nativeRelease(mNativeObject); nativeRelease(mNativeObject);
mNativeObject = 0; mNativeObject = 0;
mNativeHandle = 0; mNativeHandle = 0;
if (mDebugRelease) {
mReleaseStack = new Throwable("released here");
}
mCloseGuard.close(); mCloseGuard.close();
} }
} }
@@ -1565,11 +1540,8 @@ public final class SurfaceControl implements Parcelable {
} }
private void checkNotReleased() { private void checkNotReleased() {
if (mNativeObject == 0) { if (mNativeObject == 0) throw new NullPointerException(
Log.wtf(TAG, "Invalid " + this + " caused by:", mReleaseStack); "Invalid " + this + ", mNativeObject is null. Have you called release() already?");
throw new NullPointerException(
"mNativeObject of " + this + " is null. Have you called release() already?");
}
} }
/** /**
@@ -2417,7 +2389,6 @@ public final class SurfaceControl implements Parcelable {
public static SurfaceControl mirrorSurface(SurfaceControl mirrorOf) { public static SurfaceControl mirrorSurface(SurfaceControl mirrorOf) {
long nativeObj = nativeMirrorSurface(mirrorOf.mNativeObject); long nativeObj = nativeMirrorSurface(mirrorOf.mNativeObject);
SurfaceControl sc = new SurfaceControl(); SurfaceControl sc = new SurfaceControl();
sc.mDebugRelease = mirrorOf.mDebugRelease;
sc.assignNativeObject(nativeObj, "mirrorSurface"); sc.assignNativeObject(nativeObj, "mirrorSurface");
return sc; return sc;
} }

View File

@@ -16,7 +16,6 @@
package com.android.server.wm; package com.android.server.wm;
import static android.os.Build.IS_DEBUGGABLE;
import static android.view.InsetsState.ITYPE_CLIMATE_BAR; import static android.view.InsetsState.ITYPE_CLIMATE_BAR;
import static android.view.InsetsState.ITYPE_EXTRA_NAVIGATION_BAR; import static android.view.InsetsState.ITYPE_EXTRA_NAVIGATION_BAR;
import static android.view.InsetsState.ITYPE_IME; import static android.view.InsetsState.ITYPE_IME;
@@ -553,11 +552,6 @@ class InsetsSourceProvider {
// TODO: use 0 alpha and remove t.hide() once b/138459974 is fixed. // TODO: use 0 alpha and remove t.hide() once b/138459974 is fixed.
t.setAlpha(animationLeash, 1 /* alpha */); t.setAlpha(animationLeash, 1 /* alpha */);
t.hide(animationLeash); t.hide(animationLeash);
// TODO(b/175954493): Remove this after finding root cause.
if (IS_DEBUGGABLE) {
animationLeash.setDebugRelease(true);
}
} }
ProtoLog.i(WM_DEBUG_IME, ProtoLog.i(WM_DEBUG_IME,
"ControlAdapter startAnimation mSource: %s controlTarget: %s", mSource, "ControlAdapter startAnimation mSource: %s controlTarget: %s", mSource,