diff options
author | 2020-07-28 18:11:21 +0000 | |
---|---|---|
committer | 2020-07-29 21:43:43 +0000 | |
commit | 2f2c4e04606cf05e09423ab3071eaf26934de704 (patch) | |
tree | f8562c7cd4b3f2771dc72f283ada3d6feadee60c /libs/binder/Stability.cpp | |
parent | 09f7bc11ba9bd5ec86051e0ce5540869cd75966a (diff) |
libbinder: stricter APEX + VNDK stability checks
This is in preparation for splitting system/apex stability and also
ensures there are no surprises if/when vendor APEXes are introduced by
specifically checking that the only __ANDROID_APEX__ + __ANDROID_VNDK__
case is com.android.media, which is compiled with vendor code, but
shipped with the system partition.
Bug: 139325195
Test: build checks satifised, TEST_MAPPING
Change-Id: Id72e40addb4ab4b7a7e2e35a90c1ca0d0a51558a
Diffstat (limited to 'libs/binder/Stability.cpp')
-rw-r--r-- | libs/binder/Stability.cpp | 23 |
1 files changed, 21 insertions, 2 deletions
diff --git a/libs/binder/Stability.cpp b/libs/binder/Stability.cpp index e1565fac43..6115aec81d 100644 --- a/libs/binder/Stability.cpp +++ b/libs/binder/Stability.cpp @@ -22,7 +22,7 @@ namespace android { namespace internal { void Stability::markCompilationUnit(IBinder* binder) { - status_t result = set(binder, kLocalStability, true /*log*/); + status_t result = set(binder, getLocalStability(), true /*log*/); LOG_ALWAYS_FATAL_IF(result != OK, "Should only mark known object."); } @@ -45,7 +45,26 @@ bool Stability::requiresVintfDeclaration(const sp<IBinder>& binder) { } void Stability::tryMarkCompilationUnit(IBinder* binder) { - (void) set(binder, kLocalStability, false /*log*/); + (void) set(binder, getLocalStability(), false /*log*/); +} + +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; +#endif } status_t Stability::set(IBinder* binder, int32_t stability, bool log) { |