service.cpp 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. /*
  2. * Copyright (C) 2017 The Android Open Source Project
  3. *
  4. * Licensed under the Apache License, Version 2.0 (the "License");
  5. * you may not use this file except in compliance with the License.
  6. * You may obtain a copy of the License at
  7. *
  8. * http://www.apache.org/licenses/LICENSE-2.0
  9. *
  10. * Unless required by applicable law or agreed to in writing, software
  11. * distributed under the License is distributed on an "AS IS" BASIS,
  12. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. * See the License for the specific language governing permissions and
  14. * limitations under the License.
  15. */
  16. #define LOG_TAG "android.hardware.biometrics.fingerprint@2.1-service.vayu"
  17. #include <android/log.h>
  18. #include <hidl/HidlSupport.h>
  19. #include <hidl/HidlTransportSupport.h>
  20. #include <android/hardware/biometrics/fingerprint/2.1/IBiometricsFingerprint.h>
  21. #include <android/hardware/biometrics/fingerprint/2.1/types.h>
  22. #include <vendor/xiaomi/hardware/fingerprintextension/1.0/IXiaomiFingerprint.h>
  23. #include "BiometricsFingerprint.h"
  24. using android::hardware::biometrics::fingerprint::V2_1::IBiometricsFingerprint;
  25. using android::hardware::biometrics::fingerprint::V2_1::implementation::BiometricsFingerprint;
  26. using android::hardware::configureRpcThreadpool;
  27. using android::hardware::joinRpcThreadpool;
  28. using android::sp;
  29. using vendor::xiaomi::hardware::fingerprintextension::V1_0::IXiaomiFingerprint;
  30. int main() {
  31. android::sp<IBiometricsFingerprint> bio = BiometricsFingerprint::getInstance();
  32. android::sp<IXiaomiFingerprint> xfe = BiometricsFingerprint::getXiaomiInstance();
  33. configureRpcThreadpool(1, true /*callerWillJoin*/);
  34. if (bio != nullptr) {
  35. if (::android::OK != bio->registerAsService()) {
  36. return 1;
  37. }
  38. } else {
  39. ALOGE("Can't create instance of BiometricsFingerprint, nullptr");
  40. }
  41. if (xfe != nullptr) {
  42. if (::android::OK != xfe->registerAsService()) {
  43. return 1;
  44. }
  45. } else {
  46. ALOGE("Can't create instance of XiaomiFingerprint, nullptr");
  47. }
  48. joinRpcThreadpool();
  49. return 0; // should never get here
  50. }