power: add check for shared pointer
Add check for shared pointer Change-Id: I984988e49b3e59f3a674fb6dbfc8c19d3adb6d74
This commit is contained in:
committed by
Gerrit - the friendly Code Review server
parent
4d2b44e6c6
commit
27192f8a2b
2
main.cpp
2
main.cpp
@@ -40,11 +40,13 @@ int main() {
|
|||||||
std::shared_ptr<Power> vib = ndk::SharedRefBase::make<Power>();
|
std::shared_ptr<Power> vib = ndk::SharedRefBase::make<Power>();
|
||||||
const std::string instance = std::string() + Power::descriptor + "/default";
|
const std::string instance = std::string() + Power::descriptor + "/default";
|
||||||
LOG(INFO) << "Instance " << instance;
|
LOG(INFO) << "Instance " << instance;
|
||||||
|
if(vib){
|
||||||
binder_status_t status = AServiceManager_addService(vib->asBinder().get(), instance.c_str());
|
binder_status_t status = AServiceManager_addService(vib->asBinder().get(), instance.c_str());
|
||||||
LOG(INFO) << "Status " << status;
|
LOG(INFO) << "Status " << status;
|
||||||
if(status != STATUS_OK){
|
if(status != STATUS_OK){
|
||||||
LOG(ERROR) << "Could not register" << instance;
|
LOG(ERROR) << "Could not register" << instance;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
ABinderProcess_joinThreadPool();
|
ABinderProcess_joinThreadPool();
|
||||||
return 1; // should not reach
|
return 1; // should not reach
|
||||||
|
|||||||
Reference in New Issue
Block a user