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

Commit 73d3644e authored by Arthur Ishiguro's avatar Arthur Ishiguro
Browse files

Add ifdefs to compile out Parcel::Blob code

Also removes unused header includes based on the ifdef.

Bug: 410035138
Flag: EXEMPT minor bug fix
Test: atest binderRpcTestNoLegacy
Change-Id: I112021ed47323f8b03338609e4c9ed75beeed90f
parent 24cd4047
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -732,7 +732,7 @@ cc_library {
}

cc_library {
    name: "libbinder_rpc_no_blob",
    name: "libbinder_rpc_no_legacy",
    vendor_available: true,
    defaults: [
        "libbinder_common_defaults",
+4 −2
Original line number Diff line number Diff line
@@ -24,9 +24,9 @@
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#ifndef BINDER_DISABLE_BLOB
#include <sys/mman.h>
#include <sys/resource.h>
#include <sys/stat.h>
#endif // BINDER_DISABLE_BLOB
#include <sys/types.h>
#include <unistd.h>
#include <algorithm>
@@ -3500,6 +3500,7 @@ size_t Parcel::getOpenAshmemSize() const

// --- Parcel::Blob ---

#ifndef BINDER_DISABLE_BLOB
Parcel::Blob::Blob() :
        mFd(-1), mData(nullptr), mSize(0), mMutable(false) {
}
@@ -3530,5 +3531,6 @@ void Parcel::Blob::clear() {
    mSize = 0;
    mMutable = false;
}
#endif // BINDER_DISABLE_BLOB

} // namespace android
+3 −0
Original line number Diff line number Diff line
@@ -98,6 +98,9 @@
    },
    {
      "name": "binderStatsPusherUnitTest"
    },
    {
      "name": "binderRpcTestNoLegacy"
    }
  ],
  "presubmit-large": [
+8 −4
Original line number Diff line number Diff line
@@ -1399,6 +1399,7 @@ private:

    size_t mReserved;

#ifndef BINDER_DISABLE_BLOB
    class Blob {
    public:
        LIBBINDER_EXPORTED Blob();
@@ -1418,6 +1419,7 @@ private:
        size_t mSize;
        bool mMutable;
    };
#endif // BINDER_DISABLE_BLOB

#if defined(__clang__)
#pragma clang diagnostic push
@@ -1469,6 +1471,7 @@ private:
    LIBBINDER_EXPORTED status_t read(FlattenableHelperInterface& val) const;

public:
#ifndef BINDER_DISABLE_BLOB
    class ReadableBlob : public Blob {
        friend class Parcel;
    public:
@@ -1481,6 +1484,7 @@ public:
    public:
        LIBBINDER_EXPORTED inline void* data() { return mData; }
    };
#endif // BINDER_DISABLE_BLOB

    /**
     * Returns the total amount of ashmem memory owned by this object.
+11 −0
Original line number Diff line number Diff line
@@ -547,6 +547,17 @@ cc_test {
    ],
}

cc_test {
    name: "binderRpcTestNoLegacy",
    defaults: [
        "binderRpcTest_defaults",
        "binderRpcTest_static_defaults",
    ],
    static_libs: [
        "libbinder_rpc_no_legacy",
    ],
}

cc_test {
    name: "binderRpcTestNoKernelAtAll",
    defaults: [