Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 7db8da8a authored by John Reck's avatar John Reck
Browse files

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
parent ae4d48eb
Loading
Loading
Loading
Loading
+0 −12
Original line number Diff line number Diff line
@@ -26,7 +26,6 @@ import android.util.Log;
import com.android.internal.annotations.VisibleForTesting;

import dalvik.annotation.optimization.FastNative;
import dalvik.system.CloseGuard;

import java.lang.ref.WeakReference;

@@ -73,8 +72,6 @@ public abstract class DisplayEventReceiver {

    private static final String TAG = "DisplayEventReceiver";

    private final CloseGuard mCloseGuard = CloseGuard.get();

    @UnsupportedAppUsage
    private long mReceiverPtr;

@@ -114,8 +111,6 @@ public abstract class DisplayEventReceiver {
        mMessageQueue = looper.getQueue();
        mReceiverPtr = nativeInit(new WeakReference<DisplayEventReceiver>(this), mMessageQueue,
                vsyncSource, eventRegistration);

        mCloseGuard.open("dispose");
    }

    @Override
@@ -135,13 +130,6 @@ public abstract class DisplayEventReceiver {
    }

    private void dispose(boolean finalized) {
        if (mCloseGuard != null) {
            if (finalized) {
                mCloseGuard.warnIfOpen();
            }
            mCloseGuard.close();
        }

        if (mReceiverPtr != 0) {
            nativeDispose(mReceiverPtr);
            mReceiverPtr = 0;