- This is for Tizen 4.0.
: Tizen 4.0 Configurability and Build Blocks require
to remove all profile-depending build options in spec files.
(No More profile macros)
: Because per-profile difference could be resolved in runtime
in this package, the subpackaging has not become complex.
- The differences in binary size for non-TV profiels is about 2kiB.
Change-Id: I61cd193744cdf1976a18be700e77da62ef2b66c0
Signed-off-by: MyungJoo Ham <myungjoo.ham@samsung.com>
capi-base-common
capi-system-info
gio-2.0
-)
-
-IF("${TIZEN_FEATURE_TRACKER}" STREQUAL "on")
-SET(PKG_MODULES ${PKG_MODULES}
tracker
)
-ADD_DEFINITIONS("-DTIZEN_FEATURE_TRACKER")
-ENDIF("${TIZEN_FEATURE_TRACKER}" STREQUAL "on")
INCLUDE(FindPkgConfig)
pkg_check_modules(${fw_name} REQUIRED ${PKG_MODULES})
-%define TIZEN_FEATURE_TRACKER on
-
-%if "%{?profile}" == "tv"
-%define TIZEN_FEATURE_TRACKER off
-%endif
-
Name: capi-system-device
Summary: A Device library in TIZEN C API
Version: 0.1.0
BuildRequires: pkgconfig(dlog)
BuildRequires: pkgconfig(vconf)
BuildRequires: pkgconfig(gio-2.0)
-%if %{?TIZEN_FEATURE_TRACKER} == "on"
BuildRequires: pkgconfig(tracker)
-%endif
%description
A Device library in TIZEN C API package.
cp %{SOURCE1} .
MAJORVER=`echo %{version} | awk 'BEGIN {FS="."}{print $1}'`
%cmake . -DFULLVER=%{version} \
- -DMAJORVER=${MAJORVER} \
- -DTIZEN_FEATURE_TRACKER=%{TIZEN_FEATURE_TRACKER}
+ -DMAJORVER=${MAJORVER}
%__make %{?jobs:-j%jobs}
#include <stdio.h>
#include <string.h>
#include <errno.h>
+#include <stdlib.h>
+#include <system_info.h>
#include "common.h"
#define MAX_LINE 128
_E("Failed to read %s:%d!", file_name, lineno);
return ret;
}
+
+tizen_profile_t _get_tizen_profile()
+{
+ static tizen_profile_t profile = TIZEN_PROFILE_UNKNOWN;
+ if (__builtin_expect(profile != TIZEN_PROFILE_UNKNOWN, 1))
+ return profile;
+
+ char *profileName;
+ system_info_get_platform_string("http://tizen.org/feature/profile", &profileName);
+ switch (*profileName) {
+ 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;
+ }
+ free(profileName);
+
+ return profile;
+}
\ No newline at end of file
int cb(struct parse_result *result, void *data),
void *user_data);
+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;
+extern tizen_profile_t _get_tizen_profile();
+
+#define TIZEN_FEATURE_TRACKER (_get_tizen_profile() == TIZEN_PROFILE_TV)
+
#endif /* __COMMON_H__ */
#include <errno.h>
#include <glib.h>
#include <limits.h>
-
-#ifdef TIZEN_FEATURE_TRACKER
#include <tracker.h>
-#endif /* TIZEN_FEATURE_TRACKER */
#include "power.h"
#include "display.h"
#define POWER_CONF "/etc/deviced/device/power.conf"
-#ifdef TIZEN_FEATURE_TRACKER
static guint off_lock_timeout;
static guint padding_timeout;
static int prev_count;
static GList *request_id_list;
-#endif
-
static struct _lock_timeout {
unsigned int release;
unsigned int padding;
return NULL;
}
-#ifdef TIZEN_FEATURE_TRACKER
static void remove_off_lock_timeout(void)
{
+ if (!TIZEN_FEATURE_TRACKER)
+ return;
if (off_lock_timeout) {
_I("Power lock timeout handler removed");
g_source_remove(off_lock_timeout);
static void remove_padding_timeout(void)
{
+ if (!TIZEN_FEATURE_TRACKER)
+ return;
if (padding_timeout) {
_I("Padding timeout handler removed");
g_source_remove(padding_timeout);
{
guint id;
+ if (!TIZEN_FEATURE_TRACKER)
+ return;
+
remove_off_lock_timeout();
remove_padding_timeout();
else
_E("Failed to add Power Lock timeout handler");
}
-#else
-#define add_off_lock_timeout() do {} while (0)
-#define remove_off_lock_timeout() do {} while (0)
-#define remove_padding_timeout() do {} while (0)
-#endif /* TIZEN_FEATURE_TRACKER */
static void lock_cb(void *data, GVariant *result, GError *err)
{