From 50d2a1374d4f882c955b65b6b19467c067fbcfe1 Mon Sep 17 00:00:00 2001 From: Josh Yaganeh <319444+jyaganeh@users.noreply.github.com> Date: Fri, 5 Apr 2024 13:46:30 -0700 Subject: [PATCH] Release 17.7.4 (#1388) --- CHANGELOG.md | 11 ++++++----- gradle.properties | 2 +- .../urbanairship/debug/utils/CompatExtensions.kt | 15 ++++----------- .../android/layout/util/ActivityExtensions.kt | 5 ++++- .../LiveUpdateNotificationReceiver.kt | 5 ++++- 5 files changed, 19 insertions(+), 19 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6ab75132e..4a564ade2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,26 +2,27 @@ [Migration Guides](https://github.com/urbanairship/android-library/tree/main/documentation/migration) -## Version 17.7.4, March 27, 2024 -Patch release that fixes channel ID creation delay after enabling a feature when none was enabled. The SDK will new create the channel ID without having to relaunch the app. Apps that have no features enabled at launch should update to this version or later. +## Version 17.7.4, April 5, 2024 +Patch release that fixes a potential crash on Android 13 (API 33) channel ID creation delay after enabling a feature when none was enabled. The SDK will new create the channel ID without having to relaunch the app. Apps that have no features enabled at launch should update to this version or later. ### Changes - Fixed channel ID creation delay after enabling a feature when none was enabled. +- Fixed a potential NPE when reading from intent extras on API 33. -## Version 17.7.3, Feb 16, 2024 +## Version 17.7.3, February 16, 2024 Patch release that adjusts locale targeting behavior for In-App Automation and messaging. The SDK will now check the device's primary language against the target locale, instead of checking whether any user selected languages match the target locale. ### Changes - Adjust locale targeting behavior to only consider the primary locale selection. -## Version 17.7.2, Jan 29, 2024 +## Version 17.7.2, January 29, 2024 Patch release that fixes an issue with message limits not being respected in certain cases. Apps that make use of limits should update to this version or later. ### Changes - Fixed message limits not being respected in certain cases. - Improvements for images and GIFs in Surveys and Scenes. -## Version 16.11.2, Jan 29, 2024 +## Version 16.11.2, January 29, 2024 Patch release that fixes an issue with message limits not being respected in certain cases. Apps on SDK v16 that make use of limits should update to this version or the latest 17.x release. ### Changes diff --git a/gradle.properties b/gradle.properties index 7500b3e50..963813526 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,6 +1,6 @@ android.useAndroidX=true android.databinding.incremental=true kapt.incremental.apt=true -org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+UseParallelGC +org.gradle.jvmargs=-Xmx2048m -XX:+UseParallelGC org.gradle.caching=true org.gradle.parallel=true diff --git a/urbanairship-debug/src/main/java/com/urbanairship/debug/utils/CompatExtensions.kt b/urbanairship-debug/src/main/java/com/urbanairship/debug/utils/CompatExtensions.kt index 28c0f1320..2dc5786d4 100644 --- a/urbanairship-debug/src/main/java/com/urbanairship/debug/utils/CompatExtensions.kt +++ b/urbanairship-debug/src/main/java/com/urbanairship/debug/utils/CompatExtensions.kt @@ -1,24 +1,17 @@ package com.urbanairship.debug.utils -import android.content.Intent import android.os.Build import android.os.Bundle import android.os.Parcelable internal inline fun Bundle.getParcelableCompat(key: String): T? { - return if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) { + // The new getParcelable API was added in API 33, but came with a bug that could lead to + // NPEs. This was fixed in API 34, but we still need to use the deprecated API for 33. + // see: https://issuetracker.google.com/issues/240585930 + return if (Build.VERSION.SDK_INT > Build.VERSION_CODES.TIRAMISU) { getParcelable(key, T::class.java) } else { @Suppress("DEPRECATION") getParcelable(key) as? T } } - -internal inline fun Intent.getParcelableExtraCompat(key: String): T? { - return if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) { - getParcelableExtra(key, T::class.java) - } else { - @Suppress("DEPRECATION") - getParcelableExtra(key) as? T - } -} diff --git a/urbanairship-layout/src/main/java/com/urbanairship/android/layout/util/ActivityExtensions.kt b/urbanairship-layout/src/main/java/com/urbanairship/android/layout/util/ActivityExtensions.kt index 67dc33c3f..c136daf4f 100644 --- a/urbanairship-layout/src/main/java/com/urbanairship/android/layout/util/ActivityExtensions.kt +++ b/urbanairship-layout/src/main/java/com/urbanairship/android/layout/util/ActivityExtensions.kt @@ -4,6 +4,9 @@ import android.app.Activity import android.os.Build internal inline fun Activity.parcelableExtra(key: String): T? = when { - Build.VERSION.SDK_INT >= 33 -> intent.getParcelableExtra(key, T::class.java) + // The new getParcelableExtra API was added in API 33, but came with a bug that could lead to + // NPEs. This was fixed in API 34, but we still need to use the deprecated API for 33. + // see: https://issuetracker.google.com/issues/240585930 + Build.VERSION.SDK_INT > 33 -> intent.getParcelableExtra(key, T::class.java) else -> @Suppress("DEPRECATION") intent.getParcelableExtra(key) as? T } diff --git a/urbanairship-live-update/src/main/java/com/urbanairship/liveupdate/notification/LiveUpdateNotificationReceiver.kt b/urbanairship-live-update/src/main/java/com/urbanairship/liveupdate/notification/LiveUpdateNotificationReceiver.kt index c19af2010..11a91b30e 100644 --- a/urbanairship-live-update/src/main/java/com/urbanairship/liveupdate/notification/LiveUpdateNotificationReceiver.kt +++ b/urbanairship-live-update/src/main/java/com/urbanairship/liveupdate/notification/LiveUpdateNotificationReceiver.kt @@ -68,6 +68,9 @@ public class LiveUpdateNotificationReceiver : BroadcastReceiver() { } private inline fun Intent.getParcelableExtraCompat(key: String): T? = when { - Build.VERSION.SDK_INT >= 33 -> getParcelableExtra(key, T::class.java) + // The new getParcelableExtra API was added in API 33, but came with a bug that could lead to + // NPEs. This was fixed in API 34, but we still need to use the deprecated API for 33. + // see: https://issuetracker.google.com/issues/240585930 + Build.VERSION.SDK_INT > 33 -> getParcelableExtra(key, T::class.java) else -> @Suppress("DEPRECATION") getParcelableExtra(key) as? T }