From 912c47ff6f4abc88d33665d27da33ec7997358ef Mon Sep 17 00:00:00 2001 From: olly Date: Mon, 4 Oct 2021 14:42:09 +0100 Subject: [PATCH] Rollback of https://github.com/google/ExoPlayer/commit/8ed6c9fcf5e22ad859023703e479e21b2f578f83 *** Original commit *** Fix capitalization of language in track selector Issue: #9452 *** PiperOrigin-RevId: 400706984 --- RELEASENOTES.md | 2 -- .../java/com/google/android/exoplayer2/util/Util.java | 5 ----- .../exoplayer2/ui/DefaultTrackNameProvider.java | 10 ++-------- 3 files changed, 2 insertions(+), 15 deletions(-) diff --git a/RELEASENOTES.md b/RELEASENOTES.md index 455697bde9..98e8659397 100644 --- a/RELEASENOTES.md +++ b/RELEASENOTES.md @@ -35,8 +35,6 @@ `Player.addListener`. * Fix initial timestamp display in `PlayerControlView` ([#9524](https://github.com/google/ExoPlayer/issues/9254)). - * Fix capitalization of languages in the track selector - ([#9452](https://github.com/google/ExoPlayer/issues/9452)). * Extractors: * MP4: Correctly handle HEVC tracks with pixel aspect ratios other than 1. * TS: Correctly handle HEVC tracks with pixel aspect ratios other than 1. diff --git a/library/common/src/main/java/com/google/android/exoplayer2/util/Util.java b/library/common/src/main/java/com/google/android/exoplayer2/util/Util.java index 27a0d93670..e5bd28aca2 100644 --- a/library/common/src/main/java/com/google/android/exoplayer2/util/Util.java +++ b/library/common/src/main/java/com/google/android/exoplayer2/util/Util.java @@ -2243,11 +2243,6 @@ public final class Util { return systemLocales; } - /** Returns the default {@link Locale.Category#DISPLAY DISPLAY} {@link Locale}. */ - public static Locale getDefaultDisplayLocale() { - return Util.SDK_INT >= 24 ? Locale.getDefault(Locale.Category.DISPLAY) : Locale.getDefault(); - } - /** * Uncompresses the data in {@code input}. * diff --git a/library/ui/src/main/java/com/google/android/exoplayer2/ui/DefaultTrackNameProvider.java b/library/ui/src/main/java/com/google/android/exoplayer2/ui/DefaultTrackNameProvider.java index 03b2cfb4fd..a3d20eadb7 100644 --- a/library/ui/src/main/java/com/google/android/exoplayer2/ui/DefaultTrackNameProvider.java +++ b/library/ui/src/main/java/com/google/android/exoplayer2/ui/DefaultTrackNameProvider.java @@ -104,14 +104,8 @@ public class DefaultTrackNameProvider implements TrackNameProvider { if (TextUtils.isEmpty(language) || C.LANGUAGE_UNDETERMINED.equals(language)) { return ""; } - Locale languageLocale = - Util.SDK_INT >= 21 ? Locale.forLanguageTag(language) : new Locale(language); - Locale displayLocale = Util.getDefaultDisplayLocale(); - String languageName = languageLocale.getDisplayName(displayLocale); - // Capitalize the first letter. See: https://github.com/google/ExoPlayer/issues/9452. - int firstCodePointLength = languageName.offsetByCodePoints(0, 1); - return languageName.substring(0, firstCodePointLength).toUpperCase(displayLocale) - + languageName.substring(firstCodePointLength); + Locale locale = Util.SDK_INT >= 21 ? Locale.forLanguageTag(language) : new Locale(language); + return locale.getDisplayName(); } private String buildRoleString(Format format) {