Merge "Use hwservicemanager getTransport."

This commit is contained in:
Steven Moreland
2017-04-07 01:10:56 +00:00
committed by Gerrit Code Review

View File

@@ -276,7 +276,8 @@ static jobject JHwBinder_native_getService(
jstring ifaceNameObj, jstring ifaceNameObj,
jstring serviceNameObj) { jstring serviceNameObj) {
using ::android::vintf::operator<<; using ::android::hidl::base::V1_0::IBase;
using ::android::hidl::manager::V1_0::IServiceManager;
if (ifaceNameObj == NULL) { if (ifaceNameObj == NULL) {
jniThrowException(env, "java/lang/NullPointerException", NULL); jniThrowException(env, "java/lang/NullPointerException", NULL);
@@ -318,13 +319,20 @@ static jobject JHwBinder_native_getService(
<< "/" << "/"
<< serviceName; << serviceName;
::android::vintf::Transport transport = Return<IServiceManager::Transport> transportRet =
::android::hardware::getTransport(ifaceName, serviceName); manager->getTransport(ifaceNameHStr, serviceNameHStr);
if ( transport != ::android::vintf::Transport::EMPTY
&& transport != ::android::vintf::Transport::HWBINDER) { if (!transportRet.isOk()) {
signalExceptionForError(env, UNKNOWN_ERROR, true /* canThrowRemoteException */);
return NULL;
}
IServiceManager::Transport transport = transportRet;
if ( transport != IServiceManager::Transport::EMPTY
&& transport != IServiceManager::Transport::HWBINDER) {
LOG(ERROR) << "service " << ifaceName << " declares transport method " LOG(ERROR) << "service " << ifaceName << " declares transport method "
<< transport << " but framework expects " << toString(transport) << " but framework expects hwbinder.";
<< ::android::vintf::Transport::HWBINDER;
signalExceptionForError(env, UNKNOWN_ERROR, true /* canThrowRemoteException */); signalExceptionForError(env, UNKNOWN_ERROR, true /* canThrowRemoteException */);
return NULL; return NULL;
} }