- 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)
- It is recommended to distinguish features/profiles at runtime.
unless it incurs too much overhead, which requires you to
create multiple binaries and subpackages.
Change-Id: I015b2f10cb6bd3cb84a9c0435202bc59004e752c
Signed-off-by: MyungJoo Ham <myungjoo.ham@samsung.com>
--- /dev/null
+/*
+ * Media Utility / Private Header
+ *
+ * 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.
+ *
+ */
+
+#ifndef _MEDIA_SERVER_PRIVATE_H_
+#define _MEDIA_SERVER_PRIVATE_H_
+#include <stdlib.h>
+#include <system_info.h>
+
+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;
+
+static tizen_profile_t profile = TIZEN_PROFILE_UNKNOWN;
+static char *profileName;
+static inline tizen_profile_t _get_tizen_profile()
+{
+ if (__builtin_expect(profile != TIZEN_PROFILE_UNKNOWN, 1))
+ return profile;
+
+ 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;
+}
+
+#define _USE_SDCARD (_get_tizen_profile() == TIZEN_PROFILE_MOBILE)
+#define _USE_TV_PATH (_get_tizen_profile() == TIZEN_PROFILE_TV)
+
+#endif /* _MEDIA_SERVER_PRIVATE_H_ */
#include "media-util.h"
#include "media-util-noti-internal.h"
+#include "private.h"
+
GArray *handle_list_internal;
static GMutex mutex_internal;
GDBusConnection *bus = NULL;
GError *error = NULL;
char repl_path[MAX_FILEPATH_LEN] = {0, };
-#if !defined(_USE_SENIOR_MODE) && !defined(_USE_TV_PATH)
+#if !defined(_USE_SENIOR_MODE)
char *tmp_path = NULL;
#endif
bus = g_bus_get_sync(G_BUS_TYPE_SYSTEM, NULL, &error);
}
memset(repl_path, 0, sizeof(repl_path));
-#if !defined(_USE_SENIOR_MODE) && !defined(_USE_TV_PATH)
- /* Need uid to change path */
- if (strncmp(path, MEDIA_ROOT_PATH_EXTERNAL, strlen(MEDIA_ROOT_PATH_EXTERNAL)) == 0) {
- snprintf(repl_path, sizeof(repl_path), "%s", path);
- } else {
- if (storage_get_origin_internal_path(path, MAX_FILEPATH_LEN, repl_path) != STORAGE_ERROR_NONE) {
- MSAPI_DBG("Failed to change internal path");
- return MS_MEDIA_ERR_INTERNAL;
+#if !defined(_USE_SENIOR_MODE)
+ if (!_USE_TV_PATH) {
+ /* Need uid to change path */
+ if (strncmp(path, MEDIA_ROOT_PATH_EXTERNAL, strlen(MEDIA_ROOT_PATH_EXTERNAL)) == 0) {
+ snprintf(repl_path, sizeof(repl_path), "%s", path);
+ } else {
+ if (storage_get_origin_internal_path(path, MAX_FILEPATH_LEN, repl_path) != STORAGE_ERROR_NONE) {
+ MSAPI_DBG("Failed to change internal path");
+ return MS_MEDIA_ERR_INTERNAL;
+ }
}
- }
- MSAPI_DBG("New path: [%s]", repl_path);
-#else
- snprintf(repl_path, sizeof(repl_path), "%s", path);
+ MSAPI_DBG("New path: [%s]", repl_path);
+ } else
#endif
+ {
+ snprintf(repl_path, sizeof(repl_path), "%s", path);
+ }
if (item == MS_MEDIA_ITEM_FILE) {
MSAPI_DBG("FILE CHANGED");
#include "media-util.h"
#include "media-util-noti.h"
+#include "private.h"
+
static GDBusConnection *g_bus = NULL;
static guint g_handler = 0;
static void *g_data_store = NULL;
GDBusConnection *bus = NULL;
GError *error = NULL;
char repl_path[MAX_FILEPATH_LEN] = {0, };
-#if !defined(_USE_SENIOR_MODE) && !defined(_USE_TV_PATH)
+#if !defined(_USE_SENIOR_MODE)
char *tmp_path = NULL;
#endif
}
memset(repl_path, 0, sizeof(repl_path));
-#if !defined(_USE_SENIOR_MODE) && !defined(_USE_TV_PATH)
- /* Need uid to change path */
- if (strncmp(path, MEDIA_ROOT_PATH_EXTERNAL, strlen(MEDIA_ROOT_PATH_EXTERNAL)) == 0) {
- snprintf(repl_path, sizeof(repl_path), "%s", path);
- } else {
- if (storage_get_origin_internal_path(path, MAX_FILEPATH_LEN, repl_path) != STORAGE_ERROR_NONE) {
- MSAPI_DBG("Failed to change internal path");
- return MS_MEDIA_ERR_INTERNAL;
+#if !defined(_USE_SENIOR_MODE)
+ if (!_USE_TV_PATH) {
+ /* Need uid to change path */
+ if (strncmp(path, MEDIA_ROOT_PATH_EXTERNAL, strlen(MEDIA_ROOT_PATH_EXTERNAL)) == 0) {
+ snprintf(repl_path, sizeof(repl_path), "%s", path);
+ } else {
+ if (storage_get_origin_internal_path(path, MAX_FILEPATH_LEN, repl_path) != STORAGE_ERROR_NONE) {
+ MSAPI_DBG("Failed to change internal path");
+ return MS_MEDIA_ERR_INTERNAL;
+ }
}
- }
- MSAPI_DBG("New path: [%s]", repl_path);
-#else
- snprintf(repl_path, sizeof(repl_path), "%s", path);
+ MSAPI_DBG("New path: [%s]", repl_path);
+ } else
#endif
+ {
+ snprintf(repl_path, sizeof(repl_path), "%s", path);
+ }
if (item == MS_MEDIA_ITEM_FILE) {
MSAPI_DBG("FILE CHANGED");
%if 0%{?product_tv}
export CFLAGS="$CFLAGS -D_USE_SENIOR_MODE -D_USE_RECORDED_CONTENT -D_USE_SUSPEND_MODE -D_SET_VIP_PROCESS"
%else
-%if "%{?profile}" == "mobile"
-export CFLAGS="$CFLAGS -D_USE_MULTI_USER -D_USE_META_UPDATE -D_USE_DEVICED_DBUS -D_USE_SDCARD"
-%else
-%if "%{?profile}" == "tv"
-export CFLAGS="$CFLAGS -D_USE_MULTI_USER -D_USE_META_UPDATE -D_USE_DEVICED_DBUS -D_USE_TV_PATH"
-%else
export CFLAGS="$CFLAGS -D_USE_MULTI_USER -D_USE_META_UPDATE -D_USE_DEVICED_DBUS"
%endif
-%endif
-%endif
export CFLAGS="$CFLAGS -DTIZEN_DEBUG_ENABLE -DSYSCONFDIR=\\\"%{_sysconfdir}\\\""
export CFLAGS+=" -DPATH_LIBDIR=\\\"%{_libdir}\\\""
rm -rf autom4te.cache
#include "media-scanner-socket-v2.h"
#include "media-scanner-extract-v2.h"
+#include "private.h"
+
#define APP_NAME "media-scanner-v2"
#define MSC_VCONF_KEY_SCANNER_POWEROFF_STATUS "db/mediascanner/poweroff_status"
storage_extract_thread = g_thread_new("storage_extract_thread", (GThreadFunc)msc_storage_extract_thread, NULL);
folder_extract_thread = g_thread_new("folder_extract_thread", (GThreadFunc)msc_folder_extract_thread, NULL);
-#ifdef _USE_SDCARD
- if (ms_is_mmc_inserted()) {
+ if (_USE_SDCARD && ms_is_mmc_inserted()) {
msc_set_mmc_status(MS_STG_INSERTED);
}
-#endif
MS_DBG_INFO("scanner v2 is ready");
msc_send_ready();
#include "media-scanner-scan.h"
#include "media-scanner-socket.h"
+#include "private.h"
+
static GMainLoop *scanner_mainloop = NULL;
#ifdef _USE_DEVICED_DBUS
scan_thread = g_thread_new("scanner_thread", (GThreadFunc)msc_directory_scan_thread, NULL);
register_thread = g_thread_new("register_thread", (GThreadFunc)msc_register_thread, NULL);
-#ifdef _USE_SDCARD
- if (ms_is_mmc_inserted()) {
+ if (_USE_SDCARD && ms_is_mmc_inserted()) {
msc_set_mmc_status(MS_STG_INSERTED);
}
-#endif
MS_DBG_INFO("scanner is ready");
msc_send_ready();
#include "media-server-dcm.h"
#include "media-server-db-manage.h"
+#include "private.h"
+
#define MS_VCONF_KEY_RESET_STATUS "db/media_server/reset_status"
extern GMutex scanner_mutex;
bool smarthub_reset;
static void __ms_check_mediadb(void);
-#ifdef _USE_SDCARD
static int __ms_check_mmc_status(void);
-#endif
static int __ms_check_usb_status(void);
static void __ms_add_signal_handler(void);
static void __ms_add_event_receiver(GIOChannel *channel);
}
////////////////////////////////////////////////////////////////////
-#ifdef _USE_SDCARD
static int __ms_check_mmc_status(void)
{
int ret = MS_MEDIA_ERR_NONE;
return MS_MEDIA_ERR_NONE;
}
-#endif
static int __ms_check_usb_status(void)
{
ms_send_storage_scan_request(ms_get_path(uid), INTERNAL_STORAGE_ID, MS_SCAN_PART, uid);
*/
/* update external storage */
-#ifdef _USE_SDCARD
- __ms_check_mmc_status();
-#endif
+ if (_USE_SDCARD)
+ __ms_check_mmc_status();
__ms_check_usb_status();
}