Merge "Unified Vendor - Launch only android.hardware.gnss"

This commit is contained in:
qctecmdr Service 2019-03-21 10:19:25 -07:00 committed by Gerrit - the friendly Code Review server
commit a0488d7d56
6 changed files with 153 additions and 14 deletions

View file

@ -81,4 +81,9 @@ LOCAL_SHARED_LIBRARIES += \
android.hardware.gnss@1.0 \ android.hardware.gnss@1.0 \
LOCAL_CFLAGS += $(GNSS_CFLAGS) LOCAL_CFLAGS += $(GNSS_CFLAGS)
ifneq ($(LOC_HIDL_VERSION),)
LOCAL_CFLAGS += -DLOC_HIDL_VERSION='"$(LOC_HIDL_VERSION)"'
endif
include $(BUILD_EXECUTABLE) include $(BUILD_EXECUTABLE)

View file

@ -22,22 +22,63 @@
#include <android/hardware/gnss/1.0/IGnss.h> #include <android/hardware/gnss/1.0/IGnss.h>
#include <hidl/LegacySupport.h> #include <hidl/LegacySupport.h>
#include "loc_cfg.h" #include "loc_cfg.h"
#include "loc_misc_utils.h"
extern "C" { extern "C" {
#include "vndfwk-detect.h" #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::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() { int main() {
ALOGI("%s", __FUNCTION__);
bool vendorEnhanced = isRunningWithVendorEnhancedFramework(); bool vendorEnhanced = isRunningWithVendorEnhancedFramework();
setVendorEnhanced(vendorEnhanced); setVendorEnhanced(vendorEnhanced);
if (!vendorEnhanced) { #ifdef ARCH_ARM_32
return defaultPassthroughServiceImplementation<IGnss>(); android::hardware::ProcessState::initWithMmapSize((size_t)(DEFAULT_HW_BINDER_MEM_SIZE));
} else { #endif
return -1; 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 {
ALOGE("Error while registering IGnss 1.0 service: %d", status);
}
return 0;
} }

View file

@ -83,4 +83,9 @@ LOCAL_SHARED_LIBRARIES += \
android.hardware.gnss@1.1 \ android.hardware.gnss@1.1 \
LOCAL_CFLAGS += $(GNSS_CFLAGS) LOCAL_CFLAGS += $(GNSS_CFLAGS)
ifneq ($(LOC_HIDL_VERSION),)
LOCAL_CFLAGS += -DLOC_HIDL_VERSION='"$(LOC_HIDL_VERSION)"'
endif
include $(BUILD_EXECUTABLE) include $(BUILD_EXECUTABLE)

View file

@ -22,22 +22,63 @@
#include <android/hardware/gnss/1.1/IGnss.h> #include <android/hardware/gnss/1.1/IGnss.h>
#include <hidl/LegacySupport.h> #include <hidl/LegacySupport.h>
#include "loc_cfg.h" #include "loc_cfg.h"
#include "loc_misc_utils.h"
extern "C" { extern "C" {
#include "vndfwk-detect.h" #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::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() { int main() {
ALOGI("%s", __FUNCTION__);
bool vendorEnhanced = isRunningWithVendorEnhancedFramework(); bool vendorEnhanced = isRunningWithVendorEnhancedFramework();
setVendorEnhanced(vendorEnhanced); setVendorEnhanced(vendorEnhanced);
if (!vendorEnhanced) { #ifdef ARCH_ARM_32
return defaultPassthroughServiceImplementation<IGnss>(); android::hardware::ProcessState::initWithMmapSize((size_t)(DEFAULT_HW_BINDER_MEM_SIZE));
} else { #endif
return -1; 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 {
ALOGE("Error while registering IGnss 1.1 service: %d", status);
}
return 0;
} }

View file

@ -89,4 +89,9 @@ LOCAL_SHARED_LIBRARIES += \
android.hardware.gnss@2.0 \ android.hardware.gnss@2.0 \
LOCAL_CFLAGS += $(GNSS_CFLAGS) LOCAL_CFLAGS += $(GNSS_CFLAGS)
ifneq ($(LOC_HIDL_VERSION),)
LOCAL_CFLAGS += -DLOC_HIDL_VERSION='"$(LOC_HIDL_VERSION)"'
endif
include $(BUILD_EXECUTABLE) include $(BUILD_EXECUTABLE)

View file

@ -23,20 +23,62 @@
#include <android/hardware/gnss/2.0/IGnss.h> #include <android/hardware/gnss/2.0/IGnss.h>
#include <hidl/LegacySupport.h> #include <hidl/LegacySupport.h>
#include "loc_cfg.h" #include "loc_cfg.h"
#include "loc_misc_utils.h"
extern "C" { extern "C" {
#include "vndfwk-detect.h" #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::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() { int main() {
ALOGI("%s", __FUNCTION__);
bool vendorEnhanced = isRunningWithVendorEnhancedFramework(); bool vendorEnhanced = isRunningWithVendorEnhancedFramework();
setVendorEnhanced(vendorEnhanced); setVendorEnhanced(vendorEnhanced);
if (!vendorEnhanced) { #ifdef ARCH_ARM_32
return defaultPassthroughServiceImplementation<IGnss>(); android::hardware::ProcessState::initWithMmapSize((size_t)(DEFAULT_HW_BINDER_MEM_SIZE));
} else { #endif
return -1; 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 {
ALOGE("Error while registering IGnss 2.0 service: %d", status);
}
return 0;
} }