summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjusung son <jusung07.son@samsung.com>2018-03-19 16:48:50 +0900
committerjusung son <jusung07.son@samsung.com>2018-03-19 16:53:27 +0900
commit643d893ee0f968010bb7d1102ea79cf4deda6787 (patch)
treec03b0a698f78ba5c314cf6586f39406a8f9f3da5
parent03664ff5cb70a20ce715604071725818e6ae00f4 (diff)
downloadaul-1-643d893ee0f968010bb7d1102ea79cf4deda6787.tar.gz
aul-1-643d893ee0f968010bb7d1102ea79cf4deda6787.tar.bz2
aul-1-643d893ee0f968010bb7d1102ea79cf4deda6787.zip
Add new APIs for complication
Change-Id: If913893cd7607424845e85570f08c1b9a0a78bd3 Signed-off-by: jusung son <jusung07.son@samsung.com>
-rwxr-xr-x[-rw-r--r--]CMakeLists.txt1
-rwxr-xr-x[-rw-r--r--]include/aul_cmd.h1
-rwxr-xr-xinclude/aul_complication.h31
-rwxr-xr-xsrc/aul_complication.c81
4 files changed, 114 insertions, 0 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 8e5ec1b6..1cbf8ed8 100644..100755
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -62,6 +62,7 @@ INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/include/aul_window.h DESTINATION inclu
INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/include/aul_widget.h DESTINATION include/aul)
INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/include/aul_job_scheduler.h DESTINATION include/aul)
INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/include/aul_rpc_port.h DESTINATION include/aul)
+INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/include/aul_complication.h DESTINATION include/aul)
INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/aul.pc DESTINATION ${LIB_INSTALL_DIR}/pkgconfig)
INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/feature/preexec_list.txt DESTINATION ${SHARE_INSTALL_PREFIX}/aul )
INSTALL(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/data/miregex DESTINATION ${SHARE_INSTALL_PREFIX}/aul )
diff --git a/include/aul_cmd.h b/include/aul_cmd.h
index 82849bc6..7a944fa4 100644..100755
--- a/include/aul_cmd.h
+++ b/include/aul_cmd.h
@@ -132,6 +132,7 @@ enum app_cmd {
RPC_PORT_CREATE_SOCKET_PAIR = 101,
RPC_PORT_NOTIFY_RPC_FINISHED = 102,
+ COMPLICATION_UPDATE_REQUEST = 103,
APP_CMD_MAX
};
diff --git a/include/aul_complication.h b/include/aul_complication.h
new file mode 100755
index 00000000..ac072fe6
--- /dev/null
+++ b/include/aul_complication.h
@@ -0,0 +1,31 @@
+/*
+ * Copyright (c) 2018 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef __AUL_COMPLICATION_H__
+#define __AUL_COMPLICATION_H__
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+int aul_complication_update_request(const char *appid, const char *provider_appid, uid_t uid);
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __AUL_COMPLICATION_H__ */
diff --git a/src/aul_complication.c b/src/aul_complication.c
new file mode 100755
index 00000000..53ca32d4
--- /dev/null
+++ b/src/aul_complication.c
@@ -0,0 +1,81 @@
+/*
+ * Copyright (c) 2018 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#define _GNU_SOURCE
+#include <stdio.h>
+#include <sys/types.h>
+#include <unistd.h>
+#include <bundle_internal.h>
+
+#include "aul_api.h"
+#include "aul_util.h"
+#include "aul_sock.h"
+#include "aul_complication.h"
+#include "aul.h"
+
+#define MAX_UID_STR_BUFSZ 20
+
+API int aul_complication_update_request(const char *appid, const char *provider_appid, uid_t uid)
+{
+ bundle *b;
+ int r;
+ char buf[MAX_UID_STR_BUFSZ];
+
+ if (!appid || !provider_appid) {
+ _E("Invalid parameter");
+ return AUL_R_EINVAL;
+ }
+
+ b = bundle_create();
+ if (!b) {
+ _E("Out of memory");
+ return AUL_R_ERROR;
+ }
+
+ r = bundle_add(b, AUL_K_CALLER_APPID, appid);
+ if (r != BUNDLE_ERROR_NONE) {
+ _E("Failed to add appid(%s)", appid);
+ bundle_free(b);
+ return AUL_R_ERROR;
+ }
+
+ r = bundle_add(b, AUL_K_APPID, provider_appid);
+ if (r != BUNDLE_ERROR_NONE) {
+ _E("Failed to add provider_appid(%s)", provider_appid);
+ bundle_free(b);
+ return AUL_R_ERROR;
+ }
+
+ snprintf(buf, sizeof(buf), "%d", uid);
+ r = bundle_add(b, AUL_K_TARGET_UID, buf);
+ if (r != BUNDLE_ERROR_NONE) {
+ _E("Failed to add uid(%d)", uid);
+ bundle_free(b);
+ return AUL_R_ERROR;
+ }
+
+ r = aul_sock_send_bundle(AUL_UTIL_PID, getuid(),
+ COMPLICATION_UPDATE_REQUEST, b, AUL_SOCK_QUEUE);
+ if (r < 0) {
+ _E("Failed to send request(%d:%s)",
+ COMPLICATION_UPDATE_REQUEST, appid);
+ bundle_free(b);
+ return r;
+ }
+ bundle_free(b);
+
+ return AUL_R_OK;
+}