diff --git a/core/Android.mk b/core/Android.mk index c6d3128d..3650fbb3 100644 --- a/core/Android.mk +++ b/core/Android.mk @@ -20,7 +20,8 @@ LOCAL_SHARED_LIBRARIES := \ libutils \ libcutils \ libgps.utils \ - libdl + libdl \ + libloc_pla LOCAL_SRC_FILES += \ LocApiBase.cpp \ @@ -35,7 +36,8 @@ LOCAL_CFLAGS += \ LOCAL_C_INCLUDES:= \ $(TARGET_OUT_HEADERS)/gps.utils \ - $(TARGET_OUT_HEADERS)/libflp + $(TARGET_OUT_HEADERS)/libflp \ + $(TARGET_OUT_HEADERS)/libloc_pla LOCAL_COPY_HEADERS_TO:= libloc_core/ LOCAL_COPY_HEADERS:= \ diff --git a/loc_api/libloc_api_50001/Android.mk b/loc_api/libloc_api_50001/Android.mk index 62905e8c..cd4888d8 100644 --- a/loc_api/libloc_api_50001/Android.mk +++ b/loc_api/libloc_api_50001/Android.mk @@ -16,7 +16,8 @@ LOCAL_SHARED_LIBRARIES := \ libdl \ liblog \ libloc_core \ - libgps.utils + libgps.utils \ + libloc_pla LOCAL_SRC_FILES += \ loc_eng.cpp \ @@ -42,7 +43,8 @@ LOCAL_C_INCLUDES:= \ $(TARGET_OUT_HEADERS)/gps.utils \ $(TARGET_OUT_HEADERS)/libloc_core \ hardware/qcom/gps/loc_api/libloc_api_50001 \ - $(TARGET_OUT_HEADERS)/libflp + $(TARGET_OUT_HEADERS)/libflp \ + $(TARGET_OUT_HEADERS)/libloc_pla LOCAL_COPY_HEADERS_TO:= libloc_eng/ LOCAL_COPY_HEADERS:= \ @@ -75,7 +77,8 @@ LOCAL_SHARED_LIBRARIES := \ libloc_eng \ libloc_core \ libgps.utils \ - libdl + libdl \ + libloc_pla ifneq ($(filter $(TARGET_DEVICE), apq8084 msm8960), false) endif @@ -96,7 +99,8 @@ endif LOCAL_C_INCLUDES:= \ $(TARGET_OUT_HEADERS)/gps.utils \ $(TARGET_OUT_HEADERS)/libloc_core \ - $(TARGET_OUT_HEADERS)/libflp + $(TARGET_OUT_HEADERS)/libflp \ + $(TARGET_OUT_HEADERS)/libloc_pla LOCAL_PRELINK_MODULE := false LOCAL_MODULE_RELATIVE_PATH := hw diff --git a/loc_api/libloc_api_50001/LocEngAdapter.cpp b/loc_api/libloc_api_50001/LocEngAdapter.cpp index f3290dbd..592662df 100644 --- a/loc_api/libloc_api_50001/LocEngAdapter.cpp +++ b/loc_api/libloc_api_50001/LocEngAdapter.cpp @@ -339,10 +339,6 @@ void LocEngAdapter::requestPowerVote() LOC_LOGV("LocEngAdapterVotePower - Vote Power: %d", (int)powerUp); setGpsLock(powerUp ? 103 : 101); } -#ifndef USE_GLIB - delete mUlp; - mUlp = ulp; -#endif } void LocInternalAdapter::reportPosition(UlpLocation &location, diff --git a/utils/Android.mk b/utils/Android.mk index 240d11fa..45f3c25a 100644 --- a/utils/Android.mk +++ b/utils/Android.mk @@ -6,11 +6,13 @@ LOCAL_PATH := $(call my-dir) include $(CLEAR_VARS) + ## Libs LOCAL_SHARED_LIBRARIES := \ libutils \ libcutils \ - liblog + liblog \ + libloc_pla LOCAL_SRC_FILES += \ loc_log.cpp \ @@ -38,7 +40,7 @@ LOCAL_LDFLAGS += -Wl,--export-dynamic ## Includes LOCAL_C_INCLUDES:= \ - $(LOCAL_PATH)/platform_lib_abstractions + $(TARGET_OUT_HEADERS)/libloc_pla LOCAL_COPY_HEADERS_TO:= gps.utils/ LOCAL_COPY_HEADERS:= \ @@ -54,9 +56,6 @@ LOCAL_COPY_HEADERS:= \ loc_target.h \ loc_timer.h \ LocSharedLock.h \ - platform_lib_abstractions/platform_lib_includes.h \ - platform_lib_abstractions/platform_lib_time.h \ - platform_lib_abstractions/platform_lib_macros.h \ loc_misc_utils.h LOCAL_MODULE := libgps.utils @@ -66,5 +65,7 @@ LOCAL_MODULE_TAGS := optional LOCAL_PRELINK_MODULE := false include $(BUILD_SHARED_LIBRARY) + +include $(addsuffix /Android.mk, $(addprefix $(LOCAL_PATH)/, platform_lib_abstractions)) endif # not BUILD_TINY_ANDROID endif # BOARD_VENDOR_QCOM_GPS_LOC_API_HARDWARE diff --git a/utils/log_util.h b/utils/log_util.h new file mode 100644 index 00000000..ffd5ca97 --- /dev/null +++ b/utils/log_util.h @@ -0,0 +1,189 @@ +/* Copyright (c) 2011-2014 The Linux Foundation. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials provided + * with the distribution. + * * Neither the name of The Linux Foundation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR + * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE + * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN + * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#ifndef __LOG_UTIL_H__ +#define __LOG_UTIL_H__ + +#ifndef USE_GLIB +#include +#endif /* USE_GLIB */ + +#ifdef USE_GLIB + +#include +#include +#include + +#ifndef LOG_TAG +#define LOG_TAG "GPS_UTILS" + +#endif // LOG_TAG + +#endif /* USE_GLIB */ + +#ifdef __cplusplus +extern "C" +{ +#endif +/*============================================================================= + * + * LOC LOGGER TYPE DECLARATION + * + *============================================================================*/ +/* LOC LOGGER */ +typedef struct loc_logger_s +{ + unsigned long DEBUG_LEVEL; + unsigned long TIMESTAMP; +} loc_logger_s_type; + +/*============================================================================= + * + * EXTERNAL DATA + * + *============================================================================*/ +extern loc_logger_s_type loc_logger; + +// Logging Improvements +extern const char *loc_logger_boolStr[]; + +extern const char *boolStr[]; +extern const char VOID_RET[]; +extern const char FROM_AFW[]; +extern const char TO_MODEM[]; +extern const char FROM_MODEM[]; +extern const char TO_AFW[]; +extern const char EXIT_TAG[]; +extern const char ENTRY_TAG[]; +extern const char EXIT_ERROR_TAG[]; + +/*============================================================================= + * + * MODULE EXPORTED FUNCTIONS + * + *============================================================================*/ +extern void loc_logger_init(unsigned long debug, unsigned long timestamp); +extern char* get_timestamp(char* str, unsigned long buf_size); + +#ifndef DEBUG_DMN_LOC_API + +/* LOGGING MACROS */ +/*loc_logger.DEBUG_LEVEL is initialized to 0xff in loc_cfg.cpp + if that value remains unchanged, it means gps.conf did not + provide a value and we default to the initial value to use + Android's logging levels*/ +#define IF_LOC_LOGE if((loc_logger.DEBUG_LEVEL >= 1) && (loc_logger.DEBUG_LEVEL <= 5)) + +#define IF_LOC_LOGW if((loc_logger.DEBUG_LEVEL >= 2) && (loc_logger.DEBUG_LEVEL <= 5)) + +#define IF_LOC_LOGI if((loc_logger.DEBUG_LEVEL >= 3) && (loc_logger.DEBUG_LEVEL <= 5)) + +#define IF_LOC_LOGD if((loc_logger.DEBUG_LEVEL >= 4) && (loc_logger.DEBUG_LEVEL <= 5)) + +#define IF_LOC_LOGV if((loc_logger.DEBUG_LEVEL >= 5) && (loc_logger.DEBUG_LEVEL <= 5)) + +#define LOC_LOGE(...) \ +IF_LOC_LOGE { ALOGE("E/" __VA_ARGS__); } \ +else if (loc_logger.DEBUG_LEVEL == 0xff) { ALOGE("E/" __VA_ARGS__); } + +#define LOC_LOGW(...) \ +IF_LOC_LOGW { ALOGE("W/" __VA_ARGS__); } \ +else if (loc_logger.DEBUG_LEVEL == 0xff) { ALOGW("W/" __VA_ARGS__); } + +#define LOC_LOGI(...) \ +IF_LOC_LOGI { ALOGE("I/" __VA_ARGS__); } \ +else if (loc_logger.DEBUG_LEVEL == 0xff) { ALOGI("I/" __VA_ARGS__); } + +#define LOC_LOGD(...) \ +IF_LOC_LOGD { ALOGE("D/" __VA_ARGS__); } \ +else if (loc_logger.DEBUG_LEVEL == 0xff) { ALOGD("D/" __VA_ARGS__); } + +#define LOC_LOGV(...) \ +IF_LOC_LOGV { ALOGE("V/" __VA_ARGS__); } \ +else if (loc_logger.DEBUG_LEVEL == 0xff) { ALOGV("V/" __VA_ARGS__); } + +#else /* DEBUG_DMN_LOC_API */ + +#define LOC_LOGE(...) ALOGE("E/" __VA_ARGS__) + +#define LOC_LOGW(...) ALOGW("W/" __VA_ARGS__) + +#define LOC_LOGI(...) ALOGI("I/" __VA_ARGS__) + +#define LOC_LOGD(...) ALOGD("D/" __VA_ARGS__) + +#define LOC_LOGV(...) ALOGV("V/" __VA_ARGS__) + +#endif /* DEBUG_DMN_LOC_API */ + +/*============================================================================= + * + * LOGGING IMPROVEMENT MACROS + * + *============================================================================*/ +#define LOG_(LOC_LOG, ID, WHAT, SPEC, VAL) \ + do { \ + if (loc_logger.TIMESTAMP) { \ + char ts[32]; \ + LOC_LOG("[%s] %s %s line %d " #SPEC, \ + get_timestamp(ts, sizeof(ts)), ID, WHAT, __LINE__, VAL); \ + } else { \ + LOC_LOG("%s %s line %d " #SPEC, \ + ID, WHAT, __LINE__, VAL); \ + } \ + } while(0) + +#define LOG_I(ID, WHAT, SPEC, VAL) LOG_(LOC_LOGI, ID, WHAT, SPEC, VAL) +#define LOG_V(ID, WHAT, SPEC, VAL) LOG_(LOC_LOGV, ID, WHAT, SPEC, VAL) +#define LOG_E(ID, WHAT, SPEC, VAL) LOG_(LOC_LOGE, ID, WHAT, SPEC, VAL) + +#define ENTRY_LOG() LOG_V(ENTRY_TAG, __func__, %s, "") +#define EXIT_LOG(SPEC, VAL) LOG_V(EXIT_TAG, __func__, SPEC, VAL) +#define EXIT_LOG_WITH_ERROR(SPEC, VAL) \ + if (VAL != 0) { \ + LOG_E(EXIT_ERROR_TAG, __func__, SPEC, VAL); \ + } else { \ + LOG_V(EXIT_TAG, __func__, SPEC, VAL); \ + } + + +// Used for logging callflow from Android Framework +#define ENTRY_LOG_CALLFLOW() LOG_I(FROM_AFW, __func__, %s, "") +// Used for logging callflow to Modem +#define EXIT_LOG_CALLFLOW(SPEC, VAL) LOG_I(TO_MODEM, __func__, SPEC, VAL) +// Used for logging callflow from Modem(TO_MODEM, __func__, %s, "") +#define MODEM_LOG_CALLFLOW(SPEC, VAL) LOG_I(FROM_MODEM, __func__, SPEC, VAL) +// Used for logging callflow to Android Framework +#define CALLBACK_LOG_CALLFLOW(CB, SPEC, VAL) LOG_I(TO_AFW, CB, SPEC, VAL) + +#ifdef __cplusplus +} +#endif + +#endif // __LOG_UTIL_H__ diff --git a/utils/platform_lib_abstractions/Android.mk b/utils/platform_lib_abstractions/Android.mk new file mode 100644 index 00000000..b923a4c9 --- /dev/null +++ b/utils/platform_lib_abstractions/Android.mk @@ -0,0 +1,5 @@ +ifneq ($(BUILD_TINY_ANDROID),true) + +include $(call all-subdir-makefiles) + +endif diff --git a/utils/platform_lib_abstractions/loc_pla/Android.mk b/utils/platform_lib_abstractions/loc_pla/Android.mk new file mode 100644 index 00000000..b923a4c9 --- /dev/null +++ b/utils/platform_lib_abstractions/loc_pla/Android.mk @@ -0,0 +1,5 @@ +ifneq ($(BUILD_TINY_ANDROID),true) + +include $(call all-subdir-makefiles) + +endif diff --git a/platform_lib_abstractions/loc_pla/Makefile.am b/utils/platform_lib_abstractions/loc_pla/Makefile.am similarity index 100% rename from platform_lib_abstractions/loc_pla/Makefile.am rename to utils/platform_lib_abstractions/loc_pla/Makefile.am diff --git a/platform_lib_abstractions/loc_pla/configure.ac b/utils/platform_lib_abstractions/loc_pla/configure.ac similarity index 100% rename from platform_lib_abstractions/loc_pla/configure.ac rename to utils/platform_lib_abstractions/loc_pla/configure.ac diff --git a/platform_lib_abstractions/loc_pla/include/platform_lib_android_runtime.h b/utils/platform_lib_abstractions/loc_pla/include/platform_lib_android_runtime.h similarity index 100% rename from platform_lib_abstractions/loc_pla/include/platform_lib_android_runtime.h rename to utils/platform_lib_abstractions/loc_pla/include/platform_lib_android_runtime.h diff --git a/platform_lib_abstractions/loc_pla/include/platform_lib_gettid.h b/utils/platform_lib_abstractions/loc_pla/include/platform_lib_gettid.h similarity index 100% rename from platform_lib_abstractions/loc_pla/include/platform_lib_gettid.h rename to utils/platform_lib_abstractions/loc_pla/include/platform_lib_gettid.h diff --git a/platform_lib_abstractions/loc_pla/include/platform_lib_includes.h b/utils/platform_lib_abstractions/loc_pla/include/platform_lib_includes.h similarity index 100% rename from platform_lib_abstractions/loc_pla/include/platform_lib_includes.h rename to utils/platform_lib_abstractions/loc_pla/include/platform_lib_includes.h diff --git a/platform_lib_abstractions/loc_pla/include/platform_lib_log_util.h b/utils/platform_lib_abstractions/loc_pla/include/platform_lib_log_util.h similarity index 100% rename from platform_lib_abstractions/loc_pla/include/platform_lib_log_util.h rename to utils/platform_lib_abstractions/loc_pla/include/platform_lib_log_util.h diff --git a/platform_lib_abstractions/loc_pla/include/platform_lib_macros.h b/utils/platform_lib_abstractions/loc_pla/include/platform_lib_macros.h similarity index 100% rename from platform_lib_abstractions/loc_pla/include/platform_lib_macros.h rename to utils/platform_lib_abstractions/loc_pla/include/platform_lib_macros.h diff --git a/platform_lib_abstractions/loc_pla/include/platform_lib_property_service.h b/utils/platform_lib_abstractions/loc_pla/include/platform_lib_property_service.h similarity index 98% rename from platform_lib_abstractions/loc_pla/include/platform_lib_property_service.h rename to utils/platform_lib_abstractions/loc_pla/include/platform_lib_property_service.h index 006c94d5..ed2041f9 100644 --- a/platform_lib_abstractions/loc_pla/include/platform_lib_property_service.h +++ b/utils/platform_lib_abstractions/loc_pla/include/platform_lib_property_service.h @@ -32,8 +32,9 @@ #ifdef __cplusplus extern "C" { #endif - +#ifndef PROPERTY_VALUE_MAX #define PROPERTY_VALUE_MAX 92 +#endif int platform_lib_abstraction_property_get(const char *key, char *value, const char *default_value); #ifdef __cplusplus diff --git a/platform_lib_abstractions/loc_pla/include/platform_lib_sched_policy.h b/utils/platform_lib_abstractions/loc_pla/include/platform_lib_sched_policy.h similarity index 100% rename from platform_lib_abstractions/loc_pla/include/platform_lib_sched_policy.h rename to utils/platform_lib_abstractions/loc_pla/include/platform_lib_sched_policy.h diff --git a/platform_lib_abstractions/loc_pla/include/platform_lib_time.h b/utils/platform_lib_abstractions/loc_pla/include/platform_lib_time.h similarity index 96% rename from platform_lib_abstractions/loc_pla/include/platform_lib_time.h rename to utils/platform_lib_abstractions/loc_pla/include/platform_lib_time.h index 7033a7a1..2905a74c 100644 --- a/platform_lib_abstractions/loc_pla/include/platform_lib_time.h +++ b/utils/platform_lib_abstractions/loc_pla/include/platform_lib_time.h @@ -30,9 +30,6 @@ #define __PLATFORM_LIB_TIME_H__ #include -#ifndef USE_GLIB -#include -#endif int64_t platform_lib_abstraction_elapsed_millis_since_boot(); #endif /* __PLATFORM_LIB_TIME_H__ */ diff --git a/platform_lib_abstractions/loc_pla/loc-pla.pc.in b/utils/platform_lib_abstractions/loc_pla/loc-pla.pc.in similarity index 100% rename from platform_lib_abstractions/loc_pla/loc-pla.pc.in rename to utils/platform_lib_abstractions/loc_pla/loc-pla.pc.in diff --git a/utils/platform_lib_abstractions/loc_pla/src/Android.mk b/utils/platform_lib_abstractions/loc_pla/src/Android.mk new file mode 100644 index 00000000..7099f875 --- /dev/null +++ b/utils/platform_lib_abstractions/loc_pla/src/Android.mk @@ -0,0 +1,58 @@ +ifneq ($(BOARD_VENDOR_QCOM_GPS_LOC_API_HARDWARE),) +ifneq ($(BUILD_TINY_ANDROID),true) +#Compile this library only for builds with the latest modem image + +LOCAL_PATH := $(call my-dir) + +include $(CLEAR_VARS) + +## Libs +LOCAL_SHARED_LIBRARIES := \ + libutils \ + libcutils \ + liblog \ + libloc_stub + +LOCAL_SRC_FILES += \ + platform_lib_android_runtime.cpp \ + platform_lib_gettid.cpp \ + platform_lib_log_util.cpp \ + platform_lib_property_service.cpp \ + platform_lib_sched_policy.cpp \ + platform_lib_time.cpp + +LOCAL_CFLAGS += \ + -fno-short-enums \ + -D_ANDROID_ \ + -std=c++11 + + +LOCAL_LDFLAGS += -Wl,--export-dynamic + +## Includes +LOCAL_C_INCLUDES:= \ + $(LOCAL_PATH)/../include \ + $(TARGET_OUT_HEADERS)/libloc_stub + + +LOCAL_COPY_HEADERS_TO:= libloc_pla/ +LOCAL_COPY_HEADERS:= \ + ../include/platform_lib_android_runtime.h \ + ../include/platform_lib_gettid.h \ + ../include/platform_lib_includes.h \ + ../include/platform_lib_log_util.h \ + ../include/platform_lib_macros.h \ + ../include/platform_lib_property_service.h \ + ../include/platform_lib_sched_policy.h \ + ../include/platform_lib_time.h + +LOCAL_MODULE := libloc_pla +LOCAL_CLANG := false + +LOCAL_MODULE_TAGS := optional + +LOCAL_PRELINK_MODULE := false + +include $(BUILD_SHARED_LIBRARY) +endif # not BUILD_TINY_ANDROID +endif # BOARD_VENDOR_QCOM_GPS_LOC_API_HARDWARE diff --git a/platform_lib_abstractions/loc_pla/src/Makefile.am b/utils/platform_lib_abstractions/loc_pla/src/Makefile.am similarity index 100% rename from platform_lib_abstractions/loc_pla/src/Makefile.am rename to utils/platform_lib_abstractions/loc_pla/src/Makefile.am diff --git a/platform_lib_abstractions/loc_pla/src/platform_lib_android_runtime.cpp b/utils/platform_lib_abstractions/loc_pla/src/platform_lib_android_runtime.cpp similarity index 93% rename from platform_lib_abstractions/loc_pla/src/platform_lib_android_runtime.cpp rename to utils/platform_lib_abstractions/loc_pla/src/platform_lib_android_runtime.cpp index 447e02e3..090af13b 100644 --- a/platform_lib_abstractions/loc_pla/src/platform_lib_android_runtime.cpp +++ b/utils/platform_lib_abstractions/loc_pla/src/platform_lib_android_runtime.cpp @@ -31,10 +31,10 @@ #ifdef USE_GLIB #include #else -#include +#include #endif /* USE_GLIB */ pthread_t platform_lib_abstraction_createJavaThread(const char* name, void (*start)(void *), void* arg) { - return android::AndroidRuntime::createJavaThread(name, start, arg); + return (pthread_t)android::AndroidRuntime::createJavaThread(name, start, arg); } diff --git a/platform_lib_abstractions/loc_pla/src/platform_lib_gettid.cpp b/utils/platform_lib_abstractions/loc_pla/src/platform_lib_gettid.cpp similarity index 100% rename from platform_lib_abstractions/loc_pla/src/platform_lib_gettid.cpp rename to utils/platform_lib_abstractions/loc_pla/src/platform_lib_gettid.cpp diff --git a/platform_lib_abstractions/loc_pla/src/platform_lib_log_util.cpp b/utils/platform_lib_abstractions/loc_pla/src/platform_lib_log_util.cpp similarity index 92% rename from platform_lib_abstractions/loc_pla/src/platform_lib_log_util.cpp rename to utils/platform_lib_abstractions/loc_pla/src/platform_lib_log_util.cpp index 37a5d4a7..ef23201a 100644 --- a/platform_lib_abstractions/loc_pla/src/platform_lib_log_util.cpp +++ b/utils/platform_lib_abstractions/loc_pla/src/platform_lib_log_util.cpp @@ -27,12 +27,6 @@ */ #include "platform_lib_log_util.h" -void loc_logger_init(unsigned long debug, unsigned long timestamp) -{ - loc_logger.DEBUG_LEVEL = debug; - loc_logger.TIMESTAMP = timestamp; -} - char * get_timestamp(char *str, unsigned long buf_size) { struct timeval tv; diff --git a/platform_lib_abstractions/loc_pla/src/platform_lib_property_service.cpp b/utils/platform_lib_abstractions/loc_pla/src/platform_lib_property_service.cpp similarity index 100% rename from platform_lib_abstractions/loc_pla/src/platform_lib_property_service.cpp rename to utils/platform_lib_abstractions/loc_pla/src/platform_lib_property_service.cpp diff --git a/platform_lib_abstractions/loc_pla/src/platform_lib_sched_policy.cpp b/utils/platform_lib_abstractions/loc_pla/src/platform_lib_sched_policy.cpp similarity index 100% rename from platform_lib_abstractions/loc_pla/src/platform_lib_sched_policy.cpp rename to utils/platform_lib_abstractions/loc_pla/src/platform_lib_sched_policy.cpp diff --git a/platform_lib_abstractions/loc_pla/src/platform_lib_time.cpp b/utils/platform_lib_abstractions/loc_pla/src/platform_lib_time.cpp similarity index 100% rename from platform_lib_abstractions/loc_pla/src/platform_lib_time.cpp rename to utils/platform_lib_abstractions/loc_pla/src/platform_lib_time.cpp diff --git a/utils/platform_lib_abstractions/loc_stub/Android.mk b/utils/platform_lib_abstractions/loc_stub/Android.mk new file mode 100644 index 00000000..b923a4c9 --- /dev/null +++ b/utils/platform_lib_abstractions/loc_stub/Android.mk @@ -0,0 +1,5 @@ +ifneq ($(BUILD_TINY_ANDROID),true) + +include $(call all-subdir-makefiles) + +endif diff --git a/platform_lib_abstractions/loc_stub/Makefile.am b/utils/platform_lib_abstractions/loc_stub/Makefile.am similarity index 100% rename from platform_lib_abstractions/loc_stub/Makefile.am rename to utils/platform_lib_abstractions/loc_stub/Makefile.am diff --git a/platform_lib_abstractions/loc_stub/configure.ac b/utils/platform_lib_abstractions/loc_stub/configure.ac similarity index 100% rename from platform_lib_abstractions/loc_stub/configure.ac rename to utils/platform_lib_abstractions/loc_stub/configure.ac diff --git a/platform_lib_abstractions/loc_stub/include/loc_stub_android_runtime.h b/utils/platform_lib_abstractions/loc_stub/include/loc_stub_android_runtime.h similarity index 100% rename from platform_lib_abstractions/loc_stub/include/loc_stub_android_runtime.h rename to utils/platform_lib_abstractions/loc_stub/include/loc_stub_android_runtime.h diff --git a/platform_lib_abstractions/loc_stub/include/loc_stub_gettid.h b/utils/platform_lib_abstractions/loc_stub/include/loc_stub_gettid.h similarity index 100% rename from platform_lib_abstractions/loc_stub/include/loc_stub_gettid.h rename to utils/platform_lib_abstractions/loc_stub/include/loc_stub_gettid.h diff --git a/platform_lib_abstractions/loc_stub/include/loc_stub_property_service.h b/utils/platform_lib_abstractions/loc_stub/include/loc_stub_property_service.h similarity index 100% rename from platform_lib_abstractions/loc_stub/include/loc_stub_property_service.h rename to utils/platform_lib_abstractions/loc_stub/include/loc_stub_property_service.h diff --git a/platform_lib_abstractions/loc_stub/include/loc_stub_sched_policy.h b/utils/platform_lib_abstractions/loc_stub/include/loc_stub_sched_policy.h similarity index 100% rename from platform_lib_abstractions/loc_stub/include/loc_stub_sched_policy.h rename to utils/platform_lib_abstractions/loc_stub/include/loc_stub_sched_policy.h diff --git a/platform_lib_abstractions/loc_stub/include/loc_stub_time.h b/utils/platform_lib_abstractions/loc_stub/include/loc_stub_time.h similarity index 100% rename from platform_lib_abstractions/loc_stub/include/loc_stub_time.h rename to utils/platform_lib_abstractions/loc_stub/include/loc_stub_time.h diff --git a/platform_lib_abstractions/loc_stub/loc-stub.pc.in b/utils/platform_lib_abstractions/loc_stub/loc-stub.pc.in similarity index 100% rename from platform_lib_abstractions/loc_stub/loc-stub.pc.in rename to utils/platform_lib_abstractions/loc_stub/loc-stub.pc.in diff --git a/utils/platform_lib_abstractions/loc_stub/src/Android.mk b/utils/platform_lib_abstractions/loc_stub/src/Android.mk new file mode 100644 index 00000000..2cf25b9e --- /dev/null +++ b/utils/platform_lib_abstractions/loc_stub/src/Android.mk @@ -0,0 +1,52 @@ +ifneq ($(BOARD_VENDOR_QCOM_GPS_LOC_API_HARDWARE),) +ifneq ($(BUILD_TINY_ANDROID),true) +#Compile this library only for builds with the latest modem image + +LOCAL_PATH := $(call my-dir) + +include $(CLEAR_VARS) + +## Libs +LOCAL_SHARED_LIBRARIES := \ + libutils \ + libcutils \ + liblog + +LOCAL_SRC_FILES += \ + loc_stub_android_runtime.cpp \ + loc_stub_gettid.cpp \ + loc_stub_property_service.cpp \ + loc_stub_sched_policy.cpp \ + loc_stub_time.cpp + +LOCAL_CFLAGS += \ + -fno-short-enums \ + -D_ANDROID_ \ + -std=c++11 + + +LOCAL_LDFLAGS += -Wl,--export-dynamic + +## Includes +LOCAL_C_INCLUDES:= \ + $(LOCAL_PATH)/../include \ + + +LOCAL_COPY_HEADERS_TO:= libloc_stub/ +LOCAL_COPY_HEADERS:= \ + ../include/loc_stub_android_runtime.h \ + ../include/loc_stub_gettid.h \ + ../include/loc_stub_property_service.h \ + ../include/loc_stub_sched_policy.h \ + ../include/loc_stub_time.h + +LOCAL_MODULE := libloc_stub +LOCAL_CLANG := false + +LOCAL_MODULE_TAGS := optional + +LOCAL_PRELINK_MODULE := false + +include $(BUILD_SHARED_LIBRARY) +endif # not BUILD_TINY_ANDROID +endif # BOARD_VENDOR_QCOM_GPS_LOC_API_HARDWARE diff --git a/platform_lib_abstractions/loc_stub/src/Makefile.am b/utils/platform_lib_abstractions/loc_stub/src/Makefile.am similarity index 100% rename from platform_lib_abstractions/loc_stub/src/Makefile.am rename to utils/platform_lib_abstractions/loc_stub/src/Makefile.am diff --git a/platform_lib_abstractions/loc_stub/src/loc_stub_android_runtime.cpp b/utils/platform_lib_abstractions/loc_stub/src/loc_stub_android_runtime.cpp similarity index 100% rename from platform_lib_abstractions/loc_stub/src/loc_stub_android_runtime.cpp rename to utils/platform_lib_abstractions/loc_stub/src/loc_stub_android_runtime.cpp diff --git a/platform_lib_abstractions/loc_stub/src/loc_stub_gettid.cpp b/utils/platform_lib_abstractions/loc_stub/src/loc_stub_gettid.cpp similarity index 100% rename from platform_lib_abstractions/loc_stub/src/loc_stub_gettid.cpp rename to utils/platform_lib_abstractions/loc_stub/src/loc_stub_gettid.cpp diff --git a/platform_lib_abstractions/loc_stub/src/loc_stub_property_service.cpp b/utils/platform_lib_abstractions/loc_stub/src/loc_stub_property_service.cpp similarity index 100% rename from platform_lib_abstractions/loc_stub/src/loc_stub_property_service.cpp rename to utils/platform_lib_abstractions/loc_stub/src/loc_stub_property_service.cpp diff --git a/platform_lib_abstractions/loc_stub/src/loc_stub_sched_policy.cpp b/utils/platform_lib_abstractions/loc_stub/src/loc_stub_sched_policy.cpp similarity index 100% rename from platform_lib_abstractions/loc_stub/src/loc_stub_sched_policy.cpp rename to utils/platform_lib_abstractions/loc_stub/src/loc_stub_sched_policy.cpp diff --git a/platform_lib_abstractions/loc_stub/src/loc_stub_time.cpp b/utils/platform_lib_abstractions/loc_stub/src/loc_stub_time.cpp similarity index 100% rename from platform_lib_abstractions/loc_stub/src/loc_stub_time.cpp rename to utils/platform_lib_abstractions/loc_stub/src/loc_stub_time.cpp diff --git a/utils/platform_lib_abstractions/platform_lib_includes.h b/utils/platform_lib_abstractions/platform_lib_includes.h deleted file mode 100644 index 5858674f..00000000 --- a/utils/platform_lib_abstractions/platform_lib_includes.h +++ /dev/null @@ -1,35 +0,0 @@ -/* Copyright (c) 2013, The Linux Foundation. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of The Linux Foundation nor the names of its - * contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR - * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE - * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN - * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef _PLATFORM_LIB_INCLUDES_H_ -#define _PLATFORM_LIB_INCLUDES_H_ - -#include "platform_lib_time.h" -#include "platform_lib_macros.h" - -#endif diff --git a/utils/platform_lib_abstractions/platform_lib_macros.h b/utils/platform_lib_abstractions/platform_lib_macros.h deleted file mode 100644 index bc48dd99..00000000 --- a/utils/platform_lib_abstractions/platform_lib_macros.h +++ /dev/null @@ -1,81 +0,0 @@ -/* Copyright (c) 2013, The Linux Foundation. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of The Linux Foundation nor the names of its - * contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR - * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE - * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN - * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef __PLATFORM_LIB_MACROS_H__ -#define __PLATFORM_LIB_MACROS_H__ - -#include - -#define TS_PRINTF(format, x...) \ -{ \ - struct timeval tv; \ - struct timezone tz; \ - int hh, mm, ss; \ - gettimeofday(&tv, &tz); \ - hh = tv.tv_sec/3600%24; \ - mm = (tv.tv_sec%3600)/60; \ - ss = tv.tv_sec%60; \ - fprintf(stdout,"%02d:%02d:%02d.%06ld]" format "\n", hh, mm, ss, tv.tv_usec,##x); \ -} - - -#ifdef USE_GLIB - -#define strlcat g_strlcat -#define strlcpy g_strlcpy - -#define ALOGE(format, x...) TS_PRINTF("E/%s (%d): " format , LOG_TAG, getpid(), ##x) -#define ALOGW(format, x...) TS_PRINTF("W/%s (%d): " format , LOG_TAG, getpid(), ##x) -#define ALOGI(format, x...) TS_PRINTF("I/%s (%d): " format , LOG_TAG, getpid(), ##x) -#define ALOGD(format, x...) TS_PRINTF("D/%s (%d): " format , LOG_TAG, getpid(), ##x) -#define ALOGV(format, x...) TS_PRINTF("V/%s (%d): " format , LOG_TAG, getpid(), ##x) - -#define GETTID_PLATFORM_LIB_ABSTRACTION (syscall(SYS_gettid)) - -#define LOC_EXT_CREATE_THREAD_CB_PLATFORM_LIB_ABSTRACTION createPthread -#define ELAPSED_MILLIS_SINCE_BOOT_PLATFORM_LIB_ABSTRACTION (elapsedMillisSinceBoot()) - - -#else - -#ifdef __cplusplus -extern "C" { -#endif -pid_t gettid(void); - -#ifdef __cplusplus -} -#endif - -#define GETTID_PLATFORM_LIB_ABSTRACTION (gettid()) -#define LOC_EXT_CREATE_THREAD_CB_PLATFORM_LIB_ABSTRACTION android::AndroidRuntime::createJavaThread -#define ELAPSED_MILLIS_SINCE_BOOT_PLATFORM_LIB_ABSTRACTION (android::elapsedRealtime()) - -#endif - -#endif diff --git a/utils/platform_lib_abstractions/platform_lib_time.h b/utils/platform_lib_abstractions/platform_lib_time.h deleted file mode 100644 index ce013afc..00000000 --- a/utils/platform_lib_abstractions/platform_lib_time.h +++ /dev/null @@ -1,35 +0,0 @@ -/* Copyright (c) 2013, The Linux Foundation. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of The Linux Foundation nor the names of its - * contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR - * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE - * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN - * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef _PLATFORM_LIB_TIME_H_ -#define _PLATFORM_LIB_TIME_H_ - -int64_t systemTime(int clock); -int64_t elapsedMillisSinceBoot(); - -#endif