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

Commit 3d564ffd authored by Jooyung Han's avatar Jooyung Han
Browse files

use vector<uint8_t> for byte[] in AIDL

In native world, byte stream is typically represented in uint8_t[]
or vector<uint8_t>. C++ backend already generates that way. This
change involves NDK backend.

Now NDK backend also uses vector<uint8_t> just like C++ backend.

Bug: 144957764
Test: atest CtsNdkBinderTestCases
Merged-In: Iffe188aa42f4f827ad4d021f06d85992db204c0d
Change-Id: Iffe188aa42f4f827ad4d021f06d85992db204c0d
(cherry picked from commit cfca116b)

Exempt-From-Owner-Approval: cp from master to avoid merge-conflict
parent 9a788e15
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -66,7 +66,7 @@ static std::vector<MediaResourceParcel> toResourceVec(
    std::vector<MediaResourceParcel> resources;
    MediaResourceParcel resource{
            Type::kDrmSession, SubType::kUnspecifiedSubType,
            toStdVec<int8_t>(sessionId), value};
            toStdVec<>(sessionId), value};
    resources.push_back(resource);
    return resources;
}
+3 −3
Original line number Diff line number Diff line
@@ -35,7 +35,7 @@ MediaResource::MediaResource(Type type, SubType subType, int64_t value) {
    this->value = value;
}

MediaResource::MediaResource(Type type, const std::vector<int8_t> &id, int64_t value) {
MediaResource::MediaResource(Type type, const std::vector<uint8_t> &id, int64_t value) {
    this->type = type;
    this->subType = SubType::kUnspecifiedSubType;
    this->id = id;
@@ -66,11 +66,11 @@ MediaResource MediaResource::VideoBatteryResource() {
}

//static
MediaResource MediaResource::DrmSessionResource(const std::vector<int8_t> &id, int64_t value) {
MediaResource MediaResource::DrmSessionResource(const std::vector<uint8_t> &id, int64_t value) {
    return MediaResource(Type::kDrmSession, id, value);
}

static String8 bytesToHexString(const std::vector<int8_t> &bytes) {
static String8 bytesToHexString(const std::vector<uint8_t> &bytes) {
    String8 str;
    for (auto &b : bytes) {
        str.appendFormat("%02x", b);
+2 −2
Original line number Diff line number Diff line
@@ -35,13 +35,13 @@ public:
    MediaResource() = delete;
    MediaResource(Type type, int64_t value);
    MediaResource(Type type, SubType subType, int64_t value);
    MediaResource(Type type, const std::vector<int8_t> &id, int64_t value);
    MediaResource(Type type, const std::vector<uint8_t> &id, int64_t value);

    static MediaResource CodecResource(bool secure, bool video);
    static MediaResource GraphicMemoryResource(int64_t value);
    static MediaResource CpuBoostResource();
    static MediaResource VideoBatteryResource();
    static MediaResource DrmSessionResource(const std::vector<int8_t> &id, int64_t value);
    static MediaResource DrmSessionResource(const std::vector<uint8_t> &id, int64_t value);
};

inline static const char *asString(MediaResource::Type i, const char *def = "??") {
+1 −1
Original line number Diff line number Diff line
@@ -41,7 +41,7 @@ using ::aidl::android::media::MediaResourceParcel;
using ::aidl::android::media::MediaResourcePolicyParcel;

typedef std::map<std::tuple<
        MediaResource::Type, MediaResource::SubType, std::vector<int8_t>>,
        MediaResource::Type, MediaResource::SubType, std::vector<uint8_t>>,
        MediaResourceParcel> ResourceList;

struct ResourceInfo {