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

Commit edd8a251 authored by Steven Moreland's avatar Steven Moreland Committed by Android (Google) Code Review
Browse files

Merge "Revert "libbinder: disallow APEX at build time""

parents a2a3d0f8 e70d8fbc
Loading
Loading
Loading
Loading
+7 −0
Original line number Diff line number Diff line
@@ -78,6 +78,9 @@ 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: [
@@ -124,6 +127,10 @@ 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",
+1 −7
Original line number Diff line number Diff line
@@ -518,13 +518,7 @@ void Parcel::updateWorkSourceRequestHeaderPosition() const {
    }
}

#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__)
#if defined(__ANDROID_VNDK__) && !defined(__ANDROID_APEX__)
constexpr int32_t kHeader = B_PACK_CHARS('V', 'N', 'D', 'R');
#else
constexpr int32_t kHeader = B_PACK_CHARS('S', 'Y', 'S', 'T');
+6 −0
Original line number Diff line number Diff line
@@ -403,6 +403,12 @@ 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);
+11 −1
Original line number Diff line number Diff line
@@ -50,7 +50,17 @@ 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;