titanium-sdk icon indicating copy to clipboard operation
titanium-sdk copied to clipboard

feat(android): update ndk, camerax for 16kb page sizes support

Open m1ga opened this issue 7 months ago • 2 comments

As mentioned in this post: https://github.com/tidev/titanium-sdk/discussions/14224 Android will soon add Support 16 KB page sizes.

Benefits:

  • Lower app launch times while the system is under memory pressure: 3.16% lower on average, with more significant improvements (up to 30%) for some apps that we tested
  • Reduced power draw during app launch: 4.56% reduction on average
  • Faster camera launch: 4.48% faster hot starts on average, and 6.60% faster cold starts on average
  • Improved system boot time: improved by 8% (approximately 950 milliseconds) on average

more info in their info page: https://developer.android.com/guide/practices/page-sizes#benefits

To test apps you can use https://cs.android.com/android/platform/superproject/main/+/main:system/extras/tools/check_elf_alignment.sh and analyse the included shared libraries (everything with arm64 is important, armeabi-v7a can be ignored).

With a 12.7.0.GA app you'll see e.g.:

/tmp/app_out_Yv77w/lib/arm64-v8a/libti.webdialog.so: ALIGNED (2**16)
/tmp/app_out_Yv77w/lib/arm64-v8a/libti.playservices.so: UNALIGNED (2**12)
/tmp/app_out_Yv77w/lib/arm64-v8a/libti.mlkit.so: ALIGNED (2**16)
/tmp/app_out_Yv77w/lib/arm64-v8a/libti.map.so: UNALIGNED (2**12)
/tmp/app_out_Yv77w/lib/arm64-v8a/libti.lines.so: ALIGNED (2**16)
/tmp/app_out_Yv77w/lib/arm64-v8a/libti.googlesignin.so: ALIGNED (2**16)
/tmp/app_out_Yv77w/lib/arm64-v8a/libti.cloak.so: ALIGNED (2**16)
/tmp/app_out_Yv77w/lib/arm64-v8a/libti.animation.so: UNALIGNED (2**12)
/tmp/app_out_Yv77w/lib/arm64-v8a/liborg.iotashan.TiTouchImageView.so: ALIGNED (2**16)
/tmp/app_out_Yv77w/lib/arm64-v8a/libmlkit_google_ocr_pipeline.so: UNALIGNED (2**12)
/tmp/app_out_Yv77w/lib/arm64-v8a/libkroll-v8.so: UNALIGNED (2**12)
/tmp/app_out_Yv77w/lib/arm64-v8a/libjnirivebridge.so: UNALIGNED (2**12)
/tmp/app_out_Yv77w/lib/arm64-v8a/libimage_processing_util_jni.so: UNALIGNED (2**12)
/tmp/app_out_Yv77w/lib/arm64-v8a/libfirebase.cloudmessaging.so: ALIGNED (2**16)
/tmp/app_out_Yv77w/lib/arm64-v8a/libc++_shared.so: UNALIGNED (2**12)
/tmp/app_out_Yv77w/lib/arm64-v8a/libbarhopper_v3.so: UNALIGNED (2**12)

every UNALIGNED will show a unsupported warning in a 16kb page sizes emulator.

NDK r28 will enable and we have to update camerax for libimage_processing_util_jni:

/tmp/testapp_out_wGf7c/lib/arm64-v8a/libti.playservices.so: ALIGNED (2**14)
/tmp/testapp_out_wGf7c/lib/arm64-v8a/libti.map.so: ALIGNED (2**14)
/tmp/testapp_out_wGf7c/lib/arm64-v8a/libti.cloak.so: ALIGNED (2**16)
/tmp/testapp_out_wGf7c/lib/arm64-v8a/libsurface_util_jni.so: ALIGNED (2**14)
/tmp/testapp_out_wGf7c/lib/arm64-v8a/libkroll-v8.so: ALIGNED (2**14)
/tmp/testapp_out_wGf7c/lib/arm64-v8a/libimage_processing_util_jni.so: ALIGNED (2**14)
/tmp/testapp_out_wGf7c/lib/arm64-v8a/libc++_shared.so: ALIGNED (2**14)

Note: we have to rebuild most of the modules too with this PR. After that all so files are aligned and it will show no warning in the emulator.

Current phones still work of course.

m1ga avatar May 12 '25 13:05 m1ga

I hope NDK r28 is already functional with the current Gradle version.

prashantsaini1 avatar May 15 '25 10:05 prashantsaini1

I hope NDK r28 is already functional with the current Gradle version.

I've build ti.map with that SDK and using it for some apps today (current running a liveview session with that SDK and old modules) without any errors so far. No gradle errors or building issues

m1ga avatar May 15 '25 10:05 m1ga