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

Commit e10cdb19 authored by Fan Xu's avatar Fan Xu Committed by Android (Google) Code Review
Browse files

Merge changes I81c799e9,Ifa66f25c

* changes:
  Migrate from aidl to manual implementation
  Add a helper function to get service runtime
parents ffaf0cfe f35719ab
Loading
Loading
Loading
Loading
+1 −6
Original line number Diff line number Diff line
@@ -28,13 +28,13 @@ sharedLibraries = [
cc_library_static {
    name: "libbufferhubd",
    srcs: [
        "binder/android/dvr/IBufferHub.aidl",
        "buffer_channel.cpp",
        "buffer_hub.cpp",
        "buffer_hub_binder.cpp",
        "buffer_node.cpp",
        "consumer_channel.cpp",
        "consumer_queue_channel.cpp",
        "IBufferHub.cpp",
        "producer_channel.cpp",
        "producer_queue_channel.cpp",
    ],
@@ -49,11 +49,6 @@ cc_library_static {
    static_libs: [
        "libbufferhub",
    ],
    aidl: {
        local_include_dirs: ["binder"],
        include_dirs: ["frameworks/native/aidl/binder"],
        export_aidl_headers: true,
    },
}

cc_binary {
+20 −0
Original line number Diff line number Diff line
#include <log/log.h>
#include <private/dvr/IBufferHub.h>

namespace android {
namespace dvr {

IMPLEMENT_META_INTERFACE(BufferHub, "android.dvr.IBufferHub");

status_t BnBufferHub::onTransact(uint32_t code, const Parcel& data,
                                 Parcel* reply, uint32_t flags) {
  switch (code) {
    default:
      // Should not reach
      ALOGE("onTransact(): unknown code %u received!", code);
      return BBinder::onTransact(code, data, reply, flags);
  }
}

}  // namespace dvr
}  // namespace android
 No newline at end of file
+0 −5
Original line number Diff line number Diff line
package android.dvr;

/** {@hide} */
interface IBufferHub {
}
 No newline at end of file
+19 −0
Original line number Diff line number Diff line
@@ -58,5 +58,24 @@ status_t BufferHubBinderService::dump(int fd, const Vector<String16>& args) {
  return NO_ERROR;
}

sp<IBufferHub> BufferHubBinderService::getServiceProxy() {
  sp<IServiceManager> sm = defaultServiceManager();
  sp<IBinder> service = sm->checkService(String16(getServiceName()));

  if (service == nullptr) {
    ALOGE("getServiceProxy(): %s binder service not found!", getServiceName());
    return nullptr;
  }

  sp<IBufferHub> ret = interface_cast<IBufferHub>(service);
  if (ret == nullptr) {
    ALOGE("getServiceProxy(): %s binder service type casting error!",
          getServiceName());
    return nullptr;
  }

  return ret;
}

}  // namespace dvr
}  // namespace android
+30 −0
Original line number Diff line number Diff line
#ifndef ANDROID_DVR_IBUFFERHUB_H
#define ANDROID_DVR_IBUFFERHUB_H

#include <binder/IInterface.h>
#include <binder/Parcel.h>

namespace android {
namespace dvr {

class IBufferHub : public IInterface {
 public:
  DECLARE_META_INTERFACE(BufferHub);
};

class BnBufferHub : public BnInterface<IBufferHub> {
 public:
  virtual status_t onTransact(uint32_t code, const Parcel& data, Parcel* reply,
                              uint32_t flags = 0);
};

class BpBufferHub : public BpInterface<IBufferHub> {
 public:
  explicit BpBufferHub(const sp<IBinder>& impl)
      : BpInterface<IBufferHub>(impl) {}
};

}  // namespace dvr
}  // namespace android

#endif
 No newline at end of file
Loading