}
}
+ /**
+ * Function called via JNI to determine information about the Android version.
+ */
+ private static String getAndroidVersion()
+ {
+ return "Android " + Build.VERSION.RELEASE + " - " + Build.DISPLAY +
+ "/" + Build.VERSION.SECURITY_PATCH;
+ }
+
+ /**
+ * Function called via JNI to determine information about the device.
+ */
+ private static String getDeviceString()
+ {
+ return Build.MODEL + " - " + Build.BRAND + "/" + Build.PRODUCT + "/" + Build.MANUFACTURER;
+ }
+
/*
* The libraries are extracted to /data/data/org.strongswan.android/...
* during installation. On newer releases most are loaded in JNI_OnLoad.
/*
- * Copyright (C) 2012-2015 Tobias Brunner
+ * Copyright (C) 2012-2017 Tobias Brunner
* Copyright (C) 2012 Giuliano Grassi
* Copyright (C) 2012 Ralf Sager
- * Hochschule fuer Technik Rapperswil
+ * HSR Hochschule fuer Technik Rapperswil
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
jclass *android_charonvpnservice_builder_class;
jclass *android_simple_fetcher_class;
android_sdk_version_t android_sdk_version;
+char *android_version_string;
+char *android_device_string;
/**
* Thread-local variable. Only used because of the destructor
JNIEnv *env;
jclass jversion;
jfieldID jsdk_int;
+ jmethodID method_id;
+ jstring jstr;
int i;
android_jvm = vm;
jsdk_int = (*env)->GetStaticFieldID(env, jversion, "SDK_INT", "I");
android_sdk_version = (*env)->GetStaticIntField(env, jversion, jsdk_int);
+ method_id = (*env)->GetStaticMethodID(env, android_charonvpnservice_class,
+ "getAndroidVersion", "()Ljava/lang/String;");
+ jstr = (*env)->CallStaticObjectMethod(env,
+ android_charonvpnservice_class, method_id);
+ if (jstr)
+ {
+ android_version_string = androidjni_convert_jstring(env, jstr);
+ }
+ method_id = (*env)->GetStaticMethodID(env, android_charonvpnservice_class,
+ "getDeviceString", "()Ljava/lang/String;");
+ jstr = (*env)->CallStaticObjectMethod(env,
+ android_charonvpnservice_class, method_id);
+ if (jstr)
+ {
+ android_device_string = androidjni_convert_jstring(env, jstr);
+ }
return JNI_VERSION_1_6;
}
dlclose(libs[i].handle);
}
}
+ free(android_version_string);
+ free(android_device_string);
}
-
/*
- * Copyright (C) 2012 Tobias Brunner
+ * Copyright (C) 2012-2017 Tobias Brunner
* Copyright (C) 2012 Giuliano Grassi
* Copyright (C) 2012 Ralf Sager
- * Hochschule fuer Technik Rapperswil
+ * HSR Hochschule fuer Technik Rapperswil
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
extern android_sdk_version_t android_sdk_version;
/**
+ * A description of the current Android release
+ *
+ * see android.os.Build
+ */
+extern char *android_version_string;
+
+/**
+ * A description of the current device
+ *
+ * see android.os.Build
+ */
+extern char *android_device_string;
+
+/**
* Attach the current thread to the JVM
*
* As local JNI references are not freed until the thread detaches
{
memset(&utsname, 0, sizeof(utsname));
}
- DBG1(DBG_DMN, "Starting IKE charon daemon (strongSwan "VERSION", %s %s, %s)",
+ DBG1(DBG_DMN, "Starting IKE charon daemon (strongSwan "VERSION", %s, %s, "
+ "%s %s, %s)", android_version_string, android_device_string,
utsname.sysname, utsname.release, utsname.machine);
#ifdef PLUGINS_BYOD