From 8f39e26afc05363402d77084fee4838e0058762b Mon Sep 17 00:00:00 2001 From: Minje Ahn Date: Wed, 16 Oct 2019 15:33:28 +0900 Subject: [PATCH] Add feature checker for external storage Feature of storage.external is false on wearable profile Change-Id: If47d348164e49ede353da1547ef6b352220ae097 Signed-off-by: Minje Ahn --- src/common/media-common-system.c | 32 +++++--------------------------- src/server/media-server-main.c | 20 ++++++++++++++++++-- src/server/media-server-thumb.c | 1 + 3 files changed, 24 insertions(+), 29 deletions(-) diff --git a/src/common/media-common-system.c b/src/common/media-common-system.c index 9637622..493be1b 100644 --- a/src/common/media-common-system.c +++ b/src/common/media-common-system.c @@ -246,8 +246,6 @@ static int __ms_gdbus_method_sync(const char *dest, const char *path, const char { GDBusConnection *g_bus = NULL; GError *error = NULL; - GDBusMessage *message = NULL; - GDBusMessage *reply = NULL; GVariant *reply_var = NULL; GVariantIter *iter = NULL; char *type_str = NULL; @@ -266,30 +264,10 @@ static int __ms_gdbus_method_sync(const char *dest, const char *path, const char return MS_MEDIA_ERR_INTERNAL; } - message = g_dbus_message_new_method_call(dest, path, interface, method); - if (!message) { - MS_DBG_ERR("g_dbus_message_new_method_call(%s:%s-%s)", path, interface, method); - g_object_unref(g_bus); - return MS_MEDIA_ERR_INTERNAL; - } - - g_dbus_message_set_body(message, g_variant_new("(s)", (gchar*)param)); - - reply = g_dbus_connection_send_message_with_reply_sync(g_bus, message, G_DBUS_SEND_MESSAGE_FLAGS_NONE, DBUS_REPLY_TIMEOUT, NULL, NULL, &error); - g_object_unref(message); - if (!reply) { - MS_DBG_ERR("dbus_connection_send error(%s) %s %s:%s-%s", - error ? error->message : "none", dest, path, interface, method); - g_error_free(error); - g_object_unref(message); - g_object_unref(g_bus); - return MS_MEDIA_ERR_INTERNAL; - } - - reply_var = g_dbus_message_get_body(reply); + reply_var = g_dbus_connection_call_sync(g_bus, dest, path, interface, method, g_variant_new("(s)", (gchar*)param), NULL, G_DBUS_SEND_MESSAGE_FLAGS_NONE, DBUS_REPLY_TIMEOUT, NULL, &error); if (!reply_var) { - MS_DBG_ERR("Failed to get the body of message"); - g_object_unref(reply); + MS_DBG_ERR("Failed to get GVariant[%s]", error->message); + g_error_free(error); g_object_unref(g_bus); return MS_MEDIA_ERR_INTERNAL; } @@ -297,7 +275,7 @@ static int __ms_gdbus_method_sync(const char *dest, const char *path, const char type_str = strdup((char*)g_variant_get_type_string(reply_var)); if (!type_str) { MS_DBG_ERR("Failed to get the type-string of message"); - g_object_unref(reply); + g_variant_unref(reply_var); g_object_unref(g_bus); return MS_MEDIA_ERR_INTERNAL; } @@ -351,7 +329,7 @@ static int __ms_gdbus_method_sync(const char *dest, const char *path, const char g_variant_iter_free(iter); - g_object_unref(reply); + g_variant_unref(reply_var); g_object_unref(g_bus); MS_SAFE_FREE(type_str); diff --git a/src/server/media-server-main.c b/src/server/media-server-main.c index f40bfc1..877c18d 100644 --- a/src/server/media-server-main.c +++ b/src/server/media-server-main.c @@ -63,6 +63,8 @@ static void __ms_remove_request_receiver(GIOChannel *channel); #endif static bool __ms_is_dcm_supported(void); +static bool __ms_is_external_supported(void); + static char *priv_lang = NULL; @@ -778,7 +780,8 @@ static void __ms_check_mediadb(void) #endif /* update external storage */ - __ms_update_storage_status(); + if (__ms_is_external_supported()) + __ms_update_storage_status(); #ifdef _USE_SENIOR_MODE __ms_check_disc_status(); @@ -786,7 +789,7 @@ static void __ms_check_mediadb(void) } -static bool __ms_is_dcm_supported() +static bool __ms_is_dcm_supported(void) { bool isFaceRecognitionSupported = false; /* face_recognition feature supported */ int dcm_service_mode = -1; /* media-content-config:dcm_activation */ @@ -814,3 +817,16 @@ static bool __ms_is_dcm_supported() return (isFaceRecognitionSupported && (dcm_service_mode == 1)) ? true : false; } +static bool __ms_is_external_supported(void) +{ + bool support = false; + + int nRetVal = system_info_get_platform_bool("http://tizen.org/feature/storage.external", &support); + if (nRetVal != SYSTEM_INFO_ERROR_NONE) { + MS_DBG_ERR("SYSTEM_INFO_ERROR: storage.external [%d]", nRetVal); + return false; + } + + return support; +} + diff --git a/src/server/media-server-thumb.c b/src/server/media-server-thumb.c index effcee8..717c911 100755 --- a/src/server/media-server-thumb.c +++ b/src/server/media-server-thumb.c @@ -538,6 +538,7 @@ gpointer ms_thumb_agent_start_thread(gpointer data) context = g_main_context_new(); if (!context) { MS_DBG_ERR("g_main_context_new failed"); + close(sockfd); return NULL; } -- 2.7.4