diff options
author | Xin Li <delphij@google.com> | 2021-08-17 18:14:12 +0000 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2021-08-17 18:14:12 +0000 |
commit | c541e8abb62a9a888de1cf48bbded105f7869cc0 (patch) | |
tree | 8a9c3f56607bb90577557ddd3261d36ae2ec2b93 /vibrator/aidl/default/main.cpp | |
parent | 1aa8cad8558884c9dd0293dffbf823e45614a25d (diff) | |
parent | e287df40b90fe64c226f90c66353a33e8ef40063 (diff) |
Merge "Merge sc-dev-plus-aosp-without-vendor@7634622" into stage-aosp-master
Diffstat (limited to 'vibrator/aidl/default/main.cpp')
-rw-r--r-- | vibrator/aidl/default/main.cpp | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/vibrator/aidl/default/main.cpp b/vibrator/aidl/default/main.cpp index ebb0905a3a..bd834d2a21 100644 --- a/vibrator/aidl/default/main.cpp +++ b/vibrator/aidl/default/main.cpp @@ -15,19 +15,29 @@ */ #include "vibrator-impl/Vibrator.h" +#include "vibrator-impl/VibratorManager.h" #include <android-base/logging.h> #include <android/binder_manager.h> #include <android/binder_process.h> using aidl::android::hardware::vibrator::Vibrator; +using aidl::android::hardware::vibrator::VibratorManager; int main() { ABinderProcess_setThreadPoolMaxThreadCount(0); - std::shared_ptr<Vibrator> vib = ndk::SharedRefBase::make<Vibrator>(); - const std::string instance = std::string() + Vibrator::descriptor + "/default"; - binder_status_t status = AServiceManager_addService(vib->asBinder().get(), instance.c_str()); + // make a default vibrator service + auto vib = ndk::SharedRefBase::make<Vibrator>(); + const std::string vibName = std::string() + Vibrator::descriptor + "/default"; + binder_status_t status = AServiceManager_addService(vib->asBinder().get(), vibName.c_str()); + CHECK(status == STATUS_OK); + + // make the vibrator manager service with a different vibrator + auto managedVib = ndk::SharedRefBase::make<Vibrator>(); + auto vibManager = ndk::SharedRefBase::make<VibratorManager>(std::move(managedVib)); + const std::string vibManagerName = std::string() + VibratorManager::descriptor + "/default"; + status = AServiceManager_addService(vibManager->asBinder().get(), vibManagerName.c_str()); CHECK(status == STATUS_OK); ABinderProcess_joinThreadPool(); |