The open source OpenXR runtime

ipc/android: Allow custom service library names

Monado derivatives may choose to create and use a
custom variant of service-lib for android builds
with a different library name, this change replaces the
hard-coded library name used for dynamic lib loading.

Part-of: <https://gitlab.freedesktop.org/monado/monado/-/merge_requests/2265>

+9 -1
+8
src/xrt/ipc/android/build.gradle
··· 21 21 minSdkVersion 26 22 22 targetSdkVersion project.sharedTargetSdk 23 23 24 + def defaultServiceLibName = "monado-service" 25 + def serviceLibName = project.hasProperty("serviceLibName") ? 26 + project.serviceLibName : defaultServiceLibName 27 + if (serviceLibName == null || serviceLibName.length() == 0) { 28 + serviceLibName = defaultServiceLibName 29 + } 30 + 24 31 // Single point of truth for these names. 25 32 def serviceAction = "org.freedesktop.monado.ipc.CONNECT" 26 33 def shutdownAction = "org.freedesktop.monado.ipc.SHUTDOWN" ··· 31 38 buildConfigField("String", "SERVICE_ACTION", "\"${serviceAction}\"") 32 39 buildConfigField("String", "SHUTDOWN_ACTION", "\"${shutdownAction}\"") 33 40 buildConfigField("Long", "WATCHDOG_TIMEOUT_MILLISECONDS", "1500L") 41 + buildConfigField("String", "SERVICE_LIB_NAME", "\"${serviceLibName}\"") 34 42 } 35 43 36 44 buildTypes {
+1 -1
src/xrt/ipc/android/src/main/java/org/freedesktop/monado/ipc/MonadoImpl.java
··· 36 36 static { 37 37 // Load the shared library with the native parts of this class 38 38 // This is the service-lib target. 39 - System.loadLibrary("monado-service"); 39 + System.loadLibrary(BuildConfig.SERVICE_LIB_NAME); 40 40 } 41 41 42 42 private final Context context;