diff options
| author | 2017-04-07 01:10:56 +0000 | |
|---|---|---|
| committer | 2017-04-07 01:10:58 +0000 | |
| commit | 562ed84ff48d51d4f14bb19d1959feeeedbba4f7 (patch) | |
| tree | 895f61012f33762d409030e78d75d9c21d09b5f1 | |
| parent | b2c75d062debb40e1131b2f4d17c4edb19effe57 (diff) | |
| parent | f7019c2e53ed95689a7a559c5e9489c8b48e9161 (diff) | |
Merge "Use hwservicemanager getTransport."
| -rw-r--r-- | core/jni/android_os_HwBinder.cpp | 22 |
1 files changed, 15 insertions, 7 deletions
diff --git a/core/jni/android_os_HwBinder.cpp b/core/jni/android_os_HwBinder.cpp index c3978e7556ee..577cd49cbaec 100644 --- a/core/jni/android_os_HwBinder.cpp +++ b/core/jni/android_os_HwBinder.cpp @@ -276,7 +276,8 @@ static jobject JHwBinder_native_getService( jstring ifaceNameObj, jstring serviceNameObj) { - using ::android::vintf::operator<<; + using ::android::hidl::base::V1_0::IBase; + using ::android::hidl::manager::V1_0::IServiceManager; if (ifaceNameObj == NULL) { jniThrowException(env, "java/lang/NullPointerException", NULL); @@ -318,13 +319,20 @@ static jobject JHwBinder_native_getService( << "/" << serviceName; - ::android::vintf::Transport transport = - ::android::hardware::getTransport(ifaceName, serviceName); - if ( transport != ::android::vintf::Transport::EMPTY - && transport != ::android::vintf::Transport::HWBINDER) { + Return<IServiceManager::Transport> transportRet = + manager->getTransport(ifaceNameHStr, serviceNameHStr); + + 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 " - << transport << " but framework expects " - << ::android::vintf::Transport::HWBINDER; + << toString(transport) << " but framework expects hwbinder."; signalExceptionForError(env, UNKNOWN_ERROR, true /* canThrowRemoteException */); return NULL; } |