summaryrefslogtreecommitdiffstats
path: root/tools/aidl
diff options
context:
space:
mode:
authorJoe Onorato <joeo@google.com>2011-11-07 18:12:22 -0800
committerMike Lockwood <lockwood@google.com>2012-02-10 14:44:04 -0800
commit79824179b8ceb77d4ddb392a7c104e873d61ccc8 (patch)
treec9dce6f51c0c27c6319c6922c41880f01f935c51 /tools/aidl
parent6e0f981e864be5365b07a8cdc6f23e983d7f7352 (diff)
downloadframeworks_base-79824179b8ceb77d4ddb392a7c104e873d61ccc8.zip
frameworks_base-79824179b8ceb77d4ddb392a7c104e873d61ccc8.tar.gz
frameworks_base-79824179b8ceb77d4ddb392a7c104e873d61ccc8.tar.bz2
Support putting Flattenables in Lists.
Diffstat (limited to 'tools/aidl')
-rwxr-xr-xtools/aidl/Type.cpp37
-rwxr-xr-xtools/aidl/Type.h2
2 files changed, 34 insertions, 5 deletions
diff --git a/tools/aidl/Type.cpp b/tools/aidl/Type.cpp
index bb80d50..024062a 100755
--- a/tools/aidl/Type.cpp
+++ b/tools/aidl/Type.cpp
@@ -212,6 +212,12 @@ Type::CreatorName() const
}
string
+Type::RpcCreatorName() const
+{
+ return "";
+}
+
+string
Type::InstantiableName() const
{
return QualifiedName();
@@ -910,6 +916,12 @@ UserDataType::CreatorName() const
return QualifiedName() + ".CREATOR";
}
+string
+UserDataType::RpcCreatorName() const
+{
+ return QualifiedName() + ".RPC_CREATOR";
+}
+
void
UserDataType::WriteToParcel(StatementBlock* addTo, Variable* v, Variable* parcel, int flags)
{
@@ -1221,17 +1233,32 @@ void
GenericListType::WriteToRpcData(StatementBlock* addTo, Expression* k, Variable* v,
Variable* data, int flags)
{
- addTo->Add(new MethodCall(data, "putList", 2, k, v));
+ Type* generic = GenericArgumentTypes()[0];
+ if (generic == RPC_DATA_TYPE) {
+ addTo->Add(new MethodCall(data, "putRpcDataList", 2, k, v));
+ } else if (generic->RpcCreatorName() != "") {
+ addTo->Add(new MethodCall(data, "putFlattenableList", 2, k, v));
+ } else {
+ addTo->Add(new MethodCall(data, "putList", 2, k, v));
+ }
}
void
GenericListType::CreateFromRpcData(StatementBlock* addTo, Expression* k, Variable* v,
Variable* data, Variable** cl)
{
- string classArg = GenericArgumentTypes()[0]->QualifiedName();
- classArg += ".class";
- addTo->Add(new Assignment(v, new MethodCall(data, "getList", 2, k,
- new LiteralExpression(classArg))));
+ Type* generic = GenericArgumentTypes()[0];
+ if (generic == RPC_DATA_TYPE) {
+ addTo->Add(new Assignment(v, new MethodCall(data, "getRpcDataList", 2, k)));
+ } else if (generic->RpcCreatorName() != "") {
+ addTo->Add(new Assignment(v, new MethodCall(data, "getFlattenableList", 2, k,
+ new LiteralExpression(generic->RpcCreatorName()))));
+ } else {
+ string classArg = GenericArgumentTypes()[0]->QualifiedName();
+ classArg += ".class";
+ addTo->Add(new Assignment(v, new MethodCall(data, "getList", 2, k,
+ new LiteralExpression(classArg))));
+ }
}
diff --git a/tools/aidl/Type.h b/tools/aidl/Type.h
index f2f3f21..ae12720 100755
--- a/tools/aidl/Type.h
+++ b/tools/aidl/Type.h
@@ -42,6 +42,7 @@ public:
virtual string ImportType() const;
virtual string CreatorName() const;
+ virtual string RpcCreatorName() const;
virtual string InstantiableName() const;
virtual void WriteToParcel(StatementBlock* addTo, Variable* v,
@@ -358,6 +359,7 @@ public:
const string& declFile = "", int declLine = -1);
virtual string CreatorName() const;
+ virtual string RpcCreatorName() const;
virtual void WriteToParcel(StatementBlock* addTo, Variable* v,
Variable* parcel, int flags);