2 #include <system_info.h>
3 #include <download_private.h>
5 static __thread int feature_supported[DOWNLOAD_SUPPORTED_FEATURE_MAX] = { -1, -1, -1, -1};
7 static bool __check_feature_supported(const char *key, download_supported_feature_e feature)
9 if (feature_supported[feature] == -1) {
11 if (system_info_get_platform_bool(key, &value) < 0) {
12 TRACE_ERROR("Failed to get system info");
15 feature_supported[feature] = (int)value;
17 return (feature_supported[feature] > 0 ? true : false);
20 int _download_check_feature_supported(const char *feature, ...)
25 bool supported = false;
27 va_start(list, feature);
31 if (strcmp(key, DOWNLOAD_FEATURE) == 0)
32 value = __check_feature_supported(key, DOWNLOAD_SUPPORTED_FEATURE_DOWNLOAD);
33 else if (strcmp(key, TELEPHONY_FEATURE) == 0)
34 value = __check_feature_supported(key, DOWNLOAD_SUPPORTED_FEATURE_TELEPHONY);
35 else if (strcmp(key, WIFI_FEATURE) == 0)
36 value = __check_feature_supported(key, DOWNLOAD_SUPPORTED_FEATURE_WIFI);
37 else if (strcmp(key, WIFI_DIRECT_FEATURE) == 0)
38 value = __check_feature_supported(key, DOWNLOAD_SUPPORTED_FEATURE_WIFI_DIRECT);
41 key = va_arg(list, const char *);
46 TRACE_ERROR("Not supported features");
47 set_last_result(DOWNLOAD_ERROR_NOT_SUPPORTED);
49 return DOWNLOAD_ERROR_NOT_SUPPORTED;
52 set_last_result(DOWNLOAD_ERROR_NONE);
54 return DOWNLOAD_ERROR_NONE;