OSDN Git Service

hidl getService throw correct exceptions.
authorSteven Moreland <smoreland@google.com>
Wed, 28 Jun 2017 17:21:00 +0000 (10:21 -0700)
committerSteven Moreland <smoreland@google.com>
Wed, 28 Jun 2017 17:21:47 +0000 (10:21 -0700)
NoSuchElementException needs to be thrown when getService is
called and the service is not available.

Test: hidl_test_java
Bug: 63087967

Change-Id: I207098cfb732e888f91704f623e888e72e6ce7d9

core/jni/android_os_HwBinder.cpp

index cdd3c09..6c6fa66 100644 (file)
@@ -370,7 +370,7 @@ static jobject JHwBinder_native_getService(
     if (transport != IServiceManager::Transport::HWBINDER && !vintfLegacy) {
         LOG(ERROR) << "service " << ifaceName << " declares transport method "
                    << toString(transport) << " but framework expects hwbinder.";
-        signalExceptionForError(env, UNKNOWN_ERROR, true /* canThrowRemoteException */);
+        signalExceptionForError(env, NAME_NOT_FOUND, true /* canThrowRemoteException */);
         return NULL;
     }