support all capital method name in c++
if there is a method with all capital name, it conflicts with the enum's name for the transaction ID
so remove enum and write hardcorded transaction id to prevent misuse
from client
Bug: 119525871
Test: ./runtests.sh
Test: m -j
Change-Id: Ia82b16b6262256449f4da29b549bdd74812aec5d
diff --git a/aidl_to_cpp.cpp b/aidl_to_cpp.cpp
index 17fa3d8..efd5b6b 100644
--- a/aidl_to_cpp.cpp
+++ b/aidl_to_cpp.cpp
@@ -21,6 +21,8 @@
#include <functional>
#include <unordered_map>
+using std::ostringstream;
+
namespace android {
namespace aidl {
namespace cpp {
@@ -138,6 +140,15 @@
c.writer << "\n";
}
+std::string GetTransactionIdFor(const AidlMethod& method) {
+ ostringstream output;
+
+ if (method.IsUserDefined()) {
+ output << "::android::IBinder::FIRST_CALL_TRANSACTION + ";
+ }
+ output << method.GetId() << " /* " << method.GetName() << " */";
+ return output.str();
+}
} // namespace cpp
} // namespace aidl
} // namespace android