diff options
author | 2021-04-03 01:35:03 +0000 | |
---|---|---|
committer | 2021-04-03 01:35:03 +0000 | |
commit | 332edaa92aa6ad110483f60d71cbdacc19187e43 (patch) | |
tree | 34c9cbc60a9021d01a7613140d123b74958adfb7 /libs/binder/Stability.cpp | |
parent | a7104037a78e3facd61811979b78d892f9f60d2b (diff) | |
parent | c97ad5240699971c22a0e9f198f6f61a159086e5 (diff) |
Merge "libbinder_ndk: Add stability downgrade" am: 0e046dd201 am: c97ad52406
Original change: https://android-review.googlesource.com/c/platform/frameworks/native/+/1661238
Change-Id: Ie0f113b997e0a8103bb1986e94949f9da940899d
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 06830c027b..709cf67127 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); |