Fix subtitle outline width not applying in release builds (#1687)

## Description
Fix applying the subtitle outline width in ExoPlayer for release builds

The outline width field isn't public, so reflection is used to bypass
and modify it. Since proguard/r8 renames all of the classes and fields,
this meant the field was no longer found. The fix is to have proguard
preserve the necessary field names.

### Related issues
Fixes #1681

### Testing
Emulator w/ release build

## Screenshots
N/a

## AI or LLM usage
None
This commit is contained in:
Damontecres 2026-07-11 13:21:41 -04:00 • committed by GitHub
parent 26124a5348
commit f74306a12c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 14 additions and 0 deletions

View file

@ -11,3 +11,14 @@
# TODO investigate using smaller scope
-keep class com.google.common.cache.** { *; }
# Media3SubtitleOverride uses reflection to access/modify these fields
-keep class androidx.media3.ui.SubtitleView {
private androidx.media3.ui.SubtitleView$Output output;
}
-keep class androidx.media3.ui.CanvasSubtitleOutput {
private final java.util.List painters;
}
-keep class androidx.media3.ui.SubtitlePainter {
private final float outlineWidth;
}

View file

@ -1,5 +1,7 @@
package com.github.damontecres.wholphin.util
import androidx.annotation.OptIn
import androidx.media3.common.util.UnstableApi
import androidx.media3.ui.SubtitleView
import timber.log.Timber
import java.lang.reflect.Field
@ -7,6 +9,7 @@ import java.lang.reflect.Field
/**
* Utility class to override private fields in media3's [SubtitleView]
*/
@OptIn(UnstableApi::class)
class Media3SubtitleOverride(
val outlineThicknessPx: Float,
) {