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

Commit 8852cc78 authored by Steven Moreland's avatar Steven Moreland
Browse files

libbinder: disallow APEX at build time

Bug: 161926892
Test: build only
Change-Id: I37c5e335e7e0656c227d2b72b79124788b974a0f
parent 122d496e
Loading
Loading
Loading
Loading
+0 −7
Original line number Diff line number Diff line
@@ -78,9 +78,6 @@ cc_library {
    // or dessert updates. Instead, apex users should use libbinder_ndk.
    apex_available: [
        "//apex_available:platform",
        // TODO(b/139016109) remove these three
        "com.android.media.swcodec",
        "test_com.android.media.swcodec",
    ],

    srcs: [
@@ -127,10 +124,6 @@ cc_library {
        export_aidl_headers: true,
    },

    // TODO(b/142684679): for com.android.media which is compiled
    // as vendor and used as system code.
    use_apex_name_macro: true,

    cflags: [
        "-Wall",
        "-Wextra",
+7 −1
Original line number Diff line number Diff line
@@ -519,7 +519,13 @@ void Parcel::updateWorkSourceRequestHeaderPosition() const {
    }
}

#if defined(__ANDROID_VNDK__) && !defined(__ANDROID_APEX__)
#ifdef __ANDROID_APEX__
#error APEX cannot include libbinder. The wire protocol for libbinder is not\
    frozen, and including it in an APEX would also require APEX\
    servicemanagers which is not an options. Use libbinder_ndk instead.
#endif

#if defined(__ANDROID_VNDK__)
constexpr int32_t kHeader = B_PACK_CHARS('V', 'N', 'D', 'R');
#else
constexpr int32_t kHeader = B_PACK_CHARS('S', 'Y', 'S', 'T');
+0 −6
Original line number Diff line number Diff line
@@ -403,12 +403,6 @@ ProcessState::ProcessState(const char *driver)
    , mThreadPoolSeq(1)
    , mCallRestriction(CallRestriction::NONE)
{

// TODO(b/139016109): enforce in build system
#if defined(__ANDROID_APEX__)
    LOG_ALWAYS_FATAL("Cannot use libbinder in APEX (only system.img libbinder) since it is not stable.");
#endif

    if (mDriverFD >= 0) {
        // mmap the binder, providing a chunk of virtual address space to receive transactions.
        mVMStart = mmap(nullptr, BINDER_VM_SIZE, PROT_READ, MAP_PRIVATE | MAP_NORESERVE, mDriverFD, 0);
+1 −11
Original line number Diff line number Diff line
@@ -50,17 +50,7 @@ void Stability::tryMarkCompilationUnit(IBinder* binder) {

Stability::Level Stability::getLocalStability() {
#ifdef __ANDROID_VNDK__
    #ifdef __ANDROID_APEX__
        // TODO(b/142684679) avoid use_vendor on system APEXes
        #if !defined(__ANDROID_APEX_COM_ANDROID_MEDIA_SWCODEC__) \
            && !defined(__ANDROID_APEX_TEST_COM_ANDROID_MEDIA_SWCODEC__)
        #error VNDK + APEX only defined for com.android.media.swcodec
        #endif
        // TODO(b/142684679) avoid use_vendor on system APEXes
        return Level::SYSTEM;
    #else
    return Level::VENDOR;
    #endif
#else
    // TODO(b/139325195): split up stability levels for system/APEX.
    return Level::SYSTEM;