Support multiple instance launch
[platform/core/api/application.git] / app_control / app_control.c
index 9efcba0..5a3f983 100755 (executable)
@@ -1218,3 +1218,34 @@ int app_control_enable_app_started_result_event(app_control_h app_control)
        return APP_CONTROL_ERROR_NONE;
 }
 
+int app_control_set_instance_id(app_control_h app_control, const char *instance_id)
+{
+       int ret;
+
+       if (app_control_validate(app_control) || instance_id == NULL)
+               return app_control_error(APP_CONTROL_ERROR_INVALID_PARAMETER, __FUNCTION__, NULL);
+
+       ret = aul_svc_set_instance_id(app_control->data, instance_id);
+       if (ret < 0)
+               return app_control_error(APP_CONTROL_ERROR_OUT_OF_MEMORY, __FUNCTION__, "Out of memory");
+
+       return APP_CONTROL_ERROR_NONE;
+}
+
+int app_control_get_instance_id(app_control_h app_control, char **instance_id)
+{
+       const char *id;
+
+       if (app_control_validate(app_control) || instance_id == NULL)
+               return app_control_error(APP_CONTROL_ERROR_INVALID_PARAMETER, __FUNCTION__, NULL);
+
+       id = aul_svc_get_instance_id(app_control->data);
+       if (id == NULL)
+               return app_control_error(APP_CONTROL_ERROR_INVALID_PARAMETER, __FUNCTION__, "Failed to get the instance id");
+
+       *instance_id = strdup(id);
+       if (*instance_id == NULL)
+               return app_control_error(APP_CONTROL_ERROR_OUT_OF_MEMORY, __FUNCTION__, "Failed to duplicate the instance id");
+
+       return APP_CONTROL_ERROR_NONE;
+}