2 * Copyright (c) 2017 Samsung Electronics Co., Ltd All Rights Reserved
4 * Licensed under the Apache License, Version 2.0 (the License);
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an AS IS BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
20 #include <glib-object.h>
22 #include <sys/types.h>
26 #include <bundle_internal.h>
28 #include <aul_app_com.h>
30 #include <appcore_multiwindow_base.h>
32 #include "widget_app.h"
33 #include "widget-log.h"
34 #include "widget-private.h"
35 #include "widget_app_internal.h"
36 #include "widget-private.h"
42 #define LOG_TAG "CAPI_WIDGET_APPLICATION"
43 extern char *_viewer_endpoint;
44 static char *__class_id;
46 static void __inst_cb(const char *class_id, const char *id,
47 appcore_multiwindow_base_instance_h cxt, void *data)
50 __class_id = strdup(class_id);
53 EXPORT_API int widget_app_restart(void)
56 int status = AUL_WIDGET_INSTANCE_EVENT_APP_RESTART_REQUEST;
59 appcore_multiwindow_base_instance_foreach_full(__inst_cb, NULL);
62 bundle_add_str(kb, AUL_K_WIDGET_ID, __class_id);
63 bundle_add_byte(kb, AUL_K_WIDGET_STATUS, &status, sizeof(int));
64 ret = aul_app_com_send(_viewer_endpoint, kb);
71 if (ret != AUL_R_OK) {
72 _E("failed to kill app");
73 return WIDGET_ERROR_IO_ERROR;
75 return WIDGET_ERROR_NONE;