Merge "easy vib. instance name"

This commit is contained in:
Steven Moreland 2022-12-01 21:33:56 +00:00 committed by Gerrit Code Review
commit 92f223a9cc

View file

@ -29,15 +29,15 @@ int main() {
// 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());
binder_status_t status = AServiceManager_addService(
vib->asBinder().get(), Vibrator::makeServiceName("default").c_str());
CHECK_EQ(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());
status = AServiceManager_addService(vibManager->asBinder().get(),
VibratorManager::makeServiceName("default").c_str());
CHECK_EQ(status, STATUS_OK);
ABinderProcess_joinThreadPool();