summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorJoe Onorato <joeo@google.com>2011-09-14 21:12:28 -0700
committerMike Lockwood <lockwood@google.com>2012-02-10 10:51:21 -0800
commit21d524ea8aac9d728480f934c47613a1312f4a26 (patch)
tree68f4bdf34feaa894e7e43a4bb3e85813dafd9496 /tools
parentaa5bf14e2123d39821863d9c352b82fb7946a220 (diff)
downloadframeworks_base-21d524ea8aac9d728480f934c47613a1312f4a26.zip
frameworks_base-21d524ea8aac9d728480f934c47613a1312f4a26.tar.gz
frameworks_base-21d524ea8aac9d728480f934c47613a1312f4a26.tar.bz2
Generate fallthrough for unhandled actions in RPC methods.
Diffstat (limited to 'tools')
-rw-r--r--tools/aidl/generate_java_rpc.cpp13
1 files changed, 10 insertions, 3 deletions
diff --git a/tools/aidl/generate_java_rpc.cpp b/tools/aidl/generate_java_rpc.cpp
index e309335..53a11f2 100644
--- a/tools/aidl/generate_java_rpc.cpp
+++ b/tools/aidl/generate_java_rpc.cpp
@@ -94,6 +94,7 @@ public:
bool needed;
Method* processMethod;
Variable* actionParam;
+ Variable* requestParam;
Variable* errorParam;
Variable* requestData;
Variable* resultData;
@@ -159,15 +160,15 @@ ServiceBaseClass::generate_process()
this->actionParam = new Variable(STRING_TYPE, "action");
this->processMethod->parameters.push_back(this->actionParam);
- Variable* requestParam = new Variable(BYTE_TYPE, "requestParam", 1);
- this->processMethod->parameters.push_back(requestParam);
+ this->requestParam = new Variable(BYTE_TYPE, "requestParam", 1);
+ this->processMethod->parameters.push_back(this->requestParam);
this->errorParam = new Variable(RPC_ERROR_TYPE, "errorParam", 0);
this->processMethod->parameters.push_back(this->errorParam);
this->requestData = new Variable(RPC_DATA_TYPE, "request");
this->processMethod->statements->Add(new VariableDeclaration(requestData,
- new NewExpression(RPC_DATA_TYPE, 1, requestParam)));
+ new NewExpression(RPC_DATA_TYPE, 1, this->requestParam)));
this->resultData = new Variable(RPC_DATA_TYPE, "resultData");
this->processMethod->statements->Add(new VariableDeclaration(this->resultData,
@@ -193,6 +194,12 @@ ServiceBaseClass::AddMethod(const string& methodName, StatementBlock** statement
void
ServiceBaseClass::DoneWithMethods()
{
+ IfStatement* fallthrough = new IfStatement();
+ fallthrough->statements = new StatementBlock;
+ fallthrough->statements->Add(new ReturnStatement(
+ new MethodCall(SUPER_VALUE, "process", 3, this->actionParam, this->requestParam,
+ this->errorParam)));
+ this->dispatchIfStatement->elseif = fallthrough;
IfStatement* s = new IfStatement;
s->statements = new StatementBlock;
this->processMethod->statements->Add(s);