diff --git a/CHANGELOG.md b/CHANGELOG.md index 7aa3bde4ef..cb231dcb8a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,8 @@ +# 2.15.1 / 2024-11-04 + +* [MAINTENANCE] Fix `resolveResourceId` not correctly calling job finished when drawable cloning + failed [#2367](https://github.com/DataDog/dd-sdk-android/pull/2367) + # 2.15.0 / 2024-10-28 * [FEATURE] Add `TimeBank` in Session Replay recorder for dynamic optimisation See [#2247](https://github.com/DataDog/dd-sdk-android/pull/2247) diff --git a/features/dd-sdk-android-session-replay/src/main/kotlin/com/datadog/android/sessionreplay/internal/recorder/resources/ResourceResolver.kt b/features/dd-sdk-android-session-replay/src/main/kotlin/com/datadog/android/sessionreplay/internal/recorder/resources/ResourceResolver.kt index bed17d50e2..a1bac603a0 100644 --- a/features/dd-sdk-android-session-replay/src/main/kotlin/com/datadog/android/sessionreplay/internal/recorder/resources/ResourceResolver.kt +++ b/features/dd-sdk-android-session-replay/src/main/kotlin/com/datadog/android/sessionreplay/internal/recorder/resources/ResourceResolver.kt @@ -62,7 +62,11 @@ internal class ResourceResolver( return } - val copiedDrawable = drawableCopier.copy(originalDrawable, resources) ?: return + val copiedDrawable = drawableCopier.copy(originalDrawable, resources) + if (copiedDrawable == null) { + resourceResolverCallback.onFailure() + return + } val bitmapFromDrawable = if (copiedDrawable is BitmapDrawable && shouldUseDrawableBitmap(copiedDrawable)) { diff --git a/features/dd-sdk-android-session-replay/src/test/kotlin/com/datadog/android/sessionreplay/internal/recorder/resources/ResourceResolverTest.kt b/features/dd-sdk-android-session-replay/src/test/kotlin/com/datadog/android/sessionreplay/internal/recorder/resources/ResourceResolverTest.kt index d0b98b1047..5ed09a2d57 100644 --- a/features/dd-sdk-android-session-replay/src/test/kotlin/com/datadog/android/sessionreplay/internal/recorder/resources/ResourceResolverTest.kt +++ b/features/dd-sdk-android-session-replay/src/test/kotlin/com/datadog/android/sessionreplay/internal/recorder/resources/ResourceResolverTest.kt @@ -34,6 +34,7 @@ import org.mockito.junit.jupiter.MockitoExtension import org.mockito.junit.jupiter.MockitoSettings import org.mockito.kotlin.any import org.mockito.kotlin.anyOrNull +import org.mockito.kotlin.doReturn import org.mockito.kotlin.eq import org.mockito.kotlin.mock import org.mockito.kotlin.never @@ -269,6 +270,32 @@ internal class ResourceResolverTest { verify(mockSerializerCallback).onFailure() } + @Test + fun `M call onFailure W copy bitmap return null`() { + // Given + whenever( + mockDrawableCopier.copy( + originalDrawable = mockDrawable, + resources = mockResources + ) + ).doReturn(null) + + // When + testedResourceResolver.resolveResourceId( + resources = mockResources, + applicationContext = mockApplicationContext, + displayMetrics = mockDisplayMetrics, + originalDrawable = mockDrawable, + drawableCopier = mockDrawableCopier, + drawableWidth = mockDrawable.intrinsicWidth, + drawableHeight = mockDrawable.intrinsicHeight, + resourceResolverCallback = mockSerializerCallback + ) + + // Then + verify(mockSerializerCallback).onFailure() + } + @Test fun `M calculate resourceId W resolveResourceId() { cache miss }`() { // Given