isDeadObject conditionally sets mCheckedStatus.

This way a process can check isDeadObject but still rely
on default behavior (dying) when a more serious error occurs.

Test: boot internal device, hidl_test
Change-Id: I6d2c7ab486a4c5838dadae6008ef9aaba4c184ca
diff --git a/base/include/hidl/Status.h b/base/include/hidl/Status.h
index 7c716c7..f812ebb 100644
--- a/base/include/hidl/Status.h
+++ b/base/include/hidl/Status.h
@@ -161,9 +161,17 @@
         }
 
         // Check if underlying error is DEAD_OBJECT.
-        // Does not set mCheckedStatus.
+        // Check mCheckedStatus only if this method returns true.
         bool isDeadObject() const {
-            return mStatus.transactionError() == DEAD_OBJECT;
+            bool dead = mStatus.transactionError() == DEAD_OBJECT;
+
+            // This way, if you only check isDeadObject your process will
+            // only be killed for more serious unchecked errors
+            if (dead) {
+                mCheckedStatus = true;
+            }
+
+            return dead;
         }
 
         // For debugging purposes only