Fix for mock method feature check
[platform/core/api/location-manager.git] / src / locations.c
index 46e5b13..124ee3d 100755 (executable)
@@ -490,6 +490,11 @@ EXPORT_API int location_manager_create(location_method_e method, location_manage
                        LOCATIONS_LOGE("LOCATIONS_ERROR_NOT_SUPPORTED(0x%08x) : fail to location feature", LOCATIONS_ERROR_NOT_SUPPORTED);
                        return LOCATIONS_ERROR_NOT_SUPPORTED;
                }
+       } else if (method == LOCATIONS_METHOD_MOCK) {
+               if (__is_gps_supported() == LOCATIONS_ERROR_NOT_SUPPORTED) {
+                       LOCATIONS_LOGE("LOCATIONS_ERROR_NOT_SUPPORTED(0x%08x) : fail to location feature", LOCATIONS_ERROR_NOT_SUPPORTED);
+                       return LOCATIONS_ERROR_NOT_SUPPORTED;
+               }
        }
 
        LocationMethod _method = __convert_LocationMethod(method);
@@ -1504,6 +1509,8 @@ EXPORT_API int location_manager_set_mock_location(location_manager_h manager, co
 EXPORT_API int location_manager_clear_mock_location(location_manager_h manager)
 {
        LOCATIONS_NOT_SUPPORTED_CHECK(__is_location_supported());
+       LOCATIONS_NULL_ARG_CHECK(manager);
+
        location_manager_s *handle = (location_manager_s *) manager;
        int ret = LOCATION_ERROR_NONE;
        int enabled;
@@ -1511,7 +1518,7 @@ EXPORT_API int location_manager_clear_mock_location(location_manager_h manager)
        ret = location_is_enabled_method(LOCATION_METHOD_MOCK, &enabled);
        if (ret == LOCATIONS_ERROR_NONE) {
                if (enabled == 0) {
-                       return __convert_error_code(LOCATIONS_ERROR_SETTING_OFF);
+                       return __convert_error_code(LOCATION_ERROR_SETTING_OFF);
                }
        } else {
                return __convert_error_code(ret);