Celtoys / Remotery

Single C file, Realtime CPU/GPU Profiler with Remote Web Viewer
Apache License 2.0
3.03k stars 255 forks source link

Apps targeting Android 10 cannot directly use ashmem (/dev/ashmem) #223

Closed AGulev closed 1 year ago

AGulev commented 1 year ago

Android 10 and higher can't use /dev/ashmem directly anymore and must use NDK's ASharedMemory class. Because of that Remotery doesn't work on Android 10+.

More info is available here: https://stackoverflow.com/a/53062250

JCash commented 1 year ago

The new Android api does seem to still use the ashmem_create_region() internally, but it is a lot more involved, and it currently uses std::string for I/O: https://android.googlesource.com/platform/system/core/+/refs/heads/master/libcutils/ashmem-dev.cpp#365

Perhaps dynamically loading the shared library and grabbing the function pointer might be an option 🤔

AGulev commented 1 year ago

Yes, This is how google chromium does that https://chromium.googlesource.com/chromium/src/+/refs/heads/main/base/android/linker/modern_linker_jni.cc#115