Merge "HwBinder: register with registerAsServiceInternal"
This commit is contained in:
@@ -284,28 +284,17 @@ static void JHwBinder_native_registerService(
|
|||||||
}
|
}
|
||||||
|
|
||||||
sp<hardware::IBinder> binder = JHwBinder::GetNativeBinder(env, thiz);
|
sp<hardware::IBinder> binder = JHwBinder::GetNativeBinder(env, thiz);
|
||||||
|
|
||||||
/* TODO(b/33440494) this is not right */
|
|
||||||
sp<hidl::base::V1_0::IBase> base = new hidl::base::V1_0::BpHwBase(binder);
|
sp<hidl::base::V1_0::IBase> base = new hidl::base::V1_0::BpHwBase(binder);
|
||||||
|
|
||||||
auto manager = hardware::defaultServiceManager();
|
bool ok = hardware::details::registerAsServiceInternal(base, str.c_str()) == OK;
|
||||||
|
|
||||||
if (manager == nullptr) {
|
|
||||||
LOG(ERROR) << "Could not get hwservicemanager.";
|
|
||||||
signalExceptionForError(env, UNKNOWN_ERROR, true /* canThrowRemoteException */);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
Return<bool> ret = manager->add(str.c_str(), base);
|
|
||||||
|
|
||||||
bool ok = ret.isOk() && ret;
|
|
||||||
|
|
||||||
if (ok) {
|
if (ok) {
|
||||||
LOG(INFO) << "HwBinder: Starting thread pool for " << str.c_str();
|
LOG(INFO) << "HwBinder: Starting thread pool for " << str.c_str();
|
||||||
::android::hardware::ProcessState::self()->startThreadPool();
|
::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(
|
static jobject JHwBinder_native_getService(
|
||||||
|
|||||||
Reference in New Issue
Block a user