service.cpp 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. /*
  2. * Copyright (c) 2017-2018, The Linux Foundation. All rights reserved.
  3. * Not a Contribution
  4. */
  5. /*
  6. * Copyright (C) 2016 The Android Open Source Project
  7. *
  8. * Licensed under the Apache License, Version 2.0 (the "License");
  9. * you may not use this file except in compliance with the License.
  10. * You may obtain a copy of the License at
  11. *
  12. * http://www.apache.org/licenses/LICENSE-2.0
  13. *
  14. * Unless required by applicable law or agreed to in writing, software
  15. * distributed under the License is distributed on an "AS IS" BASIS,
  16. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  17. * See the License for the specific language governing permissions and
  18. * limitations under the License.
  19. */
  20. #define LOG_TAG "[email protected]"
  21. #include <android/hardware/gnss/1.1/IGnss.h>
  22. #include <hidl/LegacySupport.h>
  23. #include "loc_cfg.h"
  24. #include "loc_misc_utils.h"
  25. extern "C" {
  26. #include "vndfwk-detect.h"
  27. }
  28. #ifdef ARCH_ARM_32
  29. #define DEFAULT_HW_BINDER_MEM_SIZE 65536
  30. #endif
  31. using android::hardware::gnss::V1_1::IGnss;
  32. using android::hardware::configureRpcThreadpool;
  33. using android::hardware::registerPassthroughServiceImplementation;
  34. using android::hardware::joinRpcThreadpool;
  35. using android::status_t;
  36. using android::OK;
  37. typedef int vendorEnhancedServiceMain(int /* argc */, char* /* argv */ []);
  38. int main() {
  39. ALOGI("%s", __FUNCTION__);
  40. int vendorInfo = getVendorEnhancedInfo();
  41. bool vendorEnhanced = ( 1 == vendorInfo || 3 == vendorInfo );
  42. setVendorEnhanced(vendorEnhanced);
  43. #ifdef ARCH_ARM_32
  44. android::hardware::ProcessState::initWithMmapSize((size_t)(DEFAULT_HW_BINDER_MEM_SIZE));
  45. #endif
  46. configureRpcThreadpool(1, true);
  47. status_t status;
  48. status = registerPassthroughServiceImplementation<IGnss>();
  49. if (status == OK) {
  50. joinRpcThreadpool();
  51. } else {
  52. ALOGE("Error while registering IGnss 1.1 service: %d", status);
  53. }
  54. return 0;
  55. }