diff options
author | 2023-04-14 21:03:01 +0000 | |
---|---|---|
committer | 2023-04-24 19:54:28 +0000 | |
commit | 28c8728295ade83a659d9432d2adbf253eb9196e (patch) | |
tree | 69ca6727204301d360d90660fdae890d76836bd3 | |
parent | 6a66bfd4cb3091d61a80914ac5aa751257d2b26b (diff) |
freeze rpc binder wire protocol
for Android U
Bug: 266741352
Test: binderRpcWireProtocolTest
Change-Id: Iafa1f49a9f0f536162c59ff44143f05b61e9c9e8
Merged-In: Iafa1f49a9f0f536162c59ff44143f05b61e9c9e8
-rw-r--r-- | libs/binder/RpcState.cpp | 2 | ||||
-rw-r--r-- | libs/binder/include/binder/RpcSession.h | 4 | ||||
-rw-r--r-- | libs/binder/tests/binderRpcWireProtocolTest.cpp | 13 |
3 files changed, 15 insertions, 4 deletions
diff --git a/libs/binder/RpcState.cpp b/libs/binder/RpcState.cpp index ed3ce24e46..03fa69973d 100644 --- a/libs/binder/RpcState.cpp +++ b/libs/binder/RpcState.cpp @@ -928,7 +928,7 @@ processTransactInternalTailCall: transactionData.size() - offsetof(RpcWireTransaction, data)}; Span<const uint32_t> objectTableSpan; - if (session->getProtocolVersion().value() > + if (session->getProtocolVersion().value() >= RPC_WIRE_PROTOCOL_VERSION_RPC_HEADER_FEATURE_EXPLICIT_PARCEL_SIZE) { std::optional<Span<const uint8_t>> objectTableBytes = parcelSpan.splitOff(transaction->parcelDataSize); diff --git a/libs/binder/include/binder/RpcSession.h b/libs/binder/include/binder/RpcSession.h index a323febbc7..cb6460398d 100644 --- a/libs/binder/include/binder/RpcSession.h +++ b/libs/binder/include/binder/RpcSession.h @@ -37,9 +37,9 @@ class RpcState; class RpcTransport; class FdTrigger; -constexpr uint32_t RPC_WIRE_PROTOCOL_VERSION_NEXT = 1; +constexpr uint32_t RPC_WIRE_PROTOCOL_VERSION_NEXT = 2; constexpr uint32_t RPC_WIRE_PROTOCOL_VERSION_EXPERIMENTAL = 0xF0000000; -constexpr uint32_t RPC_WIRE_PROTOCOL_VERSION = RPC_WIRE_PROTOCOL_VERSION_EXPERIMENTAL; +constexpr uint32_t RPC_WIRE_PROTOCOL_VERSION = 1; // Starting with this version: // diff --git a/libs/binder/tests/binderRpcWireProtocolTest.cpp b/libs/binder/tests/binderRpcWireProtocolTest.cpp index 3dab2c748b..642cea440d 100644 --- a/libs/binder/tests/binderRpcWireProtocolTest.cpp +++ b/libs/binder/tests/binderRpcWireProtocolTest.cpp @@ -237,14 +237,25 @@ TEST(RpcWire, V0) { checkRepr(kCurrentRepr, 0); } +TEST(RpcWire, V1) { + checkRepr(kCurrentRepr, 1); +} + TEST(RpcWire, CurrentVersion) { checkRepr(kCurrentRepr, RPC_WIRE_PROTOCOL_VERSION); } -static_assert(RPC_WIRE_PROTOCOL_VERSION == RPC_WIRE_PROTOCOL_VERSION_EXPERIMENTAL, +static_assert(RPC_WIRE_PROTOCOL_VERSION == 1, "If the binder wire protocol is updated, this test should test additional versions. " "The binder wire protocol should only be updated on upstream AOSP."); +TEST(RpcWire, NextIsPlusOneReminder) { + if (RPC_WIRE_PROTOCOL_VERSION != RPC_WIRE_PROTOCOL_VERSION_EXPERIMENTAL) { + EXPECT_EQ(RPC_WIRE_PROTOCOL_VERSION + 1, RPC_WIRE_PROTOCOL_VERSION_NEXT) + << "Make sure to note what the next version should be."; + } +} + TEST(RpcWire, ReleaseBranchHasFrozenRpcWireProtocol) { if (RPC_WIRE_PROTOCOL_VERSION == RPC_WIRE_PROTOCOL_VERSION_EXPERIMENTAL) { EXPECT_FALSE(base::GetProperty("ro.build.version.codename", "") == "REL") |