diff options
author | 2021-04-03 02:01:09 +0000 | |
---|---|---|
committer | 2021-04-03 02:01:09 +0000 | |
commit | 469993c9e0df0d854375e86c20d4fb83eac72a12 (patch) | |
tree | 6f14249c26de9f6553b3bb916dba7e4028d23dde /libs/binder/Stability.cpp | |
parent | 3e3ddbe36d9be66185c4a9148764b7a8337a8201 (diff) | |
parent | 332edaa92aa6ad110483f60d71cbdacc19187e43 (diff) |
Merge "libbinder_ndk: Add stability downgrade" am: 0e046dd201 am: c97ad52406 am: 332edaa92a
Original change: https://android-review.googlesource.com/c/platform/frameworks/native/+/1661238
Change-Id: Ie0a517777bc80d5884e217e8a794a1bbba2036b3
Diffstat (limited to 'libs/binder/Stability.cpp')
-rw-r--r-- | libs/binder/Stability.cpp | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/libs/binder/Stability.cpp b/libs/binder/Stability.cpp index c3f1ba7b4d..f12ef4e35b 100644 --- a/libs/binder/Stability.cpp +++ b/libs/binder/Stability.cpp @@ -38,18 +38,30 @@ Stability::Category Stability::Category::currentFromLevel(Level level) { }; } -void Stability::forceDowngradeCompilationUnit(const sp<IBinder>& binder) { +void Stability::forceDowngradeToStability(const sp<IBinder>& binder, Level level) { // Downgrading a remote binder would require also copying the version from // the binder sent here. In practice though, we don't need to downgrade the // stability of a remote binder, since this would as an effect only restrict // what we can do to it. LOG_ALWAYS_FATAL_IF(!binder || !binder->localBinder(), "Can only downgrade local binder"); - auto stability = Category::currentFromLevel(getLocalLevel()); + auto stability = Category::currentFromLevel(level); status_t result = setRepr(binder.get(), stability.repr(), REPR_LOG | REPR_ALLOW_DOWNGRADE); LOG_ALWAYS_FATAL_IF(result != OK, "Should only mark known object."); } +void Stability::forceDowngradeToLocalStability(const sp<IBinder>& binder) { + forceDowngradeToStability(binder, getLocalLevel()); +} + +void Stability::forceDowngradeToSystemStability(const sp<IBinder>& binder) { + forceDowngradeToStability(binder, Level::SYSTEM); +} + +void Stability::forceDowngradeToVendorStability(const sp<IBinder>& binder) { + forceDowngradeToStability(binder, Level::VENDOR); +} + std::string Stability::Category::debugString() { return levelString(level) + " wire protocol version " + std::to_string(version); |