Commit e6db3479 by ibaker Committed by Tianyi Feng

Use `Future.get()` `@Deterministic` annotation in `OfflineLicenseHelper`

This means we don't need to manually store the result of `get()` into a
local to convince the nullness checker that it remains non-null.

PiperOrigin-RevId: 520576719
parent d5a934aa
......@@ -373,27 +373,25 @@ public final class OfflineLicenseHelper {
// (drmSession.state == STATE_ERROR).
drmListenerConditionVariable.block();
SettableFuture<@NullableType DrmSessionException> drmSessionErrorFuture =
SettableFuture.create();
SettableFuture<@NullableType DrmSessionException> drmSessionError = SettableFuture.create();
handler.post(
() -> {
try {
DrmSessionException drmSessionError = drmSession.getError();
DrmSessionException error = drmSession.getError();
if (drmSession.getState() == DrmSession.STATE_ERROR) {
drmSession.release(eventDispatcher);
drmSessionManager.release();
}
drmSessionErrorFuture.set(drmSessionError);
drmSessionError.set(error);
} catch (Throwable e) {
drmSessionErrorFuture.setException(e);
drmSessionError.setException(e);
drmSession.release(eventDispatcher);
drmSessionManager.release();
}
});
try {
DrmSessionException drmSessionError = drmSessionErrorFuture.get();
if (drmSessionError != null) {
throw drmSessionError;
if (drmSessionError.get() != null) {
throw drmSessionError.get();
} else {
return drmSession;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment