thermal-hal: Check throttle notification return status

Checking throttle notification callback execution status is mandatory to
catch any dead notification object exception. Handle the case to check
the notification callback and then remove the callback of any dead
object.

Change-Id: I6c3024f60802d612cbaff3358a809bc46b1b3e8f
diff --git a/thermal.cpp b/thermal.cpp
index f1d324f..f650c9f 100644
--- a/thermal.cpp
+++ b/thermal.cpp
@@ -264,9 +264,17 @@
 	LOG(DEBUG) << "Throttle Severity change: " << " Type: " << (int)t.type
 		<< " Name: " << t.name << " Value: " << t.value <<
 		" ThrottlingStatus: " << (int)t.throttlingStatus;
-	for (it = cb.begin(); it != cb.end(); it++) {
-		if (!it->is_filter_type || it->type == t.type)
-			it->callback->notifyThrottling(t);
+	it = cb.begin();
+	while (it != cb.end()) {
+		if (!it->is_filter_type || it->type == t.type) {
+			Return<void> ret = it->callback->notifyThrottling(t);
+			if (!ret.isOk()) {
+				LOG(ERROR) << "Notify callback execution error. Removing";
+				it = cb.erase(it);
+				continue;
+			}
+		}
+		it++;
 	}
 }