Skip to content

Commit 9045142

Browse files
feat: o3 level optimization for image diffing (#443)
## Summary Replace the CMake-compiled C native library with prebuilt `.so` binaries in the Android SDK, pin additional AndroidX Lifecycle dependencies in the MAUI NuGet packages, and bump the MAUI SDK version to 0.5.2. ## Changes ### Android SDK (`observability-android`) - **Switch from CMake source compilation to prebuilt `.so` binaries**: Removed all C source files (`tile_hash.c`, `tile_hash.h`, `tile_hash_jni.c`, `nearest_divisor.c`, `nearest_divisor.h`) and the `externalNativeBuild { cmake { ... } }` block from `build.gradle.kts`. Added prebuilt `libsession_replay_c.so` binaries under `jniLibs/` for all four ABIs: `arm64-v8a`, `armeabi-v7a`, `x86`, `x86_64`. This eliminates the CMake/NDK build dependency and ensures consistent binary output across environments. - **Rename native library**: Updated `TileHashNative.kt` to load `session_replay_c` instead of the old `tile_hash` library name. ### MAUI / .NET SDK (`mobile-dotnet`) - **Pin additional AndroidX Lifecycle dependencies**: Added `Xamarin.AndroidX.Lifecycle.LiveData` and `Xamarin.AndroidX.Lifecycle.ViewModelSavedState` at `[2.9.2.1, 3.0.0)` in both `LDObservability.csproj` and `LDObservability.Fat.csproj` to prevent NU1608 version-mismatch warnings in consumer projects. - **Version bump to 0.5.2** in `Directory.Build.props`. ## Test Plan - [ ] Build Android SDK — verify it compiles without CMake/NDK and the prebuilt `.so` files are bundled correctly in the AAR - [ ] Run Android SDK on all ABIs (arm64-v8a, armeabi-v7a, x86, x86_64) — verify `TileHashNative` loads `libsession_replay_c.so` successfully - [ ] Build MAUI SDK — verify no NU1608 dependency warnings - [ ] Run session replay on Android via MAUI — verify tile hashing works end-to-end <!-- CURSOR_SUMMARY --> --- > [!NOTE] > **Medium Risk** > Switches Android session-replay hashing from source-built JNI (CMake/NDK) to bundled prebuilt `.so` binaries and renames the loaded library, which can impact runtime loading/ABI compatibility. Additional AndroidX pinning and a package version bump are low risk but may affect downstream dependency resolution. > > **Overview** > Moves Android session replay tile-hashing from a CMake/NDK-built JNI library to **prebuilt native binaries**: removes the CMake build configuration and deletes the C sources/JNI glue, relies on packaged `libsession_replay_c.so` under `jniLibs/` for all ABIs, and updates `TileHashNative` to load `session_replay_c`. > > Updates the .NET MAUI NuGet packaging by bumping `LaunchDarkly.SessionReplay` to `0.5.2` and pinning additional AndroidX Lifecycle dependencies (`LiveData`, `ViewModelSavedState`, and aligned `LiveData.Core`) to reduce consumer version-conflict warnings. > > <sup>Written by [Cursor Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit b5239b4. This will update automatically on new commits. Configure [here](https://cursor.com/dashboard?tab=bugbot).</sup> <!-- /CURSOR_SUMMARY -->
1 parent 47c4640 commit 9045142

15 files changed

Lines changed: 8 additions & 380 deletions

File tree

sdk/@launchdarkly/mobile-dotnet/observability/Directory.Build.props

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<Project>
22
<PropertyGroup>
33
<PackageId>LaunchDarkly.SessionReplay</PackageId>
4-
<Version>0.5.0</Version>
4+
<Version>0.5.2</Version>
55
<UseLocalClientSdk>false</UseLocalClientSdk>
66
<Authors>LaunchDarkly</Authors>
77
<Owners>LaunchDarkly</Owners>

sdk/@launchdarkly/mobile-dotnet/observability/LDObservability.Fat.csproj

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,10 +34,12 @@
3434
<PackageReference Include="Xamarin.AndroidX.Lifecycle.Runtime.Ktx" Version="[2.9.2.1, 3.0.0)" />
3535
<!-- Keep Common, LiveData.Core, and Process aligned with Runtime to avoid NU1608 in consumers. -->
3636
<PackageReference Include="Xamarin.AndroidX.Lifecycle.Common" Version="[2.9.2.1, 3.0.0)" />
37+
<PackageReference Include="Xamarin.AndroidX.Lifecycle.LiveData" Version="[2.9.2.1, 3.0.0)" />
3738
<PackageReference Include="Xamarin.AndroidX.Lifecycle.LiveData.Core" Version="[2.9.2.1, 3.0.0)" />
3839
<!-- Keep LiveData.Core.Ktx aligned with LiveData.Core to avoid duplicate LiveDataKt classes. -->
3940
<PackageReference Include="Xamarin.AndroidX.Lifecycle.LiveData.Core.Ktx" Version="[2.9.2.1, 3.0.0)" />
4041
<PackageReference Include="Xamarin.AndroidX.Lifecycle.Process" Version="[2.9.2.1, 3.0.0)" />
42+
<PackageReference Include="Xamarin.AndroidX.Lifecycle.ViewModelSavedState" Version="[2.9.2.1, 3.0.0)" />
4143

4244
<!-- MAUI requires AndroidX.SavedState.ISavedStateRegistryOwner to exist in Xamarin.AndroidX.SavedState.dll.
4345
Xamarin.AndroidX.SavedState 1.3.0 is missing that type in the main assembly, but 1.3.1.1 has it again. -->

sdk/@launchdarkly/mobile-dotnet/observability/LDObservability.csproj

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,10 +32,12 @@
3232
<!-- Keep Lifecycle Runtime/Ktx aligned to avoid duplicate FlowExtKt between runtime-android and runtime-ktx. -->
3333
<PackageReference Include="Xamarin.AndroidX.Lifecycle.Runtime" Version="[2.9.2.1, 3.0.0)" />
3434
<PackageReference Include="Xamarin.AndroidX.Lifecycle.Runtime.Ktx" Version="[2.9.2.1, 3.0.0)" />
35-
<!-- Keep Common, LiveData.Core, and Process aligned with Runtime to avoid NU1608 in consumers. -->
35+
<!-- Keep Common, LiveData, LiveData.Core, Process, and ViewModelSavedState aligned with Runtime to avoid NU1608 in consumers. -->
3636
<PackageReference Include="Xamarin.AndroidX.Lifecycle.Common" Version="[2.9.2.1, 3.0.0)" />
37-
<PackageReference Include="Xamarin.AndroidX.Lifecycle.LiveData.Core" Version="[2.9.0, 3.0.0)" />
37+
<PackageReference Include="Xamarin.AndroidX.Lifecycle.LiveData" Version="[2.9.2.1, 3.0.0)" />
38+
<PackageReference Include="Xamarin.AndroidX.Lifecycle.LiveData.Core" Version="[2.9.2.1, 3.0.0)" />
3839
<PackageReference Include="Xamarin.AndroidX.Lifecycle.Process" Version="[2.9.2.1, 3.0.0)" />
40+
<PackageReference Include="Xamarin.AndroidX.Lifecycle.ViewModelSavedState" Version="[2.9.2.1, 3.0.0)" />
3941
<PackageReference Include="Xamarin.AndroidX.SavedState" Version="[1.3.1.1, 2.0.0)" />
4042
<PackageReference Include="Xamarin.AndroidX.SavedState.SavedState.Ktx" Version="[1.3.1.1, 2.0.0)" />
4143
</ItemGroup>

sdk/@launchdarkly/observability-android/lib/build.gradle.kts

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -92,12 +92,6 @@ android {
9292
buildConfigField("String", "OBSERVABILITY_SDK_VERSION", "\"${project.version}\"")
9393
}
9494

95-
externalNativeBuild {
96-
cmake {
97-
path = file("src/main/cpp/CMakeLists.txt")
98-
}
99-
}
100-
10195
buildTypes {
10296
release {
10397
isMinifyEnabled = false

sdk/@launchdarkly/observability-android/lib/src/main/cpp/CMakeLists.txt

Lines changed: 0 additions & 15 deletions
This file was deleted.

sdk/@launchdarkly/observability-android/lib/src/main/cpp/nearest_divisor.c

Lines changed: 0 additions & 22 deletions
This file was deleted.

sdk/@launchdarkly/observability-android/lib/src/main/cpp/nearest_divisor.h

Lines changed: 0 additions & 6 deletions
This file was deleted.

sdk/@launchdarkly/observability-android/lib/src/main/cpp/tile_hash.c

Lines changed: 0 additions & 185 deletions
This file was deleted.

sdk/@launchdarkly/observability-android/lib/src/main/cpp/tile_hash.h

Lines changed: 0 additions & 48 deletions
This file was deleted.

0 commit comments

Comments
 (0)