From 76baa5724caad62c3bddd312181cf6362b579c5b Mon Sep 17 00:00:00 2001 From: bachinger Date: Thu, 17 Jan 2019 16:53:00 +0000 Subject: [PATCH] solve nullness check warnings with asserts PiperOrigin-RevId: 229755532 --- .../android/exoplayer2/ui/PlayerNotificationManager.java | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/library/ui/src/main/java/com/google/android/exoplayer2/ui/PlayerNotificationManager.java b/library/ui/src/main/java/com/google/android/exoplayer2/ui/PlayerNotificationManager.java index 103534d8ca..c01aabc9f2 100644 --- a/library/ui/src/main/java/com/google/android/exoplayer2/ui/PlayerNotificationManager.java +++ b/library/ui/src/main/java/com/google/android/exoplayer2/ui/PlayerNotificationManager.java @@ -896,12 +896,14 @@ public class PlayerNotificationManager { @Nullable private Notification startOrUpdateNotification() { - return player != null ? startOrUpdateNotification(/* bitmap= */ null) : null; + Assertions.checkNotNull(this.player); + return startOrUpdateNotification(/* bitmap= */ null); } @RequiresNonNull("player") @Nullable private Notification startOrUpdateNotification(@Nullable Bitmap bitmap) { + Player player = this.player; Notification notification = createNotification(player, bitmap); if (notification == null) { stopNotification(/* dismissedByUser= */ false); @@ -916,8 +918,7 @@ public class PlayerNotificationManager { } } NotificationListener listener = notificationListener; - Player player = this.player; - if (listener != null && player != null) { + if (listener != null) { boolean isPlayerActive = player.getPlayWhenReady() && player.getPlaybackState() != Player.STATE_IDLE; listener.onNotificationPosted(notificationId, notification, isPlayerActive);