Make error handling kill context activity. Add parameter validation.

bug 10427951

Change-Id: I4abba969e34903265b84ee88d6a90bc9b9df5481
diff --git a/cpp/Element.cpp b/cpp/Element.cpp
index df7b5a0..d685595 100644
--- a/cpp/Element.cpp
+++ b/cpp/Element.cpp
@@ -331,7 +331,7 @@
     return new Element(id, rs, dt, dk, true, size);
 }
 
-bool Element::isCompatible(android::RSC::sp<const Element>e) {
+bool Element::isCompatible(android::RSC::sp<const Element>e) const {
     // Try strict BaseObj equality to start with.
     if (this == e.get()) {
         return true;