From 0ba6e37ff97efd75ea78da8a4e844cd3fe9a358d Mon Sep 17 00:00:00 2001 From: tonihei Date: Thu, 18 Nov 2021 10:41:49 +0000 Subject: [PATCH] Assign class member in StyledPlayerControlView before using it The local tracks variable was used to assign the initial subtext for the current track selection in the menu, but the new value was only assigned after the subtext has been evaluated. Assign the local variable first, so that the remaining accesses the latest value. Issue: google/ExoPlayer#9698 PiperOrigin-RevId: 410750396 --- .../google/android/exoplayer2/ui/StyledPlayerControlView.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/library/ui/src/main/java/com/google/android/exoplayer2/ui/StyledPlayerControlView.java b/library/ui/src/main/java/com/google/android/exoplayer2/ui/StyledPlayerControlView.java index 5322fe5b7b..3f42f19b71 100644 --- a/library/ui/src/main/java/com/google/android/exoplayer2/ui/StyledPlayerControlView.java +++ b/library/ui/src/main/java/com/google/android/exoplayer2/ui/StyledPlayerControlView.java @@ -2075,6 +2075,7 @@ public class StyledPlayerControlView extends FrameLayout { @Override public void init(List trackInformations) { + this.tracks = trackInformations; // Update subtext in settings menu with current audio track selection. TrackSelectionParameters params = checkNotNull(player).getTrackSelectionParameters(); if (trackInformations.isEmpty()) { @@ -2097,7 +2098,6 @@ public class StyledPlayerControlView extends FrameLayout { } } } - this.tracks = trackInformations; } }