diff options
Diffstat (limited to 'android/1.1/service.cpp')
-rw-r--r-- | android/1.1/service.cpp | 51 |
1 files changed, 46 insertions, 5 deletions
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; } |