HwBinder: Remove use of IHw class.

Note that this is somewhat of a hack, until we properly
solve b/33440494.

Bug: 33440494
Bug: 33173166
Test: mma, hidl_test, hidl_test_java
Change-Id: I7db8eb11c8c9c624f2f5ed11bef6c32f155b5a76
This commit is contained in:
Martijn Coenen
2016-12-08 10:48:19 +01:00
parent 7552e2de9d
commit 1298711674

View File

@@ -26,10 +26,11 @@
#include <JNIHelp.h>
#include <android/hidl/manager/1.0/IServiceManager.h>
#include <android/hidl/base/1.0/IBase.h>
#include <android/hidl/base/1.0/IHwBase.h>
#include <android/hidl/base/1.0/BpBase.h>
#include <android_runtime/AndroidRuntime.h>
#include <hidl/ServiceManagement.h>
#include <hidl/Status.h>
#include <hidl/HidlTransportSupport.h>
#include <hwbinder/ProcessState.h>
#include <nativehelper/ScopedLocalRef.h>
@@ -241,14 +242,8 @@ static void JHwBinder_native_registerService(
using android::hidl::manager::V1_0::IServiceManager;
sp<hardware::IBinder> binder = JHwBinder::GetNativeContext(env, thiz);
sp<hidl::base::V1_0::IBase> base = hidl::base::V1_0::IHwBase::asInterface(binder);
if (base.get() == nullptr) {
LOG(ERROR) << "IBinder object cannot be casted to the base interface.";
signalExceptionForError(env, UNKNOWN_ERROR);
return;
}
/* TODO(b/33440494) this is not right */
sp<hidl::base::V1_0::IBase> base = new hidl::base::V1_0::BpBase(binder);
bool ok = hardware::defaultServiceManager()->add(
interfaceChain,
serviceName,
@@ -300,7 +295,7 @@ static jobject JHwBinder_native_getService(
serviceName,
[&service](sp<hidl::base::V1_0::IBase> out) {
service = hardware::toBinder<
hidl::base::V1_0::IBase, hidl::base::V1_0::IHwBase
hidl::base::V1_0::IBase, hidl::base::V1_0::BpBase
>(out);
});