Remove CloseGuard from DisplayEventReceiver
Majority usage of DisplayEventReceiver is with Choreographer, which
is a thread-local. As such, it cannot have dispose() called on it
easily and dispose is also @hide. Since apps can't do anything
about this, and aren't really supposed to, remove the CloseGuard
as it just generates false-positive errors for 3p devs.
Fixes: 154358085
Test: none
Change-Id: I5e9e5324644967897f2b37a19f4fb1485b8ae5bb
diff --git a/core/java/android/view/DisplayEventReceiver.java b/core/java/android/view/DisplayEventReceiver.java
index e6cd252..f695284 100644
--- a/core/java/android/view/DisplayEventReceiver.java
+++ b/core/java/android/view/DisplayEventReceiver.java
@@ -26,7 +26,6 @@
import com.android.internal.annotations.VisibleForTesting;
import dalvik.annotation.optimization.FastNative;
-import dalvik.system.CloseGuard;
import java.lang.ref.WeakReference;
@@ -73,8 +72,6 @@
private static final String TAG = "DisplayEventReceiver";
- private final CloseGuard mCloseGuard = CloseGuard.get();
-
@UnsupportedAppUsage
private long mReceiverPtr;
@@ -114,8 +111,6 @@
mMessageQueue = looper.getQueue();
mReceiverPtr = nativeInit(new WeakReference<DisplayEventReceiver>(this), mMessageQueue,
vsyncSource, eventRegistration);
-
- mCloseGuard.open("dispose");
}
@Override
@@ -135,13 +130,6 @@
}
private void dispose(boolean finalized) {
- if (mCloseGuard != null) {
- if (finalized) {
- mCloseGuard.warnIfOpen();
- }
- mCloseGuard.close();
- }
-
if (mReceiverPtr != 0) {
nativeDispose(mReceiverPtr);
mReceiverPtr = 0;