Check result of registerAsService in dumpstate.
Test: see change I35f5d4498abd7369b03a04081e8aa26a3933328e
Fixes: 36704363
Change-Id: I5cc8f32592a77994e756438b8d1b7f3255acef19
diff --git a/dumpstate/1.0/default/service.cpp b/dumpstate/1.0/default/service.cpp
index 85bea12..4f276b7 100644
--- a/dumpstate/1.0/default/service.cpp
+++ b/dumpstate/1.0/default/service.cpp
@@ -24,11 +24,18 @@
using ::android::hardware::dumpstate::V1_0::IDumpstateDevice;
using ::android::hardware::dumpstate::V1_0::implementation::DumpstateDevice;
using ::android::hardware::joinRpcThreadpool;
+using ::android::OK;
using ::android::sp;
-int main (int /* argc */, char * /* argv */ []) {
+int main(int /* argc */, char* /* argv */ []) {
sp<IDumpstateDevice> dumpstate = new DumpstateDevice;
- configureRpcThreadpool(1, true);
- dumpstate->registerAsService();
+ configureRpcThreadpool(1, true /* will join */);
+ if (dumpstate->registerAsService() != OK) {
+ ALOGE("Could not register service.");
+ return 1;
+ }
joinRpcThreadpool();
+
+ ALOGE("Service exited!");
+ return 1;
}