summaryrefslogtreecommitdiff
path: root/android/2.0/service.cpp
diff options
context:
space:
mode:
authorSaurabh Srivastava <ssrivast@codeaurora.org>2019-02-21 17:01:13 +0530
committerSaurabh Srivastava <ssrivast@codeaurora.org>2019-03-21 01:20:22 +0530
commit8bd22760a63799075005c8f8de217cf4cc38b589 (patch)
treebad36e791ebce1a8a7e41b6095f394bd12886b6a /android/2.0/service.cpp
parent7d34cea4ca6de95a464ed0df0da46628b27de107 (diff)
downloadgps-8bd22760a63799075005c8f8de217cf4cc38b589.tar.gz
Unified Vendor - Launch only android.hardware.gnss
Launch android.hardware.gnss HIDL service for both vendor enhanced and non-enhanced platforms Change-Id: Ia9cb9ef52d42c788bcaa73bc1001ed8d90f7c755 CRs-Fixed: 2402833
Diffstat (limited to 'android/2.0/service.cpp')
-rw-r--r--android/2.0/service.cpp50
1 files changed, 46 insertions, 4 deletions
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;
}