Remove warning suppression.

This was added in 9609af3c23 as part of a LSC.

The RequiresNonNull annotation doesn't work anymore (it doesn't
recognize the outer class member and instead tries to find
the same variable on the inner class). So instead of suppressing
the warning of the non-fulfilled precondition, we can just
check the non-nullness directly and remove the precondition.

PiperOrigin-RevId: 367593941
This commit is contained in:
tonihei 2021-04-09 09:56:51 +01:00 committed by marcbaechinger
parent 3ea694b1fb
commit 1dd96cd8fb

View File

@ -52,7 +52,6 @@ import java.util.Set;
import java.util.UUID; import java.util.UUID;
import org.checkerframework.checker.nullness.qual.EnsuresNonNull; import org.checkerframework.checker.nullness.qual.EnsuresNonNull;
import org.checkerframework.checker.nullness.qual.MonotonicNonNull; import org.checkerframework.checker.nullness.qual.MonotonicNonNull;
import org.checkerframework.checker.nullness.qual.RequiresNonNull;
/** /**
* A {@link DrmSessionManager} that supports playbacks using {@link ExoMediaDrm}. * A {@link DrmSessionManager} that supports playbacks using {@link ExoMediaDrm}.
@ -483,8 +482,6 @@ public class DefaultDrmSessionManager implements DrmSessionManager {
exoMediaDrm = null; exoMediaDrm = null;
} }
// precondition of preacquiredSessionReference.acquire is not satisfied.
@SuppressWarnings("nullness:contracts.precondition.not.satisfied")
@Override @Override
public DrmSessionReference preacquireSession( public DrmSessionReference preacquireSession(
Looper playbackLooper, Looper playbackLooper,
@ -943,23 +940,23 @@ public class DefaultDrmSessionManager implements DrmSessionManager {
* *
* <p>Must be called at most once. Can be called from any thread. * <p>Must be called at most once. Can be called from any thread.
*/ */
@RequiresNonNull("playbackHandler")
public void acquire(Format format) { public void acquire(Format format) {
playbackHandler.post( checkNotNull(playbackHandler)
() -> { .post(
if (prepareCallsCount == 0 || isReleased) { () -> {
// The manager has been fully released or this reference has already been released. if (prepareCallsCount == 0 || isReleased) {
// Abort the acquisition attempt. // The manager has been fully released or this reference has already been
return; // released. Abort the acquisition attempt.
} return;
this.session = }
acquireSession( this.session =
checkNotNull(playbackLooper), acquireSession(
eventDispatcher, checkNotNull(playbackLooper),
format, eventDispatcher,
/* shouldReleasePreacquiredSessionsBeforeRetrying= */ false); format,
preacquiredSessionReferences.add(this); /* shouldReleasePreacquiredSessionsBeforeRetrying= */ false);
}); preacquiredSessionReferences.add(this);
});
} }
@Override @Override