Loading libs/binder/Android.bp +14 −2 Original line number Diff line number Diff line Loading @@ -66,11 +66,9 @@ libbinder_device_interface_sources = [ "IAppOpsCallback.cpp", "IAppOpsService.cpp", "IPermissionController.cpp", "IProcessInfoService.cpp", "IUidObserver.cpp", "PermissionCache.cpp", "PermissionController.cpp", "ProcessInfoService.cpp", "IpPrefix.cpp", ":activity_manager_procstate_aidl", ] Loading Loading @@ -282,3 +280,17 @@ cc_library { "libutils", ], } cc_library { name: "libprocessinfoservice_aidl", srcs: [ "IProcessInfoService.cpp", "ProcessInfoService.cpp", ], export_include_dirs: ["include_processinfo"], shared_libs: [ "libbinder", "libutils", "liblog", ], } libs/binder/IProcessInfoService.cpp +1 −1 Original line number Diff line number Diff line Loading @@ -14,7 +14,7 @@ * limitations under the License. */ #include <binder/IProcessInfoService.h> #include <processinfo/IProcessInfoService.h> #include <binder/Parcel.h> #include <utils/Errors.h> #include <sys/types.h> Loading libs/binder/ProcessInfoService.cpp +1 −1 Original line number Diff line number Diff line Loading @@ -14,7 +14,7 @@ * limitations under the License. */ #include <binder/ProcessInfoService.h> #include <processinfo/ProcessInfoService.h> #include <binder/IServiceManager.h> #include <utils/Log.h> Loading libs/binder/Stability.cpp +14 −2 Original line number Diff line number Diff line Loading @@ -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); Loading libs/binder/include/binder/Stability.h +30 −2 Original line number Diff line number Diff line Loading @@ -54,8 +54,33 @@ public: // Given a binder interface at a certain stability, there may be some // requirements associated with that higher stability level. For instance, a // VINTF stability binder is required to be in the VINTF manifest. This API // can be called to use that same interface within a partition. static void forceDowngradeCompilationUnit(const sp<IBinder>& binder); // can be called to use that same interface within the local partition. static void forceDowngradeToLocalStability(const sp<IBinder>& binder); // WARNING: The only client of // - forceDowngradeToSystemStability() and; // - korceDowngradeToVendorStability() // should be AIBinder_forceDowngradeToLocalStability(). // // getLocalLevel() in libbinder returns Level::SYSTEM when called // from libbinder_ndk (even on vendor partition). So we explicitly provide // these methods for use by the NDK API: // AIBinder_forceDowngradeToLocalStability(). // // This allows correctly downgrading the binder's stability to either system/vendor, // depending on the partition. // Given a binder interface at a certain stability, there may be some // requirements associated with that higher stability level. For instance, a // VINTF stability binder is required to be in the VINTF manifest. This API // can be called to use that same interface within the vendor partition. static void forceDowngradeToVendorStability(const sp<IBinder>& binder); // Given a binder interface at a certain stability, there may be some // requirements associated with that higher stability level. For instance, a // VINTF stability binder is required to be in the VINTF manifest. This API // can be called to use that same interface within the system partition. static void forceDowngradeToSystemStability(const sp<IBinder>& binder); // WARNING: Below APIs are only ever expected to be called by auto-generated code. // Instead of calling them, you should set the stability of a .aidl interface Loading Loading @@ -146,6 +171,9 @@ private: // returns the stability according to how this was built static Level getLocalLevel(); // Downgrades binder stability to the specified level. static void forceDowngradeToStability(const sp<IBinder>& binder, Level level); enum { REPR_NONE = 0, REPR_LOG = 1, Loading Loading
libs/binder/Android.bp +14 −2 Original line number Diff line number Diff line Loading @@ -66,11 +66,9 @@ libbinder_device_interface_sources = [ "IAppOpsCallback.cpp", "IAppOpsService.cpp", "IPermissionController.cpp", "IProcessInfoService.cpp", "IUidObserver.cpp", "PermissionCache.cpp", "PermissionController.cpp", "ProcessInfoService.cpp", "IpPrefix.cpp", ":activity_manager_procstate_aidl", ] Loading Loading @@ -282,3 +280,17 @@ cc_library { "libutils", ], } cc_library { name: "libprocessinfoservice_aidl", srcs: [ "IProcessInfoService.cpp", "ProcessInfoService.cpp", ], export_include_dirs: ["include_processinfo"], shared_libs: [ "libbinder", "libutils", "liblog", ], }
libs/binder/IProcessInfoService.cpp +1 −1 Original line number Diff line number Diff line Loading @@ -14,7 +14,7 @@ * limitations under the License. */ #include <binder/IProcessInfoService.h> #include <processinfo/IProcessInfoService.h> #include <binder/Parcel.h> #include <utils/Errors.h> #include <sys/types.h> Loading
libs/binder/ProcessInfoService.cpp +1 −1 Original line number Diff line number Diff line Loading @@ -14,7 +14,7 @@ * limitations under the License. */ #include <binder/ProcessInfoService.h> #include <processinfo/ProcessInfoService.h> #include <binder/IServiceManager.h> #include <utils/Log.h> Loading
libs/binder/Stability.cpp +14 −2 Original line number Diff line number Diff line Loading @@ -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); Loading
libs/binder/include/binder/Stability.h +30 −2 Original line number Diff line number Diff line Loading @@ -54,8 +54,33 @@ public: // Given a binder interface at a certain stability, there may be some // requirements associated with that higher stability level. For instance, a // VINTF stability binder is required to be in the VINTF manifest. This API // can be called to use that same interface within a partition. static void forceDowngradeCompilationUnit(const sp<IBinder>& binder); // can be called to use that same interface within the local partition. static void forceDowngradeToLocalStability(const sp<IBinder>& binder); // WARNING: The only client of // - forceDowngradeToSystemStability() and; // - korceDowngradeToVendorStability() // should be AIBinder_forceDowngradeToLocalStability(). // // getLocalLevel() in libbinder returns Level::SYSTEM when called // from libbinder_ndk (even on vendor partition). So we explicitly provide // these methods for use by the NDK API: // AIBinder_forceDowngradeToLocalStability(). // // This allows correctly downgrading the binder's stability to either system/vendor, // depending on the partition. // Given a binder interface at a certain stability, there may be some // requirements associated with that higher stability level. For instance, a // VINTF stability binder is required to be in the VINTF manifest. This API // can be called to use that same interface within the vendor partition. static void forceDowngradeToVendorStability(const sp<IBinder>& binder); // Given a binder interface at a certain stability, there may be some // requirements associated with that higher stability level. For instance, a // VINTF stability binder is required to be in the VINTF manifest. This API // can be called to use that same interface within the system partition. static void forceDowngradeToSystemStability(const sp<IBinder>& binder); // WARNING: Below APIs are only ever expected to be called by auto-generated code. // Instead of calling them, you should set the stability of a .aidl interface Loading Loading @@ -146,6 +171,9 @@ private: // returns the stability according to how this was built static Level getLocalLevel(); // Downgrades binder stability to the specified level. static void forceDowngradeToStability(const sp<IBinder>& binder, Level level); enum { REPR_NONE = 0, REPR_LOG = 1, Loading