[winpr,android] Unify JNI_OnLoad

* Split JNI_OnLoad and JNI_OnUnload to own module to be usable from more
  than only timezone
* Explicitly call System.loadLibrary('winpr') (and other FreeRDP
  libraries) in android client as JNI_OnLoad is only triggered by that
  and not implicit loading
This commit is contained in:
akallabeth
2022-11-15 08:24:53 +01:00
committed by akallabeth
parent 113290c35c
commit 00ee213f97
5 changed files with 118 additions and 8 deletions

View File

@@ -78,7 +78,16 @@ public class LibFreeRDP
try
{
System.loadLibrary("freerdp-android");
/* Load dependent libraries too to trigger JNI_OnLoad calls */
String version = freerdp_get_jni_version();
String[] versions = version.split(".");
if (versions.length > 0)
{
System.loadLibrary("freerdp-client" + versions[0]);
System.loadLibrary("freerdp" + versions[0]);
System.loadLibrary("winpr" + versions[0]);
}
Pattern pattern = Pattern.compile("^(\\d+)\\.(\\d+)\\.(\\d+).*");
Matcher matcher = pattern.matcher(version);
if (!matcher.matches() || (matcher.groupCount() < 3))