[Download] Enable download with net_proxy 36/146636/4
authorPawel Wasowski <p.wasowski2@partner.samsung.com>
Tue, 29 Aug 2017 14:12:17 +0000 (16:12 +0200)
committerPawel Wasowski <p.wasowski2@partner.samsung.com>
Wed, 30 Aug 2017 13:57:33 +0000 (15:57 +0200)
[Verification] TCT download pass rate, (wearable connected
               to the internet with Android mobile as a network proxy,
               no Wi-Fi/cellular network connection): 100 %

Change-Id: I0efb8c2d5281d5249dad46d58eaf8aa7c5ddc930
Signed-off-by: Pawel Wasowski <p.wasowski2@partner.samsung.com>
src/download/download_instance.cc

index 490c183b1a3b3c3b5687583c2cbaef7e4799a795..dca989a440756cb1568a81feb487227df6f7a350 100755 (executable)
@@ -514,43 +514,41 @@ void DownloadInstance::DownloadManagerStart
   bool network_support = false;
   bool cell_support = false;
   bool wifi_support = false;
-  bool ethernet_support = false;
 
   system_info_get_platform_bool("http://tizen.org/feature/network.telephony",
                                 &cell_support);
   system_info_get_platform_bool("http://tizen.org/feature/network.wifi",
                                 &wifi_support);
-  system_info_get_platform_bool("http://tizen.org/feature/network.ethernet",
-                                &ethernet_support);
 
   connection_h connection = nullptr;
   connection_create(&connection);
 
   connection_cellular_state_e cell_state = CONNECTION_CELLULAR_STATE_OUT_OF_SERVICE;
   connection_wifi_state_e wifi_state = CONNECTION_WIFI_STATE_DEACTIVATED;
-  connection_ethernet_state_e ethernet_state = CONNECTION_ETHERNET_STATE_DEACTIVATED;
 
   connection_get_cellular_state(connection, &cell_state);
   connection_get_wifi_state(connection, &wifi_state);
-  connection_get_ethernet_state(connection, &ethernet_state);
+
+  connection_type_e connection_type = CONNECTION_TYPE_DISCONNECTED;
+  connection_get_type(connection, &connection_type);
+
   connection_destroy(connection);
 
   bool network_available = false;
   bool cell_available = (CONNECTION_CELLULAR_STATE_CONNECTED == cell_state);
   bool wifi_available = (CONNECTION_WIFI_STATE_CONNECTED == wifi_state);
-  bool ethernet_available = CONNECTION_ETHERNET_STATE_CONNECTED == ethernet_state;
 
-  if (networkType == "CELLULAR") {
+  if ("CELLULAR" == networkType) {
     network_support = cell_support;
     network_available = cell_available;
     diPtr->network_type = DOWNLOAD_NETWORK_DATA_NETWORK;
-  } else if (networkType == "WIFI") {
+  } else if ("WIFI" == networkType) {
     network_support = wifi_support;
     network_available = wifi_available;
     diPtr->network_type = DOWNLOAD_NETWORK_WIFI;
-  } else if (networkType == "ALL") {
-    network_support = cell_support || wifi_support || ethernet_support;
-    network_available = cell_available || wifi_available || ethernet_available;
+  } else if (("ALL" == networkType) && (CONNECTION_TYPE_DISCONNECTED != connection_type)) {
+    network_support = true;
+    network_available = true;
     diPtr->network_type = DOWNLOAD_NETWORK_ALL;
   } else {
     LogAndReportError(
@@ -561,7 +559,10 @@ void DownloadInstance::DownloadManagerStart
     return;
   }
 
-  if (!network_support) {
+  /*
+   * There is no relevant feature for networkType == "ALL".
+   */
+  if (!network_support && ("ALL" != networkType)) {
     LogAndReportError(
         common::PlatformResult(common::ErrorCode::NOT_SUPPORTED_ERR,
                                "The networkType of the given DownloadRequest "