From: Piotr Kosko Date: Wed, 13 Jul 2016 12:21:11 +0000 (+0200) Subject: [Systeminfo] Return partial results for STORAGE if dbus fail X-Git-Tag: submit/tizen/20160808.053811~11^2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=refs%2Fchanges%2F32%2F79932%2F2;p=platform%2Fcore%2Fapi%2Fwebapi-plugins.git [Systeminfo] Return partial results for STORAGE if dbus fail [Feature] If dbus call failed, results was empty. Now returned array will hold as much data as it is possible, internal storage information would be returned. DBUS fails would be silent. [Verification] Code compiles without errors. TCT passrate is 100%. Change-Id: I65a98a95ab69416af5c61737eb93f98a7d7c3625 Signed-off-by: Piotr Kosko --- diff --git a/src/common/filesystem/filesystem_provider_deviced.cc b/src/common/filesystem/filesystem_provider_deviced.cc index 81bb5705..3c22667d 100644 --- a/src/common/filesystem/filesystem_provider_deviced.cc +++ b/src/common/filesystem/filesystem_provider_deviced.cc @@ -231,6 +231,11 @@ Storages FilesystemProviderDeviced::GetStorages() { return Storages(); } + // internal storages are gathered with storage api + Storages internal = virtual_roots_provider_.GetStorages(); + + // external storages are gathered using deviced implementation + Storages result; GError* error = nullptr; GVariant* variant = g_dbus_connection_call_sync(dbus_, kBus, @@ -246,12 +251,10 @@ Storages FilesystemProviderDeviced::GetStorages() { if (!variant || error) { std::string message = error ? error->message : ""; LoggerE("Failed to call GetDeviceList method - %s", message.c_str()); - return Storages(); + } else { + LoggerD("GetDeviceList succeed - handling result"); + result = GetStoragesFromGVariant(variant); } - // internal storages are gathered with storage api - Storages internal = virtual_roots_provider_.GetStorages(); - // external storages are gathered using deviced implementation - Storages result = GetStoragesFromGVariant(variant); // merging internal and external results together, but internal on the beginning result.insert(result.begin(), internal.begin(), internal.end());