Skip to content

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

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

m1ga
Copy link
Contributor

@m1ga m1ga commented May 12, 2025

As mentioned in this post: #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.

@prashantsaini1
Copy link
Contributor

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

@m1ga
Copy link
Contributor Author

m1ga commented May 15, 2025

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants