aux/android: support uncompressed native libs

if useLegacyPackaging in src/xrt/targets/openxr_android/build.gradle
set to false, the full path of monado.so will become
/data/app/../../base.apk!/lib/ABI/libopenxr_monado.so.
The function getRuntimeSourceDir will get the wrong path.

Part-of: <https://gitlab.freedesktop.org/monado/monado/-/merge_requests/2153>
This commit is contained in:
tao.pei 2024-02-20 14:29:40 +08:00 committed by Rylie Pavlik
parent e4636ca153
commit c5e9af025e

View file

@ -40,7 +40,14 @@ getRuntimeSourceDir()
// dli_filename is full path of the library contains the symbol. For example:
// /data/app/~~sha27MVNR46wLF-96zA_LQ==/org.freedesktop.monado.openxr_runtime.out_of_process-cqs8L2Co3WfHGgvDwF12JA==/lib/arm64/libopenxr_monado.so
dir = info.dli_fname;
// Trim trailing lib path to .so (e.g. /lib/arm64/libopenxr_monado.so)
dir = dir.substr(0, dir.find("/lib/"));
// In case the SO is not extracted, trim off the base APK name and !
// This finishes handling cases like:
// /data/app/~~sha27MVNR46wLF-96zA_LQ==/org.freedesktop.monado.openxr_runtime.out_of_process-cqs8L2Co3WfHGgvDwF12JA==/base.apk!/lib/arm64/libopenxr_monado.so
dir = dir.substr(0, dir.find("/base.apk!"));
}
return dir;