android: Add the application ID to the log
This commit is contained in:
@@ -631,6 +631,27 @@ static void __attribute__ ((constructor))register_logger()
|
|||||||
dbg = dbg_android;
|
dbg = dbg_android;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Determine the application ID of the app
|
||||||
|
*/
|
||||||
|
static char *get_app_id(JNIEnv *env, jobject service)
|
||||||
|
{
|
||||||
|
jclass cls;
|
||||||
|
jmethodID method_id;
|
||||||
|
jstring jstr;
|
||||||
|
char *name = NULL;
|
||||||
|
|
||||||
|
cls = (*env)->FindClass(env, "android/content/Context");
|
||||||
|
method_id = (*env)->GetMethodID(env, cls, "getPackageName",
|
||||||
|
"()Ljava/lang/String;");
|
||||||
|
jstr = (*env)->CallObjectMethod(env, service, method_id);
|
||||||
|
if (jstr)
|
||||||
|
{
|
||||||
|
name = androidjni_convert_jstring(env, jstr);
|
||||||
|
}
|
||||||
|
return name;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Initialize charon and the libraries via JNI
|
* Initialize charon and the libraries via JNI
|
||||||
*/
|
*/
|
||||||
@@ -639,7 +660,7 @@ JNI_METHOD(CharonVpnService, initializeCharon, jboolean,
|
|||||||
{
|
{
|
||||||
struct sigaction action;
|
struct sigaction action;
|
||||||
struct utsname utsname;
|
struct utsname utsname;
|
||||||
char *logfile, *appdir, *plugins;
|
char *logfile, *appdir, *plugins, *app_id;
|
||||||
|
|
||||||
/* initialize library */
|
/* initialize library */
|
||||||
if (!library_init(NULL, "charon"))
|
if (!library_init(NULL, "charon"))
|
||||||
@@ -685,10 +706,12 @@ JNI_METHOD(CharonVpnService, initializeCharon, jboolean,
|
|||||||
{
|
{
|
||||||
memset(&utsname, 0, sizeof(utsname));
|
memset(&utsname, 0, sizeof(utsname));
|
||||||
}
|
}
|
||||||
|
app_id = get_app_id(env, this);
|
||||||
DBG1(DBG_DMN, "+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+");
|
DBG1(DBG_DMN, "+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+");
|
||||||
DBG1(DBG_DMN, "Starting IKE service (strongSwan "VERSION", %s, %s, "
|
DBG1(DBG_DMN, "Starting IKE service (strongSwan "VERSION", %s, %s, "
|
||||||
"%s %s, %s)", android_version_string, android_device_string,
|
"%s %s, %s, %s)", android_version_string, android_device_string,
|
||||||
utsname.sysname, utsname.release, utsname.machine);
|
utsname.sysname, utsname.release, utsname.machine, app_id ?: "(unknown)");
|
||||||
|
free(app_id);
|
||||||
|
|
||||||
#ifdef PLUGINS_BYOD
|
#ifdef PLUGINS_BYOD
|
||||||
if (byod)
|
if (byod)
|
||||||
|
|||||||
Reference in New Issue
Block a user