Loading libs/binder/RpcState.cpp +2 −1 Original line number Diff line number Diff line Loading @@ -408,10 +408,11 @@ bool RpcState::validateProtocolVersion(uint32_t version) { char codename[PROPERTY_VALUE_MAX]; property_get("ro.build.version.codename", codename, ""); if (!strcmp(codename, "REL")) { ALOGE("Cannot use experimental RPC binder protocol on a release branch."); ALOGE("Cannot use experimental RPC binder protocol in a release configuration."); return false; } #else // TODO(b/305983144) // don't restrict on other platforms, though experimental should // only really be used for testing, we don't have a good way to see // what is shipping outside of Android Loading libs/binder/tests/binderRpcTestCommon.h +12 −1 Original line number Diff line number Diff line Loading @@ -70,12 +70,23 @@ static inline std::vector<RpcSecurity> RpcSecurityValues() { return {RpcSecurity::RAW, RpcSecurity::TLS}; } static inline bool hasExperimentalRpc() { #ifdef __ANDROID__ return base::GetProperty("ro.build.version.codename", "") != "REL"; #else // TODO(b/305983144): restrict on other platforms return true; #endif } static inline std::vector<uint32_t> testVersions() { std::vector<uint32_t> versions; for (size_t i = 0; i < RPC_WIRE_PROTOCOL_VERSION_NEXT; i++) { versions.push_back(i); } if (hasExperimentalRpc()) { versions.push_back(RPC_WIRE_PROTOCOL_VERSION_EXPERIMENTAL); } return versions; } Loading libs/binder/tests/binderRpcUniversalTests.cpp +2 −1 Original line number Diff line number Diff line Loading @@ -50,7 +50,8 @@ TEST(BinderRpc, CannotUseNextWireVersion) { TEST(BinderRpc, CanUseExperimentalWireVersion) { auto session = RpcSession::make(); EXPECT_TRUE(session->setProtocolVersion(RPC_WIRE_PROTOCOL_VERSION_EXPERIMENTAL)); EXPECT_EQ(hasExperimentalRpc(), session->setProtocolVersion(RPC_WIRE_PROTOCOL_VERSION_EXPERIMENTAL)); } TEST_P(BinderRpc, Ping) { Loading Loading
libs/binder/RpcState.cpp +2 −1 Original line number Diff line number Diff line Loading @@ -408,10 +408,11 @@ bool RpcState::validateProtocolVersion(uint32_t version) { char codename[PROPERTY_VALUE_MAX]; property_get("ro.build.version.codename", codename, ""); if (!strcmp(codename, "REL")) { ALOGE("Cannot use experimental RPC binder protocol on a release branch."); ALOGE("Cannot use experimental RPC binder protocol in a release configuration."); return false; } #else // TODO(b/305983144) // don't restrict on other platforms, though experimental should // only really be used for testing, we don't have a good way to see // what is shipping outside of Android Loading
libs/binder/tests/binderRpcTestCommon.h +12 −1 Original line number Diff line number Diff line Loading @@ -70,12 +70,23 @@ static inline std::vector<RpcSecurity> RpcSecurityValues() { return {RpcSecurity::RAW, RpcSecurity::TLS}; } static inline bool hasExperimentalRpc() { #ifdef __ANDROID__ return base::GetProperty("ro.build.version.codename", "") != "REL"; #else // TODO(b/305983144): restrict on other platforms return true; #endif } static inline std::vector<uint32_t> testVersions() { std::vector<uint32_t> versions; for (size_t i = 0; i < RPC_WIRE_PROTOCOL_VERSION_NEXT; i++) { versions.push_back(i); } if (hasExperimentalRpc()) { versions.push_back(RPC_WIRE_PROTOCOL_VERSION_EXPERIMENTAL); } return versions; } Loading
libs/binder/tests/binderRpcUniversalTests.cpp +2 −1 Original line number Diff line number Diff line Loading @@ -50,7 +50,8 @@ TEST(BinderRpc, CannotUseNextWireVersion) { TEST(BinderRpc, CanUseExperimentalWireVersion) { auto session = RpcSession::make(); EXPECT_TRUE(session->setProtocolVersion(RPC_WIRE_PROTOCOL_VERSION_EXPERIMENTAL)); EXPECT_EQ(hasExperimentalRpc(), session->setProtocolVersion(RPC_WIRE_PROTOCOL_VERSION_EXPERIMENTAL)); } TEST_P(BinderRpc, Ping) { Loading