#define SID_APP 5000
#define MANIFEST_PATH "/info/manifest.xml"
+#define APPDIR1 "/opt/apps/"
+#define APPDIR2 "/opt/usr/apps/"
+
uint64_t str_to_uint64(char* str)
{
uint64_t res = 0;
return -1;
}
+int get_appid(const char* execpath, char* buffer, int buflen)
+{
+ int i, ret = 0;
+ char* temp;
+ if(strncmp(execpath, APPDIR1, strlen(APPDIR1)) == 0)
+ {
+ execpath = execpath + strlen(APPDIR1);
+ temp = strchr(execpath, '/');
+ for(i = 0; i < strlen(execpath); i++)
+ {
+ if(execpath + i == temp)
+ break;
+ buffer[i] = execpath[i];
+ }
+ buffer[i] = '.';
+ buffer[i+1] = '\0';
+ temp = strrchr(execpath, '/');
+ if(temp != NULL)
+ {
+ temp++;
+ strcat(buffer, temp);
+ }
+ }
+ else if(strncmp(execpath, APPDIR2, strlen(APPDIR2)) == 0)
+ {
+ execpath = execpath + strlen(APPDIR2);
+ temp = strchr(execpath, '/');
+ for(i = 0; i < strlen(execpath); i++)
+ {
+ if(execpath + i == temp)
+ break;
+ buffer[i] = execpath[i];
+ }
+ buffer[i] = '.';
+ buffer[i+1] = '\0';
+ temp = strrchr(execpath, '/');
+ if(temp != NULL)
+ {
+ temp++;
+ strcat(buffer, temp);
+ }
+ }
+ else
+ {
+ ret = -1;
+ }
+
+ return ret;
+}
+
// return 0 if succeed
// return -1 if error occured
int remove_indir(const char *dirname)
// execute applcation with executable binary path
// return 0 to fail to execute
// return 1 to succeed to execute
+#ifdef USE_LAUNCH_PAD
+int exec_app(const char* exec_path, int app_type)
+{
+ pid_t pid;
+ char command[PATH_MAX];
+ char appid[PATH_MAX];
+
+ if (exec_path == NULL || strlen(exec_path) <= 0)
+ {
+ LOGE("Executable path is not correct\n");
+ return 0;
+ }
+
+ if (( pid = fork()) < 0) // fork error
+ return 0;
+ else if(pid > 0)
+ return 1; // exit parent process with successness
+
+ if(get_appid(exec_path, appid, PATH_MAX) < 0)
+ {
+ LOGE("failed to get appid\n");
+ return 0;
+ }
+ else
+ {
+ LOGI("launch app path is %s, executable path is %s\n", LAUNCH_APP_PATH, exec_path);
+ execl(LAUNCH_APP_PATH, LAUNCH_APP_NAME, appid, LAUNCH_APP_SDK, DA_PRELOAD_EXEC, NULL);
+ return 1;
+ }
+}
+#else
int exec_app(const char* exec_path, int app_type)
{
pid_t pid;
return 1;
}
}
+#endif
// find process id from executable binary path
pid_t find_pid_from_path(const char* path)
#define LAUNCH_APP_PATH "/usr/bin/launch_app"
#define KILL_APP_PATH "/usr/bin/pkill"
#define LAUNCH_APP_NAME "launch_app"
-#define DA_PRELOAD_EXEC "__AUL_SDK_DYNAMIC_ANALYSIS"
+#define LAUNCH_APP_SDK "__AUL_SDK__"
+#define DA_PRELOAD_EXEC "DYNAMIC_ANALYSIS"
#define DA_PRELOAD(AppType) AppType ? DA_PRELOAD_OSP : DA_PRELOAD_TIZEN
#define DA_PRELOAD_TIZEN "LD_PRELOAD=/usr/lib/da_probe_tizen.so"
#define DA_PRELOAD_OSP "LD_PRELOAD=/usr/lib/da_probe_osp.so"