diff options
author | qctecmdr Service <qctecmdr@qualcomm.com> | 2019-03-21 10:19:25 -0700 |
---|---|---|
committer | Gerrit - the friendly Code Review server <code-review@localhost> | 2019-03-21 10:19:25 -0700 |
commit | a0488d7d560b01d42f03baabb2da7e1b658d81ff (patch) | |
tree | 7943ec890febdbabe816d0bc13a598eb4f635dd3 /android | |
parent | 3774ea547f70d05aabe4c25229bfde5a2cc29485 (diff) | |
parent | 8bd22760a63799075005c8f8de217cf4cc38b589 (diff) | |
download | gps-a0488d7d560b01d42f03baabb2da7e1b658d81ff.tar.gz |
Merge "Unified Vendor - Launch only android.hardware.gnss"
Diffstat (limited to 'android')
-rw-r--r-- | android/1.0/Android.mk | 5 | ||||
-rw-r--r-- | android/1.0/service.cpp | 51 | ||||
-rw-r--r-- | android/1.1/Android.mk | 5 | ||||
-rw-r--r-- | android/1.1/service.cpp | 51 | ||||
-rw-r--r-- | android/2.0/Android.mk | 5 | ||||
-rw-r--r-- | android/2.0/service.cpp | 50 |
6 files changed, 153 insertions, 14 deletions
diff --git a/android/1.0/Android.mk b/android/1.0/Android.mk index 434b432..122ff8d 100644 --- a/android/1.0/Android.mk +++ b/android/1.0/Android.mk @@ -81,4 +81,9 @@ LOCAL_SHARED_LIBRARIES += \ android.hardware.gnss@1.0 \ LOCAL_CFLAGS += $(GNSS_CFLAGS) + +ifneq ($(LOC_HIDL_VERSION),) +LOCAL_CFLAGS += -DLOC_HIDL_VERSION='"$(LOC_HIDL_VERSION)"' +endif + include $(BUILD_EXECUTABLE) diff --git a/android/1.0/service.cpp b/android/1.0/service.cpp index ee61a10..04bb8ab 100644 --- a/android/1.0/service.cpp +++ b/android/1.0/service.cpp @@ -22,22 +22,63 @@ #include <android/hardware/gnss/1.0/IGnss.h> #include <hidl/LegacySupport.h> - #include "loc_cfg.h" +#include "loc_misc_utils.h" + extern "C" { #include "vndfwk-detect.h" } +#ifdef ARCH_ARM_32 +#define DEFAULT_HW_BINDER_MEM_SIZE 65536 +#endif + using android::hardware::gnss::V1_0::IGnss; -using android::hardware::defaultPassthroughServiceImplementation; + +using android::hardware::configureRpcThreadpool; +using android::hardware::registerPassthroughServiceImplementation; +using android::hardware::joinRpcThreadpool; + +using android::status_t; +using android::OK; + +typedef int vendorEnhancedServiceMain(int /* argc */, char* /* argv */ []); int main() { + + ALOGI("%s", __FUNCTION__); + bool vendorEnhanced = isRunningWithVendorEnhancedFramework(); setVendorEnhanced(vendorEnhanced); - if (!vendorEnhanced) { - return defaultPassthroughServiceImplementation<IGnss>(); +#ifdef ARCH_ARM_32 + android::hardware::ProcessState::initWithMmapSize((size_t)(DEFAULT_HW_BINDER_MEM_SIZE)); +#endif + configureRpcThreadpool(1, true); + status_t status; + + status = registerPassthroughServiceImplementation<IGnss>(); + if (status == OK) { + if (vendorEnhanced) { + #ifdef LOC_HIDL_VERSION + #define VENDOR_ENHANCED_LIB "vendor.qti.gnss@" LOC_HIDL_VERSION "-service.so" + + void* libHandle = NULL; + vendorEnhancedServiceMain* vendorEnhancedMainMethod = (vendorEnhancedServiceMain*) + dlGetSymFromLib(libHandle, VENDOR_ENHANCED_LIB, "main"); + if (NULL != vendorEnhancedMainMethod) { + (*vendorEnhancedMainMethod)(0, NULL); + } + #else + ALOGE("LOC_HIDL_VERSION not defined."); + #endif + } + + joinRpcThreadpool(); + } else { - return -1; + ALOGE("Error while registering IGnss 1.0 service: %d", status); } + + return 0; } diff --git a/android/1.1/Android.mk b/android/1.1/Android.mk index 33e5b0d..5c97f40 100644 --- a/android/1.1/Android.mk +++ b/android/1.1/Android.mk @@ -83,4 +83,9 @@ LOCAL_SHARED_LIBRARIES += \ android.hardware.gnss@1.1 \ LOCAL_CFLAGS += $(GNSS_CFLAGS) + +ifneq ($(LOC_HIDL_VERSION),) +LOCAL_CFLAGS += -DLOC_HIDL_VERSION='"$(LOC_HIDL_VERSION)"' +endif + include $(BUILD_EXECUTABLE) diff --git a/android/1.1/service.cpp b/android/1.1/service.cpp index c1bc6b0..bf7ad07 100644 --- a/android/1.1/service.cpp +++ b/android/1.1/service.cpp @@ -22,22 +22,63 @@ #include <android/hardware/gnss/1.1/IGnss.h> #include <hidl/LegacySupport.h> - #include "loc_cfg.h" +#include "loc_misc_utils.h" + extern "C" { #include "vndfwk-detect.h" } +#ifdef ARCH_ARM_32 +#define DEFAULT_HW_BINDER_MEM_SIZE 65536 +#endif + using android::hardware::gnss::V1_1::IGnss; -using android::hardware::defaultPassthroughServiceImplementation; + +using android::hardware::configureRpcThreadpool; +using android::hardware::registerPassthroughServiceImplementation; +using android::hardware::joinRpcThreadpool; + +using android::status_t; +using android::OK; + +typedef int vendorEnhancedServiceMain(int /* argc */, char* /* argv */ []); int main() { + + ALOGI("%s", __FUNCTION__); + bool vendorEnhanced = isRunningWithVendorEnhancedFramework(); setVendorEnhanced(vendorEnhanced); - if (!vendorEnhanced) { - return defaultPassthroughServiceImplementation<IGnss>(); +#ifdef ARCH_ARM_32 + android::hardware::ProcessState::initWithMmapSize((size_t)(DEFAULT_HW_BINDER_MEM_SIZE)); +#endif + configureRpcThreadpool(1, true); + status_t status; + + status = registerPassthroughServiceImplementation<IGnss>(); + if (status == OK) { + if (vendorEnhanced) { + #ifdef LOC_HIDL_VERSION + #define VENDOR_ENHANCED_LIB "vendor.qti.gnss@" LOC_HIDL_VERSION "-service.so" + + void* libHandle = NULL; + vendorEnhancedServiceMain* vendorEnhancedMainMethod = (vendorEnhancedServiceMain*) + dlGetSymFromLib(libHandle, VENDOR_ENHANCED_LIB, "main"); + if (NULL != vendorEnhancedMainMethod) { + (*vendorEnhancedMainMethod)(0, NULL); + } + #else + ALOGE("LOC_HIDL_VERSION not defined."); + #endif + } + + joinRpcThreadpool(); + } else { - return -1; + ALOGE("Error while registering IGnss 1.1 service: %d", status); } + + return 0; } diff --git a/android/2.0/Android.mk b/android/2.0/Android.mk index 0fa50bd..244bd9c 100644 --- a/android/2.0/Android.mk +++ b/android/2.0/Android.mk @@ -89,4 +89,9 @@ LOCAL_SHARED_LIBRARIES += \ android.hardware.gnss@2.0 \ LOCAL_CFLAGS += $(GNSS_CFLAGS) + +ifneq ($(LOC_HIDL_VERSION),) +LOCAL_CFLAGS += -DLOC_HIDL_VERSION='"$(LOC_HIDL_VERSION)"' +endif + include $(BUILD_EXECUTABLE) diff --git a/android/2.0/service.cpp b/android/2.0/service.cpp index 1fdccab..16f0b06 100644 --- a/android/2.0/service.cpp +++ b/android/2.0/service.cpp @@ -23,20 +23,62 @@ #include <android/hardware/gnss/2.0/IGnss.h> #include <hidl/LegacySupport.h> #include "loc_cfg.h" +#include "loc_misc_utils.h" extern "C" { #include "vndfwk-detect.h" } + +#ifdef ARCH_ARM_32 +#define DEFAULT_HW_BINDER_MEM_SIZE 65536 +#endif + using android::hardware::gnss::V2_0::IGnss; -using android::hardware::defaultPassthroughServiceImplementation; + +using android::hardware::configureRpcThreadpool; +using android::hardware::registerPassthroughServiceImplementation; +using android::hardware::joinRpcThreadpool; + +using android::status_t; +using android::OK; + +typedef int vendorEnhancedServiceMain(int /* argc */, char* /* argv */ []); int main() { + + ALOGI("%s", __FUNCTION__); + bool vendorEnhanced = isRunningWithVendorEnhancedFramework(); setVendorEnhanced(vendorEnhanced); - if (!vendorEnhanced) { - return defaultPassthroughServiceImplementation<IGnss>(); +#ifdef ARCH_ARM_32 + android::hardware::ProcessState::initWithMmapSize((size_t)(DEFAULT_HW_BINDER_MEM_SIZE)); +#endif + configureRpcThreadpool(1, true); + status_t status; + + status = registerPassthroughServiceImplementation<IGnss>(); + if (status == OK) { + if (vendorEnhanced) { + #ifdef LOC_HIDL_VERSION + #define VENDOR_ENHANCED_LIB "vendor.qti.gnss@" LOC_HIDL_VERSION "-service.so" + + void* libHandle = NULL; + vendorEnhancedServiceMain* vendorEnhancedMainMethod = (vendorEnhancedServiceMain*) + dlGetSymFromLib(libHandle, VENDOR_ENHANCED_LIB, "main"); + if (NULL != vendorEnhancedMainMethod) { + (*vendorEnhancedMainMethod)(0, NULL); + } + #else + ALOGE("LOC_HIDL_VERSION not defined."); + #endif + } + + joinRpcThreadpool(); + } else { - return -1; + ALOGE("Error while registering IGnss 2.0 service: %d", status); } + + return 0; } |