diff options
| author | 2021-02-18 19:18:45 +0000 | |
|---|---|---|
| committer | 2021-02-18 19:18:45 +0000 | |
| commit | c9906e91f94fb19ff602fab5be6fd570e537349f (patch) | |
| tree | 8fb6b35738c3979bdfa820347bcb7e74011719c6 | |
| parent | cc39cdd00ed78fc4a51129d3aaab2226da3ab0cf (diff) | |
| parent | 15b7029849a1c59ecb54961fa7417ee0611408a0 (diff) | |
Merge "Revert "libbinder: remove __ANDROID_APEX__ stability diff"" into sc-dev
| -rw-r--r-- | libs/binder/Parcel.cpp | 2 | ||||
| -rw-r--r-- | libs/binder/ProcessState.cpp | 6 | ||||
| -rw-r--r-- | libs/binder/Stability.cpp | 16 | ||||
| -rw-r--r-- | libs/binder/ndk/include_platform/android/binder_stability.h | 6 |
4 files changed, 21 insertions, 9 deletions
diff --git a/libs/binder/Parcel.cpp b/libs/binder/Parcel.cpp index 3773760f38..1a4ede1940 100644 --- a/libs/binder/Parcel.cpp +++ b/libs/binder/Parcel.cpp @@ -520,7 +520,7 @@ void Parcel::updateWorkSourceRequestHeaderPosition() const { } } -#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'); diff --git a/libs/binder/ProcessState.cpp b/libs/binder/ProcessState.cpp index edadcd5c58..c38249ef7c 100644 --- a/libs/binder/ProcessState.cpp +++ b/libs/binder/ProcessState.cpp @@ -406,6 +406,12 @@ ProcessState::ProcessState(const char *driver) , mThreadPoolSeq(1) , mCallRestriction(CallRestriction::NONE) { + +// TODO(b/166468760): 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); diff --git a/libs/binder/Stability.cpp b/libs/binder/Stability.cpp index b56e09fa6e..339c53833b 100644 --- a/libs/binder/Stability.cpp +++ b/libs/binder/Stability.cpp @@ -76,12 +76,18 @@ void Stability::tryMarkCompilationUnit(IBinder* binder) { } Stability::Level Stability::getLocalLevel() { -#ifdef __ANDROID_APEX__ -#error APEX can't use libbinder (must use libbinder_ndk) -#endif - #ifdef __ANDROID_VNDK__ - return Level::VENDOR; + #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; diff --git a/libs/binder/ndk/include_platform/android/binder_stability.h b/libs/binder/ndk/include_platform/android/binder_stability.h index 7a2d2b8fc8..f5e8bf60ef 100644 --- a/libs/binder/ndk/include_platform/android/binder_stability.h +++ b/libs/binder/ndk/include_platform/android/binder_stability.h @@ -30,7 +30,7 @@ enum { FLAG_PRIVATE_VENDOR = 0x10000000, }; -#if defined(__ANDROID_VNDK__) +#if defined(__ANDROID_VNDK__) && !defined(__ANDROID_APEX__) enum { FLAG_PRIVATE_LOCAL = FLAG_PRIVATE_VENDOR, @@ -45,7 +45,7 @@ static inline void AIBinder_markCompilationUnitStability(AIBinder* binder) { AIBinder_markVendorStability(binder); } -#else // defined(__ANDROID_VNDK__) +#else // defined(__ANDROID_VNDK__) && !defined(__ANDROID_APEX__) enum { FLAG_PRIVATE_LOCAL = 0, @@ -62,7 +62,7 @@ static inline void AIBinder_markCompilationUnitStability(AIBinder* binder) { AIBinder_markSystemStability(binder); } -#endif // defined(__ANDROID_VNDK__) +#endif // defined(__ANDROID_VNDK__) && !defined(__ANDROID_APEX__) /** * This interface has system<->vendor stability |