Reland "libbinder: remove __ANDROID_APEX__ stability diff"
Since the product partition is using __ANDROID_VNDK__, we can't remove
the __ANDROID_APEX__ check from the NDK header.
This reverts commit 15b7029849a1c59ecb54961fa7417ee0611408a0.
Reason for revert: reland b/179906909
Fixes: 179906909
Test: the following, which was failing before w/ stability error
mmma packages/modules/Gki
adb install --staged-ready-timeout 600000\
out/host/linux-x86/testcases/GkiInstallTest/com.android.gki.kmi_5_10_android12_0_test_high.apex
Change-Id: I189b5c07ffd767fa46c59fd8828ba4f59b31f095
diff --git a/libs/binder/Parcel.cpp b/libs/binder/Parcel.cpp
index 1a4ede1..3773760 100644
--- a/libs/binder/Parcel.cpp
+++ b/libs/binder/Parcel.cpp
@@ -520,7 +520,7 @@
}
}
-#if defined(__ANDROID_VNDK__) && !defined(__ANDROID_APEX__)
+#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');
diff --git a/libs/binder/ProcessState.cpp b/libs/binder/ProcessState.cpp
index c38249e..edadcd5 100644
--- a/libs/binder/ProcessState.cpp
+++ b/libs/binder/ProcessState.cpp
@@ -406,12 +406,6 @@
, 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 339c538..b56e09f 100644
--- a/libs/binder/Stability.cpp
+++ b/libs/binder/Stability.cpp
@@ -76,18 +76,12 @@
}
Stability::Level Stability::getLocalLevel() {
+#ifdef __ANDROID_APEX__
+#error APEX can't use libbinder (must use libbinder_ndk)
+#endif
+
#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
+ return Level::VENDOR;
#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 f5e8bf6..44ed48f 100644
--- a/libs/binder/ndk/include_platform/android/binder_stability.h
+++ b/libs/binder/ndk/include_platform/android/binder_stability.h
@@ -30,6 +30,8 @@
FLAG_PRIVATE_VENDOR = 0x10000000,
};
+// TODO(b/180646847): __ANDROID_APEX__ here is what allows product partition to
+// talk to system.
#if defined(__ANDROID_VNDK__) && !defined(__ANDROID_APEX__)
enum {