fix: android 13 crash with parcelable extras

[internal android bug!]

Signed-off-by: Infi <infi@infi.sh>
This commit is contained in:
Infi 2024-09-14 23:45:23 +02:00
parent 7cfbc3fdac
commit c39a209295
3 changed files with 12 additions and 8 deletions

View File

@ -96,7 +96,8 @@ class ShareTargetActivity : ComponentActivity() {
else -> {
listOf(
when {
Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU -> {
// due to a bug in Android 13 we still use the deprecated method on Android 13, despite the new method being available
Build.VERSION.SDK_INT > Build.VERSION_CODES.TIRAMISU -> {
intent.getParcelableExtra(
Intent.EXTRA_STREAM,
Parcelable::class.java

View File

@ -62,7 +62,8 @@ class ImageViewActivity : ComponentActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
val autumnResource = if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) {
// due to a bug in Android 13 we still use the deprecated method on Android 13, despite the new method being available
val autumnResource = if (Build.VERSION.SDK_INT > Build.VERSION_CODES.TIRAMISU) {
intent.getParcelableExtra("autumnResource", AutumnResource::class.java)
} else {
@Suppress("DEPRECATION")

View File

@ -35,12 +35,14 @@ class VideoViewActivity : FragmentActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
val autumnResource = if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) {
intent.getParcelableExtra("autumnResource", AutumnResource::class.java)
} else {
@Suppress("DEPRECATION")
intent.getParcelableExtra("autumnResource")
}
val autumnResource =
// due to a bug in Android 13 we still use the deprecated method on Android 13, despite the new method being available
if (Build.VERSION.SDK_INT > Build.VERSION_CODES.TIRAMISU) {
intent.getParcelableExtra("autumnResource", AutumnResource::class.java)
} else {
@Suppress("DEPRECATION")
intent.getParcelableExtra("autumnResource")
}
if (autumnResource?.id == null) {
Log.e("VideoViewActivity", "No AutumnResource provided")