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

Commit f35719ab authored by Fan Xu's avatar Fan Xu Committed by Tianyu Jiang
Browse files

Migrate from aidl to manual implementation

Since aidl does not support uint32_t as there is no unsigned int in
Java, after discussion we decided to stop using aidl as there are many
low-level flags implemented as unsigned int in current system, and it
will be more effort to fit them into aidl than write the boiler plate
by ourselves.

Test: "atest buffer_hub_binder_service-test" passed.
Bug: 117559794
Change-Id: I81c799e9507d686e92e34544c9b48b91c7a37157
parent 72c0b57f
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
+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
+1 −2
Original line number Diff line number Diff line
@@ -2,10 +2,9 @@
#define ANDROID_DVR_BUFFER_HUB_BINDER_H

#include <binder/BinderService.h>
#include <private/dvr/IBufferHub.h>
#include <private/dvr/buffer_hub.h>

#include "android/dvr/BnBufferHub.h"

namespace android {
namespace dvr {