Merge cherrypicks of [3276508, 3277765, 3277766, 3277904, 3276473, 3278009, 3278010, 3277767, 3277768, 3277769, 3277770, 3276509, 3276510, 3278011, 3278012, 3278013, 3278014, 3278099, 3278100, 3278101, 3278102, 3278103, 3278104, 3278105, 3278106, 3277800, 3276474, 3278015, 3278016, 3278017, 3278118, 3278119, 3278120, 3278121, 3278122, 3277946, 3277905, 3277947, 3277906, 3277751, 3278123, 3277752, 3278110, 3277771, 3277907, 3278095, 3277908, 3278111, 3277772, 3276475, 3276476] into oc-mr1-release

Change-Id: I6ed6e911860722a1a086f03a4356ad09ab8664a7
diff --git a/transport/HidlTransportUtils.cpp b/transport/HidlTransportUtils.cpp
index eda9b8a..4e952eb 100644
--- a/transport/HidlTransportUtils.cpp
+++ b/transport/HidlTransportUtils.cpp
@@ -16,16 +16,25 @@
 
 #include <hidl/HidlTransportUtils.h>
 
+#include <android/hidl/base/1.0/IBase.h>
+
 namespace android {
 namespace hardware {
 namespace details {
 
-Return<bool> canCastInterface(::android::hidl::base::V1_0::IBase* interface,
-        const char* castTo, bool emitError) {
+using ::android::hidl::base::V1_0::IBase;
+
+Return<bool> canCastInterface(IBase* interface, const char* castTo, bool emitError) {
     if (interface == nullptr) {
         return false;
     }
 
+    // b/68217907
+    // Every HIDL interface is a base interface.
+    if (std::string(IBase::descriptor) == castTo) {
+        return true;
+    }
+
     bool canCast = false;
     auto chainRet = interface->interfaceChain([&](const hidl_vec<hidl_string> &types) {
         for (size_t i = 0; i < types.size(); i++) {
@@ -46,7 +55,7 @@
     return canCast;
 }
 
-std::string getDescriptor(::android::hidl::base::V1_0::IBase* interface) {
+std::string getDescriptor(IBase* interface) {
     std::string myDescriptor{};
     auto ret = interface->interfaceDescriptor([&](const hidl_string &types) {
         myDescriptor = types.c_str();