summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Steven Moreland <smoreland@google.com> 2023-10-28 01:07:40 +0000
committer Steven Moreland <smoreland@google.com> 2023-10-30 22:23:52 +0000
commit687728e4dd034fc2b3116c8aac41b3e79f7c8b01 (patch)
tree5af882871264807667434bd780f7d0a6c78bc3fe
parent2de74ac2c70e03f78476174272cc19d27853f873 (diff)
RPC Binder: limit experimental wire protocol use
Only allow experimental wire protocol when: - we're on Android - it's not a release build This is intended to avoid things in the wild accidentally freezing the experimental wire protocol. If such a thing happened, we'd have to stop using the existing experimental wire protocol version and increment it. Worse though, it may de facto freeze the experimental version at that time, or even cause RPC binder to fail in certain cases. One downside of this is that when we make changes to the RPC binder wire protocol, that we would no longer be able to test it. In order to avoid that problem, we could add another way to enable it at that time. However, to play things on the safe side, disabling by default for now. Fixes: 305983144 Test: binderRpcTest Change-Id: Ieb23cc11d6f3c5b77545dcfd7621f1464dd98f0f
-rw-r--r--libs/binder/RpcState.cpp6
-rw-r--r--libs/binder/tests/binderRpcTestCommon.h3
2 files changed, 3 insertions, 6 deletions
diff --git a/libs/binder/RpcState.cpp b/libs/binder/RpcState.cpp
index 26a2f4fa39..749c2f81ea 100644
--- a/libs/binder/RpcState.cpp
+++ b/libs/binder/RpcState.cpp
@@ -412,10 +412,8 @@ bool RpcState::validateProtocolVersion(uint32_t version) {
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
+ ALOGE("Cannot use experimental RPC binder protocol outside of Android.");
+ return false;
#endif
} else if (version >= RPC_WIRE_PROTOCOL_VERSION_NEXT) {
ALOGE("Cannot use RPC binder protocol version %u which is unknown (current protocol "
diff --git a/libs/binder/tests/binderRpcTestCommon.h b/libs/binder/tests/binderRpcTestCommon.h
index 786fab8133..c3070ddd14 100644
--- a/libs/binder/tests/binderRpcTestCommon.h
+++ b/libs/binder/tests/binderRpcTestCommon.h
@@ -74,8 +74,7 @@ static inline bool hasExperimentalRpc() {
#ifdef __ANDROID__
return base::GetProperty("ro.build.version.codename", "") != "REL";
#else
- // TODO(b/305983144): restrict on other platforms
- return true;
+ return false;
#endif
}