libbinder_ndk: Add stability downgrade
This can be used to allow registering a service with a VINTF interface
without requiring a manifest declaration.
This is useful for test services or in the case of a system proxy
service that implements the same interface as the vintf service.
Bug: 183154648
Bug: 177664629
Test: atest binderStabilityTest
Change-Id: Ibd8dad46945a339b77dca70484082fda06220ee3
diff --git a/libs/binder/ndk/stability.cpp b/libs/binder/ndk/stability.cpp
index a5b3ece..7eafb9c 100644
--- a/libs/binder/ndk/stability.cpp
+++ b/libs/binder/ndk/stability.cpp
@@ -31,7 +31,7 @@
#error libbinder_ndk should only be built in a system context
#endif
-// explicit extern because symbol is only declared in header when __ANDROID_VNDK__
+// explicit extern because symbol is only declared in header when __ANDROID_VENDOR__
extern "C" void AIBinder_markVendorStability(AIBinder* binder) {
Stability::markVndk(binder->getBinder().get());
}
@@ -43,3 +43,12 @@
void AIBinder_markVintfStability(AIBinder* binder) {
Stability::markVintf(binder->getBinder().get());
}
+
+// explicit extern because symbol is only declared in header when __ANDROID_VENDOR__
+extern "C" void AIBinder_forceDowngradeToVendorStability(AIBinder* binder) {
+ Stability::forceDowngradeToVendorStability(binder->getBinder());
+}
+
+void AIBinder_forceDowngradeToSystemStability(AIBinder* binder) {
+ Stability::forceDowngradeToSystemStability(binder->getBinder());
+}