aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJooyung Han <jooyung@google.com>2021-04-30 03:00:13 +0900
committerJooyung Han <jooyung@google.com>2021-05-07 13:48:25 +0900
commit39054a60696b2994efe5788eef5f208736994de0 (patch)
tree40d2f988f471c9d2e880a6d6d0cd799c7571f371
parentc87d83118e3107349323f7e76f99d04c29817363 (diff)
downloadaidl-android10-gsi.tar.gz
Fix readFromParcel in every backendandroid10-gsi
readFromParcel should check the size before reading a field and set Parcel's data position on successful exit. Previously, the first field was read without checking the available data, which fails when the older version is empty. Bug: 186632725 Bug: 186633641 Test: ./runtests.sh Merged-In: I8cbe9cd280833e04ee5f1c58f26eca0a9bdf1076 Change-Id: I8cbe9cd280833e04ee5f1c58f26eca0a9bdf1076 (cherry picked from commit cb2a8b201890cb79fdf3c8a1f1fee13d1d4890fc)
-rw-r--r--Android.bp28
-rw-r--r--aidl_api/aidl-test-versioned-interface/1/android/aidl/versioned/tests/Foo.aidl20
-rw-r--r--aidl_api/aidl-test-versioned-interface/1/android/aidl/versioned/tests/IFooInterface.aidl21
-rw-r--r--aidl_api/aidl-test-versioned-interface/2/android/aidl/versioned/tests/Foo.aidl21
-rw-r--r--aidl_api/aidl-test-versioned-interface/2/android/aidl/versioned/tests/IFooInterface.aidl21
-rw-r--r--aidl_api/aidl-test-versioned-interface/current/android/aidl/versioned/tests/Foo.aidl21
-rw-r--r--aidl_api/aidl-test-versioned-interface/current/android/aidl/versioned/tests/IFooInterface.aidl21
-rw-r--r--aidl_unittest.cpp2
-rw-r--r--generate_cpp.cpp16
-rw-r--r--generate_java.cpp5
-rw-r--r--generate_ndk.cpp8
-rw-r--r--tests/aidl_test_client.cpp3
-rw-r--r--tests/aidl_test_client_versioned_interface.cpp63
-rw-r--r--tests/aidl_test_client_versioned_interface.h29
-rw-r--r--tests/aidl_test_service.cpp18
-rw-r--r--tests/versioned/android/aidl/versioned/tests/Foo.aidl21
-rw-r--r--tests/versioned/android/aidl/versioned/tests/IFooInterface.aidl23
17 files changed, 323 insertions, 18 deletions
diff --git a/Android.bp b/Android.bp
index 14f2d009..19d14560 100644
--- a/Android.bp
+++ b/Android.bp
@@ -170,7 +170,7 @@ cc_defaults {
],
}
-cc_library_shared {
+cc_library_static {
name: "libaidl-integration-test",
defaults: ["aidl_test_defaults"],
aidl: {
@@ -187,14 +187,22 @@ cc_library_shared {
cc_binary {
name: "aidl_test_service",
defaults: ["aidl_test_defaults"],
- shared_libs: ["libaidl-integration-test"],
+ static_libs: [
+ "libaidl-integration-test",
+ // service uses the old version
+ "aidl-test-versioned-interface-V1-cpp",
+ ],
srcs: ["tests/aidl_test_service.cpp"],
}
cc_binary {
name: "aidl_test_client",
defaults: ["aidl_test_defaults"],
- shared_libs: ["libaidl-integration-test"],
+ static_libs: [
+ "libaidl-integration-test",
+ // client uses the latest version
+ "aidl-test-versioned-interface-cpp",
+ ],
srcs: [
"tests/aidl_test_client.cpp",
"tests/aidl_test_client_file_descriptors.cpp",
@@ -204,6 +212,7 @@ cc_binary {
"tests/aidl_test_client_utf8_strings.cpp",
"tests/aidl_test_client_service_exceptions.cpp",
"tests/aidl_test_client_defaultimpl.cpp",
+ "tests/aidl_test_client_versioned_interface.cpp",
],
}
@@ -266,3 +275,16 @@ aidl_interface {
},
},
}
+
+aidl_interface {
+ name: "aidl-test-versioned-interface",
+ local_include_dir: "tests/versioned",
+ srcs: [
+ "tests/versioned/**/*.aidl",
+ ],
+ versions: [
+ "1",
+ "2",
+ ],
+ api_dir: "aidl_api/aidl-test-versioned-interface",
+}
diff --git a/aidl_api/aidl-test-versioned-interface/1/android/aidl/versioned/tests/Foo.aidl b/aidl_api/aidl-test-versioned-interface/1/android/aidl/versioned/tests/Foo.aidl
new file mode 100644
index 00000000..da1c01b7
--- /dev/null
+++ b/aidl_api/aidl-test-versioned-interface/1/android/aidl/versioned/tests/Foo.aidl
@@ -0,0 +1,20 @@
+///////////////////////////////////////////////////////////////////////////////
+// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
+///////////////////////////////////////////////////////////////////////////////
+
+// This file is a snapshot of an AIDL interface (or parcelable). Do not try to
+// edit this file. It looks like you are doing that because you have modified
+// an AIDL interface in a backward-incompatible way, e.g., deleting a function
+// from an interface or a field from a parcelable and it broke the build. That
+// breakage is intended.
+//
+// You must not make a backward incompatible changes to the AIDL files built
+// with the aidl_interface module type with versions property set. The module
+// type is used to build AIDL files in a way that they can be used across
+// independently updatable components of the system. If a device is shipped
+// with such a backward incompatible change, it has a high risk of breaking
+// later when a module using the interface is updated, e.g., Mainline modules.
+
+package android.aidl.versioned.tests;
+parcelable Foo {
+}
diff --git a/aidl_api/aidl-test-versioned-interface/1/android/aidl/versioned/tests/IFooInterface.aidl b/aidl_api/aidl-test-versioned-interface/1/android/aidl/versioned/tests/IFooInterface.aidl
new file mode 100644
index 00000000..0f97859c
--- /dev/null
+++ b/aidl_api/aidl-test-versioned-interface/1/android/aidl/versioned/tests/IFooInterface.aidl
@@ -0,0 +1,21 @@
+///////////////////////////////////////////////////////////////////////////////
+// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
+///////////////////////////////////////////////////////////////////////////////
+
+// This file is a snapshot of an AIDL interface (or parcelable). Do not try to
+// edit this file. It looks like you are doing that because you have modified
+// an AIDL interface in a backward-incompatible way, e.g., deleting a function
+// from an interface or a field from a parcelable and it broke the build. That
+// breakage is intended.
+//
+// You must not make a backward incompatible changes to the AIDL files built
+// with the aidl_interface module type with versions property set. The module
+// type is used to build AIDL files in a way that they can be used across
+// independently updatable components of the system. If a device is shipped
+// with such a backward incompatible change, it has a high risk of breaking
+// later when a module using the interface is updated, e.g., Mainline modules.
+
+package android.aidl.versioned.tests;
+interface IFooInterface {
+ int ignoreFooAndReturnInt(in android.aidl.versioned.tests.Foo foo, int value);
+}
diff --git a/aidl_api/aidl-test-versioned-interface/2/android/aidl/versioned/tests/Foo.aidl b/aidl_api/aidl-test-versioned-interface/2/android/aidl/versioned/tests/Foo.aidl
new file mode 100644
index 00000000..bd8beb64
--- /dev/null
+++ b/aidl_api/aidl-test-versioned-interface/2/android/aidl/versioned/tests/Foo.aidl
@@ -0,0 +1,21 @@
+///////////////////////////////////////////////////////////////////////////////
+// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
+///////////////////////////////////////////////////////////////////////////////
+
+// This file is a snapshot of an AIDL interface (or parcelable). Do not try to
+// edit this file. It looks like you are doing that because you have modified
+// an AIDL interface in a backward-incompatible way, e.g., deleting a function
+// from an interface or a field from a parcelable and it broke the build. That
+// breakage is intended.
+//
+// You must not make a backward incompatible changes to the AIDL files built
+// with the aidl_interface module type with versions property set. The module
+// type is used to build AIDL files in a way that they can be used across
+// independently updatable components of the system. If a device is shipped
+// with such a backward incompatible change, it has a high risk of breaking
+// later when a module using the interface is updated, e.g., Mainline modules.
+
+package android.aidl.versioned.tests;
+parcelable Foo {
+ int intDefault42 = 42;
+}
diff --git a/aidl_api/aidl-test-versioned-interface/2/android/aidl/versioned/tests/IFooInterface.aidl b/aidl_api/aidl-test-versioned-interface/2/android/aidl/versioned/tests/IFooInterface.aidl
new file mode 100644
index 00000000..0f97859c
--- /dev/null
+++ b/aidl_api/aidl-test-versioned-interface/2/android/aidl/versioned/tests/IFooInterface.aidl
@@ -0,0 +1,21 @@
+///////////////////////////////////////////////////////////////////////////////
+// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
+///////////////////////////////////////////////////////////////////////////////
+
+// This file is a snapshot of an AIDL interface (or parcelable). Do not try to
+// edit this file. It looks like you are doing that because you have modified
+// an AIDL interface in a backward-incompatible way, e.g., deleting a function
+// from an interface or a field from a parcelable and it broke the build. That
+// breakage is intended.
+//
+// You must not make a backward incompatible changes to the AIDL files built
+// with the aidl_interface module type with versions property set. The module
+// type is used to build AIDL files in a way that they can be used across
+// independently updatable components of the system. If a device is shipped
+// with such a backward incompatible change, it has a high risk of breaking
+// later when a module using the interface is updated, e.g., Mainline modules.
+
+package android.aidl.versioned.tests;
+interface IFooInterface {
+ int ignoreFooAndReturnInt(in android.aidl.versioned.tests.Foo foo, int value);
+}
diff --git a/aidl_api/aidl-test-versioned-interface/current/android/aidl/versioned/tests/Foo.aidl b/aidl_api/aidl-test-versioned-interface/current/android/aidl/versioned/tests/Foo.aidl
new file mode 100644
index 00000000..bd8beb64
--- /dev/null
+++ b/aidl_api/aidl-test-versioned-interface/current/android/aidl/versioned/tests/Foo.aidl
@@ -0,0 +1,21 @@
+///////////////////////////////////////////////////////////////////////////////
+// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
+///////////////////////////////////////////////////////////////////////////////
+
+// This file is a snapshot of an AIDL interface (or parcelable). Do not try to
+// edit this file. It looks like you are doing that because you have modified
+// an AIDL interface in a backward-incompatible way, e.g., deleting a function
+// from an interface or a field from a parcelable and it broke the build. That
+// breakage is intended.
+//
+// You must not make a backward incompatible changes to the AIDL files built
+// with the aidl_interface module type with versions property set. The module
+// type is used to build AIDL files in a way that they can be used across
+// independently updatable components of the system. If a device is shipped
+// with such a backward incompatible change, it has a high risk of breaking
+// later when a module using the interface is updated, e.g., Mainline modules.
+
+package android.aidl.versioned.tests;
+parcelable Foo {
+ int intDefault42 = 42;
+}
diff --git a/aidl_api/aidl-test-versioned-interface/current/android/aidl/versioned/tests/IFooInterface.aidl b/aidl_api/aidl-test-versioned-interface/current/android/aidl/versioned/tests/IFooInterface.aidl
new file mode 100644
index 00000000..0f97859c
--- /dev/null
+++ b/aidl_api/aidl-test-versioned-interface/current/android/aidl/versioned/tests/IFooInterface.aidl
@@ -0,0 +1,21 @@
+///////////////////////////////////////////////////////////////////////////////
+// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE. //
+///////////////////////////////////////////////////////////////////////////////
+
+// This file is a snapshot of an AIDL interface (or parcelable). Do not try to
+// edit this file. It looks like you are doing that because you have modified
+// an AIDL interface in a backward-incompatible way, e.g., deleting a function
+// from an interface or a field from a parcelable and it broke the build. That
+// breakage is intended.
+//
+// You must not make a backward incompatible changes to the AIDL files built
+// with the aidl_interface module type with versions property set. The module
+// type is used to build AIDL files in a way that they can be used across
+// independently updatable components of the system. If a device is shipped
+// with such a backward incompatible change, it has a high risk of breaking
+// later when a module using the interface is updated, e.g., Mainline modules.
+
+package android.aidl.versioned.tests;
+interface IFooInterface {
+ int ignoreFooAndReturnInt(in android.aidl.versioned.tests.Foo foo, int value);
+}
diff --git a/aidl_unittest.cpp b/aidl_unittest.cpp
index 7cf81722..95ad8b94 100644
--- a/aidl_unittest.cpp
+++ b/aidl_unittest.cpp
@@ -113,10 +113,10 @@ public class Rect implements android.os.Parcelable
int _aidl_parcelable_size = _aidl_parcel.readInt();
if (_aidl_parcelable_size < 0) return;
try {
+ if (_aidl_parcel.dataPosition() - _aidl_start_pos >= _aidl_parcelable_size) return;
x = _aidl_parcel.readInt();
if (_aidl_parcel.dataPosition() - _aidl_start_pos >= _aidl_parcelable_size) return;
y = _aidl_parcel.readInt();
- if (_aidl_parcel.dataPosition() - _aidl_start_pos >= _aidl_parcelable_size) return;
} finally {
_aidl_parcel.setDataPosition(_aidl_start_pos + _aidl_parcelable_size);
}
diff --git a/generate_cpp.cpp b/generate_cpp.cpp
index 9d2a1fb6..e2d54608 100644
--- a/generate_cpp.cpp
+++ b/generate_cpp.cpp
@@ -1056,20 +1056,22 @@ std::unique_ptr<Document> BuildParcelSource(const TypeNamespace& /*types*/,
"if (_aidl_parcelable_raw_size < 0) return ::android::BAD_VALUE;\n"
"size_t _aidl_parcelable_size = static_cast<size_t>(_aidl_parcelable_raw_size);\n");
+ auto checkAvailableData = StringPrintf(
+ "if (_aidl_parcel->dataPosition() - _aidl_start_pos >= _aidl_parcelable_size) {\n"
+ " _aidl_parcel->setDataPosition(_aidl_start_pos + _aidl_parcelable_size);\n"
+ " return %s;\n"
+ "}\n",
+ kAndroidStatusVarName);
+
for (const auto& variable : parcel.GetFields()) {
+ read_block->AddLiteral(checkAvailableData, /*add_semicolon=*/false);
string method = variable->GetType().GetLanguageType<Type>()->ReadFromParcelMethod();
-
read_block->AddStatement(new Assignment(
kAndroidStatusVarName, new MethodCall(StringPrintf("_aidl_parcel->%s", method.c_str()),
ArgList("&" + variable->GetName()))));
read_block->AddStatement(ReturnOnStatusNotOk());
- read_block->AddLiteral(StringPrintf(
- "if (_aidl_parcel->dataPosition() - _aidl_start_pos >= _aidl_parcelable_size) {\n"
- " _aidl_parcel->setDataPosition(_aidl_start_pos + _aidl_parcelable_size);\n"
- " return %s;\n"
- "}",
- kAndroidStatusVarName));
}
+ read_block->AddLiteral("_aidl_parcel->setDataPosition(_aidl_start_pos + _aidl_parcelable_size)");
read_block->AddLiteral(StringPrintf("return %s", kAndroidStatusVarName));
unique_ptr<MethodImpl> write{
diff --git a/generate_java.cpp b/generate_java.cpp
index 0d962035..d8512529 100644
--- a/generate_java.cpp
+++ b/generate_java.cpp
@@ -184,11 +184,12 @@ android::aidl::java::Class* generate_parcel_class(const AidlStructuredParcelable
out.str("");
out << " if (_aidl_parcel.dataPosition() - _aidl_start_pos >= _aidl_parcelable_size) return;\n";
- LiteralStatement* sizeCheck = nullptr;
+ string sizeCheck = out.str();
// keep this across different fields in order to create the classloader
// at most once.
bool is_classloader_created = false;
for (const auto& field : parcel->GetFields()) {
+ read_method->statements->Add(new LiteralStatement(sizeCheck));
string code;
CodeWriterPtr writer = CodeWriter::ForString(&code);
CodeGeneratorContext context{
@@ -203,8 +204,6 @@ android::aidl::java::Class* generate_parcel_class(const AidlStructuredParcelable
CreateFromParcelFor(context);
writer->Close();
read_method->statements->Add(new LiteralStatement(code));
- if (!sizeCheck) sizeCheck = new LiteralStatement(out.str());
- read_method->statements->Add(sizeCheck);
}
out.str("");
diff --git a/generate_ndk.cpp b/generate_ndk.cpp
index f0445f7a..87cf9671 100644
--- a/generate_ndk.cpp
+++ b/generate_ndk.cpp
@@ -818,14 +818,14 @@ void GenerateParcelSource(CodeWriter& out, const AidlTypenames& types,
out << "if (_aidl_null == 0) return STATUS_UNEXPECTED_NULL;\n\n";
for (const auto& variable : defined_type.GetFields()) {
- out << "_aidl_ret_status = ";
- ReadFromParcelFor({out, types, variable->GetType(), "parcel", "&" + variable->GetName()});
- out << ";\n";
- StatusCheckReturn(out);
out << "if (AParcel_getDataPosition(parcel) - _aidl_start_pos >= _aidl_parcelable_size) {\n"
<< " AParcel_setDataPosition(parcel, _aidl_start_pos + _aidl_parcelable_size);\n"
<< " return _aidl_ret_status;\n"
<< "}\n";
+ out << "_aidl_ret_status = ";
+ ReadFromParcelFor({out, types, variable->GetType(), "parcel", "&" + variable->GetName()});
+ out << ";\n";
+ StatusCheckReturn(out);
}
out << "AParcel_setDataPosition(parcel, _aidl_start_pos + _aidl_parcelable_size);\n"
<< "return _aidl_ret_status;\n";
diff --git a/tests/aidl_test_client.cpp b/tests/aidl_test_client.cpp
index f4850b00..f55178a3 100644
--- a/tests/aidl_test_client.cpp
+++ b/tests/aidl_test_client.cpp
@@ -30,6 +30,7 @@
#include "aidl_test_client_primitives.h"
#include "aidl_test_client_service_exceptions.h"
#include "aidl_test_client_utf8_strings.h"
+#include "aidl_test_client_versioned_interface.h"
// libutils:
using android::OK;
@@ -112,5 +113,7 @@ int main(int /* argc */, char * argv []) {
if (!client_tests::ConfirmDefaultImpl(service)) return 1;
+ if (!client_tests::ConfirmReadDataAfterParcelableWithNewField()) return 1;
+
return 0;
}
diff --git a/tests/aidl_test_client_versioned_interface.cpp b/tests/aidl_test_client_versioned_interface.cpp
new file mode 100644
index 00000000..205e2ace
--- /dev/null
+++ b/tests/aidl_test_client_versioned_interface.cpp
@@ -0,0 +1,63 @@
+/*
+ * Copyright (C) 2021 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+#include "aidl_test_client_versioned_interface.h"
+
+#include <iostream>
+
+#include <android/aidl/versioned/tests/IFooInterface.h>
+#include <binder/IServiceManager.h>
+#include <utils/StrongPointer.h>
+
+using std::cout;
+using std::endl;
+
+using android::OK;
+using android::sp;
+using android::aidl::versioned::tests::Foo;
+using android::aidl::versioned::tests::IFooInterface;
+
+namespace android {
+namespace aidl {
+namespace tests {
+namespace client {
+
+bool ConfirmReadDataAfterParcelableWithNewField() {
+ cout << "Confirming reading data after parcelable with new field." << endl;
+ sp<IFooInterface> versioned;
+ if (OK != android::getService(IFooInterface::descriptor, &versioned) || versioned == nullptr) {
+ // skip when IFooInterface is not available
+ return true;
+ }
+
+ Foo foo;
+ int32_t ret;
+ auto status = versioned->ignoreFooAndReturnInt(foo, 43, &ret);
+ if (!status.isOk()) {
+ cout << "failed to call ignoreFooAndRepeatInt(): " << endl;
+ return false;
+ }
+ if (ret != 43) {
+ cout << "IFooInterface::ignoreFooAndRepeatInt(foo, 43) should return 43, but got " << ret
+ << endl;
+ return false;
+ }
+ return true;
+}
+
+} // namespace client
+} // namespace tests
+} // namespace aidl
+} // namespace android \ No newline at end of file
diff --git a/tests/aidl_test_client_versioned_interface.h b/tests/aidl_test_client_versioned_interface.h
new file mode 100644
index 00000000..6aa86af0
--- /dev/null
+++ b/tests/aidl_test_client_versioned_interface.h
@@ -0,0 +1,29 @@
+/*
+ * Copyright (C) 2021 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#pragma once
+
+namespace android {
+namespace aidl {
+namespace tests {
+namespace client {
+
+bool ConfirmReadDataAfterParcelableWithNewField();
+
+} // namespace client
+} // namespace tests
+} // namespace aidl
+} // namespace android
diff --git a/tests/aidl_test_service.cpp b/tests/aidl_test_service.cpp
index 6bb8a632..9cb128d5 100644
--- a/tests/aidl_test_service.cpp
+++ b/tests/aidl_test_service.cpp
@@ -33,6 +33,8 @@
#include <utils/Looper.h>
#include <utils/StrongPointer.h>
+#include "android/aidl/versioned/tests/BnFooInterface.h"
+
#include "android/aidl/tests/BnTestService.h"
#include "android/aidl/tests/ITestService.h"
@@ -67,6 +69,8 @@ using android::aidl::tests::BnNamedCallback;
using android::aidl::tests::BnTestService;
using android::aidl::tests::INamedCallback;
using android::aidl::tests::SimpleParcelable;
+using android::aidl::versioned::tests::BnFooInterface;
+using android::aidl::versioned::tests::Foo;
using android::binder::Map;
using android::os::ParcelFileDescriptor;
using android::os::PersistableBundle;
@@ -485,8 +489,21 @@ class NativeService : public BnTestService {
map<String16, sp<INamedCallback>> service_map_;
};
+class FooInterface : public BnFooInterface {
+ public:
+ FooInterface() {}
+ virtual ~FooInterface() = default;
+
+ Status ignoreFooAndReturnInt(const Foo& foo, int32_t value, int32_t* ret) override {
+ (void)foo;
+ *ret = value;
+ return Status::ok();
+ }
+};
+
int Run() {
android::sp<NativeService> service = new NativeService;
+ android::sp<FooInterface> versioned = new FooInterface;
sp<Looper> looper(Looper::prepare(0 /* opts */));
int binder_fd = -1;
@@ -505,6 +522,7 @@ int Run() {
defaultServiceManager()->addService(service->getInterfaceDescriptor(),
service);
+ defaultServiceManager()->addService(versioned->getInterfaceDescriptor(), versioned);
ALOGI("Entering loop");
while (true) {
diff --git a/tests/versioned/android/aidl/versioned/tests/Foo.aidl b/tests/versioned/android/aidl/versioned/tests/Foo.aidl
new file mode 100644
index 00000000..a7a655b9
--- /dev/null
+++ b/tests/versioned/android/aidl/versioned/tests/Foo.aidl
@@ -0,0 +1,21 @@
+/*
+ * Copyright (C) 2021 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.aidl.versioned.tests;
+
+parcelable Foo {
+ int intDefault42 = 42;
+} \ No newline at end of file
diff --git a/tests/versioned/android/aidl/versioned/tests/IFooInterface.aidl b/tests/versioned/android/aidl/versioned/tests/IFooInterface.aidl
new file mode 100644
index 00000000..59c38bc5
--- /dev/null
+++ b/tests/versioned/android/aidl/versioned/tests/IFooInterface.aidl
@@ -0,0 +1,23 @@
+/*
+ * Copyright (C) 2021 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.aidl.versioned.tests;
+
+import android.aidl.versioned.tests.Foo;
+
+interface IFooInterface {
+ int ignoreFooAndReturnInt(in Foo foo, int value);
+} \ No newline at end of file