Merge "Use IBase instead of IBinder for IServiceManager."

This commit is contained in:
Treehugger Robot
2016-12-03 23:04:24 +00:00
committed by Gerrit Code Review

View File

@@ -25,6 +25,8 @@
#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_runtime/AndroidRuntime.h>
#include <hidl/ServiceManagement.h>
#include <hidl/Status.h>
@@ -239,11 +241,11 @@ 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);
bool ok = hardware::defaultServiceManager()->add(
interfaceChain,
serviceName,
binder);
base);
env->ReleaseStringUTFChars(serviceNameObj, serviceName);
serviceName = NULL;
@@ -289,8 +291,10 @@ static jobject JHwBinder_native_getService(
hardware::defaultServiceManager()->get(
ifaceName,
serviceName,
[&service](sp<hardware::IBinder> out) {
service = out;
[&service](sp<hidl::base::V1_0::IBase> out) {
service = hardware::toBinder<
hidl::base::V1_0::IBase, hidl::base::V1_0::IHwBase
>(out);
});
env->ReleaseStringUTFChars(ifaceNameObj, ifaceName);