Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit bae1b55a authored by Yifan Hong's avatar Yifan Hong
Browse files

Use IBase instead of IBinder for IServiceManager.

Test: compiles with mma
Change-Id: I5805df48aa358dcef555125f6467d659f095b0c2
parent 4134ccb2
Loading
Loading
Loading
Loading
+8 −4
Original line number Diff line number Diff line
@@ -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);