Fix getInterfaceVersion() inconsistency bug between backends
Java:
- Server
writeNoException(), and then writeInt(version)
- Client
As-is: just readInt() -> read exception code, not version
To-be: readException, and then readInt() -> consume exception code first
Cpp:
- Transaction code
As-is: getInterface's ID
To-be: FIRST_CALL_TRANSACTION + the ID
- Server & Client
As-is: No exception read/write before version code
To-be: Add exception value before version code
Bug: 133118233
Test: m
Test: atest CtsNdkBinderTestCases
Test: ./runtests.sh
Change-Id: I168a0b8ff7e1871afd95a0ab76b544bfe131a9ed
Merged-In: I168a0b8ff7e1871afd95a0ab76b544bfe131a9ed
diff --git a/aidl_to_cpp.cpp b/aidl_to_cpp.cpp
index 61917e9..f335475 100644
--- a/aidl_to_cpp.cpp
+++ b/aidl_to_cpp.cpp
@@ -38,9 +38,7 @@
std::string GetTransactionIdFor(const AidlMethod& method) {
ostringstream output;
- if (method.IsUserDefined()) {
- output << "::android::IBinder::FIRST_CALL_TRANSACTION + ";
- }
+ output << "::android::IBinder::FIRST_CALL_TRANSACTION + ";
output << method.GetId() << " /* " << method.GetName() << " */";
return output.str();
}