CameraService: Check Thread::run for failed threads.
While a thread failing to launch is somewhat catastrophic, checking the
result and printing the error / returning early is good practice.
Test: Ran CameraThreadSafetyTest.
Change-Id: I8c1d3fe197ef8af631960dd286096287de9a280e
diff --git a/services/camera/libcameraservice/CameraServiceWatchdog.h b/services/camera/libcameraservice/CameraServiceWatchdog.h
index e55fa28..e35d69e 100644
--- a/services/camera/libcameraservice/CameraServiceWatchdog.h
+++ b/services/camera/libcameraservice/CameraServiceWatchdog.h
@@ -79,7 +79,13 @@
new CameraServiceWatchdog(cycles, cycleLength, mEnabled);
mEnabledLock.unlock();
- tempWatchdog->run("CameraServiceWatchdog");
+ status_t status = tempWatchdog->run("CameraServiceWatchdog");
+ if (status != OK) {
+ ALOGE("Unable to watch thread: %s (%d)", strerror(-status), status);
+ res = watchThread(func, tid);
+ return res;
+ }
+
res = tempWatchdog->watchThread(func, tid);
tempWatchdog->requestExit();
tempWatchdog.clear();