From ded421f5355a2f99e6b16ed6a24c5b3c2892445d Mon Sep 17 00:00:00 2001 From: Steven Moreland Date: Thu, 11 Oct 2018 14:41:33 -0700 Subject: [PATCH] HwBinder: register with registerAsServiceInternal This ties together the Java/C++ logic for service registration. Bug: 36424585 Test: boot Change-Id: I1fe8266e7d291e3253af492e9321bd5a24da4cc3 --- core/jni/android_os_HwBinder.cpp | 17 +++-------------- 1 file changed, 3 insertions(+), 14 deletions(-) diff --git a/core/jni/android_os_HwBinder.cpp b/core/jni/android_os_HwBinder.cpp index 163b86b29030e..4e2d4a594edf6 100644 --- a/core/jni/android_os_HwBinder.cpp +++ b/core/jni/android_os_HwBinder.cpp @@ -269,28 +269,17 @@ static void JHwBinder_native_registerService( } sp binder = JHwBinder::GetNativeBinder(env, thiz); - - /* TODO(b/33440494) this is not right */ sp base = new hidl::base::V1_0::BpHwBase(binder); - auto manager = hardware::defaultServiceManager(); - - if (manager == nullptr) { - LOG(ERROR) << "Could not get hwservicemanager."; - signalExceptionForError(env, UNKNOWN_ERROR, true /* canThrowRemoteException */); - return; - } - - Return ret = manager->add(str.c_str(), base); - - bool ok = ret.isOk() && ret; + bool ok = hardware::details::registerAsServiceInternal(base, str.c_str()) == OK; if (ok) { LOG(INFO) << "HwBinder: Starting thread pool for " << str.c_str(); ::android::hardware::ProcessState::self()->startThreadPool(); } - signalExceptionForError(env, (ok ? OK : UNKNOWN_ERROR), true /* canThrowRemoteException */); + // avoiding richer error exceptions to stick with legacy behavior + signalExceptionForError(env, (ok ? OK : UNKNOWN_ERROR), true /*canThrowRemoteException*/); } static jobject JHwBinder_native_getService(