12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697 |
- #define LOG_TAG "android.hardware.gnss@2.1-service-qti"
- #include <android/hardware/gnss/2.1/IGnss.h>
- #include <hidl/LegacySupport.h>
- #include "loc_cfg.h"
- #include "loc_misc_utils.h"
- #include <dlfcn.h>
- extern "C" {
- #include "vndfwk-detect.h"
- }
- #ifdef ARCH_ARM_32
- #define DEFAULT_HW_BINDER_MEM_SIZE 65536
- #endif
- using android::hardware::gnss::V2_1::IGnss;
- using android::hardware::configureRpcThreadpool;
- using android::hardware::registerPassthroughServiceImplementation;
- using android::hardware::joinRpcThreadpool;
- using android::status_t;
- using android::OK;
- typedef int vendorEnhancedServiceMain(int , char* []);
- #define GNSS_POWER_LIBNAME "/vendor/lib64/libgnssauto_power.so"
- typedef const void* (*gnssAutoPowerHandler)(void);
- void initializeGnssPowerHandler() {
- void * handle = nullptr;
- const char* error = nullptr;
- gnssAutoPowerHandler getter = nullptr;
- getter = (gnssAutoPowerHandler) dlGetSymFromLib(handle, GNSS_POWER_LIBNAME,
- "initGnssAutoPowerHandler");
- if (nullptr == getter) {
-
- ALOGW("dlGetSymFromLib for getGnssAutoPowerHandler failed - may not be real problem.");
- } else {
-
- getter();
- ALOGI("GnssAutoPowerHandler Initialized!");
- }
- }
- int main() {
- ALOGI("%s", __FUNCTION__);
- int vendorInfo = getVendorEnhancedInfo();
-
- bool vendorEnhanced = ( vendorInfo & 2 );
- setVendorEnhanced(vendorEnhanced);
- #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) {
- initializeGnssPowerHandler();
- joinRpcThreadpool();
- } else {
- ALOGE("Error while registering IGnss 2.1 service: %d", status);
- }
- return 0;
- }
|