PKG_CHECK_MODULES(GIO_DEPS REQUIRED gio-2.0)
PKG_CHECK_MODULES(GLIB_DEPS REQUIRED glib-2.0)
PKG_CHECK_MODULES(GMOCK_DEPS REQUIRED gmock)
+PKG_CHECK_MODULES(INIPARSER_DEPS REQUIRED iniparser)
PKG_CHECK_MODULES(LIBSMACK_DEPS REQUIRED libsmack)
PKG_CHECK_MODULES(LIBTZPLATFORM_CONFIG_DEPS REQUIRED libtzplatform-config)
PKG_CHECK_MODULES(LIBXML_DEPS REQUIRED libxml-2.0)
BuildRequires: pkgconfig(gio-2.0)
BuildRequires: pkgconfig(glib-2.0)
BuildRequires: pkgconfig(gmock)
+BuildRequires: pkgconfig(iniparser)
BuildRequires: pkgconfig(libsmack)
BuildRequires: pkgconfig(libtzplatform-config)
BuildRequires: pkgconfig(libxml-2.0)
APPLY_PKG_CONFIG(${TARGET_AUL} PUBLIC
BUNDLE_DEPS
+ CAPI_SYSTEM_INFO_DEPS
CAPI_SYSTEM_RESOURCE_DEPS
DLOG_DEPS
GIO_DEPS
GLIB_DEPS
+ INIPARSER_DEPS
LIBSMACK_DEPS
LIBTZPLATFORM_CONFIG_DEPS
PARCEL_DEPS
#include <sys/types.h>
#include <tzplatform_config.h>
#include <unistd.h>
+#include <vconf.h>
#include "aul/aul_api.h"
#include "aul/aul_util.h"
constexpr const int MAX_NR_OF_DESCRIPTORS = 2;
constexpr const int MAX_PAYLOAD_SIZE = 1024 * 1024 * 1;
+constexpr const char PATH_AUL_SOCKET_TIMEOUT[] = "/run/aul/.socket_timeout";
constexpr const char PATH_AMD_SOCK[] = "/run/aul/daemons/.amd-sock";
constexpr unsigned int SOCKET_TIMEOUT_MIN = 5000U;
public:
SocketTimeout() = default;
- ~SocketTimeout() = default;
+ ~SocketTimeout() {
+ if (initialized_)
+ vconf_ignore_key_changed(VCONFKEY_AUL_SOCKET_TIMEOUT, VconfCb);
+ }
timeval GetTimeval() const {
return time_val_;
}
+ bool IsInitialized() const {
+ return initialized_;
+ }
+
+ void Init() {
+ if (access(PATH_AUL_SOCKET_TIMEOUT, F_OK) != 0) {
+ initialized_ = true;
+ return;
+ }
+
+ double timeout = 5.2f;
+ int ret = vconf_get_dbl(VCONFKEY_AUL_SOCKET_TIMEOUT, &timeout);
+ if (ret != VCONF_OK)
+ _E("vconf_get_dbl() is failed. error(%d)", ret);
+
+ ret = vconf_notify_key_changed(VCONFKEY_AUL_SOCKET_TIMEOUT, VconfCb, this);
+ if (ret != VCONF_OK)
+ _E("vconf_notify_key_changed() is failed. error(%d)", ret);
+
+ SetTimeout(timeout);
+ initialized_ = true;
+ }
+
+ private:
+ static void VconfCb(keynode_t* node, void* user_data) {
+ auto* h = static_cast<SocketTimeout*>(user_data);
+ double timeout = vconf_keynode_get_dbl(node);
+ h->SetTimeout(timeout);
+ }
+
+ void SetTimeout(double timeout) {
+ char buf[12];
+ snprintf(buf, sizeof(buf), "%.3f", timeout);
+ gchar* ptr = nullptr;
+ time_val_.tv_sec = g_ascii_strtoll(buf, &ptr, 10);
+ time_val_.tv_usec = g_ascii_strtoll(ptr + 1, &ptr, 10) * 1000;
+ }
+
private:
+ bool initialized_ = false;
timeval time_val_ = { 5, 200 * 1000 };
};
return ret;
if (cli) {
+ if (TIZEN_FEATURE_SOCKET_TIMEOUT && !socket_timeout.IsInitialized())
+ socket_timeout.Init();
+
auto timeout = socket_timeout.GetTimeval();
ret = setsockopt(fd, SOL_SOCKET, SO_RCVTIMEO, &timeout, sizeof(timeout));
if (ret != 0)
#include <bundle_internal.h>
#include <dlfcn.h>
#include <glib.h>
+#include <iniparser.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
--- /dev/null
+/*
+ * Copyright (c) 2016 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 <stdlib.h>
+#include <system_info.h>
+#include "aul_util.h"
+
+tizen_profile_t _get_tizen_profile(void)
+{
+ static tizen_profile_t profile = TIZEN_PROFILE_UNKNOWN;
+ char *profile_name = NULL;
+
+ if (__builtin_expect(profile != TIZEN_PROFILE_UNKNOWN, 1))
+ return profile;
+
+ system_info_get_platform_string("http://tizen.org/feature/profile",
+ &profile_name);
+ if (profile_name == NULL)
+ return profile;
+
+ switch (*profile_name) {
+ case 'm':
+ case 'M':
+ profile = TIZEN_PROFILE_MOBILE;
+ break;
+ case 'w':
+ case 'W':
+ profile = TIZEN_PROFILE_WEARABLE;
+ break;
+ case 't':
+ case 'T':
+ profile = TIZEN_PROFILE_TV;
+ break;
+ case 'i':
+ case 'I':
+ profile = TIZEN_PROFILE_IVI;
+ break;
+ default: /* common or unknown ==> ALL ARE COMMON. */
+ profile = TIZEN_PROFILE_COMMON;
+ break;
+ }
+ free(profile_name);
+
+ return profile;
+}
#define REGULAR_UID_MIN 5000
#define MAX_RUNNING_INSTANCE 10000
+typedef enum {
+ TIZEN_PROFILE_UNKNOWN = 0,
+ TIZEN_PROFILE_MOBILE = 0x1,
+ TIZEN_PROFILE_WEARABLE = 0x2,
+ TIZEN_PROFILE_TV = 0x4,
+ TIZEN_PROFILE_IVI = 0x8,
+ TIZEN_PROFILE_COMMON = 0x10,
+} tizen_profile_t;
+
+tizen_profile_t _get_tizen_profile(void);
+
+#define TIZEN_FEATURE_SOCKET_TIMEOUT (_get_tizen_profile() & TIZEN_PROFILE_TV)
+#define TIZEN_FEATURE_SHARE_PANEL (_get_tizen_profile() & TIZEN_PROFILE_MOBILE)
+#define TIZEN_FEATURE_APPSVC_ALIAS (!(_get_tizen_profile() & TIZEN_PROFILE_TV))
+
#ifdef __cplusplus
}
#endif
DLOG_DEPS
GIO_DEPS
GLIB_DEPS
+ INIPARSER_DEPS
LIBSMACK_DEPS
LIBTZPLATFORM_CONFIG_DEPS
LIBXML_DEPS