Snap for 8253222 from 80bdb3715478d4c4fbbcfe284c9302af46bc7daf to sdk-release
Change-Id: I4135753bcc661f681a8c65b6c4f73fb5caa6e7f4
diff --git a/Android.bp b/Android.bp
index dbaf05e..79d2590 100644
--- a/Android.bp
+++ b/Android.bp
@@ -152,6 +152,11 @@
"-g",
],
+ tidy_timeout_srcs: [
+ "aidl_unittest.cpp",
+ "options_unittest.cpp",
+ ],
+
srcs: [
"aidl_unittest.cpp",
"ast_java_unittest.cpp",
@@ -303,8 +308,6 @@
"tests/android/aidl/tests/UnionWithFd.aidl",
"tests/android/aidl/tests/extension/*.aidl",
"tests/android/aidl/tests/nested/*.aidl",
- "tests/android/aidl/tests/permission/IProtected.aidl",
- "tests/android/aidl/tests/permission/IProtectedInterface.aidl",
"tests/android/aidl/tests/unions/*.aidl",
],
path: "tests",
@@ -321,8 +324,10 @@
}
filegroup {
- name: "libaidl-integration-platform-test-files",
+ name: "libaidl-integration-permission-test-files",
srcs: [
+ "tests/android/aidl/tests/permission/IProtected.aidl",
+ "tests/android/aidl/tests/permission/IProtectedInterface.aidl",
"tests/android/aidl/tests/permission/platform/*.aidl",
],
path: "tests",
@@ -340,6 +345,9 @@
"2",
],
backend: {
+ java: {
+ gen_rpc: true,
+ },
rust: {
enabled: true,
},
@@ -392,6 +400,10 @@
"aidl_test_loggable_interface-cpp",
"aidl-test-fixedsizearray-cpp",
],
+ tidy_timeout_srcs: [
+ "tests/aidl_test_client_parcelables.cpp",
+ "tests/aidl_test_client_primitives.cpp",
+ ],
srcs: [
"tests/aidl_test_client.cpp",
"tests/aidl_test_client_builtin_transactions.cpp",
@@ -624,13 +636,16 @@
// warning: keep this list up to date with tests/golden_test.sh
":aidl-test-interface-cpp-source",
":aidl-test-interface-java-source",
- ":aidl-test-versioned-interface-V2-java-source",
+ ":aidl-test-versioned-interface-V1-cpp-source",
+ ":aidl-test-versioned-interface-V1-java-source",
+ ":aidl-test-versioned-interface-V1-ndk-source",
+ ":aidl-test-versioned-interface-V1-rust-source",
":aidl-test-interface-ndk-source",
":aidl-test-interface-rust-source",
":aidl_test_loggable_interface-cpp-source",
":aidl_test_loggable_interface-java-source",
":aidl_test_loggable_interface-ndk-source",
- ":aidl-test-interface-platform-java-source",
+ ":aidl-test-interface-permission-java-source",
":aidl-test-fixedsizearray-cpp-source",
":aidl-test-fixedsizearray-java-source",
":aidl-test-fixedsizearray-ndk-source",
@@ -698,10 +713,10 @@
}
aidl_interface {
- name: "aidl-test-interface-platform",
+ name: "aidl-test-interface-permission",
unstable: true,
flags: ["-Werror"],
- srcs: [":libaidl-integration-platform-test-files"],
+ srcs: [":libaidl-integration-permission-test-files"],
include_dirs: [
"frameworks/base/core/java",
],
diff --git a/aidl.cpp b/aidl.cpp
index fd63c6a..6938b53 100644
--- a/aidl.cpp
+++ b/aidl.cpp
@@ -578,18 +578,18 @@
if (options.Version() > 0) {
auto ret = typenames->MakeResolvedType(AIDL_LOCATION_HERE, "int", false);
vector<unique_ptr<AidlArgument>>* args = new vector<unique_ptr<AidlArgument>>();
- auto method = std::make_unique<AidlMethod>(
- AIDL_LOCATION_HERE, false, ret.release(), "getInterfaceVersion", args, Comments{},
- kGetInterfaceVersionId, false /* is_user_defined */);
+ auto method = std::make_unique<AidlMethod>(AIDL_LOCATION_HERE, false, ret.release(),
+ "getInterfaceVersion", args, Comments{},
+ kGetInterfaceVersionId);
interface->AddMethod(std::move(method));
}
// add the meta-method 'string getInterfaceHash()' if hash is specified.
if (!options.Hash().empty()) {
auto ret = typenames->MakeResolvedType(AIDL_LOCATION_HERE, "String", false);
vector<unique_ptr<AidlArgument>>* args = new vector<unique_ptr<AidlArgument>>();
- auto method = std::make_unique<AidlMethod>(
- AIDL_LOCATION_HERE, false, ret.release(), kGetInterfaceHash, args, Comments{},
- kGetInterfaceHashId, false /* is_user_defined */);
+ auto method =
+ std::make_unique<AidlMethod>(AIDL_LOCATION_HERE, false, ret.release(),
+ kGetInterfaceHash, args, Comments{}, kGetInterfaceHashId);
interface->AddMethod(std::move(method));
}
if (!CheckAndAssignMethodIDs(interface->GetMethods())) {
diff --git a/aidl_const_expressions.cpp b/aidl_const_expressions.cpp
index eeeb14b..0288a60 100644
--- a/aidl_const_expressions.cpp
+++ b/aidl_const_expressions.cpp
@@ -248,6 +248,49 @@
c == '\\'); // Disallow backslashes for future proofing.
}
+static std::string PrintCharLiteral(char c) {
+ std::ostringstream os;
+ switch (c) {
+ case '\0':
+ os << "\\0";
+ break;
+ case '\'':
+ os << "\\'";
+ break;
+ case '\\':
+ os << "\\\\";
+ break;
+ case '\a':
+ os << "\\a";
+ break;
+ case '\b':
+ os << "\\b";
+ break;
+ case '\f':
+ os << "\\f";
+ break;
+ case '\n':
+ os << "\\n";
+ break;
+ case '\r':
+ os << "\\r";
+ break;
+ case '\t':
+ os << "\\t";
+ break;
+ case '\v':
+ os << "\\v";
+ break;
+ default:
+ if (std::isprint(static_cast<unsigned char>(c))) {
+ os << c;
+ } else {
+ os << "\\x" << std::hex << std::uppercase << static_cast<int>(c);
+ }
+ }
+ return os.str();
+}
+
bool ParseFloating(std::string_view sv, double* parsed) {
// float literal should be parsed successfully.
android::base::ConsumeSuffix(&sv, "f");
@@ -372,7 +415,7 @@
AIDL_FATAL_IF(value.size() != 3 || value[0] != '\'' || value[2] != '\'', location) << value;
if (!isValidLiteralChar(value[1])) {
- AIDL_ERROR(location) << "Invalid character literal " << value[1];
+ AIDL_ERROR(location) << "Invalid character literal " << PrintCharLiteral(value[1]);
return new AidlConstantValue(location, Type::ERROR, value);
}
}
diff --git a/aidl_dumpapi.cpp b/aidl_dumpapi.cpp
index 7d3f19d..30f65dc 100644
--- a/aidl_dumpapi.cpp
+++ b/aidl_dumpapi.cpp
@@ -32,6 +32,9 @@
namespace aidl {
void DumpVisitor::DumpType(const AidlDefinedType& dt, const string& type) {
+ if (!dt.IsUserDefined()) {
+ return;
+ }
DumpComments(dt);
DumpAnnotations(dt);
out << type << " " << dt.GetName();
@@ -47,7 +50,6 @@
void DumpVisitor::DumpMembers(const AidlDefinedType& dt) {
for (const auto& method : dt.GetMethods()) {
- if (!method->IsUserDefined()) continue;
method->DispatchVisit(*this);
}
for (const auto& field : dt.GetFields()) {
@@ -95,16 +97,23 @@
void DumpVisitor::Visit(const AidlInterface& t) {
DumpType(t, "interface");
}
+
void DumpVisitor::Visit(const AidlParcelable& t) {
DumpType(t, "parcelable");
}
+
void DumpVisitor::Visit(const AidlStructuredParcelable& t) {
DumpType(t, "parcelable");
}
+
void DumpVisitor::Visit(const AidlUnionDecl& t) {
DumpType(t, "union");
}
+
void DumpVisitor::Visit(const AidlEnumDeclaration& t) {
+ if (!t.IsUserDefined()) {
+ return;
+ }
DumpComments(t);
DumpAnnotations(t);
out << "enum " << t.GetName() << " {\n";
@@ -119,10 +128,17 @@
}
void DumpVisitor::Visit(const AidlMethod& m) {
+ if (!m.IsUserDefined()) {
+ return;
+ }
DumpComments(m);
out << m.ToString() << ";\n";
}
+
void DumpVisitor::Visit(const AidlVariableDeclaration& v) {
+ if (!v.IsUserDefined()) {
+ return;
+ }
DumpComments(v);
Visit(v.GetType());
if (v.IsDefaultUserSpecified()) {
@@ -133,7 +149,11 @@
out << " " << v.GetName() << ";\n";
}
}
+
void DumpVisitor::Visit(const AidlConstantDeclaration& c) {
+ if (!c.IsUserDefined()) {
+ return;
+ }
DumpComments(c);
out << "const ";
Visit(c.GetType());
diff --git a/aidl_language.cpp b/aidl_language.cpp
index e6b4b32..c835396 100644
--- a/aidl_language.cpp
+++ b/aidl_language.cpp
@@ -1068,20 +1068,19 @@
AidlMethod::AidlMethod(const AidlLocation& location, bool oneway, AidlTypeSpecifier* type,
const std::string& name, std::vector<std::unique_ptr<AidlArgument>>* args,
const Comments& comments)
- : AidlMethod(location, oneway, type, name, args, comments, 0, true) {
+ : AidlMethod(location, oneway, type, name, args, comments, 0) {
has_id_ = false;
}
AidlMethod::AidlMethod(const AidlLocation& location, bool oneway, AidlTypeSpecifier* type,
const std::string& name, std::vector<std::unique_ptr<AidlArgument>>* args,
- const Comments& comments, int id, bool is_user_defined)
+ const Comments& comments, int id)
: AidlMember(location, comments),
oneway_(oneway),
type_(type),
name_(name),
arguments_(std::move(*args)),
- id_(id),
- is_user_defined_(is_user_defined) {
+ id_(id) {
has_id_ = true;
delete args;
for (const unique_ptr<AidlArgument>& a : arguments_) {
diff --git a/aidl_language.h b/aidl_language.h
index c73618f..1e52625 100644
--- a/aidl_language.h
+++ b/aidl_language.h
@@ -165,6 +165,7 @@
static void ClearUnvisitedNodes();
static const std::vector<AidlLocation>& GetLocationsOfUnvisitedNodes();
void MarkVisited() const;
+ bool IsUserDefined() const { return !GetLocation().IsInternal(); }
private:
std::string PrintLine() const;
@@ -854,8 +855,7 @@
AidlMethod(const AidlLocation& location, bool oneway, AidlTypeSpecifier* type, const string& name,
vector<unique_ptr<AidlArgument>>* args, const Comments& comments);
AidlMethod(const AidlLocation& location, bool oneway, AidlTypeSpecifier* type, const string& name,
- vector<unique_ptr<AidlArgument>>* args, const Comments& comments, int id,
- bool is_user_defined = true);
+ vector<unique_ptr<AidlArgument>>* args, const Comments& comments, int id);
virtual ~AidlMethod() = default;
// non-copyable, non-movable
@@ -877,8 +877,6 @@
int GetId() const { return id_; }
void SetId(unsigned id) { id_ = id; }
- bool IsUserDefined() const { return is_user_defined_; }
-
const std::vector<std::unique_ptr<AidlArgument>>& GetArguments() const {
return arguments_;
}
@@ -920,7 +918,6 @@
std::vector<const AidlArgument*> out_arguments_;
bool has_id_;
int id_;
- bool is_user_defined_ = true;
};
// AidlDefinedType represents either an interface, parcelable, or enum that is
diff --git a/aidl_language_l.ll b/aidl_language_l.ll
index 33054a3..34e84f1 100644
--- a/aidl_language_l.ll
+++ b/aidl_language_l.ll
@@ -142,7 +142,7 @@
{identifier} { yylval->token = new AidlToken(yytext, comments);
return yy::parser::token::IDENTIFIER;
}
-'.' { yylval->token = new AidlToken(yytext, comments);
+'.' { yylval->token = new AidlToken(std::string(yytext, yyleng), comments);
return yy::parser::token::CHARVALUE; }
{intvalue} { yylval->token = new AidlToken(yytext, comments);
return yy::parser::token::INTVALUE; }
diff --git a/aidl_to_cpp_common.cpp b/aidl_to_cpp_common.cpp
index f0df305..b8e38ea 100644
--- a/aidl_to_cpp_common.cpp
+++ b/aidl_to_cpp_common.cpp
@@ -314,7 +314,7 @@
}} else {{
return (_lhs.getTag() == _Tag)
? _cmp_value(_lhs.get<_Tag>(), _rhs.get<_Tag>())
- : _cmp_value_at<(Tag)(_Tag-1)>(_lhs, _rhs);
+ : _cmp_value_at<static_cast<Tag>(static_cast<size_t>(_Tag)-1)>(_lhs, _rhs);
}}
}}
template <typename _Type>
@@ -540,7 +540,7 @@
auto typelist = Join(field_types, ", ");
auto tmpl = R"--(
template <Tag _Tag>
-using _at = typename std::tuple_element<_Tag, std::tuple<{typelist}>>::type;
+using _at = typename std::tuple_element<static_cast<size_t>(_Tag), std::tuple<{typelist}>>::type;
template <Tag _Tag, typename _Type>
static {name} make(_Type&& _arg) {{
{name} _inst;
@@ -578,7 +578,7 @@
template<typename _Tp>
static constexpr bool _not_self = !std::is_same_v<std::remove_cv_t<std::remove_reference_t<_Tp>>, {name}>;
-{name}() : _value(std::in_place_index<{default_name}>, {default_value}) {{ }}
+{name}() : _value(std::in_place_index<static_cast<size_t>({default_name})>, {default_value}) {{ }}
template <typename _Tp, typename = std::enable_if_t<_not_self<_Tp>>>
// NOLINTNEXTLINE(google-explicit-constructor)
@@ -591,12 +591,12 @@
template <Tag _tag, typename... _Tp>
static {name} make(_Tp&&... _args) {{
- return {name}(std::in_place_index<_tag>, std::forward<_Tp>(_args)...);
+ return {name}(std::in_place_index<static_cast<size_t>(_tag)>, std::forward<_Tp>(_args)...);
}}
template <Tag _tag, typename _Tp, typename... _Up>
static {name} make(std::initializer_list<_Tp> _il, _Up&&... _args) {{
- return {name}(std::in_place_index<_tag>, std::move(_il), std::forward<_Up>(_args)...);
+ return {name}(std::in_place_index<static_cast<size_t>(_tag)>, std::move(_il), std::forward<_Up>(_args)...);
}}
Tag getTag() const {{
@@ -606,18 +606,18 @@
template <Tag _tag>
const auto& get() const {{
if (getTag() != _tag) {{ __assert2(__FILE__, __LINE__, __PRETTY_FUNCTION__, "bad access: a wrong tag"); }}
- return std::get<_tag>(_value);
+ return std::get<static_cast<size_t>(_tag)>(_value);
}}
template <Tag _tag>
auto& get() {{
if (getTag() != _tag) {{ __assert2(__FILE__, __LINE__, __PRETTY_FUNCTION__, "bad access: a wrong tag"); }}
- return std::get<_tag>(_value);
+ return std::get<static_cast<size_t>(_tag)>(_value);
}}
template <Tag _tag, typename... _Tp>
void set(_Tp&&... _args) {{
- _value.emplace<_tag>(std::forward<_Tp>(_args)...);
+ _value.emplace<static_cast<size_t>(_tag)>(std::forward<_Tp>(_args)...);
}}
)--";
@@ -644,7 +644,7 @@
out << fmt::format("{} {};\n", ctx.status_type, status);
read_var(tag, *tag_type);
- out << fmt::format("switch ({}) {{\n", tag);
+ out << fmt::format("switch (static_cast<Tag>({})) {{\n", tag);
for (const auto& variable : decl.GetFields()) {
out << fmt::format("case {}: {{\n", variable->GetName());
out.Indent();
@@ -680,7 +680,7 @@
const string status = "_aidl_ret_status";
out << fmt::format("{} {} = ", ctx.status_type, status);
- ctx.write_func(out, "getTag()", *tag_type);
+ ctx.write_func(out, "static_cast<int32_t>(getTag())", *tag_type);
out << ";\n";
out << fmt::format("if ({} != {}) return {};\n", status, ctx.status_ok, status);
out << "switch (getTag()) {\n";
diff --git a/aidl_to_java.cpp b/aidl_to_java.cpp
index d60362b..3cc2472 100644
--- a/aidl_to_java.cpp
+++ b/aidl_to_java.cpp
@@ -894,7 +894,11 @@
void ToStringFor(const CodeGeneratorContext& c) {
if (c.type.IsArray()) {
- c.writer << "java.util.Arrays.toString(" << c.var << ")";
+ if (c.type.IsDynamicArray() || c.type.GetFixedSizeArrayDimensions().size() == 1) {
+ c.writer << "java.util.Arrays.toString(" << c.var << ")";
+ } else {
+ c.writer << "java.util.Arrays.deepToString(" << c.var << ")";
+ }
return;
}
diff --git a/aidl_unittest.cpp b/aidl_unittest.cpp
index 5a975fe..632cded 100644
--- a/aidl_unittest.cpp
+++ b/aidl_unittest.cpp
@@ -1286,6 +1286,18 @@
EXPECT_EQ(AidlError::BAD_TYPE, error);
}
+TEST_F(AidlTest, InvalidCharLiteral) {
+ auto filename = "Foo.aidl";
+ char code[] = "parcelable Foo { char a = '\0'; char b = '\t'; }";
+ io_delegate_.SetFileContents(filename,
+ string{code, sizeof(code) - 1}); // -1 to drop nil at the end
+ CaptureStderr();
+ EXPECT_TRUE(Parser::Parse(filename, io_delegate_, typenames_, /*is_preprocessed=*/false));
+ auto err = GetCapturedStderr();
+ EXPECT_THAT(err, HasSubstr("Invalid character literal \\0"));
+ EXPECT_THAT(err, HasSubstr("Invalid character literal \\t"));
+}
+
TEST_P(AidlTest, RejectUnstructuredParcelablesInNDKandRust) {
io_delegate_.SetFileContents("o/Foo.aidl", "package o; parcelable Foo cpp_header \"cpp/Foo.h\";");
const auto options =
@@ -5038,7 +5050,7 @@
TEST_P(AidlTest, WarningInterfaceName) {
io_delegate_.SetFileContents("p/Foo.aidl", "interface Foo {}");
auto options = Options::From("aidl --lang " + to_string(GetLanguage()) +
- " -Weverything -o out -h out p/Foo.aidl");
+ " -Winterface-name -o out -h out p/Foo.aidl");
CaptureStderr();
EXPECT_TRUE(compile_aidl(options, io_delegate_));
EXPECT_EQ("WARNING: p/Foo.aidl:1.1-10: Interface names should start with I. [-Winterface-name]\n",
@@ -5048,7 +5060,7 @@
TEST_P(AidlTest, ErrorInterfaceName) {
io_delegate_.SetFileContents("p/Foo.aidl", "interface Foo {}");
auto options = Options::From("aidl --lang " + to_string(GetLanguage()) +
- " -Weverything -Werror -o out -h out p/Foo.aidl");
+ " -Winterface-name -Werror -o out -h out p/Foo.aidl");
CaptureStderr();
EXPECT_FALSE(compile_aidl(options, io_delegate_));
EXPECT_EQ("ERROR: p/Foo.aidl:1.1-10: Interface names should start with I. [-Winterface-name]\n",
@@ -5156,24 +5168,6 @@
EXPECT_EQ(GetCapturedStderr(), "");
}
-TEST_F(AidlTest, PropagateBeforeTiramisu) {
- io_delegate_.SetFileContents("p/IFoo.aidl",
- "interface IFoo{\n"
- " @PropagateAllowBlocking IBinder foo();\n"
- "}");
- CaptureStderr();
- EXPECT_FALSE(compile_aidl(
- Options::From("aidl --lang=java --min_sdk_version 30 -o out p/IFoo.aidl"), io_delegate_));
- auto captured_stderr = GetCapturedStderr();
- EXPECT_THAT(captured_stderr, HasSubstr("@PropagateAllowBlocking requires"));
-
- CaptureStderr();
- EXPECT_TRUE(
- compile_aidl(Options::From("aidl --lang=java --min_sdk_version Tiramisu -o out p/IFoo.aidl"),
- io_delegate_));
- EXPECT_EQ(GetCapturedStderr(), "");
-}
-
TEST_F(AidlTest, RustNameOf_PfdFixedArray) {
auto pfd = typenames_.MakeResolvedType(AIDL_LOCATION_HERE, "ParcelFileDescriptor", false);
ASSERT_TRUE(pfd->MakeArray(FixedSizeArray{
diff --git a/build/Android.bp b/build/Android.bp
index f12a4f5..32c8386 100644
--- a/build/Android.bp
+++ b/build/Android.bp
@@ -124,7 +124,13 @@
},
},
gen_trace: true,
- versions: ["1"],
+ versions_with_info: [
+ {
+ version: "1",
+ imports: ["test-piece-1-V3"],
+ },
+ ],
+
}
aidl_interface {
@@ -217,7 +223,7 @@
aidl_interface {
name: "tests_transitive_parcel.a",
flags: ["-Werror"],
- srcs: [ "tests_transitive_parcel/a/*.aidl" ],
+ srcs: ["tests_transitive_parcel/a/*.aidl"],
imports: [
"tests_transitive_parcel.b",
"tests_transitive_parcel.c",
@@ -233,8 +239,8 @@
aidl_interface {
name: "tests_transitive_parcel.b",
flags: ["-Werror"],
- srcs: [ "tests_transitive_parcel/b/*.aidl" ],
- imports: [ "tests_transitive_parcel.c" ],
+ srcs: ["tests_transitive_parcel/b/*.aidl"],
+ imports: ["tests_transitive_parcel.c"],
unstable: true,
backend: {
rust: {
@@ -246,7 +252,7 @@
aidl_interface {
name: "tests_transitive_parcel.c",
flags: ["-Werror"],
- srcs: [ "tests_transitive_parcel/c/*.aidl" ],
+ srcs: ["tests_transitive_parcel/c/*.aidl"],
unstable: true,
backend: {
rust: {
diff --git a/build/aidl_api.go b/build/aidl_api.go
index 62d2541..15a50d0 100644
--- a/build/aidl_api.go
+++ b/build/aidl_api.go
@@ -149,12 +149,132 @@
return apiDump{version, apiDir, apiFiles.Paths(), android.OptionalPathForPath(hashFile)}
}
+func wrapWithDiffCheckIfElse(m *aidlApi, rb *android.RuleBuilder, writer func(*android.RuleBuilderCommand), elseBlock func(*android.RuleBuilderCommand)) {
+ rbc := rb.Command()
+ rbc.Text("if [ \"$(cat ").Input(m.hasDevelopment).Text(")\" = \"1\" ]; then")
+ writer(rbc)
+ rbc.Text("; else")
+ elseBlock(rbc)
+ rbc.Text("; fi")
+}
+
+func wrapWithDiffCheckIf(m *aidlApi, rb *android.RuleBuilder, writer func(*android.RuleBuilderCommand), needToWrap bool) {
+ rbc := rb.Command()
+ if needToWrap {
+ rbc.Text("if [ \"$(cat ").Input(m.hasDevelopment).Text(")\" = \"1\" ]; then")
+ }
+ writer(rbc)
+ if needToWrap {
+ rbc.Text("; fi")
+ }
+}
+
+// Migrate `versions` into `version_with_info`, and then append a version if it isn't nil
+func (m *aidlApi) migrateAndAppendVersion(ctx android.ModuleContext, rb *android.RuleBuilder, version *string, transitive bool) {
+ isFreezingApi := version != nil
+
+ // Remove `versions` property which is deprecated.
+ wrapWithDiffCheckIf(m, rb, func(rbc *android.RuleBuilderCommand) {
+ rbc.BuiltTool("bpmodify").
+ Text("-w -m " + m.properties.BaseName).
+ Text("-parameter versions -remove-property").
+ Text(android.PathForModuleSrc(ctx, "Android.bp").String())
+ }, isFreezingApi)
+
+ var iface *aidlInterface
+ ctx.VisitDirectDeps(func(dep android.Module) {
+ switch ctx.OtherModuleDependencyTag(dep).(type) {
+ case interfaceDepTag:
+ iface = dep.(*aidlInterface)
+ }
+ })
+ if iface == nil {
+ ctx.ModuleErrorf("aidl_interface %s doesn't exist", m.properties.BaseName)
+ return
+ }
+ var versions []string
+ if len(iface.properties.Versions_with_info) == 0 {
+ versions = append(versions, iface.getVersions()...)
+ }
+ if isFreezingApi {
+ versions = append(versions, *version)
+ }
+ for _, v := range versions {
+ importIfaces := make(map[string]*aidlInterface)
+ ctx.VisitDirectDeps(func(dep android.Module) {
+ if _, ok := ctx.OtherModuleDependencyTag(dep).(importInterfaceDepTag); ok {
+ other := dep.(*aidlInterface)
+ importIfaces[other.BaseModuleName()] = other
+ }
+ })
+ imports := make([]string, 0, len(iface.getImportsForVersion(v)))
+ needTransitiveFreeze := isFreezingApi && v == *version && transitive
+
+ if needTransitiveFreeze {
+ importApis := make(map[string]*aidlApi)
+ ctx.WalkDeps(func(child android.Module, parent android.Module) bool {
+ if api, ok := child.(*aidlApi); ok {
+ moduleName := strings.TrimSuffix(api.Name(), aidlApiSuffix)
+ if _, ok := importIfaces[moduleName]; ok {
+ importApis[moduleName] = api
+ return false
+ }
+ }
+ return true
+ })
+ wrapWithDiffCheckIf(m, rb, func(rbc *android.RuleBuilderCommand) {
+ rbc.BuiltTool("bpmodify").
+ Text("-w -m " + m.properties.BaseName).
+ Text("-parameter versions_with_info -add-literal '").
+ Text(fmt.Sprintf(`{version: "%s", imports: [`, v))
+
+ for _, im := range iface.getImportsForVersion(v) {
+ moduleName, version := parseModuleWithVersion(im)
+
+ // Invoke an imported interface's freeze-api only if it depends on ToT version explicitly or implicitly.
+ if version == importIfaces[moduleName].nextVersion() || !hasVersionSuffix(im) {
+ rb.Command().Text(fmt.Sprintf(`echo "Call %s-freeze-api because %s depends on %s."`, moduleName, m.properties.BaseName, moduleName))
+ rbc.Implicit(importApis[moduleName].freezeApiTimestamp)
+ }
+ if hasVersionSuffix(im) {
+ rbc.Text(fmt.Sprintf(`"%s",`, im))
+ } else {
+ rbc.Text("\"" + im + "-V'" + `$(if [ "$(cat `).
+ Input(importApis[im].hasDevelopment).
+ Text(`)" = "1" ]; then echo "` + importIfaces[im].nextVersion() +
+ `"; else echo "` + importIfaces[im].latestVersion() + `"; fi)'"`)
+ }
+ }
+ rbc.Text("]}' ").
+ Text(android.PathForModuleSrc(ctx, "Android.bp").String())
+ }, isFreezingApi)
+ } else {
+ for _, im := range iface.getImportsForVersion(v) {
+ if hasVersionSuffix(im) {
+ imports = append(imports, im)
+ } else {
+ imports = append(imports, im+"-V"+importIfaces[im].latestVersion())
+ }
+ }
+ data := fmt.Sprintf(`{version: "%s", imports: %v}`, v, wrap(`"`, imports, `"`))
+
+ // Also modify Android.bp file to add the new version to the 'versions_with_info' property.
+ wrapWithDiffCheckIf(m, rb, func(rbc *android.RuleBuilderCommand) {
+ rbc.BuiltTool("bpmodify").
+ Text("-w -m " + m.properties.BaseName).
+ Text("-parameter versions_with_info -add-literal '" + data + "' ").
+ Text(android.PathForModuleSrc(ctx, "Android.bp").String())
+ }, isFreezingApi)
+ }
+ }
+}
+
func (m *aidlApi) makeApiDumpAsVersion(ctx android.ModuleContext, dump apiDump, version string, latestVersionDump *apiDump) android.WritablePath {
creatingNewVersion := version != currentVersion
moduleDir := android.PathForModuleSrc(ctx).String()
targetDir := filepath.Join(moduleDir, m.apiDir(), version)
rb := android.NewRuleBuilder(pctx, ctx)
-
+ transitive := ctx.Config().IsEnvTrue("AIDL_TRANSITIVE_FREEZE")
var actionWord string
if creatingNewVersion {
actionWord = "Making"
@@ -163,27 +283,24 @@
// otherwise we will be unnecessarily creating many versions.
// Copy the given dump to the target directory only when the equality check failed
// (i.e. `has_development` file contains "1").
- rb.Command().
- Text("if [ \"$(cat ").Input(m.hasDevelopment).Text(")\" = \"1\" ]; then").
- Text("mkdir -p " + targetDir + " && ").
- Text("cp -rf " + dump.dir.String() + "/. " + targetDir).Implicits(dump.files).
- Text("; fi")
-
- // Also modify Android.bp file to add the new version to the 'versions' property.
- rb.Command().
- Text("if [ \"$(cat ").Input(m.hasDevelopment).Text(")\" = \"1\" ]; then").
- BuiltTool("bpmodify").
- Text("-w -m " + m.properties.BaseName).
- Text("-parameter versions -a " + version).
- Text(android.PathForModuleSrc(ctx, "Android.bp").String()).
- Text("; fi")
-
+ wrapWithDiffCheckIf(m, rb, func(rbc *android.RuleBuilderCommand) {
+ rbc.Text("mkdir -p " + targetDir + " && ").
+ Text("cp -rf " + dump.dir.String() + "/. " + targetDir).Implicits(dump.files)
+ }, true /* needToWrap */)
+ wrapWithDiffCheckIfElse(m, rb, func(rbc *android.RuleBuilderCommand) {
+ rbc.Text(fmt.Sprintf(`echo "There is change between ToT version and the latest stable version. Freezing %s-V%s."`, m.properties.BaseName, version))
+ }, func(rbc *android.RuleBuilderCommand) {
+ rbc.Text(fmt.Sprintf(`echo "There is no change from the latest stable version of %s. Nothing happened."`, m.properties.BaseName))
+ })
+ m.migrateAndAppendVersion(ctx, rb, &version, transitive)
} else {
actionWord = "Updating"
// We are updating the current version. Don't copy .hash to the current dump
rb.Command().Text("mkdir -p " + targetDir)
rb.Command().Text("rm -rf " + targetDir + "/*")
rb.Command().Text("cp -rf " + dump.dir.String() + "/* " + targetDir).Implicits(dump.files)
+
+ m.migrateAndAppendVersion(ctx, rb, nil, false)
}
timestampFile := android.PathForModuleOut(ctx, "updateapi_"+version+".timestamp")
@@ -460,7 +577,7 @@
AidlRoot: aidlRoot,
Stability: i.properties.Stability,
Imports: i.properties.Imports,
- Versions: i.properties.Versions,
+ Versions: i.getVersions(),
Dumpapi: i.properties.Dumpapi,
})
return apiModule
diff --git a/build/aidl_interface.go b/build/aidl_interface.go
index 8d27826..15b2588 100644
--- a/build/aidl_interface.go
+++ b/build/aidl_interface.go
@@ -327,9 +327,20 @@
// interface must be kept stable as long as it is used.
Stability *string
+ // Deprecated: Use `versions_with_info` instead. Don't use `versions` property directly.
+ Versions []string
+
// Previous API versions that are now frozen. The version that is last in
// the list is considered as the most recent version.
- Versions []string
+ // The struct contains both version and imports information per a version.
+ // Until versions property is removed, don't use `versions_with_info` directly.
+ Versions_with_info []struct {
+ Version string
+ Imports []string
+ }
+
+ // Use aidlInterface.getVersions()
+ VersionsInternal []string `blueprint:"mutated"`
// The minimum version of the sdk that the compiled artifacts will run against
// For native modules, the property needs to be set when a module is a part of mainline modules(APEX).
@@ -559,7 +570,7 @@
anImportWithVersion := tag.anImport
_, version := parseModuleWithVersion(tag.anImport)
if version != "" {
- candidateVersions := concat(other.properties.Versions, []string{other.nextVersion()})
+ candidateVersions := concat(other.getVersions(), []string{other.nextVersion()})
if !android.InList(version, candidateVersions) {
mctx.PropertyErrorf("imports", "%q depends on %q version %q(%q), which doesn't exist. The version must be one of %q", i.ModuleBase.Name(), anImport, version, anImportWithVersion, candidateVersions)
}
@@ -613,9 +624,23 @@
}
}
func (i *aidlInterface) checkVersions(mctx android.LoadHookContext) {
+ if len(i.properties.Versions) > 0 && len(i.properties.Versions_with_info) > 0 {
+ mctx.ModuleErrorf("versions:%q and versions_with_info:%q cannot be used at the same time. Use versions_with_info instead of versions.", i.properties.Versions, i.properties.Versions_with_info)
+ }
+
+ if len(i.properties.Versions) > 0 {
+ i.properties.VersionsInternal = make([]string, len(i.properties.Versions))
+ copy(i.properties.VersionsInternal, i.properties.Versions)
+ } else if len(i.properties.Versions_with_info) > 0 {
+ i.properties.VersionsInternal = make([]string, len(i.properties.Versions_with_info))
+ for idx, value := range i.properties.Versions_with_info {
+ i.properties.VersionsInternal[idx] = value.Version
+ }
+ }
+
versions := make(map[string]bool)
- intVersions := make([]int, 0, len(i.properties.Versions))
- for _, ver := range i.properties.Versions {
+ intVersions := make([]int, 0, len(i.getVersions()))
+ for _, ver := range i.getVersions() {
if _, dup := versions[ver]; dup {
mctx.PropertyErrorf("versions", "duplicate found", ver)
continue
@@ -634,7 +659,7 @@
}
if !mctx.Failed() && !sort.IntsAreSorted(intVersions) {
- mctx.PropertyErrorf("versions", "should be sorted, but is %v", i.properties.Versions)
+ mctx.PropertyErrorf("versions", "should be sorted, but is %v", i.getVersions())
}
}
func (i *aidlInterface) checkVndkUseVersion(mctx android.LoadHookContext) {
@@ -648,7 +673,7 @@
if *i.properties.Vndk_use_version == i.nextVersion() {
return
}
- for _, ver := range i.properties.Versions {
+ for _, ver := range i.getVersions() {
if *i.properties.Vndk_use_version == ver {
return
}
@@ -660,7 +685,7 @@
if proptools.Bool(i.properties.Unstable) {
return ""
}
- return nextVersion(i.properties.Versions)
+ return nextVersion(i.getVersions())
}
func nextVersion(versions []string) string {
@@ -679,11 +704,15 @@
if !i.hasVersion() {
return "0"
}
- return i.properties.Versions[len(i.properties.Versions)-1]
+ return i.getVersions()[len(i.getVersions())-1]
}
func (i *aidlInterface) hasVersion() bool {
- return len(i.properties.Versions) > 0
+ return len(i.getVersions()) > 0
+}
+
+func (i *aidlInterface) getVersions() []string {
+ return i.properties.VersionsInternal
}
func hasVersionSuffix(moduleName string) bool {
@@ -759,7 +788,7 @@
mctx.PropertyErrorf("versions", "must be set (need to be frozen) when \"unstable\" is false, PLATFORM_VERSION_CODENAME is REL, and \"owner\" property is missing.")
}
- versions := i.properties.Versions
+ versions := i.getVersions()
nextVersion := i.nextVersion()
shouldGenerateLangBackendMap := map[string]bool{
langCpp: i.shouldGenerateCppBackend(),
@@ -836,7 +865,7 @@
i.preprocessed = make(map[string]android.WritablePath)
// generate (len(versions) + 1) preprocessed.aidl files
- for _, version := range concat(i.properties.Versions, []string{i.nextVersion()}) {
+ for _, version := range concat(i.getVersions(), []string{i.nextVersion()}) {
i.preprocessed[version] = i.buildPreprocessed(ctx, version)
}
// helpful aliases
@@ -851,18 +880,27 @@
}
}
-// imported interfaces
-// TODO(b/146436251) use imports in versions_with_info
-// For example, foo-V1 should use bar-V1 while foo-V2 should use bar-V2
-// name: "foo",
-// versions_with_info: [
-// { version: "1", imports: ["bar-V1"]},
-// { version: "2", imports: ["bar-V2"]},
-// ]
+func (i *aidlInterface) getImportsForVersion(version string) []string {
+ // `Imports` is used when version == i.nextVersion() or`versions` is defined instead of `versions_with_info`
+ importsSrc := i.properties.Imports
+ for _, v := range i.properties.Versions_with_info {
+ if v.Version == version {
+ importsSrc = v.Imports
+ break
+ }
+ }
+ imports := make([]string, len(importsSrc))
+ copy(imports, importsSrc)
+
+ return imports
+}
+
func (i *aidlInterface) getImports(version string) map[string]string {
imports := make(map[string]string)
+ imports_src := i.getImportsForVersion(version)
+
useLatestStable := !proptools.Bool(i.properties.Unstable) && version != "" && version != i.nextVersion()
- for _, importString := range i.properties.Imports {
+ for _, importString := range imports_src {
name, targetVersion := parseModuleWithVersion(importString)
if targetVersion == "" && useLatestStable {
targetVersion = "latest"
diff --git a/build/aidl_interface_backends.go b/build/aidl_interface_backends.go
index ac4fce4..f522a15 100644
--- a/build/aidl_interface_backends.go
+++ b/build/aidl_interface_backends.go
@@ -75,7 +75,7 @@
}, &aidlGenProperties{
Srcs: srcs,
AidlRoot: aidlRoot,
- Imports: i.properties.Imports,
+ Imports: i.getImportsForVersion(version),
Stability: i.properties.Stability,
Min_sdk_version: i.minSdkVersion(lang),
Lang: lang,
@@ -156,7 +156,7 @@
Lang: lang,
AidlInterfaceName: i.ModuleBase.Name(),
Version: version,
- Imports: i.properties.Imports,
+ Imports: i.getImportsForVersion(version),
ModuleProperties: []interface{}{
&ccProperties{
Name: proptools.StringPtr(cppModuleGen),
@@ -219,7 +219,7 @@
}, &aidlGenProperties{
Srcs: srcs,
AidlRoot: aidlRoot,
- Imports: i.properties.Imports,
+ Imports: i.getImportsForVersion(version),
Stability: i.properties.Stability,
Min_sdk_version: minSdkVersion,
Platform_apis: proptools.Bool(i.properties.Backend.Java.Platform_apis),
@@ -239,7 +239,7 @@
Lang: langJava,
AidlInterfaceName: i.ModuleBase.Name(),
Version: version,
- Imports: i.properties.Imports,
+ Imports: i.getImportsForVersion(version),
ModuleProperties: []interface{}{&javaProperties{
Name: proptools.StringPtr(javaModuleGen),
Installable: proptools.BoolPtr(true),
@@ -271,7 +271,7 @@
}, &aidlGenProperties{
Srcs: srcs,
AidlRoot: aidlRoot,
- Imports: i.properties.Imports,
+ Imports: i.getImportsForVersion(version),
Stability: i.properties.Stability,
Min_sdk_version: i.minSdkVersion(langRust),
Lang: langRust,
@@ -299,7 +299,7 @@
Source_stem: proptools.StringPtr(versionedRustName),
}, &aidlRustSourceProviderProperties{
SourceGen: rustSourceGen,
- Imports: i.properties.Imports,
+ Imports: i.getImportsForVersion(version),
Version: version,
AidlInterfaceName: i.ModuleBase.Name(),
})
@@ -350,7 +350,7 @@
flags = append(flags, i.properties.Flags...)
// For ToT, turn on "-Weverything" (enable all warnings)
if version == i.nextVersion() {
- flags = append(flags, "-Weverything")
+ flags = append(flags, "-Weverything -Wno-missing-permission-annotation")
}
return
}
diff --git a/build/aidl_interface_metadata_singleton.go b/build/aidl_interface_metadata_singleton.go
index 9e2e014..8b421a5 100644
--- a/build/aidl_interface_metadata_singleton.go
+++ b/build/aidl_interface_metadata_singleton.go
@@ -99,7 +99,7 @@
info := moduleInfos[t.ModuleBase.Name()]
info.Stability = proptools.StringDefault(t.properties.Stability, "")
info.ComputedTypes = t.computedTypes
- info.Versions = t.properties.Versions
+ info.Versions = t.getVersions()
moduleInfos[t.ModuleBase.Name()] = info
case *aidlGenRule:
info := moduleInfos[t.properties.BaseName]
diff --git a/build/aidl_test.go b/build/aidl_test.go
index 2d5dc17..d7534d2 100644
--- a/build/aidl_test.go
+++ b/build/aidl_test.go
@@ -60,6 +60,12 @@
})
}
+func setTransitiveFreezeEnv() android.FixturePreparer {
+ return android.FixtureMergeEnv(map[string]string{
+ "AIDL_TRANSITIVE_FREEZE": "true",
+ })
+}
+
func _testAidl(t *testing.T, bp string, customizers ...android.FixturePreparer) android.FixturePreparer {
t.Helper()
@@ -1650,3 +1656,121 @@
testAidl(t, ``, files, setTestFreezeEnv())
testAidl(t, ``, files)
}
+
+func TestVersionsWithInfoAndVersions(t *testing.T) {
+ conflictingFields := `
+ aidl_interface {
+ name: "foo",
+ versions: [
+ "1",
+ ],
+ versions_with_info: [
+ {
+ version: "1",
+ }
+ ],
+ }
+ `
+ files := withFiles(map[string][]byte{
+ "aidl_api/foo/1/foo.1.aidl": nil,
+ "aidl_api/foo/1/.hash": nil,
+ })
+
+ expectedError := `Use versions_with_info instead of versions.`
+ testAidlError(t, expectedError, conflictingFields, files)
+}
+
+func TestVersionsWithInfo(t *testing.T) {
+ ctx, _ := testAidl(t, ``, withFiles(map[string][]byte{
+ "common/Android.bp": []byte(`
+ aidl_interface {
+ name: "common",
+ srcs: ["ICommon.aidl"],
+ versions: ["1", "2"],
+ }
+ `),
+ "common/aidl_api/common/1/ICommon.aidl": nil,
+ "common/aidl_api/common/1/.hash": nil,
+ "common/aidl_api/common/2/ICommon.aidl": nil,
+ "common/aidl_api/common/2/.hash": nil,
+ "foo/Android.bp": []byte(`
+ aidl_interface {
+ name: "foo",
+ srcs: ["IFoo.aidl"],
+ imports: ["common"],
+ versions_with_info: [
+ {version: "1", imports: ["common-V1"]},
+ {version: "2", imports: ["common-V2"]},
+ ]
+ }
+ `),
+ "foo/aidl_api/foo/1/IFoo.aidl": nil,
+ "foo/aidl_api/foo/1/.hash": nil,
+ "foo/aidl_api/foo/2/IFoo.aidl": nil,
+ "foo/aidl_api/foo/2/.hash": nil,
+ }))
+
+ fooV1Java := FindModule(ctx, "foo-V1-java", "android_common", "foo").(*java.Library)
+ android.AssertStringListContains(t, "a/foo-v1 deps", fooV1Java.CompilerDeps(), "common-V1-java")
+
+ fooV2Java := FindModule(ctx, "foo-V2-java", "android_common", "foo").(*java.Library)
+ android.AssertStringListContains(t, "a/foo-v2 deps", fooV2Java.CompilerDeps(), "common-V2-java")
+
+ fooV3Java := FindModule(ctx, "foo-V3-java", "android_common", "foo").(*java.Library)
+ android.AssertStringListContains(t, "a/foo-v3 deps", fooV3Java.CompilerDeps(), "common-V3-java")
+}
+
+func TestFreezeApiDeps(t *testing.T) {
+ for _, transitive := range []bool{true, false} {
+ for _, testcase := range []struct {
+ string
+ bool
+ }{{"common", true}, {"common-V3", true}, {"common-V2", false}} {
+ im := testcase.string
+ customizers := []android.FixturePreparer{
+ withFiles(map[string][]byte{
+ "common/Android.bp": []byte(`
+ aidl_interface {
+ name: "common",
+ srcs: ["ICommon.aidl"],
+ versions: ["1", "2"],
+ }
+ `),
+ "common/aidl_api/common/1/ICommon.aidl": nil,
+ "common/aidl_api/common/1/.hash": nil,
+ "common/aidl_api/common/2/ICommon.aidl": nil,
+ "common/aidl_api/common/2/.hash": nil,
+ "foo/Android.bp": []byte(fmt.Sprintf(`
+ aidl_interface {
+ name: "foo",
+ srcs: ["IFoo.aidl"],
+ imports: ["%s"],
+ versions_with_info: [
+ {version: "1", imports: ["common-V1"]},
+ {version: "2", imports: ["common-V2"]},
+ ]
+ }
+ `, im)),
+ "foo/aidl_api/foo/1/IFoo.aidl": nil,
+ "foo/aidl_api/foo/1/.hash": nil,
+ "foo/aidl_api/foo/2/IFoo.aidl": nil,
+ "foo/aidl_api/foo/2/.hash": nil,
+ }),
+ }
+ if transitive {
+ customizers = append(customizers, setTransitiveFreezeEnv())
+ }
+
+ ctx, _ := testAidl(t, ``, customizers...)
+ shouldHaveDep := transitive && testcase.bool
+ fooFreezeApiRule := ctx.ModuleForTests("foo-api", "").Output("updateapi_3.timestamp")
+ commonFreezeApiOutput := ctx.ModuleForTests("common-api", "").Output("updateapi_3.timestamp").Output.String()
+ testMethod := android.AssertStringListDoesNotContain
+ if shouldHaveDep {
+ testMethod = android.AssertStringListContains
+ }
+ testMethod(t, "Only if AIDL_TRANSITIVE_FREEZE is set and an aidl_interface depends on an another aidl_interface's ToT version, an imported aidl_interface should be frozen as well.",
+ fooFreezeApiRule.Implicits.Strings(), commonFreezeApiOutput)
+ }
+ }
+}
diff --git a/check_valid.cpp b/check_valid.cpp
index 2d7fb90..e7bcb8d 100644
--- a/check_valid.cpp
+++ b/check_valid.cpp
@@ -80,16 +80,6 @@
return true;
});
- v.Check([&](const AidlTypeSpecifier& type) {
- // TODO(b/151102494): annotation is applied on the return type
- if (type.IsPropagateAllowBlocking() && options.GetMinSdkVersion() < JAVA_PROPAGATE_VERSION) {
- AIDL_ERROR(type) << "@PropagateAllowBlocking requires " << JAVA_PROPAGATE_VERSION
- << ". Current min_sdk_version is " << min_sdk_version << ".";
- return false;
- }
- return true;
- });
-
VisitTopDown(v, doc);
return v.success;
}
diff --git a/diagnostics.cpp b/diagnostics.cpp
index 13f918f..0eca8ae 100644
--- a/diagnostics.cpp
+++ b/diagnostics.cpp
@@ -55,6 +55,9 @@
DiagnosticsContext(DiagnosticMapping mapping) : mapping_({std::move(mapping)}) {}
AidlErrorLog Report(const AidlLocation& loc, DiagnosticID id,
DiagnosticSeverity force_severity = DiagnosticSeverity::DISABLED) {
+ if (loc.IsInternal()) {
+ return AidlErrorLog(AidlErrorLog::NO_OP, loc);
+ }
const std::string suffix = " [-W" + to_string(id) + "]";
auto severity = std::max(force_severity, mapping_.top().Severity(id));
switch (severity) {
@@ -296,6 +299,44 @@
}
};
+struct DiagnosePermissionAnnotations : DiagnosticsVisitor {
+ DiagnosePermissionAnnotations(DiagnosticsContext& diag) : DiagnosticsVisitor(diag) {}
+ void Visit(const AidlInterface& intf) override {
+ const std::string diag_message =
+ " is not annotated for permissions. Declare which permissions are "
+ "required using @EnforcePermission. If permissions are manually "
+ "verified within the implementation, use @PermissionManuallyEnforced. "
+ "If no permissions are required, use @RequiresNoPermission.";
+ if (intf.EnforceExpression() || intf.IsPermissionManual() || intf.IsPermissionNone()) {
+ return;
+ }
+ const auto& methods = intf.GetMethods();
+ std::vector<size_t> methods_without_annotations;
+ size_t num_user_defined_methods = 0;
+ for (size_t i = 0; i < methods.size(); ++i) {
+ auto& m = methods[i];
+ if (!m->IsUserDefined()) continue;
+ num_user_defined_methods++;
+ if (m->GetType().EnforceExpression() || m->GetType().IsPermissionManual() ||
+ m->GetType().IsPermissionNone()) {
+ continue;
+ }
+ methods_without_annotations.push_back(i);
+ }
+ if (methods_without_annotations.size() == num_user_defined_methods) {
+ diag.Report(intf.GetLocation(), DiagnosticID::missing_permission_annotation)
+ << intf.GetName() << diag_message
+ << " This can be done for the whole interface or for each method.";
+ } else {
+ for (size_t i : methods_without_annotations) {
+ auto& m = methods[i];
+ diag.Report(m->GetLocation(), DiagnosticID::missing_permission_annotation)
+ << m->GetName() << diag_message;
+ }
+ }
+ }
+};
+
bool Diagnose(const AidlDocument& doc, const DiagnosticMapping& mapping) {
DiagnosticsContext diag(mapping);
@@ -309,6 +350,7 @@
DiagnoseOutNullable{diag}.Check(doc);
DiagnoseImports{diag}.Check(doc);
DiagnoseUntypedCollection{diag}.Check(doc);
+ DiagnosePermissionAnnotations{diag}.Check(doc);
return diag.ErrorCount() == 0;
}
diff --git a/diagnostics.inc b/diagnostics.inc
index 101b737..6a0570a 100644
--- a/diagnostics.inc
+++ b/diagnostics.inc
@@ -4,6 +4,7 @@
DIAG(file_descriptor, "file-descriptor", false)
DIAG(inout_parameter, "inout-parameter", false)
DIAG(interface_name, "interface-name", false)
+DIAG(missing_permission_annotation, "missing-permission-annotation", false)
DIAG(mixed_oneway, "mixed-oneway", false)
DIAG(out_array, "out-array", false)
DIAG(out_nullable, "out-nullable", false)
diff --git a/diagnostics_unittest.cpp b/diagnostics_unittest.cpp
index 0066b9f..3a45d09 100644
--- a/diagnostics_unittest.cpp
+++ b/diagnostics_unittest.cpp
@@ -24,7 +24,6 @@
#include "parser.h"
#include "tests/fake_io_delegate.h"
-using android::aidl::AidlError;
using android::aidl::AidlTypenames;
using android::aidl::DiagnosticID;
using android::aidl::Options;
@@ -40,56 +39,63 @@
for (const auto& [file, contents] : files) {
io.SetFileContents(file, contents);
}
+ if (!enable_diagnostic) {
+ ASSERT_TRUE(expect_diagnostic);
+ enable_diagnostic = expect_diagnostic;
+ }
// emit diagnostics as warnings.
// "java" has no specific meaning here because we're testing CheckValid()
- const Options options =
- Options::From("aidl " + optional_args + " -I . --lang java -o out -Weverything " + main);
+ const Options options = Options::From("aidl " + optional_args + " -I . --lang java -o out -W" +
+ to_string(*enable_diagnostic) + " " + main);
CaptureStderr();
load_and_validate_aidl(main, options, io, &typenames, nullptr);
const std::string err = GetCapturedStderr();
- if (expect_diagnostics.empty()) {
- EXPECT_EQ("", err);
+ if (expect_diagnostic) {
+ EXPECT_THAT(err, testing::HasSubstr("-W" + to_string(*expect_diagnostic)));
} else {
- for (const auto id : expect_diagnostics) {
- EXPECT_THAT(err, testing::HasSubstr("-W" + to_string(id)));
- }
+ EXPECT_EQ("", err);
}
}
AidlTypenames typenames;
FakeIoDelegate io;
std::string optional_args;
- std::vector<DiagnosticID> expect_diagnostics;
+ // The type of diagnostic to enable for the test. If expect_diagnostic is
+ // set, use the same value.
+ std::optional<DiagnosticID> enable_diagnostic;
+ // The expected diagnostic. Must be set.
+ std::optional<DiagnosticID> expect_diagnostic;
};
TEST_F(DiagnosticsTest, const_name_ForEnumerator) {
- expect_diagnostics = {DiagnosticID::const_name};
+ expect_diagnostic = DiagnosticID::const_name;
ParseFiles({{"Foo.aidl", "enum Foo { foo }"}});
}
TEST_F(DiagnosticsTest, const_name_ForConstants) {
- expect_diagnostics = {DiagnosticID::const_name};
+ expect_diagnostic = DiagnosticID::const_name;
ParseFiles({{"IFoo.aidl", "interface IFoo { const int foo = 1; }"}});
}
TEST_F(DiagnosticsTest, interface_name) {
- expect_diagnostics = {DiagnosticID::interface_name};
+ expect_diagnostic = DiagnosticID::interface_name;
ParseFiles({{"Foo.aidl", "interface Foo { }"}});
}
TEST_F(DiagnosticsTest, enum_explicit_default) {
- expect_diagnostics = {DiagnosticID::enum_explicit_default};
+ expect_diagnostic = DiagnosticID::enum_explicit_default;
ParseFiles({{"Foo.aidl", "parcelable Foo { E e; }"}, {"E.aidl", "enum E { A }"}});
}
TEST_F(DiagnosticsTest, inout_parameter) {
- expect_diagnostics = {DiagnosticID::inout_parameter};
+ expect_diagnostic = DiagnosticID::inout_parameter;
ParseFiles({{"IFoo.aidl", "interface IFoo { void foo(inout Bar bar); }"},
{"Bar.aidl", "parcelable Bar {}"}});
}
TEST_F(DiagnosticsTest, inout_parameter_SuppressAtMethodLevel) {
- expect_diagnostics = {};
+ enable_diagnostic = DiagnosticID::inout_parameter;
+ expect_diagnostic = {};
ParseFiles({
{"IFoo.aidl",
"interface IFoo { @SuppressWarnings(value={\"inout-parameter\"}) void foo(inout Bar b); }"},
@@ -98,7 +104,8 @@
}
TEST_F(DiagnosticsTest, inout_parameter_SuppressAtDeclLevel) {
- expect_diagnostics = {};
+ enable_diagnostic = DiagnosticID::inout_parameter;
+ expect_diagnostic = {};
ParseFiles({
{"IFoo.aidl",
"@SuppressWarnings(value={\"inout-parameter\"}) interface IFoo { void foo(inout Bar b); }"},
@@ -107,14 +114,14 @@
}
TEST_F(DiagnosticsTest, UnknownWarning) {
- expect_diagnostics = {DiagnosticID::unknown_warning};
+ expect_diagnostic = DiagnosticID::unknown_warning;
ParseFiles({
{"IFoo.aidl", "@SuppressWarnings(value={\"blahblah\"}) interface IFoo { void foo(); }"},
});
}
TEST_F(DiagnosticsTest, CantSuppressUnknownWarning) {
- expect_diagnostics = {DiagnosticID::unknown_warning};
+ expect_diagnostic = DiagnosticID::unknown_warning;
ParseFiles({
{"IFoo.aidl",
"@SuppressWarnings(value={\"unknown-warning\"})\n"
@@ -123,14 +130,15 @@
}
TEST_F(DiagnosticsTest, DontMixOnewayWithTwowayMethods) {
- expect_diagnostics = {DiagnosticID::mixed_oneway};
+ expect_diagnostic = DiagnosticID::mixed_oneway;
ParseFiles({
{"IFoo.aidl", "interface IFoo { void foo(); oneway void bar(); }"},
});
}
TEST_F(DiagnosticsTest, DontMixOnewayWithTwowayMethodsSuppressedAtMethod) {
- expect_diagnostics = {};
+ enable_diagnostic = DiagnosticID::mixed_oneway;
+ expect_diagnostic = {};
ParseFiles({
{"IFoo.aidl",
"interface IFoo {\n"
@@ -142,21 +150,22 @@
TEST_F(DiagnosticsTest, OnewayInterfaceIsOkayWithSyntheticMethods) {
optional_args = "--version 2"; // will add getInterfaceVersion() synthetic method
- expect_diagnostics = {};
+ enable_diagnostic = DiagnosticID::mixed_oneway;
+ expect_diagnostic = {};
ParseFiles({
{"IFoo.aidl", "oneway interface IFoo { void foo(); }"},
});
}
TEST_F(DiagnosticsTest, ArraysAsOutputParametersConsideredHarmful) {
- expect_diagnostics = {DiagnosticID::out_array};
+ expect_diagnostic = DiagnosticID::out_array;
ParseFiles({
{"IFoo.aidl", "interface IFoo { void foo(out String[] ret); }"},
});
}
TEST_F(DiagnosticsTest, file_descriptor) {
- expect_diagnostics = {DiagnosticID::file_descriptor};
+ expect_diagnostic = DiagnosticID::file_descriptor;
ParseFiles({{"IFoo.aidl",
"interface IFoo {\n"
" void foo(in FileDescriptor fd);\n"
@@ -164,7 +173,7 @@
}
TEST_F(DiagnosticsTest, out_nullable) {
- expect_diagnostics = {DiagnosticID::out_nullable};
+ expect_diagnostic = DiagnosticID::out_nullable;
ParseFiles({{"IFoo.aidl",
"interface IFoo {\n"
" void foo(out @nullable Bar bar);\n"
@@ -173,7 +182,7 @@
}
TEST_F(DiagnosticsTest, inout_nullable) {
- expect_diagnostics = {DiagnosticID::out_nullable};
+ expect_diagnostic = DiagnosticID::out_nullable;
ParseFiles({{"IFoo.aidl",
"interface IFoo {\n"
" void foo(inout @nullable Bar bar);\n"
@@ -182,7 +191,7 @@
}
TEST_F(DiagnosticsTest, out_nullable_OkayForArrays) {
- expect_diagnostics = {DiagnosticID::out_array}; // not triggering out_nullable
+ expect_diagnostic = DiagnosticID::out_array; // not triggering out_nullable
ParseFiles({{"IFoo.aidl",
"interface IFoo {\n"
" void foo(inout @nullable Bar[] bar1, out @nullable Bar[] bar2);\n"
@@ -191,7 +200,7 @@
}
TEST_F(DiagnosticsTest, RejectImportsCollisionWithTopLevelDecl) {
- expect_diagnostics = {DiagnosticID::unique_import};
+ expect_diagnostic = DiagnosticID::unique_import;
ParseFiles({{"p/IFoo.aidl",
"package p;\n"
"import q.IFoo;\n" // should collide with previous import
@@ -200,7 +209,7 @@
}
TEST_F(DiagnosticsTest, RejectImportsCollision) {
- expect_diagnostics = {DiagnosticID::unique_import};
+ expect_diagnostic = DiagnosticID::unique_import;
ParseFiles({{"p/IFoo.aidl",
"package p;\n"
"import q.IBar;\n"
@@ -211,7 +220,8 @@
}
TEST_F(DiagnosticsTest, AllowImportingSelf) {
- expect_diagnostics = {};
+ enable_diagnostic = DiagnosticID::unique_import;
+ expect_diagnostic = {};
ParseFiles({{"p/IFoo.aidl",
"package p;\n"
"import p.IFoo;\n"
@@ -219,7 +229,7 @@
}
TEST_F(DiagnosticsTest, RedundantImports) {
- expect_diagnostics = {DiagnosticID::unique_import};
+ expect_diagnostic = DiagnosticID::unique_import;
ParseFiles({{"p/IFoo.aidl",
"package p;\n"
"import q.IBar;\n"
@@ -229,22 +239,45 @@
}
TEST_F(DiagnosticsTest, UntypedCollectionInterface) {
- expect_diagnostics = {DiagnosticID::untyped_collection};
+ expect_diagnostic = DiagnosticID::untyped_collection;
ParseFiles({{"IFoo.aidl", "interface IFoo { void foo(in Map m); }"}});
}
TEST_F(DiagnosticsTest, UntypedCollectionParcelable) {
- expect_diagnostics = {DiagnosticID::untyped_collection};
+ expect_diagnostic = DiagnosticID::untyped_collection;
ParseFiles({{"Foo.aidl", "parcelable Foo { Map m; }"}});
}
TEST_F(DiagnosticsTest, UntypedCollectionUnion) {
- expect_diagnostics = {DiagnosticID::untyped_collection};
+ expect_diagnostic = DiagnosticID::untyped_collection;
ParseFiles({{"Foo.aidl", "union Foo { List l; }"}});
}
TEST_F(DiagnosticsTest, UntypedCollectionInTypeArg) {
- expect_diagnostics = {DiagnosticID::untyped_collection};
+ expect_diagnostic = DiagnosticID::untyped_collection;
ParseFiles({{"IFoo.aidl", "interface IFoo { void foo(in Bar<Map> m); }"},
{"Bar.aidl", "parcelable Bar<T> {}"}});
-}
\ No newline at end of file
+}
+
+TEST_F(DiagnosticsTest, PermissionMissing) {
+ expect_diagnostic = DiagnosticID::missing_permission_annotation;
+ ParseFiles({{"IFoo.aidl", "interface IFoo { void food(); }"}});
+}
+
+TEST_F(DiagnosticsTest, PermissionMethod) {
+ enable_diagnostic = DiagnosticID::missing_permission_annotation;
+ expect_diagnostic = {};
+ ParseFiles({{"IFoo.aidl", "interface IFoo { @EnforcePermission(\"INTERNET\") void food(); }"}});
+}
+
+TEST_F(DiagnosticsTest, PermissionMethodMissing) {
+ expect_diagnostic = DiagnosticID::missing_permission_annotation;
+ ParseFiles({{"IFoo.aidl",
+ "interface IFoo { @EnforcePermission(\"INTERNET\") void food(); void foo2(); }"}});
+}
+
+TEST_F(DiagnosticsTest, PermissionInterface) {
+ enable_diagnostic = DiagnosticID::missing_permission_annotation;
+ expect_diagnostic = {};
+ ParseFiles({{"IFoo.aidl", "@EnforcePermission(\"INTERNET\") interface IFoo { void food(); }"}});
+}
diff --git a/generate_cpp.cpp b/generate_cpp.cpp
index 1ea2010..988ac2b 100644
--- a/generate_cpp.cpp
+++ b/generate_cpp.cpp
@@ -469,6 +469,10 @@
kTraceVarName, interface.GetName().c_str(), method.GetName().c_str());
}
+ if (interface.EnforceExpression() || method.GetType().EnforceExpression()) {
+ out.Write("#error Permission checks not implemented for the cpp backend\n");
+ }
+
// Deserialize each "in" parameter to the transaction.
for (const auto& a: method.GetArguments()) {
// Deserialization looks roughly like:
diff --git a/generate_java_binder.cpp b/generate_java_binder.cpp
index fa6ea46..e94c17c 100644
--- a/generate_java_binder.cpp
+++ b/generate_java_binder.cpp
@@ -799,8 +799,14 @@
// TODO(b/151102494): annotation is applied on the return type
if (method.GetType().IsPropagateAllowBlocking()) {
- tryStatement->statements->Add(
- std::make_shared<LiteralStatement>("_reply.setPropagateAllowBlocking();\n"));
+ if (options.GetMinSdkVersion() < JAVA_PROPAGATE_VERSION) {
+ tryStatement->statements->Add(std::make_shared<LiteralStatement>(
+ "if (android.os.Build.VERSION.SDK_INT >= " + std::to_string(JAVA_PROPAGATE_VERSION) +
+ ") { _reply.setPropagateAllowBlocking(); }\n"));
+ } else {
+ tryStatement->statements->Add(
+ std::make_shared<LiteralStatement>("_reply.setPropagateAllowBlocking();\n"));
+ }
}
// If the transaction returns false, which means UNKNOWN_TRANSACTION, fall back to the local
@@ -994,13 +1000,14 @@
<< "public int " << kGetInterfaceVersion << "()"
<< " throws "
<< "android.os.RemoteException {\n"
- << " if (mCachedVersion == -1) {\n"
- << " android.os.Parcel data = android.os.Parcel.obtain();\n"
- << " android.os.Parcel reply = android.os.Parcel.obtain();\n";
+ << " if (mCachedVersion == -1) {\n";
if (options.GenRpc()) {
- code << " data.markForBinder(asBinder());\n";
+ code << " android.os.Parcel data = android.os.Parcel.obtain(asBinder());\n";
+ } else {
+ code << " android.os.Parcel data = android.os.Parcel.obtain();\n";
}
- code << " try {\n"
+ code << " android.os.Parcel reply = android.os.Parcel.obtain();\n"
+ << " try {\n"
<< " data.writeInterfaceToken(DESCRIPTOR);\n"
<< " boolean _status = mRemote.transact(Stub." << transactCodeName << ", "
<< "data, reply, 0);\n";
@@ -1028,13 +1035,14 @@
<< "public synchronized String " << kGetInterfaceHash << "()"
<< " throws "
<< "android.os.RemoteException {\n"
- << " if (\"-1\".equals(mCachedHash)) {\n"
- << " android.os.Parcel data = android.os.Parcel.obtain();\n"
- << " android.os.Parcel reply = android.os.Parcel.obtain();\n";
+ << " if (\"-1\".equals(mCachedHash)) {\n";
if (options.GenRpc()) {
- code << " data.markForBinder(asBinder());\n";
+ code << " android.os.Parcel data = android.os.Parcel.obtain(asBinder());\n";
+ } else {
+ code << " android.os.Parcel data = android.os.Parcel.obtain();\n";
}
- code << " try {\n"
+ code << " android.os.Parcel reply = android.os.Parcel.obtain();\n"
+ << " try {\n"
<< " data.writeInterfaceToken(DESCRIPTOR);\n"
<< " boolean _status = mRemote.transact(Stub." << transactCodeName << ", "
<< "data, reply, 0);\n";
diff --git a/generate_ndk.cpp b/generate_ndk.cpp
index d7b6663..e3db352 100644
--- a/generate_ndk.cpp
+++ b/generate_ndk.cpp
@@ -604,6 +604,11 @@
out << "case " << MethodId(method) << ": {\n";
out.Indent();
+
+ if (defined_type.EnforceExpression() || method.GetType().EnforceExpression()) {
+ out.Write("#error Permission checks not implemented for the ndk backend\n");
+ }
+
for (const auto& arg : method.GetArguments()) {
out << NdkNameOf(types, arg->GetType(), StorageMode::STACK) << " " << cpp::BuildVarName(*arg)
<< ";\n";
diff --git a/generate_rust.cpp b/generate_rust.cpp
index 079a6c7..725cf0e 100644
--- a/generate_rust.cpp
+++ b/generate_rust.cpp
@@ -387,11 +387,15 @@
out << "}\n";
}
-void GenerateServerTransaction(CodeWriter& out, const AidlMethod& method,
- const AidlTypenames& typenames) {
+void GenerateServerTransaction(CodeWriter& out, const AidlInterface& interface,
+ const AidlMethod& method, const AidlTypenames& typenames) {
out << "transactions::" << method.GetName() << " => {\n";
out.Indent();
+ if (interface.EnforceExpression() || method.GetType().EnforceExpression()) {
+ out << "compile_error!(\"Permission checks not support for the Rust backend\");\n";
+ }
+
string args;
for (const auto& arg : method.GetArguments()) {
string arg_name = kArgumentPrefix + arg->GetName();
@@ -498,7 +502,7 @@
out << "match _aidl_code {\n";
out.Indent();
for (const auto& method : iface->GetMethods()) {
- GenerateServerTransaction(out, *method, typenames);
+ GenerateServerTransaction(out, *iface, *method, typenames);
}
out << "_ => Err(binder::StatusCode::UNKNOWN_TRANSACTION)\n";
out.Dedent();
diff --git a/tests/aidl_test_client_parcelables.cpp b/tests/aidl_test_client_parcelables.cpp
index 99052bc..8d4adee 100644
--- a/tests/aidl_test_client_parcelables.cpp
+++ b/tests/aidl_test_client_parcelables.cpp
@@ -211,7 +211,8 @@
// Use std::in_place_index<tag> to avoid "move"
// Note that make<tag>(...) involves "move" of the content value
- EXPECT_EQ(Union::make<Union::ns>(3, 0), Union(std::in_place_index<Union::ns>, 3, 0));
+ EXPECT_EQ(Union::make<Union::ns>(3, 0),
+ Union(std::in_place_index<static_cast<size_t>(Union::ns)>, 3, 0));
Union one_two = one_two_three;
// get<tag> can be used to modify the content
diff --git a/tests/android/aidl/fixedsizearray/FixedSizeArrayExample.aidl b/tests/android/aidl/fixedsizearray/FixedSizeArrayExample.aidl
index e226c3d..2c76c87 100644
--- a/tests/android/aidl/fixedsizearray/FixedSizeArrayExample.aidl
+++ b/tests/android/aidl/fixedsizearray/FixedSizeArrayExample.aidl
@@ -16,6 +16,7 @@
package android.aidl.fixedsizearray;
+@JavaDerive(toString=true)
@RustDerive(PartialEq=true)
parcelable FixedSizeArrayExample {
// to see if NxM array works
diff --git a/tests/golden_output/aidl-test-fixedsizearray-java-source/gen/android/aidl/fixedsizearray/FixedSizeArrayExample.java b/tests/golden_output/aidl-test-fixedsizearray-java-source/gen/android/aidl/fixedsizearray/FixedSizeArrayExample.java
index f28cc6a..f04dd40 100644
--- a/tests/golden_output/aidl-test-fixedsizearray-java-source/gen/android/aidl/fixedsizearray/FixedSizeArrayExample.java
+++ b/tests/golden_output/aidl-test-fixedsizearray-java-source/gen/android/aidl/fixedsizearray/FixedSizeArrayExample.java
@@ -268,6 +268,66 @@
}
}
@Override
+ public String toString() {
+ java.util.StringJoiner _aidl_sj = new java.util.StringJoiner(", ", "{", "}");
+ _aidl_sj.add("int2x3: " + (java.util.Arrays.deepToString(int2x3)));
+ _aidl_sj.add("boolArray: " + (java.util.Arrays.toString(boolArray)));
+ _aidl_sj.add("byteArray: " + (java.util.Arrays.toString(byteArray)));
+ _aidl_sj.add("charArray: " + (java.util.Arrays.toString(charArray)));
+ _aidl_sj.add("intArray: " + (java.util.Arrays.toString(intArray)));
+ _aidl_sj.add("longArray: " + (java.util.Arrays.toString(longArray)));
+ _aidl_sj.add("floatArray: " + (java.util.Arrays.toString(floatArray)));
+ _aidl_sj.add("doubleArray: " + (java.util.Arrays.toString(doubleArray)));
+ _aidl_sj.add("stringArray: " + (java.util.Arrays.toString(stringArray)));
+ _aidl_sj.add("byteEnumArray: " + (java.util.Arrays.toString(byteEnumArray)));
+ _aidl_sj.add("intEnumArray: " + (java.util.Arrays.toString(intEnumArray)));
+ _aidl_sj.add("longEnumArray: " + (java.util.Arrays.toString(longEnumArray)));
+ _aidl_sj.add("parcelableArray: " + (java.util.Arrays.toString(parcelableArray)));
+ _aidl_sj.add("boolMatrix: " + (java.util.Arrays.deepToString(boolMatrix)));
+ _aidl_sj.add("byteMatrix: " + (java.util.Arrays.deepToString(byteMatrix)));
+ _aidl_sj.add("charMatrix: " + (java.util.Arrays.deepToString(charMatrix)));
+ _aidl_sj.add("intMatrix: " + (java.util.Arrays.deepToString(intMatrix)));
+ _aidl_sj.add("longMatrix: " + (java.util.Arrays.deepToString(longMatrix)));
+ _aidl_sj.add("floatMatrix: " + (java.util.Arrays.deepToString(floatMatrix)));
+ _aidl_sj.add("doubleMatrix: " + (java.util.Arrays.deepToString(doubleMatrix)));
+ _aidl_sj.add("stringMatrix: " + (java.util.Arrays.deepToString(stringMatrix)));
+ _aidl_sj.add("byteEnumMatrix: " + (java.util.Arrays.deepToString(byteEnumMatrix)));
+ _aidl_sj.add("intEnumMatrix: " + (java.util.Arrays.deepToString(intEnumMatrix)));
+ _aidl_sj.add("longEnumMatrix: " + (java.util.Arrays.deepToString(longEnumMatrix)));
+ _aidl_sj.add("parcelableMatrix: " + (java.util.Arrays.deepToString(parcelableMatrix)));
+ _aidl_sj.add("boolNullableArray: " + (java.util.Arrays.toString(boolNullableArray)));
+ _aidl_sj.add("byteNullableArray: " + (java.util.Arrays.toString(byteNullableArray)));
+ _aidl_sj.add("charNullableArray: " + (java.util.Arrays.toString(charNullableArray)));
+ _aidl_sj.add("intNullableArray: " + (java.util.Arrays.toString(intNullableArray)));
+ _aidl_sj.add("longNullableArray: " + (java.util.Arrays.toString(longNullableArray)));
+ _aidl_sj.add("floatNullableArray: " + (java.util.Arrays.toString(floatNullableArray)));
+ _aidl_sj.add("doubleNullableArray: " + (java.util.Arrays.toString(doubleNullableArray)));
+ _aidl_sj.add("stringNullableArray: " + (java.util.Arrays.toString(stringNullableArray)));
+ _aidl_sj.add("byteEnumNullableArray: " + (java.util.Arrays.toString(byteEnumNullableArray)));
+ _aidl_sj.add("intEnumNullableArray: " + (java.util.Arrays.toString(intEnumNullableArray)));
+ _aidl_sj.add("longEnumNullableArray: " + (java.util.Arrays.toString(longEnumNullableArray)));
+ _aidl_sj.add("binderNullableArray: " + (java.util.Arrays.toString(binderNullableArray)));
+ _aidl_sj.add("pfdNullableArray: " + (java.util.Arrays.toString(pfdNullableArray)));
+ _aidl_sj.add("parcelableNullableArray: " + (java.util.Arrays.toString(parcelableNullableArray)));
+ _aidl_sj.add("interfaceNullableArray: " + (java.util.Arrays.toString(interfaceNullableArray)));
+ _aidl_sj.add("boolNullableMatrix: " + (java.util.Arrays.deepToString(boolNullableMatrix)));
+ _aidl_sj.add("byteNullableMatrix: " + (java.util.Arrays.deepToString(byteNullableMatrix)));
+ _aidl_sj.add("charNullableMatrix: " + (java.util.Arrays.deepToString(charNullableMatrix)));
+ _aidl_sj.add("intNullableMatrix: " + (java.util.Arrays.deepToString(intNullableMatrix)));
+ _aidl_sj.add("longNullableMatrix: " + (java.util.Arrays.deepToString(longNullableMatrix)));
+ _aidl_sj.add("floatNullableMatrix: " + (java.util.Arrays.deepToString(floatNullableMatrix)));
+ _aidl_sj.add("doubleNullableMatrix: " + (java.util.Arrays.deepToString(doubleNullableMatrix)));
+ _aidl_sj.add("stringNullableMatrix: " + (java.util.Arrays.deepToString(stringNullableMatrix)));
+ _aidl_sj.add("byteEnumNullableMatrix: " + (java.util.Arrays.deepToString(byteEnumNullableMatrix)));
+ _aidl_sj.add("intEnumNullableMatrix: " + (java.util.Arrays.deepToString(intEnumNullableMatrix)));
+ _aidl_sj.add("longEnumNullableMatrix: " + (java.util.Arrays.deepToString(longEnumNullableMatrix)));
+ _aidl_sj.add("binderNullableMatrix: " + (java.util.Arrays.deepToString(binderNullableMatrix)));
+ _aidl_sj.add("pfdNullableMatrix: " + (java.util.Arrays.deepToString(pfdNullableMatrix)));
+ _aidl_sj.add("parcelableNullableMatrix: " + (java.util.Arrays.deepToString(parcelableNullableMatrix)));
+ _aidl_sj.add("interfaceNullableMatrix: " + (java.util.Arrays.deepToString(interfaceNullableMatrix)));
+ return "android.aidl.fixedsizearray.FixedSizeArrayExample" + _aidl_sj.toString() ;
+ }
+ @Override
public int describeContents() {
int _mask = 0;
_mask |= describeContents(parcelableArray);
diff --git a/tests/golden_output/aidl-test-interface-cpp-source/gen/android/aidl/tests/ArrayOfInterfaces.cpp b/tests/golden_output/aidl-test-interface-cpp-source/gen/android/aidl/tests/ArrayOfInterfaces.cpp
index 1973f8f..c3df2a0 100644
--- a/tests/golden_output/aidl-test-interface-cpp-source/gen/android/aidl/tests/ArrayOfInterfaces.cpp
+++ b/tests/golden_output/aidl-test-interface-cpp-source/gen/android/aidl/tests/ArrayOfInterfaces.cpp
@@ -393,7 +393,7 @@
::android::status_t _aidl_ret_status;
int32_t _aidl_tag;
if ((_aidl_ret_status = _aidl_parcel->readInt32(&_aidl_tag)) != ::android::OK) return _aidl_ret_status;
- switch (_aidl_tag) {
+ switch (static_cast<Tag>(_aidl_tag)) {
case iface: {
::android::sp<::android::aidl::tests::ArrayOfInterfaces::IEmptyInterface> _aidl_value;
if ((_aidl_ret_status = _aidl_parcel->readStrongBinder(&_aidl_value)) != ::android::OK) return _aidl_ret_status;
@@ -438,7 +438,7 @@
return ::android::BAD_VALUE;
}
::android::status_t ArrayOfInterfaces::MyUnion::writeToParcel(::android::Parcel* _aidl_parcel) const {
- ::android::status_t _aidl_ret_status = _aidl_parcel->writeInt32(getTag());
+ ::android::status_t _aidl_ret_status = _aidl_parcel->writeInt32(static_cast<int32_t>(getTag()));
if (_aidl_ret_status != ::android::OK) return _aidl_ret_status;
switch (getTag()) {
case iface: return _aidl_parcel->writeStrongBinder(get<iface>());
diff --git a/tests/golden_output/aidl-test-interface-cpp-source/gen/android/aidl/tests/FixedSize.cpp b/tests/golden_output/aidl-test-interface-cpp-source/gen/android/aidl/tests/FixedSize.cpp
index 73fca2c..320fe27 100644
--- a/tests/golden_output/aidl-test-interface-cpp-source/gen/android/aidl/tests/FixedSize.cpp
+++ b/tests/golden_output/aidl-test-interface-cpp-source/gen/android/aidl/tests/FixedSize.cpp
@@ -179,7 +179,7 @@
::android::status_t _aidl_ret_status;
int32_t _aidl_tag;
if ((_aidl_ret_status = _aidl_parcel->readInt32(&_aidl_tag)) != ::android::OK) return _aidl_ret_status;
- switch (_aidl_tag) {
+ switch (static_cast<Tag>(_aidl_tag)) {
case booleanValue: {
bool _aidl_value;
if ((_aidl_ret_status = _aidl_parcel->readBool(&_aidl_value)) != ::android::OK) return _aidl_ret_status;
@@ -264,7 +264,7 @@
return ::android::BAD_VALUE;
}
::android::status_t FixedSize::FixedUnion::writeToParcel(::android::Parcel* _aidl_parcel) const {
- ::android::status_t _aidl_ret_status = _aidl_parcel->writeInt32(getTag());
+ ::android::status_t _aidl_ret_status = _aidl_parcel->writeInt32(static_cast<int32_t>(getTag()));
if (_aidl_ret_status != ::android::OK) return _aidl_ret_status;
switch (getTag()) {
case booleanValue: return _aidl_parcel->writeBool(get<booleanValue>());
diff --git a/tests/golden_output/aidl-test-interface-cpp-source/gen/android/aidl/tests/ListOfInterfaces.cpp b/tests/golden_output/aidl-test-interface-cpp-source/gen/android/aidl/tests/ListOfInterfaces.cpp
index 7a0e43e..dfca641 100644
--- a/tests/golden_output/aidl-test-interface-cpp-source/gen/android/aidl/tests/ListOfInterfaces.cpp
+++ b/tests/golden_output/aidl-test-interface-cpp-source/gen/android/aidl/tests/ListOfInterfaces.cpp
@@ -377,7 +377,7 @@
::android::status_t _aidl_ret_status;
int32_t _aidl_tag;
if ((_aidl_ret_status = _aidl_parcel->readInt32(&_aidl_tag)) != ::android::OK) return _aidl_ret_status;
- switch (_aidl_tag) {
+ switch (static_cast<Tag>(_aidl_tag)) {
case iface: {
::android::sp<::android::aidl::tests::ListOfInterfaces::IEmptyInterface> _aidl_value;
if ((_aidl_ret_status = _aidl_parcel->readStrongBinder(&_aidl_value)) != ::android::OK) return _aidl_ret_status;
@@ -422,7 +422,7 @@
return ::android::BAD_VALUE;
}
::android::status_t ListOfInterfaces::MyUnion::writeToParcel(::android::Parcel* _aidl_parcel) const {
- ::android::status_t _aidl_ret_status = _aidl_parcel->writeInt32(getTag());
+ ::android::status_t _aidl_ret_status = _aidl_parcel->writeInt32(static_cast<int32_t>(getTag()));
if (_aidl_ret_status != ::android::OK) return _aidl_ret_status;
switch (getTag()) {
case iface: return _aidl_parcel->writeStrongBinder(get<iface>());
diff --git a/tests/golden_output/aidl-test-interface-cpp-source/gen/android/aidl/tests/Union.cpp b/tests/golden_output/aidl-test-interface-cpp-source/gen/android/aidl/tests/Union.cpp
index 36b8670..bd4eef1 100644
--- a/tests/golden_output/aidl-test-interface-cpp-source/gen/android/aidl/tests/Union.cpp
+++ b/tests/golden_output/aidl-test-interface-cpp-source/gen/android/aidl/tests/Union.cpp
@@ -11,7 +11,7 @@
::android::status_t _aidl_ret_status;
int32_t _aidl_tag;
if ((_aidl_ret_status = _aidl_parcel->readInt32(&_aidl_tag)) != ::android::OK) return _aidl_ret_status;
- switch (_aidl_tag) {
+ switch (static_cast<Tag>(_aidl_tag)) {
case ns: {
::std::vector<int32_t> _aidl_value;
if ((_aidl_ret_status = _aidl_parcel->readInt32Vector(&_aidl_value)) != ::android::OK) return _aidl_ret_status;
@@ -86,7 +86,7 @@
return ::android::BAD_VALUE;
}
::android::status_t Union::writeToParcel(::android::Parcel* _aidl_parcel) const {
- ::android::status_t _aidl_ret_status = _aidl_parcel->writeInt32(getTag());
+ ::android::status_t _aidl_ret_status = _aidl_parcel->writeInt32(static_cast<int32_t>(getTag()));
if (_aidl_ret_status != ::android::OK) return _aidl_ret_status;
switch (getTag()) {
case ns: return _aidl_parcel->writeInt32Vector(get<ns>());
diff --git a/tests/golden_output/aidl-test-interface-cpp-source/gen/android/aidl/tests/UnionWithFd.cpp b/tests/golden_output/aidl-test-interface-cpp-source/gen/android/aidl/tests/UnionWithFd.cpp
index 1006527..d8f4103 100644
--- a/tests/golden_output/aidl-test-interface-cpp-source/gen/android/aidl/tests/UnionWithFd.cpp
+++ b/tests/golden_output/aidl-test-interface-cpp-source/gen/android/aidl/tests/UnionWithFd.cpp
@@ -7,7 +7,7 @@
::android::status_t _aidl_ret_status;
int32_t _aidl_tag;
if ((_aidl_ret_status = _aidl_parcel->readInt32(&_aidl_tag)) != ::android::OK) return _aidl_ret_status;
- switch (_aidl_tag) {
+ switch (static_cast<Tag>(_aidl_tag)) {
case num: {
int32_t _aidl_value;
if ((_aidl_ret_status = _aidl_parcel->readInt32(&_aidl_value)) != ::android::OK) return _aidl_ret_status;
@@ -32,7 +32,7 @@
return ::android::BAD_VALUE;
}
::android::status_t UnionWithFd::writeToParcel(::android::Parcel* _aidl_parcel) const {
- ::android::status_t _aidl_ret_status = _aidl_parcel->writeInt32(getTag());
+ ::android::status_t _aidl_ret_status = _aidl_parcel->writeInt32(static_cast<int32_t>(getTag()));
if (_aidl_ret_status != ::android::OK) return _aidl_ret_status;
switch (getTag()) {
case num: return _aidl_parcel->writeInt32(get<num>());
diff --git a/tests/golden_output/aidl-test-interface-cpp-source/gen/android/aidl/tests/permission/IProtected.cpp b/tests/golden_output/aidl-test-interface-cpp-source/gen/android/aidl/tests/permission/IProtected.cpp
deleted file mode 100644
index 44ad7e3..0000000
--- a/tests/golden_output/aidl-test-interface-cpp-source/gen/android/aidl/tests/permission/IProtected.cpp
+++ /dev/null
@@ -1,197 +0,0 @@
-#include <android/aidl/tests/permission/IProtected.h>
-#include <android/aidl/tests/permission/BpProtected.h>
-namespace android {
-namespace aidl {
-namespace tests {
-namespace permission {
-DO_NOT_DIRECTLY_USE_ME_IMPLEMENT_META_INTERFACE(Protected, "android.aidl.tests.permission.IProtected")
-} // namespace permission
-} // namespace tests
-} // namespace aidl
-} // namespace android
-#include <android/aidl/tests/permission/BpProtected.h>
-#include <android/aidl/tests/permission/BnProtected.h>
-#include <binder/Parcel.h>
-#include <android-base/macros.h>
-
-namespace android {
-namespace aidl {
-namespace tests {
-namespace permission {
-
-BpProtected::BpProtected(const ::android::sp<::android::IBinder>& _aidl_impl)
- : BpInterface<IProtected>(_aidl_impl){
-}
-
-::android::binder::Status BpProtected::PermissionProtected() {
- ::android::Parcel _aidl_data;
- _aidl_data.markForBinder(remoteStrong());
- ::android::Parcel _aidl_reply;
- ::android::status_t _aidl_ret_status = ::android::OK;
- ::android::binder::Status _aidl_status;
- _aidl_ret_status = _aidl_data.writeInterfaceToken(getInterfaceDescriptor());
- if (((_aidl_ret_status) != (::android::OK))) {
- goto _aidl_error;
- }
- _aidl_ret_status = remote()->transact(BnProtected::TRANSACTION_PermissionProtected, _aidl_data, &_aidl_reply, 0);
- if (UNLIKELY(_aidl_ret_status == ::android::UNKNOWN_TRANSACTION && IProtected::getDefaultImpl())) {
- return IProtected::getDefaultImpl()->PermissionProtected();
- }
- if (((_aidl_ret_status) != (::android::OK))) {
- goto _aidl_error;
- }
- _aidl_ret_status = _aidl_status.readFromParcel(_aidl_reply);
- if (((_aidl_ret_status) != (::android::OK))) {
- goto _aidl_error;
- }
- if (!_aidl_status.isOk()) {
- return _aidl_status;
- }
- _aidl_error:
- _aidl_status.setFromStatusT(_aidl_ret_status);
- return _aidl_status;
-}
-
-::android::binder::Status BpProtected::MultiplePermissionsAll() {
- ::android::Parcel _aidl_data;
- _aidl_data.markForBinder(remoteStrong());
- ::android::Parcel _aidl_reply;
- ::android::status_t _aidl_ret_status = ::android::OK;
- ::android::binder::Status _aidl_status;
- _aidl_ret_status = _aidl_data.writeInterfaceToken(getInterfaceDescriptor());
- if (((_aidl_ret_status) != (::android::OK))) {
- goto _aidl_error;
- }
- _aidl_ret_status = remote()->transact(BnProtected::TRANSACTION_MultiplePermissionsAll, _aidl_data, &_aidl_reply, 0);
- if (UNLIKELY(_aidl_ret_status == ::android::UNKNOWN_TRANSACTION && IProtected::getDefaultImpl())) {
- return IProtected::getDefaultImpl()->MultiplePermissionsAll();
- }
- if (((_aidl_ret_status) != (::android::OK))) {
- goto _aidl_error;
- }
- _aidl_ret_status = _aidl_status.readFromParcel(_aidl_reply);
- if (((_aidl_ret_status) != (::android::OK))) {
- goto _aidl_error;
- }
- if (!_aidl_status.isOk()) {
- return _aidl_status;
- }
- _aidl_error:
- _aidl_status.setFromStatusT(_aidl_ret_status);
- return _aidl_status;
-}
-
-::android::binder::Status BpProtected::MultiplePermissionsAny() {
- ::android::Parcel _aidl_data;
- _aidl_data.markForBinder(remoteStrong());
- ::android::Parcel _aidl_reply;
- ::android::status_t _aidl_ret_status = ::android::OK;
- ::android::binder::Status _aidl_status;
- _aidl_ret_status = _aidl_data.writeInterfaceToken(getInterfaceDescriptor());
- if (((_aidl_ret_status) != (::android::OK))) {
- goto _aidl_error;
- }
- _aidl_ret_status = remote()->transact(BnProtected::TRANSACTION_MultiplePermissionsAny, _aidl_data, &_aidl_reply, 0);
- if (UNLIKELY(_aidl_ret_status == ::android::UNKNOWN_TRANSACTION && IProtected::getDefaultImpl())) {
- return IProtected::getDefaultImpl()->MultiplePermissionsAny();
- }
- if (((_aidl_ret_status) != (::android::OK))) {
- goto _aidl_error;
- }
- _aidl_ret_status = _aidl_status.readFromParcel(_aidl_reply);
- if (((_aidl_ret_status) != (::android::OK))) {
- goto _aidl_error;
- }
- if (!_aidl_status.isOk()) {
- return _aidl_status;
- }
- _aidl_error:
- _aidl_status.setFromStatusT(_aidl_ret_status);
- return _aidl_status;
-}
-
-} // namespace permission
-} // namespace tests
-} // namespace aidl
-} // namespace android
-#include <android/aidl/tests/permission/BnProtected.h>
-#include <binder/Parcel.h>
-#include <binder/Stability.h>
-
-namespace android {
-namespace aidl {
-namespace tests {
-namespace permission {
-
-BnProtected::BnProtected()
-{
- ::android::internal::Stability::markCompilationUnit(this);
-}
-
-::android::status_t BnProtected::onTransact(uint32_t _aidl_code, const ::android::Parcel& _aidl_data, ::android::Parcel* _aidl_reply, uint32_t _aidl_flags) {
- ::android::status_t _aidl_ret_status = ::android::OK;
- switch (_aidl_code) {
- case BnProtected::TRANSACTION_PermissionProtected:
- {
- if (!(_aidl_data.checkInterface(this))) {
- _aidl_ret_status = ::android::BAD_TYPE;
- break;
- }
- ::android::binder::Status _aidl_status(PermissionProtected());
- _aidl_ret_status = _aidl_status.writeToParcel(_aidl_reply);
- if (((_aidl_ret_status) != (::android::OK))) {
- break;
- }
- if (!_aidl_status.isOk()) {
- break;
- }
- }
- break;
- case BnProtected::TRANSACTION_MultiplePermissionsAll:
- {
- if (!(_aidl_data.checkInterface(this))) {
- _aidl_ret_status = ::android::BAD_TYPE;
- break;
- }
- ::android::binder::Status _aidl_status(MultiplePermissionsAll());
- _aidl_ret_status = _aidl_status.writeToParcel(_aidl_reply);
- if (((_aidl_ret_status) != (::android::OK))) {
- break;
- }
- if (!_aidl_status.isOk()) {
- break;
- }
- }
- break;
- case BnProtected::TRANSACTION_MultiplePermissionsAny:
- {
- if (!(_aidl_data.checkInterface(this))) {
- _aidl_ret_status = ::android::BAD_TYPE;
- break;
- }
- ::android::binder::Status _aidl_status(MultiplePermissionsAny());
- _aidl_ret_status = _aidl_status.writeToParcel(_aidl_reply);
- if (((_aidl_ret_status) != (::android::OK))) {
- break;
- }
- if (!_aidl_status.isOk()) {
- break;
- }
- }
- break;
- default:
- {
- _aidl_ret_status = ::android::BBinder::onTransact(_aidl_code, _aidl_data, _aidl_reply, _aidl_flags);
- }
- break;
- }
- if (_aidl_ret_status == ::android::UNEXPECTED_NULL) {
- _aidl_ret_status = ::android::binder::Status::fromExceptionCode(::android::binder::Status::EX_NULL_POINTER).writeOverParcel(_aidl_reply);
- }
- return _aidl_ret_status;
-}
-
-} // namespace permission
-} // namespace tests
-} // namespace aidl
-} // namespace android
diff --git a/tests/golden_output/aidl-test-interface-cpp-source/gen/android/aidl/tests/permission/IProtected.cpp.d b/tests/golden_output/aidl-test-interface-cpp-source/gen/android/aidl/tests/permission/IProtected.cpp.d
deleted file mode 100644
index 3fb3aee..0000000
--- a/tests/golden_output/aidl-test-interface-cpp-source/gen/android/aidl/tests/permission/IProtected.cpp.d
+++ /dev/null
@@ -1,2 +0,0 @@
-out/soong/.intermediates/system/tools/aidl/aidl-test-interface-cpp-source/gen/android/aidl/tests/permission/IProtected.cpp : \
- system/tools/aidl/tests/android/aidl/tests/permission/IProtected.aidl
diff --git a/tests/golden_output/aidl-test-interface-cpp-source/gen/android/aidl/tests/permission/IProtectedInterface.cpp b/tests/golden_output/aidl-test-interface-cpp-source/gen/android/aidl/tests/permission/IProtectedInterface.cpp
deleted file mode 100644
index bd9fe9d..0000000
--- a/tests/golden_output/aidl-test-interface-cpp-source/gen/android/aidl/tests/permission/IProtectedInterface.cpp
+++ /dev/null
@@ -1,152 +0,0 @@
-#include <android/aidl/tests/permission/IProtectedInterface.h>
-#include <android/aidl/tests/permission/BpProtectedInterface.h>
-namespace android {
-namespace aidl {
-namespace tests {
-namespace permission {
-DO_NOT_DIRECTLY_USE_ME_IMPLEMENT_META_INTERFACE(ProtectedInterface, "android.aidl.tests.permission.IProtectedInterface")
-} // namespace permission
-} // namespace tests
-} // namespace aidl
-} // namespace android
-#include <android/aidl/tests/permission/BpProtectedInterface.h>
-#include <android/aidl/tests/permission/BnProtectedInterface.h>
-#include <binder/Parcel.h>
-#include <android-base/macros.h>
-
-namespace android {
-namespace aidl {
-namespace tests {
-namespace permission {
-
-BpProtectedInterface::BpProtectedInterface(const ::android::sp<::android::IBinder>& _aidl_impl)
- : BpInterface<IProtectedInterface>(_aidl_impl){
-}
-
-::android::binder::Status BpProtectedInterface::Method1() {
- ::android::Parcel _aidl_data;
- _aidl_data.markForBinder(remoteStrong());
- ::android::Parcel _aidl_reply;
- ::android::status_t _aidl_ret_status = ::android::OK;
- ::android::binder::Status _aidl_status;
- _aidl_ret_status = _aidl_data.writeInterfaceToken(getInterfaceDescriptor());
- if (((_aidl_ret_status) != (::android::OK))) {
- goto _aidl_error;
- }
- _aidl_ret_status = remote()->transact(BnProtectedInterface::TRANSACTION_Method1, _aidl_data, &_aidl_reply, 0);
- if (UNLIKELY(_aidl_ret_status == ::android::UNKNOWN_TRANSACTION && IProtectedInterface::getDefaultImpl())) {
- return IProtectedInterface::getDefaultImpl()->Method1();
- }
- if (((_aidl_ret_status) != (::android::OK))) {
- goto _aidl_error;
- }
- _aidl_ret_status = _aidl_status.readFromParcel(_aidl_reply);
- if (((_aidl_ret_status) != (::android::OK))) {
- goto _aidl_error;
- }
- if (!_aidl_status.isOk()) {
- return _aidl_status;
- }
- _aidl_error:
- _aidl_status.setFromStatusT(_aidl_ret_status);
- return _aidl_status;
-}
-
-::android::binder::Status BpProtectedInterface::Method2() {
- ::android::Parcel _aidl_data;
- _aidl_data.markForBinder(remoteStrong());
- ::android::Parcel _aidl_reply;
- ::android::status_t _aidl_ret_status = ::android::OK;
- ::android::binder::Status _aidl_status;
- _aidl_ret_status = _aidl_data.writeInterfaceToken(getInterfaceDescriptor());
- if (((_aidl_ret_status) != (::android::OK))) {
- goto _aidl_error;
- }
- _aidl_ret_status = remote()->transact(BnProtectedInterface::TRANSACTION_Method2, _aidl_data, &_aidl_reply, 0);
- if (UNLIKELY(_aidl_ret_status == ::android::UNKNOWN_TRANSACTION && IProtectedInterface::getDefaultImpl())) {
- return IProtectedInterface::getDefaultImpl()->Method2();
- }
- if (((_aidl_ret_status) != (::android::OK))) {
- goto _aidl_error;
- }
- _aidl_ret_status = _aidl_status.readFromParcel(_aidl_reply);
- if (((_aidl_ret_status) != (::android::OK))) {
- goto _aidl_error;
- }
- if (!_aidl_status.isOk()) {
- return _aidl_status;
- }
- _aidl_error:
- _aidl_status.setFromStatusT(_aidl_ret_status);
- return _aidl_status;
-}
-
-} // namespace permission
-} // namespace tests
-} // namespace aidl
-} // namespace android
-#include <android/aidl/tests/permission/BnProtectedInterface.h>
-#include <binder/Parcel.h>
-#include <binder/Stability.h>
-
-namespace android {
-namespace aidl {
-namespace tests {
-namespace permission {
-
-BnProtectedInterface::BnProtectedInterface()
-{
- ::android::internal::Stability::markCompilationUnit(this);
-}
-
-::android::status_t BnProtectedInterface::onTransact(uint32_t _aidl_code, const ::android::Parcel& _aidl_data, ::android::Parcel* _aidl_reply, uint32_t _aidl_flags) {
- ::android::status_t _aidl_ret_status = ::android::OK;
- switch (_aidl_code) {
- case BnProtectedInterface::TRANSACTION_Method1:
- {
- if (!(_aidl_data.checkInterface(this))) {
- _aidl_ret_status = ::android::BAD_TYPE;
- break;
- }
- ::android::binder::Status _aidl_status(Method1());
- _aidl_ret_status = _aidl_status.writeToParcel(_aidl_reply);
- if (((_aidl_ret_status) != (::android::OK))) {
- break;
- }
- if (!_aidl_status.isOk()) {
- break;
- }
- }
- break;
- case BnProtectedInterface::TRANSACTION_Method2:
- {
- if (!(_aidl_data.checkInterface(this))) {
- _aidl_ret_status = ::android::BAD_TYPE;
- break;
- }
- ::android::binder::Status _aidl_status(Method2());
- _aidl_ret_status = _aidl_status.writeToParcel(_aidl_reply);
- if (((_aidl_ret_status) != (::android::OK))) {
- break;
- }
- if (!_aidl_status.isOk()) {
- break;
- }
- }
- break;
- default:
- {
- _aidl_ret_status = ::android::BBinder::onTransact(_aidl_code, _aidl_data, _aidl_reply, _aidl_flags);
- }
- break;
- }
- if (_aidl_ret_status == ::android::UNEXPECTED_NULL) {
- _aidl_ret_status = ::android::binder::Status::fromExceptionCode(::android::binder::Status::EX_NULL_POINTER).writeOverParcel(_aidl_reply);
- }
- return _aidl_ret_status;
-}
-
-} // namespace permission
-} // namespace tests
-} // namespace aidl
-} // namespace android
diff --git a/tests/golden_output/aidl-test-interface-cpp-source/gen/android/aidl/tests/permission/IProtectedInterface.cpp.d b/tests/golden_output/aidl-test-interface-cpp-source/gen/android/aidl/tests/permission/IProtectedInterface.cpp.d
deleted file mode 100644
index 1841b65..0000000
--- a/tests/golden_output/aidl-test-interface-cpp-source/gen/android/aidl/tests/permission/IProtectedInterface.cpp.d
+++ /dev/null
@@ -1,2 +0,0 @@
-out/soong/.intermediates/system/tools/aidl/aidl-test-interface-cpp-source/gen/android/aidl/tests/permission/IProtectedInterface.cpp : \
- system/tools/aidl/tests/android/aidl/tests/permission/IProtectedInterface.aidl
diff --git a/tests/golden_output/aidl-test-interface-cpp-source/gen/android/aidl/tests/unions/EnumUnion.cpp b/tests/golden_output/aidl-test-interface-cpp-source/gen/android/aidl/tests/unions/EnumUnion.cpp
index e780a45..b51ef52 100644
--- a/tests/golden_output/aidl-test-interface-cpp-source/gen/android/aidl/tests/unions/EnumUnion.cpp
+++ b/tests/golden_output/aidl-test-interface-cpp-source/gen/android/aidl/tests/unions/EnumUnion.cpp
@@ -8,7 +8,7 @@
::android::status_t _aidl_ret_status;
int32_t _aidl_tag;
if ((_aidl_ret_status = _aidl_parcel->readInt32(&_aidl_tag)) != ::android::OK) return _aidl_ret_status;
- switch (_aidl_tag) {
+ switch (static_cast<Tag>(_aidl_tag)) {
case intEnum: {
::android::aidl::tests::IntEnum _aidl_value;
if ((_aidl_ret_status = _aidl_parcel->readInt32(reinterpret_cast<int32_t *>(&_aidl_value))) != ::android::OK) return _aidl_ret_status;
@@ -33,7 +33,7 @@
return ::android::BAD_VALUE;
}
::android::status_t EnumUnion::writeToParcel(::android::Parcel* _aidl_parcel) const {
- ::android::status_t _aidl_ret_status = _aidl_parcel->writeInt32(getTag());
+ ::android::status_t _aidl_ret_status = _aidl_parcel->writeInt32(static_cast<int32_t>(getTag()));
if (_aidl_ret_status != ::android::OK) return _aidl_ret_status;
switch (getTag()) {
case intEnum: return _aidl_parcel->writeInt32(static_cast<int32_t>(get<intEnum>()));
diff --git a/tests/golden_output/aidl-test-interface-cpp-source/gen/android/aidl/tests/unions/UnionInUnion.cpp b/tests/golden_output/aidl-test-interface-cpp-source/gen/android/aidl/tests/unions/UnionInUnion.cpp
index 06f668e..100dda2 100644
--- a/tests/golden_output/aidl-test-interface-cpp-source/gen/android/aidl/tests/unions/UnionInUnion.cpp
+++ b/tests/golden_output/aidl-test-interface-cpp-source/gen/android/aidl/tests/unions/UnionInUnion.cpp
@@ -8,7 +8,7 @@
::android::status_t _aidl_ret_status;
int32_t _aidl_tag;
if ((_aidl_ret_status = _aidl_parcel->readInt32(&_aidl_tag)) != ::android::OK) return _aidl_ret_status;
- switch (_aidl_tag) {
+ switch (static_cast<Tag>(_aidl_tag)) {
case first: {
::android::aidl::tests::unions::EnumUnion _aidl_value;
if ((_aidl_ret_status = _aidl_parcel->readParcelable(&_aidl_value)) != ::android::OK) return _aidl_ret_status;
@@ -33,7 +33,7 @@
return ::android::BAD_VALUE;
}
::android::status_t UnionInUnion::writeToParcel(::android::Parcel* _aidl_parcel) const {
- ::android::status_t _aidl_ret_status = _aidl_parcel->writeInt32(getTag());
+ ::android::status_t _aidl_ret_status = _aidl_parcel->writeInt32(static_cast<int32_t>(getTag()));
if (_aidl_ret_status != ::android::OK) return _aidl_ret_status;
switch (getTag()) {
case first: return _aidl_parcel->writeParcelable(get<first>());
diff --git a/tests/golden_output/aidl-test-interface-cpp-source/gen/include/android/aidl/tests/ArrayOfInterfaces.h b/tests/golden_output/aidl-test-interface-cpp-source/gen/include/android/aidl/tests/ArrayOfInterfaces.h
index 6932199..0265063 100644
--- a/tests/golden_output/aidl-test-interface-cpp-source/gen/include/android/aidl/tests/ArrayOfInterfaces.h
+++ b/tests/golden_output/aidl-test-interface-cpp-source/gen/include/android/aidl/tests/ArrayOfInterfaces.h
@@ -146,7 +146,7 @@
template<typename _Tp>
static constexpr bool _not_self = !std::is_same_v<std::remove_cv_t<std::remove_reference_t<_Tp>>, MyUnion>;
- MyUnion() : _value(std::in_place_index<iface>, ::android::sp<::android::aidl::tests::ArrayOfInterfaces::IEmptyInterface>()) { }
+ MyUnion() : _value(std::in_place_index<static_cast<size_t>(iface)>, ::android::sp<::android::aidl::tests::ArrayOfInterfaces::IEmptyInterface>()) { }
template <typename _Tp, typename = std::enable_if_t<_not_self<_Tp>>>
// NOLINTNEXTLINE(google-explicit-constructor)
@@ -159,12 +159,12 @@
template <Tag _tag, typename... _Tp>
static MyUnion make(_Tp&&... _args) {
- return MyUnion(std::in_place_index<_tag>, std::forward<_Tp>(_args)...);
+ return MyUnion(std::in_place_index<static_cast<size_t>(_tag)>, std::forward<_Tp>(_args)...);
}
template <Tag _tag, typename _Tp, typename... _Up>
static MyUnion make(std::initializer_list<_Tp> _il, _Up&&... _args) {
- return MyUnion(std::in_place_index<_tag>, std::move(_il), std::forward<_Up>(_args)...);
+ return MyUnion(std::in_place_index<static_cast<size_t>(_tag)>, std::move(_il), std::forward<_Up>(_args)...);
}
Tag getTag() const {
@@ -174,18 +174,18 @@
template <Tag _tag>
const auto& get() const {
if (getTag() != _tag) { __assert2(__FILE__, __LINE__, __PRETTY_FUNCTION__, "bad access: a wrong tag"); }
- return std::get<_tag>(_value);
+ return std::get<static_cast<size_t>(_tag)>(_value);
}
template <Tag _tag>
auto& get() {
if (getTag() != _tag) { __assert2(__FILE__, __LINE__, __PRETTY_FUNCTION__, "bad access: a wrong tag"); }
- return std::get<_tag>(_value);
+ return std::get<static_cast<size_t>(_tag)>(_value);
}
template <Tag _tag, typename... _Tp>
void set(_Tp&&... _args) {
- _value.emplace<_tag>(std::forward<_Tp>(_args)...);
+ _value.emplace<static_cast<size_t>(_tag)>(std::forward<_Tp>(_args)...);
}
inline bool operator!=(const MyUnion& rhs) const {
diff --git a/tests/golden_output/aidl-test-interface-cpp-source/gen/include/android/aidl/tests/FixedSize.h b/tests/golden_output/aidl-test-interface-cpp-source/gen/include/android/aidl/tests/FixedSize.h
index 2e670e3..f94a3b8 100644
--- a/tests/golden_output/aidl-test-interface-cpp-source/gen/include/android/aidl/tests/FixedSize.h
+++ b/tests/golden_output/aidl-test-interface-cpp-source/gen/include/android/aidl/tests/FixedSize.h
@@ -36,7 +36,7 @@
};
template <Tag _Tag>
- using _at = typename std::tuple_element<_Tag, std::tuple<bool, int8_t, char16_t, int32_t, int64_t, float, double, ::android::aidl::tests::LongEnum>>::type;
+ using _at = typename std::tuple_element<static_cast<size_t>(_Tag), std::tuple<bool, int8_t, char16_t, int32_t, int64_t, float, double, ::android::aidl::tests::LongEnum>>::type;
template <Tag _Tag, typename _Type>
static FixedUnion make(_Type&& _arg) {
FixedUnion _inst;
@@ -71,7 +71,7 @@
} else {
return (_lhs.getTag() == _Tag)
? _cmp_value(_lhs.get<_Tag>(), _rhs.get<_Tag>())
- : _cmp_value_at<(Tag)(_Tag-1)>(_lhs, _rhs);
+ : _cmp_value_at<static_cast<Tag>(static_cast<size_t>(_Tag)-1)>(_lhs, _rhs);
}
}
template <typename _Type>
diff --git a/tests/golden_output/aidl-test-interface-cpp-source/gen/include/android/aidl/tests/ListOfInterfaces.h b/tests/golden_output/aidl-test-interface-cpp-source/gen/include/android/aidl/tests/ListOfInterfaces.h
index 696c816..e9dcb2b 100644
--- a/tests/golden_output/aidl-test-interface-cpp-source/gen/include/android/aidl/tests/ListOfInterfaces.h
+++ b/tests/golden_output/aidl-test-interface-cpp-source/gen/include/android/aidl/tests/ListOfInterfaces.h
@@ -146,7 +146,7 @@
template<typename _Tp>
static constexpr bool _not_self = !std::is_same_v<std::remove_cv_t<std::remove_reference_t<_Tp>>, MyUnion>;
- MyUnion() : _value(std::in_place_index<iface>, ::android::sp<::android::aidl::tests::ListOfInterfaces::IEmptyInterface>()) { }
+ MyUnion() : _value(std::in_place_index<static_cast<size_t>(iface)>, ::android::sp<::android::aidl::tests::ListOfInterfaces::IEmptyInterface>()) { }
template <typename _Tp, typename = std::enable_if_t<_not_self<_Tp>>>
// NOLINTNEXTLINE(google-explicit-constructor)
@@ -159,12 +159,12 @@
template <Tag _tag, typename... _Tp>
static MyUnion make(_Tp&&... _args) {
- return MyUnion(std::in_place_index<_tag>, std::forward<_Tp>(_args)...);
+ return MyUnion(std::in_place_index<static_cast<size_t>(_tag)>, std::forward<_Tp>(_args)...);
}
template <Tag _tag, typename _Tp, typename... _Up>
static MyUnion make(std::initializer_list<_Tp> _il, _Up&&... _args) {
- return MyUnion(std::in_place_index<_tag>, std::move(_il), std::forward<_Up>(_args)...);
+ return MyUnion(std::in_place_index<static_cast<size_t>(_tag)>, std::move(_il), std::forward<_Up>(_args)...);
}
Tag getTag() const {
@@ -174,18 +174,18 @@
template <Tag _tag>
const auto& get() const {
if (getTag() != _tag) { __assert2(__FILE__, __LINE__, __PRETTY_FUNCTION__, "bad access: a wrong tag"); }
- return std::get<_tag>(_value);
+ return std::get<static_cast<size_t>(_tag)>(_value);
}
template <Tag _tag>
auto& get() {
if (getTag() != _tag) { __assert2(__FILE__, __LINE__, __PRETTY_FUNCTION__, "bad access: a wrong tag"); }
- return std::get<_tag>(_value);
+ return std::get<static_cast<size_t>(_tag)>(_value);
}
template <Tag _tag, typename... _Tp>
void set(_Tp&&... _args) {
- _value.emplace<_tag>(std::forward<_Tp>(_args)...);
+ _value.emplace<static_cast<size_t>(_tag)>(std::forward<_Tp>(_args)...);
}
inline bool operator!=(const MyUnion& rhs) const {
diff --git a/tests/golden_output/aidl-test-interface-cpp-source/gen/include/android/aidl/tests/Union.h b/tests/golden_output/aidl-test-interface-cpp-source/gen/include/android/aidl/tests/Union.h
index 62c1bf4..4428401 100644
--- a/tests/golden_output/aidl-test-interface-cpp-source/gen/include/android/aidl/tests/Union.h
+++ b/tests/golden_output/aidl-test-interface-cpp-source/gen/include/android/aidl/tests/Union.h
@@ -36,7 +36,7 @@
template<typename _Tp>
static constexpr bool _not_self = !std::is_same_v<std::remove_cv_t<std::remove_reference_t<_Tp>>, Union>;
- Union() : _value(std::in_place_index<ns>, ::std::vector<int32_t>({})) { }
+ Union() : _value(std::in_place_index<static_cast<size_t>(ns)>, ::std::vector<int32_t>({})) { }
template <typename _Tp, typename = std::enable_if_t<_not_self<_Tp>>>
// NOLINTNEXTLINE(google-explicit-constructor)
@@ -49,12 +49,12 @@
template <Tag _tag, typename... _Tp>
static Union make(_Tp&&... _args) {
- return Union(std::in_place_index<_tag>, std::forward<_Tp>(_args)...);
+ return Union(std::in_place_index<static_cast<size_t>(_tag)>, std::forward<_Tp>(_args)...);
}
template <Tag _tag, typename _Tp, typename... _Up>
static Union make(std::initializer_list<_Tp> _il, _Up&&... _args) {
- return Union(std::in_place_index<_tag>, std::move(_il), std::forward<_Up>(_args)...);
+ return Union(std::in_place_index<static_cast<size_t>(_tag)>, std::move(_il), std::forward<_Up>(_args)...);
}
Tag getTag() const {
@@ -64,18 +64,18 @@
template <Tag _tag>
const auto& get() const {
if (getTag() != _tag) { __assert2(__FILE__, __LINE__, __PRETTY_FUNCTION__, "bad access: a wrong tag"); }
- return std::get<_tag>(_value);
+ return std::get<static_cast<size_t>(_tag)>(_value);
}
template <Tag _tag>
auto& get() {
if (getTag() != _tag) { __assert2(__FILE__, __LINE__, __PRETTY_FUNCTION__, "bad access: a wrong tag"); }
- return std::get<_tag>(_value);
+ return std::get<static_cast<size_t>(_tag)>(_value);
}
template <Tag _tag, typename... _Tp>
void set(_Tp&&... _args) {
- _value.emplace<_tag>(std::forward<_Tp>(_args)...);
+ _value.emplace<static_cast<size_t>(_tag)>(std::forward<_Tp>(_args)...);
}
inline bool operator!=(const Union& rhs) const {
diff --git a/tests/golden_output/aidl-test-interface-cpp-source/gen/include/android/aidl/tests/UnionWithFd.h b/tests/golden_output/aidl-test-interface-cpp-source/gen/include/android/aidl/tests/UnionWithFd.h
index 373aba7..06ae2a6 100644
--- a/tests/golden_output/aidl-test-interface-cpp-source/gen/include/android/aidl/tests/UnionWithFd.h
+++ b/tests/golden_output/aidl-test-interface-cpp-source/gen/include/android/aidl/tests/UnionWithFd.h
@@ -28,7 +28,7 @@
template<typename _Tp>
static constexpr bool _not_self = !std::is_same_v<std::remove_cv_t<std::remove_reference_t<_Tp>>, UnionWithFd>;
- UnionWithFd() : _value(std::in_place_index<num>, int32_t(0)) { }
+ UnionWithFd() : _value(std::in_place_index<static_cast<size_t>(num)>, int32_t(0)) { }
template <typename _Tp, typename = std::enable_if_t<_not_self<_Tp>>>
// NOLINTNEXTLINE(google-explicit-constructor)
@@ -41,12 +41,12 @@
template <Tag _tag, typename... _Tp>
static UnionWithFd make(_Tp&&... _args) {
- return UnionWithFd(std::in_place_index<_tag>, std::forward<_Tp>(_args)...);
+ return UnionWithFd(std::in_place_index<static_cast<size_t>(_tag)>, std::forward<_Tp>(_args)...);
}
template <Tag _tag, typename _Tp, typename... _Up>
static UnionWithFd make(std::initializer_list<_Tp> _il, _Up&&... _args) {
- return UnionWithFd(std::in_place_index<_tag>, std::move(_il), std::forward<_Up>(_args)...);
+ return UnionWithFd(std::in_place_index<static_cast<size_t>(_tag)>, std::move(_il), std::forward<_Up>(_args)...);
}
Tag getTag() const {
@@ -56,18 +56,18 @@
template <Tag _tag>
const auto& get() const {
if (getTag() != _tag) { __assert2(__FILE__, __LINE__, __PRETTY_FUNCTION__, "bad access: a wrong tag"); }
- return std::get<_tag>(_value);
+ return std::get<static_cast<size_t>(_tag)>(_value);
}
template <Tag _tag>
auto& get() {
if (getTag() != _tag) { __assert2(__FILE__, __LINE__, __PRETTY_FUNCTION__, "bad access: a wrong tag"); }
- return std::get<_tag>(_value);
+ return std::get<static_cast<size_t>(_tag)>(_value);
}
template <Tag _tag, typename... _Tp>
void set(_Tp&&... _args) {
- _value.emplace<_tag>(std::forward<_Tp>(_args)...);
+ _value.emplace<static_cast<size_t>(_tag)>(std::forward<_Tp>(_args)...);
}
inline bool operator!=(const UnionWithFd& rhs) const {
diff --git a/tests/golden_output/aidl-test-interface-cpp-source/gen/include/android/aidl/tests/permission/BnProtected.h b/tests/golden_output/aidl-test-interface-cpp-source/gen/include/android/aidl/tests/permission/BnProtected.h
deleted file mode 100644
index 82340aa..0000000
--- a/tests/golden_output/aidl-test-interface-cpp-source/gen/include/android/aidl/tests/permission/BnProtected.h
+++ /dev/null
@@ -1,38 +0,0 @@
-#pragma once
-
-#include <binder/IInterface.h>
-#include <android/aidl/tests/permission/IProtected.h>
-
-namespace android {
-namespace aidl {
-namespace tests {
-namespace permission {
-class BnProtected : public ::android::BnInterface<IProtected> {
-public:
- static constexpr uint32_t TRANSACTION_PermissionProtected = ::android::IBinder::FIRST_CALL_TRANSACTION + 0;
- static constexpr uint32_t TRANSACTION_MultiplePermissionsAll = ::android::IBinder::FIRST_CALL_TRANSACTION + 1;
- static constexpr uint32_t TRANSACTION_MultiplePermissionsAny = ::android::IBinder::FIRST_CALL_TRANSACTION + 2;
- explicit BnProtected();
- ::android::status_t onTransact(uint32_t _aidl_code, const ::android::Parcel& _aidl_data, ::android::Parcel* _aidl_reply, uint32_t _aidl_flags) override;
-}; // class BnProtected
-
-class IProtectedDelegator : public BnProtected {
-public:
- explicit IProtectedDelegator(::android::sp<IProtected> &impl) : _aidl_delegate(impl) {}
-
- ::android::binder::Status PermissionProtected() override {
- return _aidl_delegate->PermissionProtected();
- }
- ::android::binder::Status MultiplePermissionsAll() override {
- return _aidl_delegate->MultiplePermissionsAll();
- }
- ::android::binder::Status MultiplePermissionsAny() override {
- return _aidl_delegate->MultiplePermissionsAny();
- }
-private:
- ::android::sp<IProtected> _aidl_delegate;
-}; // class IProtectedDelegator
-} // namespace permission
-} // namespace tests
-} // namespace aidl
-} // namespace android
diff --git a/tests/golden_output/aidl-test-interface-cpp-source/gen/include/android/aidl/tests/permission/BnProtectedInterface.h b/tests/golden_output/aidl-test-interface-cpp-source/gen/include/android/aidl/tests/permission/BnProtectedInterface.h
deleted file mode 100644
index 7516a17..0000000
--- a/tests/golden_output/aidl-test-interface-cpp-source/gen/include/android/aidl/tests/permission/BnProtectedInterface.h
+++ /dev/null
@@ -1,34 +0,0 @@
-#pragma once
-
-#include <binder/IInterface.h>
-#include <android/aidl/tests/permission/IProtectedInterface.h>
-
-namespace android {
-namespace aidl {
-namespace tests {
-namespace permission {
-class BnProtectedInterface : public ::android::BnInterface<IProtectedInterface> {
-public:
- static constexpr uint32_t TRANSACTION_Method1 = ::android::IBinder::FIRST_CALL_TRANSACTION + 0;
- static constexpr uint32_t TRANSACTION_Method2 = ::android::IBinder::FIRST_CALL_TRANSACTION + 1;
- explicit BnProtectedInterface();
- ::android::status_t onTransact(uint32_t _aidl_code, const ::android::Parcel& _aidl_data, ::android::Parcel* _aidl_reply, uint32_t _aidl_flags) override;
-}; // class BnProtectedInterface
-
-class IProtectedInterfaceDelegator : public BnProtectedInterface {
-public:
- explicit IProtectedInterfaceDelegator(::android::sp<IProtectedInterface> &impl) : _aidl_delegate(impl) {}
-
- ::android::binder::Status Method1() override {
- return _aidl_delegate->Method1();
- }
- ::android::binder::Status Method2() override {
- return _aidl_delegate->Method2();
- }
-private:
- ::android::sp<IProtectedInterface> _aidl_delegate;
-}; // class IProtectedInterfaceDelegator
-} // namespace permission
-} // namespace tests
-} // namespace aidl
-} // namespace android
diff --git a/tests/golden_output/aidl-test-interface-cpp-source/gen/include/android/aidl/tests/permission/BpProtected.h b/tests/golden_output/aidl-test-interface-cpp-source/gen/include/android/aidl/tests/permission/BpProtected.h
deleted file mode 100644
index fa83ef0..0000000
--- a/tests/golden_output/aidl-test-interface-cpp-source/gen/include/android/aidl/tests/permission/BpProtected.h
+++ /dev/null
@@ -1,23 +0,0 @@
-#pragma once
-
-#include <binder/IBinder.h>
-#include <binder/IInterface.h>
-#include <utils/Errors.h>
-#include <android/aidl/tests/permission/IProtected.h>
-
-namespace android {
-namespace aidl {
-namespace tests {
-namespace permission {
-class BpProtected : public ::android::BpInterface<IProtected> {
-public:
- explicit BpProtected(const ::android::sp<::android::IBinder>& _aidl_impl);
- virtual ~BpProtected() = default;
- ::android::binder::Status PermissionProtected() override;
- ::android::binder::Status MultiplePermissionsAll() override;
- ::android::binder::Status MultiplePermissionsAny() override;
-}; // class BpProtected
-} // namespace permission
-} // namespace tests
-} // namespace aidl
-} // namespace android
diff --git a/tests/golden_output/aidl-test-interface-cpp-source/gen/include/android/aidl/tests/permission/BpProtectedInterface.h b/tests/golden_output/aidl-test-interface-cpp-source/gen/include/android/aidl/tests/permission/BpProtectedInterface.h
deleted file mode 100644
index c77b59a..0000000
--- a/tests/golden_output/aidl-test-interface-cpp-source/gen/include/android/aidl/tests/permission/BpProtectedInterface.h
+++ /dev/null
@@ -1,22 +0,0 @@
-#pragma once
-
-#include <binder/IBinder.h>
-#include <binder/IInterface.h>
-#include <utils/Errors.h>
-#include <android/aidl/tests/permission/IProtectedInterface.h>
-
-namespace android {
-namespace aidl {
-namespace tests {
-namespace permission {
-class BpProtectedInterface : public ::android::BpInterface<IProtectedInterface> {
-public:
- explicit BpProtectedInterface(const ::android::sp<::android::IBinder>& _aidl_impl);
- virtual ~BpProtectedInterface() = default;
- ::android::binder::Status Method1() override;
- ::android::binder::Status Method2() override;
-}; // class BpProtectedInterface
-} // namespace permission
-} // namespace tests
-} // namespace aidl
-} // namespace android
diff --git a/tests/golden_output/aidl-test-interface-cpp-source/gen/include/android/aidl/tests/permission/IProtected.h b/tests/golden_output/aidl-test-interface-cpp-source/gen/include/android/aidl/tests/permission/IProtected.h
deleted file mode 100644
index d8b05b9..0000000
--- a/tests/golden_output/aidl-test-interface-cpp-source/gen/include/android/aidl/tests/permission/IProtected.h
+++ /dev/null
@@ -1,38 +0,0 @@
-#pragma once
-
-#include <binder/IBinder.h>
-#include <binder/IInterface.h>
-#include <binder/Status.h>
-#include <utils/StrongPointer.h>
-
-namespace android {
-namespace aidl {
-namespace tests {
-namespace permission {
-class IProtected : public ::android::IInterface {
-public:
- DECLARE_META_INTERFACE(Protected)
- virtual ::android::binder::Status PermissionProtected() = 0;
- virtual ::android::binder::Status MultiplePermissionsAll() = 0;
- virtual ::android::binder::Status MultiplePermissionsAny() = 0;
-}; // class IProtected
-
-class IProtectedDefault : public IProtected {
-public:
- ::android::IBinder* onAsBinder() override {
- return nullptr;
- }
- ::android::binder::Status PermissionProtected() override {
- return ::android::binder::Status::fromStatusT(::android::UNKNOWN_TRANSACTION);
- }
- ::android::binder::Status MultiplePermissionsAll() override {
- return ::android::binder::Status::fromStatusT(::android::UNKNOWN_TRANSACTION);
- }
- ::android::binder::Status MultiplePermissionsAny() override {
- return ::android::binder::Status::fromStatusT(::android::UNKNOWN_TRANSACTION);
- }
-}; // class IProtectedDefault
-} // namespace permission
-} // namespace tests
-} // namespace aidl
-} // namespace android
diff --git a/tests/golden_output/aidl-test-interface-cpp-source/gen/include/android/aidl/tests/permission/IProtectedInterface.h b/tests/golden_output/aidl-test-interface-cpp-source/gen/include/android/aidl/tests/permission/IProtectedInterface.h
deleted file mode 100644
index 82aaceb..0000000
--- a/tests/golden_output/aidl-test-interface-cpp-source/gen/include/android/aidl/tests/permission/IProtectedInterface.h
+++ /dev/null
@@ -1,34 +0,0 @@
-#pragma once
-
-#include <binder/IBinder.h>
-#include <binder/IInterface.h>
-#include <binder/Status.h>
-#include <utils/StrongPointer.h>
-
-namespace android {
-namespace aidl {
-namespace tests {
-namespace permission {
-class IProtectedInterface : public ::android::IInterface {
-public:
- DECLARE_META_INTERFACE(ProtectedInterface)
- virtual ::android::binder::Status Method1() = 0;
- virtual ::android::binder::Status Method2() = 0;
-}; // class IProtectedInterface
-
-class IProtectedInterfaceDefault : public IProtectedInterface {
-public:
- ::android::IBinder* onAsBinder() override {
- return nullptr;
- }
- ::android::binder::Status Method1() override {
- return ::android::binder::Status::fromStatusT(::android::UNKNOWN_TRANSACTION);
- }
- ::android::binder::Status Method2() override {
- return ::android::binder::Status::fromStatusT(::android::UNKNOWN_TRANSACTION);
- }
-}; // class IProtectedInterfaceDefault
-} // namespace permission
-} // namespace tests
-} // namespace aidl
-} // namespace android
diff --git a/tests/golden_output/aidl-test-interface-cpp-source/gen/include/android/aidl/tests/unions/EnumUnion.h b/tests/golden_output/aidl-test-interface-cpp-source/gen/include/android/aidl/tests/unions/EnumUnion.h
index 348e34d..3898fbc 100644
--- a/tests/golden_output/aidl-test-interface-cpp-source/gen/include/android/aidl/tests/unions/EnumUnion.h
+++ b/tests/golden_output/aidl-test-interface-cpp-source/gen/include/android/aidl/tests/unions/EnumUnion.h
@@ -29,7 +29,7 @@
template<typename _Tp>
static constexpr bool _not_self = !std::is_same_v<std::remove_cv_t<std::remove_reference_t<_Tp>>, EnumUnion>;
- EnumUnion() : _value(std::in_place_index<intEnum>, ::android::aidl::tests::IntEnum(::android::aidl::tests::IntEnum::FOO)) { }
+ EnumUnion() : _value(std::in_place_index<static_cast<size_t>(intEnum)>, ::android::aidl::tests::IntEnum(::android::aidl::tests::IntEnum::FOO)) { }
template <typename _Tp, typename = std::enable_if_t<_not_self<_Tp>>>
// NOLINTNEXTLINE(google-explicit-constructor)
@@ -42,12 +42,12 @@
template <Tag _tag, typename... _Tp>
static EnumUnion make(_Tp&&... _args) {
- return EnumUnion(std::in_place_index<_tag>, std::forward<_Tp>(_args)...);
+ return EnumUnion(std::in_place_index<static_cast<size_t>(_tag)>, std::forward<_Tp>(_args)...);
}
template <Tag _tag, typename _Tp, typename... _Up>
static EnumUnion make(std::initializer_list<_Tp> _il, _Up&&... _args) {
- return EnumUnion(std::in_place_index<_tag>, std::move(_il), std::forward<_Up>(_args)...);
+ return EnumUnion(std::in_place_index<static_cast<size_t>(_tag)>, std::move(_il), std::forward<_Up>(_args)...);
}
Tag getTag() const {
@@ -57,18 +57,18 @@
template <Tag _tag>
const auto& get() const {
if (getTag() != _tag) { __assert2(__FILE__, __LINE__, __PRETTY_FUNCTION__, "bad access: a wrong tag"); }
- return std::get<_tag>(_value);
+ return std::get<static_cast<size_t>(_tag)>(_value);
}
template <Tag _tag>
auto& get() {
if (getTag() != _tag) { __assert2(__FILE__, __LINE__, __PRETTY_FUNCTION__, "bad access: a wrong tag"); }
- return std::get<_tag>(_value);
+ return std::get<static_cast<size_t>(_tag)>(_value);
}
template <Tag _tag, typename... _Tp>
void set(_Tp&&... _args) {
- _value.emplace<_tag>(std::forward<_Tp>(_args)...);
+ _value.emplace<static_cast<size_t>(_tag)>(std::forward<_Tp>(_args)...);
}
inline bool operator!=(const EnumUnion& rhs) const {
diff --git a/tests/golden_output/aidl-test-interface-cpp-source/gen/include/android/aidl/tests/unions/UnionInUnion.h b/tests/golden_output/aidl-test-interface-cpp-source/gen/include/android/aidl/tests/unions/UnionInUnion.h
index d83935c..9adbbe9 100644
--- a/tests/golden_output/aidl-test-interface-cpp-source/gen/include/android/aidl/tests/unions/UnionInUnion.h
+++ b/tests/golden_output/aidl-test-interface-cpp-source/gen/include/android/aidl/tests/unions/UnionInUnion.h
@@ -29,7 +29,7 @@
template<typename _Tp>
static constexpr bool _not_self = !std::is_same_v<std::remove_cv_t<std::remove_reference_t<_Tp>>, UnionInUnion>;
- UnionInUnion() : _value(std::in_place_index<first>, ::android::aidl::tests::unions::EnumUnion()) { }
+ UnionInUnion() : _value(std::in_place_index<static_cast<size_t>(first)>, ::android::aidl::tests::unions::EnumUnion()) { }
template <typename _Tp, typename = std::enable_if_t<_not_self<_Tp>>>
// NOLINTNEXTLINE(google-explicit-constructor)
@@ -42,12 +42,12 @@
template <Tag _tag, typename... _Tp>
static UnionInUnion make(_Tp&&... _args) {
- return UnionInUnion(std::in_place_index<_tag>, std::forward<_Tp>(_args)...);
+ return UnionInUnion(std::in_place_index<static_cast<size_t>(_tag)>, std::forward<_Tp>(_args)...);
}
template <Tag _tag, typename _Tp, typename... _Up>
static UnionInUnion make(std::initializer_list<_Tp> _il, _Up&&... _args) {
- return UnionInUnion(std::in_place_index<_tag>, std::move(_il), std::forward<_Up>(_args)...);
+ return UnionInUnion(std::in_place_index<static_cast<size_t>(_tag)>, std::move(_il), std::forward<_Up>(_args)...);
}
Tag getTag() const {
@@ -57,18 +57,18 @@
template <Tag _tag>
const auto& get() const {
if (getTag() != _tag) { __assert2(__FILE__, __LINE__, __PRETTY_FUNCTION__, "bad access: a wrong tag"); }
- return std::get<_tag>(_value);
+ return std::get<static_cast<size_t>(_tag)>(_value);
}
template <Tag _tag>
auto& get() {
if (getTag() != _tag) { __assert2(__FILE__, __LINE__, __PRETTY_FUNCTION__, "bad access: a wrong tag"); }
- return std::get<_tag>(_value);
+ return std::get<static_cast<size_t>(_tag)>(_value);
}
template <Tag _tag, typename... _Tp>
void set(_Tp&&... _args) {
- _value.emplace<_tag>(std::forward<_Tp>(_args)...);
+ _value.emplace<static_cast<size_t>(_tag)>(std::forward<_Tp>(_args)...);
}
inline bool operator!=(const UnionInUnion& rhs) const {
diff --git a/tests/golden_output/aidl-test-interface-java-source/gen/android/aidl/tests/permission/IProtected.java.d b/tests/golden_output/aidl-test-interface-java-source/gen/android/aidl/tests/permission/IProtected.java.d
deleted file mode 100644
index 9eb7054..0000000
--- a/tests/golden_output/aidl-test-interface-java-source/gen/android/aidl/tests/permission/IProtected.java.d
+++ /dev/null
@@ -1,2 +0,0 @@
-out/soong/.intermediates/system/tools/aidl/aidl-test-interface-java-source/gen/android/aidl/tests/permission/IProtected.java : \
- system/tools/aidl/tests/android/aidl/tests/permission/IProtected.aidl
diff --git a/tests/golden_output/aidl-test-interface-java-source/gen/android/aidl/tests/permission/IProtectedInterface.java.d b/tests/golden_output/aidl-test-interface-java-source/gen/android/aidl/tests/permission/IProtectedInterface.java.d
deleted file mode 100644
index 4f04f76..0000000
--- a/tests/golden_output/aidl-test-interface-java-source/gen/android/aidl/tests/permission/IProtectedInterface.java.d
+++ /dev/null
@@ -1,2 +0,0 @@
-out/soong/.intermediates/system/tools/aidl/aidl-test-interface-java-source/gen/android/aidl/tests/permission/IProtectedInterface.java : \
- system/tools/aidl/tests/android/aidl/tests/permission/IProtectedInterface.aidl
diff --git a/tests/golden_output/aidl-test-interface-ndk-source/gen/android/aidl/tests/ArrayOfInterfaces.cpp b/tests/golden_output/aidl-test-interface-ndk-source/gen/android/aidl/tests/ArrayOfInterfaces.cpp
index e3f691a..c42c372 100644
--- a/tests/golden_output/aidl-test-interface-ndk-source/gen/android/aidl/tests/ArrayOfInterfaces.cpp
+++ b/tests/golden_output/aidl-test-interface-ndk-source/gen/android/aidl/tests/ArrayOfInterfaces.cpp
@@ -415,7 +415,7 @@
binder_status_t _aidl_ret_status;
int32_t _aidl_tag;
if ((_aidl_ret_status = ::ndk::AParcel_readData(_parcel, &_aidl_tag)) != STATUS_OK) return _aidl_ret_status;
- switch (_aidl_tag) {
+ switch (static_cast<Tag>(_aidl_tag)) {
case iface: {
std::shared_ptr<::aidl::android::aidl::tests::ArrayOfInterfaces::IEmptyInterface> _aidl_value;
if ((_aidl_ret_status = ::ndk::AParcel_readData(_parcel, &_aidl_value)) != STATUS_OK) return _aidl_ret_status;
@@ -460,7 +460,7 @@
return STATUS_BAD_VALUE;
}
binder_status_t ArrayOfInterfaces::MyUnion::writeToParcel(AParcel* _parcel) const {
- binder_status_t _aidl_ret_status = ::ndk::AParcel_writeData(_parcel, getTag());
+ binder_status_t _aidl_ret_status = ::ndk::AParcel_writeData(_parcel, static_cast<int32_t>(getTag()));
if (_aidl_ret_status != STATUS_OK) return _aidl_ret_status;
switch (getTag()) {
case iface: return ::ndk::AParcel_writeData(_parcel, get<iface>());
diff --git a/tests/golden_output/aidl-test-interface-ndk-source/gen/android/aidl/tests/FixedSize.cpp b/tests/golden_output/aidl-test-interface-ndk-source/gen/android/aidl/tests/FixedSize.cpp
index b5a6115..689a388 100644
--- a/tests/golden_output/aidl-test-interface-ndk-source/gen/android/aidl/tests/FixedSize.cpp
+++ b/tests/golden_output/aidl-test-interface-ndk-source/gen/android/aidl/tests/FixedSize.cpp
@@ -172,7 +172,7 @@
binder_status_t _aidl_ret_status;
int32_t _aidl_tag;
if ((_aidl_ret_status = ::ndk::AParcel_readData(_parcel, &_aidl_tag)) != STATUS_OK) return _aidl_ret_status;
- switch (_aidl_tag) {
+ switch (static_cast<Tag>(_aidl_tag)) {
case booleanValue: {
bool _aidl_value;
if ((_aidl_ret_status = ::ndk::AParcel_readData(_parcel, &_aidl_value)) != STATUS_OK) return _aidl_ret_status;
@@ -257,7 +257,7 @@
return STATUS_BAD_VALUE;
}
binder_status_t FixedSize::FixedUnion::writeToParcel(AParcel* _parcel) const {
- binder_status_t _aidl_ret_status = ::ndk::AParcel_writeData(_parcel, getTag());
+ binder_status_t _aidl_ret_status = ::ndk::AParcel_writeData(_parcel, static_cast<int32_t>(getTag()));
if (_aidl_ret_status != STATUS_OK) return _aidl_ret_status;
switch (getTag()) {
case booleanValue: return ::ndk::AParcel_writeData(_parcel, get<booleanValue>());
diff --git a/tests/golden_output/aidl-test-interface-ndk-source/gen/android/aidl/tests/ListOfInterfaces.cpp b/tests/golden_output/aidl-test-interface-ndk-source/gen/android/aidl/tests/ListOfInterfaces.cpp
index e1eda40..cd90a13 100644
--- a/tests/golden_output/aidl-test-interface-ndk-source/gen/android/aidl/tests/ListOfInterfaces.cpp
+++ b/tests/golden_output/aidl-test-interface-ndk-source/gen/android/aidl/tests/ListOfInterfaces.cpp
@@ -403,7 +403,7 @@
binder_status_t _aidl_ret_status;
int32_t _aidl_tag;
if ((_aidl_ret_status = ::ndk::AParcel_readData(_parcel, &_aidl_tag)) != STATUS_OK) return _aidl_ret_status;
- switch (_aidl_tag) {
+ switch (static_cast<Tag>(_aidl_tag)) {
case iface: {
std::shared_ptr<::aidl::android::aidl::tests::ListOfInterfaces::IEmptyInterface> _aidl_value;
if ((_aidl_ret_status = ::ndk::AParcel_readData(_parcel, &_aidl_value)) != STATUS_OK) return _aidl_ret_status;
@@ -448,7 +448,7 @@
return STATUS_BAD_VALUE;
}
binder_status_t ListOfInterfaces::MyUnion::writeToParcel(AParcel* _parcel) const {
- binder_status_t _aidl_ret_status = ::ndk::AParcel_writeData(_parcel, getTag());
+ binder_status_t _aidl_ret_status = ::ndk::AParcel_writeData(_parcel, static_cast<int32_t>(getTag()));
if (_aidl_ret_status != STATUS_OK) return _aidl_ret_status;
switch (getTag()) {
case iface: return ::ndk::AParcel_writeData(_parcel, get<iface>());
diff --git a/tests/golden_output/aidl-test-interface-ndk-source/gen/android/aidl/tests/Union.cpp b/tests/golden_output/aidl-test-interface-ndk-source/gen/android/aidl/tests/Union.cpp
index 6941c03..a8989bc 100644
--- a/tests/golden_output/aidl-test-interface-ndk-source/gen/android/aidl/tests/Union.cpp
+++ b/tests/golden_output/aidl-test-interface-ndk-source/gen/android/aidl/tests/Union.cpp
@@ -13,7 +13,7 @@
binder_status_t _aidl_ret_status;
int32_t _aidl_tag;
if ((_aidl_ret_status = ::ndk::AParcel_readData(_parcel, &_aidl_tag)) != STATUS_OK) return _aidl_ret_status;
- switch (_aidl_tag) {
+ switch (static_cast<Tag>(_aidl_tag)) {
case ns: {
std::vector<int32_t> _aidl_value;
if ((_aidl_ret_status = ::ndk::AParcel_readData(_parcel, &_aidl_value)) != STATUS_OK) return _aidl_ret_status;
@@ -88,7 +88,7 @@
return STATUS_BAD_VALUE;
}
binder_status_t Union::writeToParcel(AParcel* _parcel) const {
- binder_status_t _aidl_ret_status = ::ndk::AParcel_writeData(_parcel, getTag());
+ binder_status_t _aidl_ret_status = ::ndk::AParcel_writeData(_parcel, static_cast<int32_t>(getTag()));
if (_aidl_ret_status != STATUS_OK) return _aidl_ret_status;
switch (getTag()) {
case ns: return ::ndk::AParcel_writeData(_parcel, get<ns>());
diff --git a/tests/golden_output/aidl-test-interface-ndk-source/gen/android/aidl/tests/UnionWithFd.cpp b/tests/golden_output/aidl-test-interface-ndk-source/gen/android/aidl/tests/UnionWithFd.cpp
index 223d64c..1eefc3e 100644
--- a/tests/golden_output/aidl-test-interface-ndk-source/gen/android/aidl/tests/UnionWithFd.cpp
+++ b/tests/golden_output/aidl-test-interface-ndk-source/gen/android/aidl/tests/UnionWithFd.cpp
@@ -12,7 +12,7 @@
binder_status_t _aidl_ret_status;
int32_t _aidl_tag;
if ((_aidl_ret_status = ::ndk::AParcel_readData(_parcel, &_aidl_tag)) != STATUS_OK) return _aidl_ret_status;
- switch (_aidl_tag) {
+ switch (static_cast<Tag>(_aidl_tag)) {
case num: {
int32_t _aidl_value;
if ((_aidl_ret_status = ::ndk::AParcel_readData(_parcel, &_aidl_value)) != STATUS_OK) return _aidl_ret_status;
@@ -37,7 +37,7 @@
return STATUS_BAD_VALUE;
}
binder_status_t UnionWithFd::writeToParcel(AParcel* _parcel) const {
- binder_status_t _aidl_ret_status = ::ndk::AParcel_writeData(_parcel, getTag());
+ binder_status_t _aidl_ret_status = ::ndk::AParcel_writeData(_parcel, static_cast<int32_t>(getTag()));
if (_aidl_ret_status != STATUS_OK) return _aidl_ret_status;
switch (getTag()) {
case num: return ::ndk::AParcel_writeData(_parcel, get<num>());
diff --git a/tests/golden_output/aidl-test-interface-ndk-source/gen/android/aidl/tests/permission/IProtected.cpp b/tests/golden_output/aidl-test-interface-ndk-source/gen/android/aidl/tests/permission/IProtected.cpp
deleted file mode 100644
index 15e7a78..0000000
--- a/tests/golden_output/aidl-test-interface-ndk-source/gen/android/aidl/tests/permission/IProtected.cpp
+++ /dev/null
@@ -1,234 +0,0 @@
-#include "aidl/android/aidl/tests/permission/IProtected.h"
-
-#include <android/binder_parcel_utils.h>
-#include <aidl/android/aidl/tests/permission/BnProtected.h>
-#include <aidl/android/aidl/tests/permission/BpProtected.h>
-
-namespace aidl {
-namespace android {
-namespace aidl {
-namespace tests {
-namespace permission {
-static binder_status_t _aidl_android_aidl_tests_permission_IProtected_onTransact(AIBinder* _aidl_binder, transaction_code_t _aidl_code, const AParcel* _aidl_in, AParcel* _aidl_out) {
- (void)_aidl_in;
- (void)_aidl_out;
- binder_status_t _aidl_ret_status = STATUS_UNKNOWN_TRANSACTION;
- std::shared_ptr<BnProtected> _aidl_impl = std::static_pointer_cast<BnProtected>(::ndk::ICInterface::asInterface(_aidl_binder));
- switch (_aidl_code) {
- case (FIRST_CALL_TRANSACTION + 0 /*PermissionProtected*/): {
-
- ::ndk::ScopedAStatus _aidl_status = _aidl_impl->PermissionProtected();
- _aidl_ret_status = AParcel_writeStatusHeader(_aidl_out, _aidl_status.get());
- if (_aidl_ret_status != STATUS_OK) break;
-
- if (!AStatus_isOk(_aidl_status.get())) break;
-
- break;
- }
- case (FIRST_CALL_TRANSACTION + 1 /*MultiplePermissionsAll*/): {
-
- ::ndk::ScopedAStatus _aidl_status = _aidl_impl->MultiplePermissionsAll();
- _aidl_ret_status = AParcel_writeStatusHeader(_aidl_out, _aidl_status.get());
- if (_aidl_ret_status != STATUS_OK) break;
-
- if (!AStatus_isOk(_aidl_status.get())) break;
-
- break;
- }
- case (FIRST_CALL_TRANSACTION + 2 /*MultiplePermissionsAny*/): {
-
- ::ndk::ScopedAStatus _aidl_status = _aidl_impl->MultiplePermissionsAny();
- _aidl_ret_status = AParcel_writeStatusHeader(_aidl_out, _aidl_status.get());
- if (_aidl_ret_status != STATUS_OK) break;
-
- if (!AStatus_isOk(_aidl_status.get())) break;
-
- break;
- }
- }
- return _aidl_ret_status;
-}
-
-static AIBinder_Class* _g_aidl_android_aidl_tests_permission_IProtected_clazz = ::ndk::ICInterface::defineClass(IProtected::descriptor, _aidl_android_aidl_tests_permission_IProtected_onTransact);
-
-BpProtected::BpProtected(const ::ndk::SpAIBinder& binder) : BpCInterface(binder) {}
-BpProtected::~BpProtected() {}
-
-::ndk::ScopedAStatus BpProtected::PermissionProtected() {
- binder_status_t _aidl_ret_status = STATUS_OK;
- ::ndk::ScopedAStatus _aidl_status;
- ::ndk::ScopedAParcel _aidl_in;
- ::ndk::ScopedAParcel _aidl_out;
-
- _aidl_ret_status = AIBinder_prepareTransaction(asBinder().get(), _aidl_in.getR());
- if (_aidl_ret_status != STATUS_OK) goto _aidl_error;
-
- _aidl_ret_status = AIBinder_transact(
- asBinder().get(),
- (FIRST_CALL_TRANSACTION + 0 /*PermissionProtected*/),
- _aidl_in.getR(),
- _aidl_out.getR(),
- 0
- #ifdef BINDER_STABILITY_SUPPORT
- | FLAG_PRIVATE_LOCAL
- #endif // BINDER_STABILITY_SUPPORT
- );
- if (_aidl_ret_status == STATUS_UNKNOWN_TRANSACTION && IProtected::getDefaultImpl()) {
- _aidl_status = IProtected::getDefaultImpl()->PermissionProtected();
- goto _aidl_status_return;
- }
- if (_aidl_ret_status != STATUS_OK) goto _aidl_error;
-
- _aidl_ret_status = AParcel_readStatusHeader(_aidl_out.get(), _aidl_status.getR());
- if (_aidl_ret_status != STATUS_OK) goto _aidl_error;
-
- if (!AStatus_isOk(_aidl_status.get())) goto _aidl_status_return;
- _aidl_error:
- _aidl_status.set(AStatus_fromStatus(_aidl_ret_status));
- _aidl_status_return:
- return _aidl_status;
-}
-::ndk::ScopedAStatus BpProtected::MultiplePermissionsAll() {
- binder_status_t _aidl_ret_status = STATUS_OK;
- ::ndk::ScopedAStatus _aidl_status;
- ::ndk::ScopedAParcel _aidl_in;
- ::ndk::ScopedAParcel _aidl_out;
-
- _aidl_ret_status = AIBinder_prepareTransaction(asBinder().get(), _aidl_in.getR());
- if (_aidl_ret_status != STATUS_OK) goto _aidl_error;
-
- _aidl_ret_status = AIBinder_transact(
- asBinder().get(),
- (FIRST_CALL_TRANSACTION + 1 /*MultiplePermissionsAll*/),
- _aidl_in.getR(),
- _aidl_out.getR(),
- 0
- #ifdef BINDER_STABILITY_SUPPORT
- | FLAG_PRIVATE_LOCAL
- #endif // BINDER_STABILITY_SUPPORT
- );
- if (_aidl_ret_status == STATUS_UNKNOWN_TRANSACTION && IProtected::getDefaultImpl()) {
- _aidl_status = IProtected::getDefaultImpl()->MultiplePermissionsAll();
- goto _aidl_status_return;
- }
- if (_aidl_ret_status != STATUS_OK) goto _aidl_error;
-
- _aidl_ret_status = AParcel_readStatusHeader(_aidl_out.get(), _aidl_status.getR());
- if (_aidl_ret_status != STATUS_OK) goto _aidl_error;
-
- if (!AStatus_isOk(_aidl_status.get())) goto _aidl_status_return;
- _aidl_error:
- _aidl_status.set(AStatus_fromStatus(_aidl_ret_status));
- _aidl_status_return:
- return _aidl_status;
-}
-::ndk::ScopedAStatus BpProtected::MultiplePermissionsAny() {
- binder_status_t _aidl_ret_status = STATUS_OK;
- ::ndk::ScopedAStatus _aidl_status;
- ::ndk::ScopedAParcel _aidl_in;
- ::ndk::ScopedAParcel _aidl_out;
-
- _aidl_ret_status = AIBinder_prepareTransaction(asBinder().get(), _aidl_in.getR());
- if (_aidl_ret_status != STATUS_OK) goto _aidl_error;
-
- _aidl_ret_status = AIBinder_transact(
- asBinder().get(),
- (FIRST_CALL_TRANSACTION + 2 /*MultiplePermissionsAny*/),
- _aidl_in.getR(),
- _aidl_out.getR(),
- 0
- #ifdef BINDER_STABILITY_SUPPORT
- | FLAG_PRIVATE_LOCAL
- #endif // BINDER_STABILITY_SUPPORT
- );
- if (_aidl_ret_status == STATUS_UNKNOWN_TRANSACTION && IProtected::getDefaultImpl()) {
- _aidl_status = IProtected::getDefaultImpl()->MultiplePermissionsAny();
- goto _aidl_status_return;
- }
- if (_aidl_ret_status != STATUS_OK) goto _aidl_error;
-
- _aidl_ret_status = AParcel_readStatusHeader(_aidl_out.get(), _aidl_status.getR());
- if (_aidl_ret_status != STATUS_OK) goto _aidl_error;
-
- if (!AStatus_isOk(_aidl_status.get())) goto _aidl_status_return;
- _aidl_error:
- _aidl_status.set(AStatus_fromStatus(_aidl_ret_status));
- _aidl_status_return:
- return _aidl_status;
-}
-// Source for BnProtected
-BnProtected::BnProtected() {}
-BnProtected::~BnProtected() {}
-::ndk::SpAIBinder BnProtected::createBinder() {
- AIBinder* binder = AIBinder_new(_g_aidl_android_aidl_tests_permission_IProtected_clazz, static_cast<void*>(this));
- #ifdef BINDER_STABILITY_SUPPORT
- AIBinder_markCompilationUnitStability(binder);
- #endif // BINDER_STABILITY_SUPPORT
- return ::ndk::SpAIBinder(binder);
-}
-// Source for IProtected
-const char* IProtected::descriptor = "android.aidl.tests.permission.IProtected";
-IProtected::IProtected() {}
-IProtected::~IProtected() {}
-
-
-std::shared_ptr<IProtected> IProtected::fromBinder(const ::ndk::SpAIBinder& binder) {
- if (!AIBinder_associateClass(binder.get(), _g_aidl_android_aidl_tests_permission_IProtected_clazz)) { return nullptr; }
- std::shared_ptr<::ndk::ICInterface> interface = ::ndk::ICInterface::asInterface(binder.get());
- if (interface) {
- return std::static_pointer_cast<IProtected>(interface);
- }
- return ::ndk::SharedRefBase::make<BpProtected>(binder);
-}
-
-binder_status_t IProtected::writeToParcel(AParcel* parcel, const std::shared_ptr<IProtected>& instance) {
- return AParcel_writeStrongBinder(parcel, instance ? instance->asBinder().get() : nullptr);
-}
-binder_status_t IProtected::readFromParcel(const AParcel* parcel, std::shared_ptr<IProtected>* instance) {
- ::ndk::SpAIBinder binder;
- binder_status_t status = AParcel_readStrongBinder(parcel, binder.getR());
- if (status != STATUS_OK) return status;
- *instance = IProtected::fromBinder(binder);
- return STATUS_OK;
-}
-bool IProtected::setDefaultImpl(const std::shared_ptr<IProtected>& impl) {
- // Only one user of this interface can use this function
- // at a time. This is a heuristic to detect if two different
- // users in the same process use this function.
- assert(!IProtected::default_impl);
- if (impl) {
- IProtected::default_impl = impl;
- return true;
- }
- return false;
-}
-const std::shared_ptr<IProtected>& IProtected::getDefaultImpl() {
- return IProtected::default_impl;
-}
-std::shared_ptr<IProtected> IProtected::default_impl = nullptr;
-::ndk::ScopedAStatus IProtectedDefault::PermissionProtected() {
- ::ndk::ScopedAStatus _aidl_status;
- _aidl_status.set(AStatus_fromStatus(STATUS_UNKNOWN_TRANSACTION));
- return _aidl_status;
-}
-::ndk::ScopedAStatus IProtectedDefault::MultiplePermissionsAll() {
- ::ndk::ScopedAStatus _aidl_status;
- _aidl_status.set(AStatus_fromStatus(STATUS_UNKNOWN_TRANSACTION));
- return _aidl_status;
-}
-::ndk::ScopedAStatus IProtectedDefault::MultiplePermissionsAny() {
- ::ndk::ScopedAStatus _aidl_status;
- _aidl_status.set(AStatus_fromStatus(STATUS_UNKNOWN_TRANSACTION));
- return _aidl_status;
-}
-::ndk::SpAIBinder IProtectedDefault::asBinder() {
- return ::ndk::SpAIBinder();
-}
-bool IProtectedDefault::isRemote() {
- return false;
-}
-} // namespace permission
-} // namespace tests
-} // namespace aidl
-} // namespace android
-} // namespace aidl
diff --git a/tests/golden_output/aidl-test-interface-ndk-source/gen/android/aidl/tests/permission/IProtected.cpp.d b/tests/golden_output/aidl-test-interface-ndk-source/gen/android/aidl/tests/permission/IProtected.cpp.d
deleted file mode 100644
index 7db52de..0000000
--- a/tests/golden_output/aidl-test-interface-ndk-source/gen/android/aidl/tests/permission/IProtected.cpp.d
+++ /dev/null
@@ -1,2 +0,0 @@
-out/soong/.intermediates/system/tools/aidl/aidl-test-interface-ndk-source/gen/android/aidl/tests/permission/IProtected.cpp : \
- system/tools/aidl/tests/android/aidl/tests/permission/IProtected.aidl
diff --git a/tests/golden_output/aidl-test-interface-ndk-source/gen/android/aidl/tests/permission/IProtectedInterface.cpp b/tests/golden_output/aidl-test-interface-ndk-source/gen/android/aidl/tests/permission/IProtectedInterface.cpp
deleted file mode 100644
index 454f6a4..0000000
--- a/tests/golden_output/aidl-test-interface-ndk-source/gen/android/aidl/tests/permission/IProtectedInterface.cpp
+++ /dev/null
@@ -1,185 +0,0 @@
-#include "aidl/android/aidl/tests/permission/IProtectedInterface.h"
-
-#include <android/binder_parcel_utils.h>
-#include <aidl/android/aidl/tests/permission/BnProtectedInterface.h>
-#include <aidl/android/aidl/tests/permission/BpProtectedInterface.h>
-
-namespace aidl {
-namespace android {
-namespace aidl {
-namespace tests {
-namespace permission {
-static binder_status_t _aidl_android_aidl_tests_permission_IProtectedInterface_onTransact(AIBinder* _aidl_binder, transaction_code_t _aidl_code, const AParcel* _aidl_in, AParcel* _aidl_out) {
- (void)_aidl_in;
- (void)_aidl_out;
- binder_status_t _aidl_ret_status = STATUS_UNKNOWN_TRANSACTION;
- std::shared_ptr<BnProtectedInterface> _aidl_impl = std::static_pointer_cast<BnProtectedInterface>(::ndk::ICInterface::asInterface(_aidl_binder));
- switch (_aidl_code) {
- case (FIRST_CALL_TRANSACTION + 0 /*Method1*/): {
-
- ::ndk::ScopedAStatus _aidl_status = _aidl_impl->Method1();
- _aidl_ret_status = AParcel_writeStatusHeader(_aidl_out, _aidl_status.get());
- if (_aidl_ret_status != STATUS_OK) break;
-
- if (!AStatus_isOk(_aidl_status.get())) break;
-
- break;
- }
- case (FIRST_CALL_TRANSACTION + 1 /*Method2*/): {
-
- ::ndk::ScopedAStatus _aidl_status = _aidl_impl->Method2();
- _aidl_ret_status = AParcel_writeStatusHeader(_aidl_out, _aidl_status.get());
- if (_aidl_ret_status != STATUS_OK) break;
-
- if (!AStatus_isOk(_aidl_status.get())) break;
-
- break;
- }
- }
- return _aidl_ret_status;
-}
-
-static AIBinder_Class* _g_aidl_android_aidl_tests_permission_IProtectedInterface_clazz = ::ndk::ICInterface::defineClass(IProtectedInterface::descriptor, _aidl_android_aidl_tests_permission_IProtectedInterface_onTransact);
-
-BpProtectedInterface::BpProtectedInterface(const ::ndk::SpAIBinder& binder) : BpCInterface(binder) {}
-BpProtectedInterface::~BpProtectedInterface() {}
-
-::ndk::ScopedAStatus BpProtectedInterface::Method1() {
- binder_status_t _aidl_ret_status = STATUS_OK;
- ::ndk::ScopedAStatus _aidl_status;
- ::ndk::ScopedAParcel _aidl_in;
- ::ndk::ScopedAParcel _aidl_out;
-
- _aidl_ret_status = AIBinder_prepareTransaction(asBinder().get(), _aidl_in.getR());
- if (_aidl_ret_status != STATUS_OK) goto _aidl_error;
-
- _aidl_ret_status = AIBinder_transact(
- asBinder().get(),
- (FIRST_CALL_TRANSACTION + 0 /*Method1*/),
- _aidl_in.getR(),
- _aidl_out.getR(),
- 0
- #ifdef BINDER_STABILITY_SUPPORT
- | FLAG_PRIVATE_LOCAL
- #endif // BINDER_STABILITY_SUPPORT
- );
- if (_aidl_ret_status == STATUS_UNKNOWN_TRANSACTION && IProtectedInterface::getDefaultImpl()) {
- _aidl_status = IProtectedInterface::getDefaultImpl()->Method1();
- goto _aidl_status_return;
- }
- if (_aidl_ret_status != STATUS_OK) goto _aidl_error;
-
- _aidl_ret_status = AParcel_readStatusHeader(_aidl_out.get(), _aidl_status.getR());
- if (_aidl_ret_status != STATUS_OK) goto _aidl_error;
-
- if (!AStatus_isOk(_aidl_status.get())) goto _aidl_status_return;
- _aidl_error:
- _aidl_status.set(AStatus_fromStatus(_aidl_ret_status));
- _aidl_status_return:
- return _aidl_status;
-}
-::ndk::ScopedAStatus BpProtectedInterface::Method2() {
- binder_status_t _aidl_ret_status = STATUS_OK;
- ::ndk::ScopedAStatus _aidl_status;
- ::ndk::ScopedAParcel _aidl_in;
- ::ndk::ScopedAParcel _aidl_out;
-
- _aidl_ret_status = AIBinder_prepareTransaction(asBinder().get(), _aidl_in.getR());
- if (_aidl_ret_status != STATUS_OK) goto _aidl_error;
-
- _aidl_ret_status = AIBinder_transact(
- asBinder().get(),
- (FIRST_CALL_TRANSACTION + 1 /*Method2*/),
- _aidl_in.getR(),
- _aidl_out.getR(),
- 0
- #ifdef BINDER_STABILITY_SUPPORT
- | FLAG_PRIVATE_LOCAL
- #endif // BINDER_STABILITY_SUPPORT
- );
- if (_aidl_ret_status == STATUS_UNKNOWN_TRANSACTION && IProtectedInterface::getDefaultImpl()) {
- _aidl_status = IProtectedInterface::getDefaultImpl()->Method2();
- goto _aidl_status_return;
- }
- if (_aidl_ret_status != STATUS_OK) goto _aidl_error;
-
- _aidl_ret_status = AParcel_readStatusHeader(_aidl_out.get(), _aidl_status.getR());
- if (_aidl_ret_status != STATUS_OK) goto _aidl_error;
-
- if (!AStatus_isOk(_aidl_status.get())) goto _aidl_status_return;
- _aidl_error:
- _aidl_status.set(AStatus_fromStatus(_aidl_ret_status));
- _aidl_status_return:
- return _aidl_status;
-}
-// Source for BnProtectedInterface
-BnProtectedInterface::BnProtectedInterface() {}
-BnProtectedInterface::~BnProtectedInterface() {}
-::ndk::SpAIBinder BnProtectedInterface::createBinder() {
- AIBinder* binder = AIBinder_new(_g_aidl_android_aidl_tests_permission_IProtectedInterface_clazz, static_cast<void*>(this));
- #ifdef BINDER_STABILITY_SUPPORT
- AIBinder_markCompilationUnitStability(binder);
- #endif // BINDER_STABILITY_SUPPORT
- return ::ndk::SpAIBinder(binder);
-}
-// Source for IProtectedInterface
-const char* IProtectedInterface::descriptor = "android.aidl.tests.permission.IProtectedInterface";
-IProtectedInterface::IProtectedInterface() {}
-IProtectedInterface::~IProtectedInterface() {}
-
-
-std::shared_ptr<IProtectedInterface> IProtectedInterface::fromBinder(const ::ndk::SpAIBinder& binder) {
- if (!AIBinder_associateClass(binder.get(), _g_aidl_android_aidl_tests_permission_IProtectedInterface_clazz)) { return nullptr; }
- std::shared_ptr<::ndk::ICInterface> interface = ::ndk::ICInterface::asInterface(binder.get());
- if (interface) {
- return std::static_pointer_cast<IProtectedInterface>(interface);
- }
- return ::ndk::SharedRefBase::make<BpProtectedInterface>(binder);
-}
-
-binder_status_t IProtectedInterface::writeToParcel(AParcel* parcel, const std::shared_ptr<IProtectedInterface>& instance) {
- return AParcel_writeStrongBinder(parcel, instance ? instance->asBinder().get() : nullptr);
-}
-binder_status_t IProtectedInterface::readFromParcel(const AParcel* parcel, std::shared_ptr<IProtectedInterface>* instance) {
- ::ndk::SpAIBinder binder;
- binder_status_t status = AParcel_readStrongBinder(parcel, binder.getR());
- if (status != STATUS_OK) return status;
- *instance = IProtectedInterface::fromBinder(binder);
- return STATUS_OK;
-}
-bool IProtectedInterface::setDefaultImpl(const std::shared_ptr<IProtectedInterface>& impl) {
- // Only one user of this interface can use this function
- // at a time. This is a heuristic to detect if two different
- // users in the same process use this function.
- assert(!IProtectedInterface::default_impl);
- if (impl) {
- IProtectedInterface::default_impl = impl;
- return true;
- }
- return false;
-}
-const std::shared_ptr<IProtectedInterface>& IProtectedInterface::getDefaultImpl() {
- return IProtectedInterface::default_impl;
-}
-std::shared_ptr<IProtectedInterface> IProtectedInterface::default_impl = nullptr;
-::ndk::ScopedAStatus IProtectedInterfaceDefault::Method1() {
- ::ndk::ScopedAStatus _aidl_status;
- _aidl_status.set(AStatus_fromStatus(STATUS_UNKNOWN_TRANSACTION));
- return _aidl_status;
-}
-::ndk::ScopedAStatus IProtectedInterfaceDefault::Method2() {
- ::ndk::ScopedAStatus _aidl_status;
- _aidl_status.set(AStatus_fromStatus(STATUS_UNKNOWN_TRANSACTION));
- return _aidl_status;
-}
-::ndk::SpAIBinder IProtectedInterfaceDefault::asBinder() {
- return ::ndk::SpAIBinder();
-}
-bool IProtectedInterfaceDefault::isRemote() {
- return false;
-}
-} // namespace permission
-} // namespace tests
-} // namespace aidl
-} // namespace android
-} // namespace aidl
diff --git a/tests/golden_output/aidl-test-interface-ndk-source/gen/android/aidl/tests/permission/IProtectedInterface.cpp.d b/tests/golden_output/aidl-test-interface-ndk-source/gen/android/aidl/tests/permission/IProtectedInterface.cpp.d
deleted file mode 100644
index 0dbab58..0000000
--- a/tests/golden_output/aidl-test-interface-ndk-source/gen/android/aidl/tests/permission/IProtectedInterface.cpp.d
+++ /dev/null
@@ -1,2 +0,0 @@
-out/soong/.intermediates/system/tools/aidl/aidl-test-interface-ndk-source/gen/android/aidl/tests/permission/IProtectedInterface.cpp : \
- system/tools/aidl/tests/android/aidl/tests/permission/IProtectedInterface.aidl
diff --git a/tests/golden_output/aidl-test-interface-ndk-source/gen/android/aidl/tests/unions/EnumUnion.cpp b/tests/golden_output/aidl-test-interface-ndk-source/gen/android/aidl/tests/unions/EnumUnion.cpp
index 08bcd8c..bb47430 100644
--- a/tests/golden_output/aidl-test-interface-ndk-source/gen/android/aidl/tests/unions/EnumUnion.cpp
+++ b/tests/golden_output/aidl-test-interface-ndk-source/gen/android/aidl/tests/unions/EnumUnion.cpp
@@ -13,7 +13,7 @@
binder_status_t _aidl_ret_status;
int32_t _aidl_tag;
if ((_aidl_ret_status = ::ndk::AParcel_readData(_parcel, &_aidl_tag)) != STATUS_OK) return _aidl_ret_status;
- switch (_aidl_tag) {
+ switch (static_cast<Tag>(_aidl_tag)) {
case intEnum: {
::aidl::android::aidl::tests::IntEnum _aidl_value;
if ((_aidl_ret_status = ::ndk::AParcel_readData(_parcel, &_aidl_value)) != STATUS_OK) return _aidl_ret_status;
@@ -38,7 +38,7 @@
return STATUS_BAD_VALUE;
}
binder_status_t EnumUnion::writeToParcel(AParcel* _parcel) const {
- binder_status_t _aidl_ret_status = ::ndk::AParcel_writeData(_parcel, getTag());
+ binder_status_t _aidl_ret_status = ::ndk::AParcel_writeData(_parcel, static_cast<int32_t>(getTag()));
if (_aidl_ret_status != STATUS_OK) return _aidl_ret_status;
switch (getTag()) {
case intEnum: return ::ndk::AParcel_writeData(_parcel, get<intEnum>());
diff --git a/tests/golden_output/aidl-test-interface-ndk-source/gen/android/aidl/tests/unions/UnionInUnion.cpp b/tests/golden_output/aidl-test-interface-ndk-source/gen/android/aidl/tests/unions/UnionInUnion.cpp
index 5db5c98..670eb34 100644
--- a/tests/golden_output/aidl-test-interface-ndk-source/gen/android/aidl/tests/unions/UnionInUnion.cpp
+++ b/tests/golden_output/aidl-test-interface-ndk-source/gen/android/aidl/tests/unions/UnionInUnion.cpp
@@ -13,7 +13,7 @@
binder_status_t _aidl_ret_status;
int32_t _aidl_tag;
if ((_aidl_ret_status = ::ndk::AParcel_readData(_parcel, &_aidl_tag)) != STATUS_OK) return _aidl_ret_status;
- switch (_aidl_tag) {
+ switch (static_cast<Tag>(_aidl_tag)) {
case first: {
::aidl::android::aidl::tests::unions::EnumUnion _aidl_value;
if ((_aidl_ret_status = ::ndk::AParcel_readData(_parcel, &_aidl_value)) != STATUS_OK) return _aidl_ret_status;
@@ -38,7 +38,7 @@
return STATUS_BAD_VALUE;
}
binder_status_t UnionInUnion::writeToParcel(AParcel* _parcel) const {
- binder_status_t _aidl_ret_status = ::ndk::AParcel_writeData(_parcel, getTag());
+ binder_status_t _aidl_ret_status = ::ndk::AParcel_writeData(_parcel, static_cast<int32_t>(getTag()));
if (_aidl_ret_status != STATUS_OK) return _aidl_ret_status;
switch (getTag()) {
case first: return ::ndk::AParcel_writeData(_parcel, get<first>());
diff --git a/tests/golden_output/aidl-test-interface-ndk-source/gen/include/aidl/android/aidl/tests/ArrayOfInterfaces.h b/tests/golden_output/aidl-test-interface-ndk-source/gen/include/aidl/android/aidl/tests/ArrayOfInterfaces.h
index 6e43bf0..40951a7 100644
--- a/tests/golden_output/aidl-test-interface-ndk-source/gen/include/aidl/android/aidl/tests/ArrayOfInterfaces.h
+++ b/tests/golden_output/aidl-test-interface-ndk-source/gen/include/aidl/android/aidl/tests/ArrayOfInterfaces.h
@@ -162,7 +162,7 @@
template<typename _Tp>
static constexpr bool _not_self = !std::is_same_v<std::remove_cv_t<std::remove_reference_t<_Tp>>, MyUnion>;
- MyUnion() : _value(std::in_place_index<iface>, std::shared_ptr<::aidl::android::aidl::tests::ArrayOfInterfaces::IEmptyInterface>()) { }
+ MyUnion() : _value(std::in_place_index<static_cast<size_t>(iface)>, std::shared_ptr<::aidl::android::aidl::tests::ArrayOfInterfaces::IEmptyInterface>()) { }
template <typename _Tp, typename = std::enable_if_t<_not_self<_Tp>>>
// NOLINTNEXTLINE(google-explicit-constructor)
@@ -175,12 +175,12 @@
template <Tag _tag, typename... _Tp>
static MyUnion make(_Tp&&... _args) {
- return MyUnion(std::in_place_index<_tag>, std::forward<_Tp>(_args)...);
+ return MyUnion(std::in_place_index<static_cast<size_t>(_tag)>, std::forward<_Tp>(_args)...);
}
template <Tag _tag, typename _Tp, typename... _Up>
static MyUnion make(std::initializer_list<_Tp> _il, _Up&&... _args) {
- return MyUnion(std::in_place_index<_tag>, std::move(_il), std::forward<_Up>(_args)...);
+ return MyUnion(std::in_place_index<static_cast<size_t>(_tag)>, std::move(_il), std::forward<_Up>(_args)...);
}
Tag getTag() const {
@@ -190,18 +190,18 @@
template <Tag _tag>
const auto& get() const {
if (getTag() != _tag) { __assert2(__FILE__, __LINE__, __PRETTY_FUNCTION__, "bad access: a wrong tag"); }
- return std::get<_tag>(_value);
+ return std::get<static_cast<size_t>(_tag)>(_value);
}
template <Tag _tag>
auto& get() {
if (getTag() != _tag) { __assert2(__FILE__, __LINE__, __PRETTY_FUNCTION__, "bad access: a wrong tag"); }
- return std::get<_tag>(_value);
+ return std::get<static_cast<size_t>(_tag)>(_value);
}
template <Tag _tag, typename... _Tp>
void set(_Tp&&... _args) {
- _value.emplace<_tag>(std::forward<_Tp>(_args)...);
+ _value.emplace<static_cast<size_t>(_tag)>(std::forward<_Tp>(_args)...);
}
binder_status_t readFromParcel(const AParcel* _parcel);
diff --git a/tests/golden_output/aidl-test-interface-ndk-source/gen/include/aidl/android/aidl/tests/FixedSize.h b/tests/golden_output/aidl-test-interface-ndk-source/gen/include/aidl/android/aidl/tests/FixedSize.h
index 2a78374..7c92e11 100644
--- a/tests/golden_output/aidl-test-interface-ndk-source/gen/include/aidl/android/aidl/tests/FixedSize.h
+++ b/tests/golden_output/aidl-test-interface-ndk-source/gen/include/aidl/android/aidl/tests/FixedSize.h
@@ -49,7 +49,7 @@
};
template <Tag _Tag>
- using _at = typename std::tuple_element<_Tag, std::tuple<bool, int8_t, char16_t, int32_t, int64_t, float, double, ::aidl::android::aidl::tests::LongEnum>>::type;
+ using _at = typename std::tuple_element<static_cast<size_t>(_Tag), std::tuple<bool, int8_t, char16_t, int32_t, int64_t, float, double, ::aidl::android::aidl::tests::LongEnum>>::type;
template <Tag _Tag, typename _Type>
static FixedUnion make(_Type&& _arg) {
FixedUnion _inst;
@@ -87,7 +87,7 @@
} else {
return (_lhs.getTag() == _Tag)
? _cmp_value(_lhs.get<_Tag>(), _rhs.get<_Tag>())
- : _cmp_value_at<(Tag)(_Tag-1)>(_lhs, _rhs);
+ : _cmp_value_at<static_cast<Tag>(static_cast<size_t>(_Tag)-1)>(_lhs, _rhs);
}
}
template <typename _Type>
diff --git a/tests/golden_output/aidl-test-interface-ndk-source/gen/include/aidl/android/aidl/tests/ListOfInterfaces.h b/tests/golden_output/aidl-test-interface-ndk-source/gen/include/aidl/android/aidl/tests/ListOfInterfaces.h
index a669820..7c93f75 100644
--- a/tests/golden_output/aidl-test-interface-ndk-source/gen/include/aidl/android/aidl/tests/ListOfInterfaces.h
+++ b/tests/golden_output/aidl-test-interface-ndk-source/gen/include/aidl/android/aidl/tests/ListOfInterfaces.h
@@ -162,7 +162,7 @@
template<typename _Tp>
static constexpr bool _not_self = !std::is_same_v<std::remove_cv_t<std::remove_reference_t<_Tp>>, MyUnion>;
- MyUnion() : _value(std::in_place_index<iface>, std::shared_ptr<::aidl::android::aidl::tests::ListOfInterfaces::IEmptyInterface>()) { }
+ MyUnion() : _value(std::in_place_index<static_cast<size_t>(iface)>, std::shared_ptr<::aidl::android::aidl::tests::ListOfInterfaces::IEmptyInterface>()) { }
template <typename _Tp, typename = std::enable_if_t<_not_self<_Tp>>>
// NOLINTNEXTLINE(google-explicit-constructor)
@@ -175,12 +175,12 @@
template <Tag _tag, typename... _Tp>
static MyUnion make(_Tp&&... _args) {
- return MyUnion(std::in_place_index<_tag>, std::forward<_Tp>(_args)...);
+ return MyUnion(std::in_place_index<static_cast<size_t>(_tag)>, std::forward<_Tp>(_args)...);
}
template <Tag _tag, typename _Tp, typename... _Up>
static MyUnion make(std::initializer_list<_Tp> _il, _Up&&... _args) {
- return MyUnion(std::in_place_index<_tag>, std::move(_il), std::forward<_Up>(_args)...);
+ return MyUnion(std::in_place_index<static_cast<size_t>(_tag)>, std::move(_il), std::forward<_Up>(_args)...);
}
Tag getTag() const {
@@ -190,18 +190,18 @@
template <Tag _tag>
const auto& get() const {
if (getTag() != _tag) { __assert2(__FILE__, __LINE__, __PRETTY_FUNCTION__, "bad access: a wrong tag"); }
- return std::get<_tag>(_value);
+ return std::get<static_cast<size_t>(_tag)>(_value);
}
template <Tag _tag>
auto& get() {
if (getTag() != _tag) { __assert2(__FILE__, __LINE__, __PRETTY_FUNCTION__, "bad access: a wrong tag"); }
- return std::get<_tag>(_value);
+ return std::get<static_cast<size_t>(_tag)>(_value);
}
template <Tag _tag, typename... _Tp>
void set(_Tp&&... _args) {
- _value.emplace<_tag>(std::forward<_Tp>(_args)...);
+ _value.emplace<static_cast<size_t>(_tag)>(std::forward<_Tp>(_args)...);
}
binder_status_t readFromParcel(const AParcel* _parcel);
diff --git a/tests/golden_output/aidl-test-interface-ndk-source/gen/include/aidl/android/aidl/tests/Union.h b/tests/golden_output/aidl-test-interface-ndk-source/gen/include/aidl/android/aidl/tests/Union.h
index 7b6c7f8..27ee97c 100644
--- a/tests/golden_output/aidl-test-interface-ndk-source/gen/include/aidl/android/aidl/tests/Union.h
+++ b/tests/golden_output/aidl-test-interface-ndk-source/gen/include/aidl/android/aidl/tests/Union.h
@@ -43,7 +43,7 @@
template<typename _Tp>
static constexpr bool _not_self = !std::is_same_v<std::remove_cv_t<std::remove_reference_t<_Tp>>, Union>;
- Union() : _value(std::in_place_index<ns>, std::vector<int32_t>({})) { }
+ Union() : _value(std::in_place_index<static_cast<size_t>(ns)>, std::vector<int32_t>({})) { }
template <typename _Tp, typename = std::enable_if_t<_not_self<_Tp>>>
// NOLINTNEXTLINE(google-explicit-constructor)
@@ -56,12 +56,12 @@
template <Tag _tag, typename... _Tp>
static Union make(_Tp&&... _args) {
- return Union(std::in_place_index<_tag>, std::forward<_Tp>(_args)...);
+ return Union(std::in_place_index<static_cast<size_t>(_tag)>, std::forward<_Tp>(_args)...);
}
template <Tag _tag, typename _Tp, typename... _Up>
static Union make(std::initializer_list<_Tp> _il, _Up&&... _args) {
- return Union(std::in_place_index<_tag>, std::move(_il), std::forward<_Up>(_args)...);
+ return Union(std::in_place_index<static_cast<size_t>(_tag)>, std::move(_il), std::forward<_Up>(_args)...);
}
Tag getTag() const {
@@ -71,18 +71,18 @@
template <Tag _tag>
const auto& get() const {
if (getTag() != _tag) { __assert2(__FILE__, __LINE__, __PRETTY_FUNCTION__, "bad access: a wrong tag"); }
- return std::get<_tag>(_value);
+ return std::get<static_cast<size_t>(_tag)>(_value);
}
template <Tag _tag>
auto& get() {
if (getTag() != _tag) { __assert2(__FILE__, __LINE__, __PRETTY_FUNCTION__, "bad access: a wrong tag"); }
- return std::get<_tag>(_value);
+ return std::get<static_cast<size_t>(_tag)>(_value);
}
template <Tag _tag, typename... _Tp>
void set(_Tp&&... _args) {
- _value.emplace<_tag>(std::forward<_Tp>(_args)...);
+ _value.emplace<static_cast<size_t>(_tag)>(std::forward<_Tp>(_args)...);
}
binder_status_t readFromParcel(const AParcel* _parcel);
diff --git a/tests/golden_output/aidl-test-interface-ndk-source/gen/include/aidl/android/aidl/tests/UnionWithFd.h b/tests/golden_output/aidl-test-interface-ndk-source/gen/include/aidl/android/aidl/tests/UnionWithFd.h
index e1929bf..818ff01 100644
--- a/tests/golden_output/aidl-test-interface-ndk-source/gen/include/aidl/android/aidl/tests/UnionWithFd.h
+++ b/tests/golden_output/aidl-test-interface-ndk-source/gen/include/aidl/android/aidl/tests/UnionWithFd.h
@@ -37,7 +37,7 @@
template<typename _Tp>
static constexpr bool _not_self = !std::is_same_v<std::remove_cv_t<std::remove_reference_t<_Tp>>, UnionWithFd>;
- UnionWithFd() : _value(std::in_place_index<num>, int32_t(0)) { }
+ UnionWithFd() : _value(std::in_place_index<static_cast<size_t>(num)>, int32_t(0)) { }
template <typename _Tp, typename = std::enable_if_t<_not_self<_Tp>>>
// NOLINTNEXTLINE(google-explicit-constructor)
@@ -50,12 +50,12 @@
template <Tag _tag, typename... _Tp>
static UnionWithFd make(_Tp&&... _args) {
- return UnionWithFd(std::in_place_index<_tag>, std::forward<_Tp>(_args)...);
+ return UnionWithFd(std::in_place_index<static_cast<size_t>(_tag)>, std::forward<_Tp>(_args)...);
}
template <Tag _tag, typename _Tp, typename... _Up>
static UnionWithFd make(std::initializer_list<_Tp> _il, _Up&&... _args) {
- return UnionWithFd(std::in_place_index<_tag>, std::move(_il), std::forward<_Up>(_args)...);
+ return UnionWithFd(std::in_place_index<static_cast<size_t>(_tag)>, std::move(_il), std::forward<_Up>(_args)...);
}
Tag getTag() const {
@@ -65,18 +65,18 @@
template <Tag _tag>
const auto& get() const {
if (getTag() != _tag) { __assert2(__FILE__, __LINE__, __PRETTY_FUNCTION__, "bad access: a wrong tag"); }
- return std::get<_tag>(_value);
+ return std::get<static_cast<size_t>(_tag)>(_value);
}
template <Tag _tag>
auto& get() {
if (getTag() != _tag) { __assert2(__FILE__, __LINE__, __PRETTY_FUNCTION__, "bad access: a wrong tag"); }
- return std::get<_tag>(_value);
+ return std::get<static_cast<size_t>(_tag)>(_value);
}
template <Tag _tag, typename... _Tp>
void set(_Tp&&... _args) {
- _value.emplace<_tag>(std::forward<_Tp>(_args)...);
+ _value.emplace<static_cast<size_t>(_tag)>(std::forward<_Tp>(_args)...);
}
binder_status_t readFromParcel(const AParcel* _parcel);
diff --git a/tests/golden_output/aidl-test-interface-ndk-source/gen/include/aidl/android/aidl/tests/permission/BnProtected.h b/tests/golden_output/aidl-test-interface-ndk-source/gen/include/aidl/android/aidl/tests/permission/BnProtected.h
deleted file mode 100644
index 150c5b8..0000000
--- a/tests/golden_output/aidl-test-interface-ndk-source/gen/include/aidl/android/aidl/tests/permission/BnProtected.h
+++ /dev/null
@@ -1,24 +0,0 @@
-#pragma once
-
-#include "aidl/android/aidl/tests/permission/IProtected.h"
-
-#include <android/binder_ibinder.h>
-
-namespace aidl {
-namespace android {
-namespace aidl {
-namespace tests {
-namespace permission {
-class BnProtected : public ::ndk::BnCInterface<IProtected> {
-public:
- BnProtected();
- virtual ~BnProtected();
-protected:
- ::ndk::SpAIBinder createBinder() override;
-private:
-};
-} // namespace permission
-} // namespace tests
-} // namespace aidl
-} // namespace android
-} // namespace aidl
diff --git a/tests/golden_output/aidl-test-interface-ndk-source/gen/include/aidl/android/aidl/tests/permission/BnProtectedInterface.h b/tests/golden_output/aidl-test-interface-ndk-source/gen/include/aidl/android/aidl/tests/permission/BnProtectedInterface.h
deleted file mode 100644
index ac2a46c..0000000
--- a/tests/golden_output/aidl-test-interface-ndk-source/gen/include/aidl/android/aidl/tests/permission/BnProtectedInterface.h
+++ /dev/null
@@ -1,24 +0,0 @@
-#pragma once
-
-#include "aidl/android/aidl/tests/permission/IProtectedInterface.h"
-
-#include <android/binder_ibinder.h>
-
-namespace aidl {
-namespace android {
-namespace aidl {
-namespace tests {
-namespace permission {
-class BnProtectedInterface : public ::ndk::BnCInterface<IProtectedInterface> {
-public:
- BnProtectedInterface();
- virtual ~BnProtectedInterface();
-protected:
- ::ndk::SpAIBinder createBinder() override;
-private:
-};
-} // namespace permission
-} // namespace tests
-} // namespace aidl
-} // namespace android
-} // namespace aidl
diff --git a/tests/golden_output/aidl-test-interface-ndk-source/gen/include/aidl/android/aidl/tests/permission/BpProtected.h b/tests/golden_output/aidl-test-interface-ndk-source/gen/include/aidl/android/aidl/tests/permission/BpProtected.h
deleted file mode 100644
index f3d8ee9..0000000
--- a/tests/golden_output/aidl-test-interface-ndk-source/gen/include/aidl/android/aidl/tests/permission/BpProtected.h
+++ /dev/null
@@ -1,25 +0,0 @@
-#pragma once
-
-#include "aidl/android/aidl/tests/permission/IProtected.h"
-
-#include <android/binder_ibinder.h>
-
-namespace aidl {
-namespace android {
-namespace aidl {
-namespace tests {
-namespace permission {
-class BpProtected : public ::ndk::BpCInterface<IProtected> {
-public:
- explicit BpProtected(const ::ndk::SpAIBinder& binder);
- virtual ~BpProtected();
-
- ::ndk::ScopedAStatus PermissionProtected() override;
- ::ndk::ScopedAStatus MultiplePermissionsAll() override;
- ::ndk::ScopedAStatus MultiplePermissionsAny() override;
-};
-} // namespace permission
-} // namespace tests
-} // namespace aidl
-} // namespace android
-} // namespace aidl
diff --git a/tests/golden_output/aidl-test-interface-ndk-source/gen/include/aidl/android/aidl/tests/permission/BpProtectedInterface.h b/tests/golden_output/aidl-test-interface-ndk-source/gen/include/aidl/android/aidl/tests/permission/BpProtectedInterface.h
deleted file mode 100644
index 7878862..0000000
--- a/tests/golden_output/aidl-test-interface-ndk-source/gen/include/aidl/android/aidl/tests/permission/BpProtectedInterface.h
+++ /dev/null
@@ -1,24 +0,0 @@
-#pragma once
-
-#include "aidl/android/aidl/tests/permission/IProtectedInterface.h"
-
-#include <android/binder_ibinder.h>
-
-namespace aidl {
-namespace android {
-namespace aidl {
-namespace tests {
-namespace permission {
-class BpProtectedInterface : public ::ndk::BpCInterface<IProtectedInterface> {
-public:
- explicit BpProtectedInterface(const ::ndk::SpAIBinder& binder);
- virtual ~BpProtectedInterface();
-
- ::ndk::ScopedAStatus Method1() override;
- ::ndk::ScopedAStatus Method2() override;
-};
-} // namespace permission
-} // namespace tests
-} // namespace aidl
-} // namespace android
-} // namespace aidl
diff --git a/tests/golden_output/aidl-test-interface-ndk-source/gen/include/aidl/android/aidl/tests/permission/IProtected.h b/tests/golden_output/aidl-test-interface-ndk-source/gen/include/aidl/android/aidl/tests/permission/IProtected.h
deleted file mode 100644
index b3bc190..0000000
--- a/tests/golden_output/aidl-test-interface-ndk-source/gen/include/aidl/android/aidl/tests/permission/IProtected.h
+++ /dev/null
@@ -1,51 +0,0 @@
-#pragma once
-
-#include <cstdint>
-#include <memory>
-#include <optional>
-#include <string>
-#include <vector>
-#include <android/binder_interface_utils.h>
-#ifdef BINDER_STABILITY_SUPPORT
-#include <android/binder_stability.h>
-#endif // BINDER_STABILITY_SUPPORT
-
-namespace aidl {
-namespace android {
-namespace aidl {
-namespace tests {
-namespace permission {
-class IProtected : public ::ndk::ICInterface {
-public:
- static const char* descriptor;
- IProtected();
- virtual ~IProtected();
-
- static constexpr uint32_t TRANSACTION_PermissionProtected = FIRST_CALL_TRANSACTION + 0;
- static constexpr uint32_t TRANSACTION_MultiplePermissionsAll = FIRST_CALL_TRANSACTION + 1;
- static constexpr uint32_t TRANSACTION_MultiplePermissionsAny = FIRST_CALL_TRANSACTION + 2;
-
- static std::shared_ptr<IProtected> fromBinder(const ::ndk::SpAIBinder& binder);
- static binder_status_t writeToParcel(AParcel* parcel, const std::shared_ptr<IProtected>& instance);
- static binder_status_t readFromParcel(const AParcel* parcel, std::shared_ptr<IProtected>* instance);
- static bool setDefaultImpl(const std::shared_ptr<IProtected>& impl);
- static const std::shared_ptr<IProtected>& getDefaultImpl();
- virtual ::ndk::ScopedAStatus PermissionProtected() = 0;
- virtual ::ndk::ScopedAStatus MultiplePermissionsAll() = 0;
- virtual ::ndk::ScopedAStatus MultiplePermissionsAny() = 0;
-private:
- static std::shared_ptr<IProtected> default_impl;
-};
-class IProtectedDefault : public IProtected {
-public:
- ::ndk::ScopedAStatus PermissionProtected() override;
- ::ndk::ScopedAStatus MultiplePermissionsAll() override;
- ::ndk::ScopedAStatus MultiplePermissionsAny() override;
- ::ndk::SpAIBinder asBinder() override;
- bool isRemote() override;
-};
-} // namespace permission
-} // namespace tests
-} // namespace aidl
-} // namespace android
-} // namespace aidl
diff --git a/tests/golden_output/aidl-test-interface-ndk-source/gen/include/aidl/android/aidl/tests/permission/IProtectedInterface.h b/tests/golden_output/aidl-test-interface-ndk-source/gen/include/aidl/android/aidl/tests/permission/IProtectedInterface.h
deleted file mode 100644
index 2afb203..0000000
--- a/tests/golden_output/aidl-test-interface-ndk-source/gen/include/aidl/android/aidl/tests/permission/IProtectedInterface.h
+++ /dev/null
@@ -1,48 +0,0 @@
-#pragma once
-
-#include <cstdint>
-#include <memory>
-#include <optional>
-#include <string>
-#include <vector>
-#include <android/binder_interface_utils.h>
-#ifdef BINDER_STABILITY_SUPPORT
-#include <android/binder_stability.h>
-#endif // BINDER_STABILITY_SUPPORT
-
-namespace aidl {
-namespace android {
-namespace aidl {
-namespace tests {
-namespace permission {
-class IProtectedInterface : public ::ndk::ICInterface {
-public:
- static const char* descriptor;
- IProtectedInterface();
- virtual ~IProtectedInterface();
-
- static constexpr uint32_t TRANSACTION_Method1 = FIRST_CALL_TRANSACTION + 0;
- static constexpr uint32_t TRANSACTION_Method2 = FIRST_CALL_TRANSACTION + 1;
-
- static std::shared_ptr<IProtectedInterface> fromBinder(const ::ndk::SpAIBinder& binder);
- static binder_status_t writeToParcel(AParcel* parcel, const std::shared_ptr<IProtectedInterface>& instance);
- static binder_status_t readFromParcel(const AParcel* parcel, std::shared_ptr<IProtectedInterface>* instance);
- static bool setDefaultImpl(const std::shared_ptr<IProtectedInterface>& impl);
- static const std::shared_ptr<IProtectedInterface>& getDefaultImpl();
- virtual ::ndk::ScopedAStatus Method1() = 0;
- virtual ::ndk::ScopedAStatus Method2() = 0;
-private:
- static std::shared_ptr<IProtectedInterface> default_impl;
-};
-class IProtectedInterfaceDefault : public IProtectedInterface {
-public:
- ::ndk::ScopedAStatus Method1() override;
- ::ndk::ScopedAStatus Method2() override;
- ::ndk::SpAIBinder asBinder() override;
- bool isRemote() override;
-};
-} // namespace permission
-} // namespace tests
-} // namespace aidl
-} // namespace android
-} // namespace aidl
diff --git a/tests/golden_output/aidl-test-interface-ndk-source/gen/include/aidl/android/aidl/tests/unions/EnumUnion.h b/tests/golden_output/aidl-test-interface-ndk-source/gen/include/aidl/android/aidl/tests/unions/EnumUnion.h
index 77c10d1..dc3c3fb 100644
--- a/tests/golden_output/aidl-test-interface-ndk-source/gen/include/aidl/android/aidl/tests/unions/EnumUnion.h
+++ b/tests/golden_output/aidl-test-interface-ndk-source/gen/include/aidl/android/aidl/tests/unions/EnumUnion.h
@@ -40,7 +40,7 @@
template<typename _Tp>
static constexpr bool _not_self = !std::is_same_v<std::remove_cv_t<std::remove_reference_t<_Tp>>, EnumUnion>;
- EnumUnion() : _value(std::in_place_index<intEnum>, ::aidl::android::aidl::tests::IntEnum(::aidl::android::aidl::tests::IntEnum::FOO)) { }
+ EnumUnion() : _value(std::in_place_index<static_cast<size_t>(intEnum)>, ::aidl::android::aidl::tests::IntEnum(::aidl::android::aidl::tests::IntEnum::FOO)) { }
template <typename _Tp, typename = std::enable_if_t<_not_self<_Tp>>>
// NOLINTNEXTLINE(google-explicit-constructor)
@@ -53,12 +53,12 @@
template <Tag _tag, typename... _Tp>
static EnumUnion make(_Tp&&... _args) {
- return EnumUnion(std::in_place_index<_tag>, std::forward<_Tp>(_args)...);
+ return EnumUnion(std::in_place_index<static_cast<size_t>(_tag)>, std::forward<_Tp>(_args)...);
}
template <Tag _tag, typename _Tp, typename... _Up>
static EnumUnion make(std::initializer_list<_Tp> _il, _Up&&... _args) {
- return EnumUnion(std::in_place_index<_tag>, std::move(_il), std::forward<_Up>(_args)...);
+ return EnumUnion(std::in_place_index<static_cast<size_t>(_tag)>, std::move(_il), std::forward<_Up>(_args)...);
}
Tag getTag() const {
@@ -68,18 +68,18 @@
template <Tag _tag>
const auto& get() const {
if (getTag() != _tag) { __assert2(__FILE__, __LINE__, __PRETTY_FUNCTION__, "bad access: a wrong tag"); }
- return std::get<_tag>(_value);
+ return std::get<static_cast<size_t>(_tag)>(_value);
}
template <Tag _tag>
auto& get() {
if (getTag() != _tag) { __assert2(__FILE__, __LINE__, __PRETTY_FUNCTION__, "bad access: a wrong tag"); }
- return std::get<_tag>(_value);
+ return std::get<static_cast<size_t>(_tag)>(_value);
}
template <Tag _tag, typename... _Tp>
void set(_Tp&&... _args) {
- _value.emplace<_tag>(std::forward<_Tp>(_args)...);
+ _value.emplace<static_cast<size_t>(_tag)>(std::forward<_Tp>(_args)...);
}
binder_status_t readFromParcel(const AParcel* _parcel);
diff --git a/tests/golden_output/aidl-test-interface-ndk-source/gen/include/aidl/android/aidl/tests/unions/UnionInUnion.h b/tests/golden_output/aidl-test-interface-ndk-source/gen/include/aidl/android/aidl/tests/unions/UnionInUnion.h
index 8dc56f2..147a566 100644
--- a/tests/golden_output/aidl-test-interface-ndk-source/gen/include/aidl/android/aidl/tests/unions/UnionInUnion.h
+++ b/tests/golden_output/aidl-test-interface-ndk-source/gen/include/aidl/android/aidl/tests/unions/UnionInUnion.h
@@ -39,7 +39,7 @@
template<typename _Tp>
static constexpr bool _not_self = !std::is_same_v<std::remove_cv_t<std::remove_reference_t<_Tp>>, UnionInUnion>;
- UnionInUnion() : _value(std::in_place_index<first>, ::aidl::android::aidl::tests::unions::EnumUnion()) { }
+ UnionInUnion() : _value(std::in_place_index<static_cast<size_t>(first)>, ::aidl::android::aidl::tests::unions::EnumUnion()) { }
template <typename _Tp, typename = std::enable_if_t<_not_self<_Tp>>>
// NOLINTNEXTLINE(google-explicit-constructor)
@@ -52,12 +52,12 @@
template <Tag _tag, typename... _Tp>
static UnionInUnion make(_Tp&&... _args) {
- return UnionInUnion(std::in_place_index<_tag>, std::forward<_Tp>(_args)...);
+ return UnionInUnion(std::in_place_index<static_cast<size_t>(_tag)>, std::forward<_Tp>(_args)...);
}
template <Tag _tag, typename _Tp, typename... _Up>
static UnionInUnion make(std::initializer_list<_Tp> _il, _Up&&... _args) {
- return UnionInUnion(std::in_place_index<_tag>, std::move(_il), std::forward<_Up>(_args)...);
+ return UnionInUnion(std::in_place_index<static_cast<size_t>(_tag)>, std::move(_il), std::forward<_Up>(_args)...);
}
Tag getTag() const {
@@ -67,18 +67,18 @@
template <Tag _tag>
const auto& get() const {
if (getTag() != _tag) { __assert2(__FILE__, __LINE__, __PRETTY_FUNCTION__, "bad access: a wrong tag"); }
- return std::get<_tag>(_value);
+ return std::get<static_cast<size_t>(_tag)>(_value);
}
template <Tag _tag>
auto& get() {
if (getTag() != _tag) { __assert2(__FILE__, __LINE__, __PRETTY_FUNCTION__, "bad access: a wrong tag"); }
- return std::get<_tag>(_value);
+ return std::get<static_cast<size_t>(_tag)>(_value);
}
template <Tag _tag, typename... _Tp>
void set(_Tp&&... _args) {
- _value.emplace<_tag>(std::forward<_Tp>(_args)...);
+ _value.emplace<static_cast<size_t>(_tag)>(std::forward<_Tp>(_args)...);
}
binder_status_t readFromParcel(const AParcel* _parcel);
diff --git a/tests/golden_output/aidl-test-interface-java-source/gen/android/aidl/tests/permission/IProtected.java b/tests/golden_output/aidl-test-interface-permission-java-source/gen/android/aidl/tests/permission/IProtected.java
similarity index 96%
rename from tests/golden_output/aidl-test-interface-java-source/gen/android/aidl/tests/permission/IProtected.java
rename to tests/golden_output/aidl-test-interface-permission-java-source/gen/android/aidl/tests/permission/IProtected.java
index 0a3ad19..9448d5d 100644
--- a/tests/golden_output/aidl-test-interface-java-source/gen/android/aidl/tests/permission/IProtected.java
+++ b/tests/golden_output/aidl-test-interface-permission-java-source/gen/android/aidl/tests/permission/IProtected.java
@@ -115,7 +115,7 @@
}
@Override public void PermissionProtected() throws android.os.RemoteException
{
- android.os.Parcel _data = android.os.Parcel.obtain(asBinder());
+ android.os.Parcel _data = android.os.Parcel.obtain();
android.os.Parcel _reply = android.os.Parcel.obtain();
try {
_data.writeInterfaceToken(DESCRIPTOR);
@@ -129,7 +129,7 @@
}
@Override public void MultiplePermissionsAll() throws android.os.RemoteException
{
- android.os.Parcel _data = android.os.Parcel.obtain(asBinder());
+ android.os.Parcel _data = android.os.Parcel.obtain();
android.os.Parcel _reply = android.os.Parcel.obtain();
try {
_data.writeInterfaceToken(DESCRIPTOR);
@@ -143,7 +143,7 @@
}
@Override public void MultiplePermissionsAny() throws android.os.RemoteException
{
- android.os.Parcel _data = android.os.Parcel.obtain(asBinder());
+ android.os.Parcel _data = android.os.Parcel.obtain();
android.os.Parcel _reply = android.os.Parcel.obtain();
try {
_data.writeInterfaceToken(DESCRIPTOR);
diff --git a/tests/golden_output/aidl-test-interface-permission-java-source/gen/android/aidl/tests/permission/IProtected.java.d b/tests/golden_output/aidl-test-interface-permission-java-source/gen/android/aidl/tests/permission/IProtected.java.d
new file mode 100644
index 0000000..752e4bf
--- /dev/null
+++ b/tests/golden_output/aidl-test-interface-permission-java-source/gen/android/aidl/tests/permission/IProtected.java.d
@@ -0,0 +1,2 @@
+out/soong/.intermediates/system/tools/aidl/aidl-test-interface-permission-java-source/gen/android/aidl/tests/permission/IProtected.java : \
+ system/tools/aidl/tests/android/aidl/tests/permission/IProtected.aidl
diff --git a/tests/golden_output/aidl-test-interface-java-source/gen/android/aidl/tests/permission/IProtectedInterface.java b/tests/golden_output/aidl-test-interface-permission-java-source/gen/android/aidl/tests/permission/IProtectedInterface.java
similarity index 97%
rename from tests/golden_output/aidl-test-interface-java-source/gen/android/aidl/tests/permission/IProtectedInterface.java
rename to tests/golden_output/aidl-test-interface-permission-java-source/gen/android/aidl/tests/permission/IProtectedInterface.java
index 13392fd..e8d1c1b 100644
--- a/tests/golden_output/aidl-test-interface-java-source/gen/android/aidl/tests/permission/IProtectedInterface.java
+++ b/tests/golden_output/aidl-test-interface-permission-java-source/gen/android/aidl/tests/permission/IProtectedInterface.java
@@ -107,7 +107,7 @@
}
@Override public void Method1() throws android.os.RemoteException
{
- android.os.Parcel _data = android.os.Parcel.obtain(asBinder());
+ android.os.Parcel _data = android.os.Parcel.obtain();
android.os.Parcel _reply = android.os.Parcel.obtain();
try {
_data.writeInterfaceToken(DESCRIPTOR);
@@ -121,7 +121,7 @@
}
@Override public void Method2() throws android.os.RemoteException
{
- android.os.Parcel _data = android.os.Parcel.obtain(asBinder());
+ android.os.Parcel _data = android.os.Parcel.obtain();
android.os.Parcel _reply = android.os.Parcel.obtain();
try {
_data.writeInterfaceToken(DESCRIPTOR);
diff --git a/tests/golden_output/aidl-test-interface-permission-java-source/gen/android/aidl/tests/permission/IProtectedInterface.java.d b/tests/golden_output/aidl-test-interface-permission-java-source/gen/android/aidl/tests/permission/IProtectedInterface.java.d
new file mode 100644
index 0000000..1a36e38
--- /dev/null
+++ b/tests/golden_output/aidl-test-interface-permission-java-source/gen/android/aidl/tests/permission/IProtectedInterface.java.d
@@ -0,0 +1,2 @@
+out/soong/.intermediates/system/tools/aidl/aidl-test-interface-permission-java-source/gen/android/aidl/tests/permission/IProtectedInterface.java : \
+ system/tools/aidl/tests/android/aidl/tests/permission/IProtectedInterface.aidl
diff --git a/tests/golden_output/aidl-test-interface-permission-java-source/gen/android/aidl/tests/permission/platform/IProtected.java b/tests/golden_output/aidl-test-interface-permission-java-source/gen/android/aidl/tests/permission/platform/IProtected.java
new file mode 100644
index 0000000..7b6d96f
--- /dev/null
+++ b/tests/golden_output/aidl-test-interface-permission-java-source/gen/android/aidl/tests/permission/platform/IProtected.java
@@ -0,0 +1,124 @@
+/*
+ * This file is auto-generated. DO NOT MODIFY.
+ */
+package android.aidl.tests.permission.platform;
+public interface IProtected extends android.os.IInterface
+{
+ /** Default implementation for IProtected. */
+ public static class Default implements android.aidl.tests.permission.platform.IProtected
+ {
+ @Override public void ProtectedWithSourceAttribution(android.content.AttributionSource source) throws android.os.RemoteException
+ {
+ }
+ @Override
+ public android.os.IBinder asBinder() {
+ return null;
+ }
+ }
+ /** Local-side IPC implementation stub class. */
+ public static abstract class Stub extends android.os.Binder implements android.aidl.tests.permission.platform.IProtected
+ {
+ /** Construct the stub at attach it to the interface. */
+ public Stub()
+ {
+ this.attachInterface(this, DESCRIPTOR);
+ }
+ /**
+ * Cast an IBinder object into an android.aidl.tests.permission.platform.IProtected interface,
+ * generating a proxy if needed.
+ */
+ public static android.aidl.tests.permission.platform.IProtected asInterface(android.os.IBinder obj)
+ {
+ if ((obj==null)) {
+ return null;
+ }
+ android.os.IInterface iin = obj.queryLocalInterface(DESCRIPTOR);
+ if (((iin!=null)&&(iin instanceof android.aidl.tests.permission.platform.IProtected))) {
+ return ((android.aidl.tests.permission.platform.IProtected)iin);
+ }
+ return new android.aidl.tests.permission.platform.IProtected.Stub.Proxy(obj);
+ }
+ @Override public android.os.IBinder asBinder()
+ {
+ return this;
+ }
+ @Override public boolean onTransact(int code, android.os.Parcel data, android.os.Parcel reply, int flags) throws android.os.RemoteException
+ {
+ java.lang.String descriptor = DESCRIPTOR;
+ if (code >= android.os.IBinder.FIRST_CALL_TRANSACTION && code <= android.os.IBinder.LAST_CALL_TRANSACTION) {
+ data.enforceInterface(descriptor);
+ }
+ switch (code)
+ {
+ case INTERFACE_TRANSACTION:
+ {
+ reply.writeString(descriptor);
+ return true;
+ }
+ }
+ switch (code)
+ {
+ case TRANSACTION_ProtectedWithSourceAttribution:
+ {
+ android.content.AttributionSource _arg0;
+ _arg0 = data.readTypedObject(android.content.AttributionSource.CREATOR);
+ data.enforceNoDataAvail();
+ if (((this.permissionCheckerWrapper(android.Manifest.permission.INTERNET, this.getCallingPid(), _arg0)&&this.permissionCheckerWrapper(android.Manifest.permission.VIBRATE, this.getCallingPid(), _arg0))!=true)) {
+ throw new SecurityException("Access denied, requires: allOf = {android.Manifest.permission.INTERNET, android.Manifest.permission.VIBRATE}");
+ }
+ this.ProtectedWithSourceAttribution(_arg0);
+ reply.writeNoException();
+ break;
+ }
+ default:
+ {
+ return super.onTransact(code, data, reply, flags);
+ }
+ }
+ return true;
+ }
+ private static class Proxy implements android.aidl.tests.permission.platform.IProtected
+ {
+ private android.os.IBinder mRemote;
+ Proxy(android.os.IBinder remote)
+ {
+ mRemote = remote;
+ }
+ @Override public android.os.IBinder asBinder()
+ {
+ return mRemote;
+ }
+ public java.lang.String getInterfaceDescriptor()
+ {
+ return DESCRIPTOR;
+ }
+ @Override public void ProtectedWithSourceAttribution(android.content.AttributionSource source) throws android.os.RemoteException
+ {
+ android.os.Parcel _data = android.os.Parcel.obtain();
+ android.os.Parcel _reply = android.os.Parcel.obtain();
+ try {
+ _data.writeInterfaceToken(DESCRIPTOR);
+ _data.writeTypedObject(source, 0);
+ boolean _status = mRemote.transact(Stub.TRANSACTION_ProtectedWithSourceAttribution, _data, _reply, 0);
+ _reply.readException();
+ }
+ finally {
+ _reply.recycle();
+ _data.recycle();
+ }
+ }
+ }
+ private boolean permissionCheckerWrapper(
+ String permission, int pid, android.content.AttributionSource attributionSource) {
+ android.content.Context ctx =
+ android.app.ActivityThread.currentActivityThread().getSystemContext();
+ return (android.content.PermissionChecker.checkPermissionForDataDelivery(
+ ctx, permission, pid, attributionSource, "" /*message*/) ==
+ android.content.PermissionChecker.PERMISSION_GRANTED);
+ }
+ static final int TRANSACTION_ProtectedWithSourceAttribution = (android.os.IBinder.FIRST_CALL_TRANSACTION + 0);
+ }
+ public static final java.lang.String DESCRIPTOR = "android$aidl$tests$permission$platform$IProtected".replace('$', '.');
+ @android.annotation.EnforcePermission(allOf = {android.Manifest.permission.INTERNET, android.Manifest.permission.VIBRATE})
+ public void ProtectedWithSourceAttribution(android.content.AttributionSource source) throws android.os.RemoteException;
+}
diff --git a/tests/golden_output/aidl-test-interface-permission-java-source/gen/android/aidl/tests/permission/platform/IProtected.java.d b/tests/golden_output/aidl-test-interface-permission-java-source/gen/android/aidl/tests/permission/platform/IProtected.java.d
new file mode 100644
index 0000000..86866a2
--- /dev/null
+++ b/tests/golden_output/aidl-test-interface-permission-java-source/gen/android/aidl/tests/permission/platform/IProtected.java.d
@@ -0,0 +1,3 @@
+out/soong/.intermediates/system/tools/aidl/aidl-test-interface-permission-java-source/gen/android/aidl/tests/permission/platform/IProtected.java : \
+ system/tools/aidl/tests/android/aidl/tests/permission/platform/IProtected.aidl \
+ frameworks/base/core/java/android/content/AttributionSource.aidl
diff --git a/tests/golden_output/aidl-test-versioned-interface-V2-java-source/gen/timestamp b/tests/golden_output/aidl-test-interface-permission-java-source/gen/timestamp
similarity index 100%
copy from tests/golden_output/aidl-test-versioned-interface-V2-java-source/gen/timestamp
copy to tests/golden_output/aidl-test-interface-permission-java-source/gen/timestamp
diff --git a/tests/golden_output/aidl-test-interface-rust-source/gen/android/aidl/tests/permission/IProtected.rs b/tests/golden_output/aidl-test-interface-rust-source/gen/android/aidl/tests/permission/IProtected.rs
deleted file mode 100644
index 0abf8c1..0000000
--- a/tests/golden_output/aidl-test-interface-rust-source/gen/android/aidl/tests/permission/IProtected.rs
+++ /dev/null
@@ -1,242 +0,0 @@
-#![forbid(unsafe_code)]
-#![rustfmt::skip]
-#![allow(non_upper_case_globals)]
-#![allow(non_snake_case)]
-#[allow(unused_imports)] use binder::binder_impl::IBinderInternal;
-use binder::declare_binder_interface;
-declare_binder_interface! {
- IProtected["android.aidl.tests.permission.IProtected"] {
- native: BnProtected(on_transact),
- proxy: BpProtected {
- },
- async: IProtectedAsync,
- }
-}
-pub trait IProtected: binder::Interface + Send {
- fn get_descriptor() -> &'static str where Self: Sized { "android.aidl.tests.permission.IProtected" }
- fn PermissionProtected(&self) -> binder::Result<()>;
- fn MultiplePermissionsAll(&self) -> binder::Result<()>;
- fn MultiplePermissionsAny(&self) -> binder::Result<()>;
- fn getDefaultImpl() -> IProtectedDefaultRef where Self: Sized {
- DEFAULT_IMPL.lock().unwrap().clone()
- }
- fn setDefaultImpl(d: IProtectedDefaultRef) -> IProtectedDefaultRef where Self: Sized {
- std::mem::replace(&mut *DEFAULT_IMPL.lock().unwrap(), d)
- }
-}
-pub trait IProtectedAsync<P>: binder::Interface + Send {
- fn get_descriptor() -> &'static str where Self: Sized { "android.aidl.tests.permission.IProtected" }
- fn PermissionProtected<'a>(&'a self) -> binder::BoxFuture<'a, binder::Result<()>>;
- fn MultiplePermissionsAll<'a>(&'a self) -> binder::BoxFuture<'a, binder::Result<()>>;
- fn MultiplePermissionsAny<'a>(&'a self) -> binder::BoxFuture<'a, binder::Result<()>>;
-}
-#[::async_trait::async_trait]
-pub trait IProtectedAsyncServer: binder::Interface + Send {
- fn get_descriptor() -> &'static str where Self: Sized { "android.aidl.tests.permission.IProtected" }
- async fn PermissionProtected(&self) -> binder::Result<()>;
- async fn MultiplePermissionsAll(&self) -> binder::Result<()>;
- async fn MultiplePermissionsAny(&self) -> binder::Result<()>;
-}
-impl BnProtected {
- /// Create a new async binder service.
- pub fn new_async_binder<T, R>(inner: T, rt: R, features: binder::BinderFeatures) -> binder::Strong<dyn IProtected>
- where
- T: IProtectedAsyncServer + binder::Interface + Send + Sync + 'static,
- R: binder::binder_impl::BinderAsyncRuntime + Send + Sync + 'static,
- {
- struct Wrapper<T, R> {
- _inner: T,
- _rt: R,
- }
- impl<T, R> binder::Interface for Wrapper<T, R> where T: binder::Interface, R: Send + Sync {
- fn as_binder(&self) -> binder::SpIBinder { self._inner.as_binder() }
- fn dump(&self, _file: &std::fs::File, _args: &[&std::ffi::CStr]) -> std::result::Result<(), binder::StatusCode> { self._inner.dump(_file, _args) }
- }
- impl<T, R> IProtected for Wrapper<T, R>
- where
- T: IProtectedAsyncServer + Send + Sync + 'static,
- R: binder::binder_impl::BinderAsyncRuntime + Send + Sync + 'static,
- {
- fn PermissionProtected(&self) -> binder::Result<()> {
- self._rt.block_on(self._inner.PermissionProtected())
- }
- fn MultiplePermissionsAll(&self) -> binder::Result<()> {
- self._rt.block_on(self._inner.MultiplePermissionsAll())
- }
- fn MultiplePermissionsAny(&self) -> binder::Result<()> {
- self._rt.block_on(self._inner.MultiplePermissionsAny())
- }
- }
- let wrapped = Wrapper { _inner: inner, _rt: rt };
- Self::new_binder(wrapped, features)
- }
-}
-pub trait IProtectedDefault: Send + Sync {
- fn PermissionProtected(&self) -> binder::Result<()> {
- Err(binder::StatusCode::UNKNOWN_TRANSACTION.into())
- }
- fn MultiplePermissionsAll(&self) -> binder::Result<()> {
- Err(binder::StatusCode::UNKNOWN_TRANSACTION.into())
- }
- fn MultiplePermissionsAny(&self) -> binder::Result<()> {
- Err(binder::StatusCode::UNKNOWN_TRANSACTION.into())
- }
-}
-pub mod transactions {
- pub const PermissionProtected: binder::binder_impl::TransactionCode = binder::binder_impl::FIRST_CALL_TRANSACTION + 0;
- pub const MultiplePermissionsAll: binder::binder_impl::TransactionCode = binder::binder_impl::FIRST_CALL_TRANSACTION + 1;
- pub const MultiplePermissionsAny: binder::binder_impl::TransactionCode = binder::binder_impl::FIRST_CALL_TRANSACTION + 2;
-}
-pub type IProtectedDefaultRef = Option<std::sync::Arc<dyn IProtectedDefault>>;
-use lazy_static::lazy_static;
-lazy_static! {
- static ref DEFAULT_IMPL: std::sync::Mutex<IProtectedDefaultRef> = std::sync::Mutex::new(None);
-}
-impl BpProtected {
- fn build_parcel_PermissionProtected(&self) -> binder::Result<binder::binder_impl::Parcel> {
- let mut aidl_data = self.binder.prepare_transact()?;
- Ok(aidl_data)
- }
- fn read_response_PermissionProtected(&self, _aidl_reply: std::result::Result<binder::binder_impl::Parcel, binder::StatusCode>) -> binder::Result<()> {
- if let Err(binder::StatusCode::UNKNOWN_TRANSACTION) = _aidl_reply {
- if let Some(_aidl_default_impl) = <Self as IProtected>::getDefaultImpl() {
- return _aidl_default_impl.PermissionProtected();
- }
- }
- let _aidl_reply = _aidl_reply?;
- let _aidl_status: binder::Status = _aidl_reply.read()?;
- if !_aidl_status.is_ok() { return Err(_aidl_status); }
- Ok(())
- }
- fn build_parcel_MultiplePermissionsAll(&self) -> binder::Result<binder::binder_impl::Parcel> {
- let mut aidl_data = self.binder.prepare_transact()?;
- Ok(aidl_data)
- }
- fn read_response_MultiplePermissionsAll(&self, _aidl_reply: std::result::Result<binder::binder_impl::Parcel, binder::StatusCode>) -> binder::Result<()> {
- if let Err(binder::StatusCode::UNKNOWN_TRANSACTION) = _aidl_reply {
- if let Some(_aidl_default_impl) = <Self as IProtected>::getDefaultImpl() {
- return _aidl_default_impl.MultiplePermissionsAll();
- }
- }
- let _aidl_reply = _aidl_reply?;
- let _aidl_status: binder::Status = _aidl_reply.read()?;
- if !_aidl_status.is_ok() { return Err(_aidl_status); }
- Ok(())
- }
- fn build_parcel_MultiplePermissionsAny(&self) -> binder::Result<binder::binder_impl::Parcel> {
- let mut aidl_data = self.binder.prepare_transact()?;
- Ok(aidl_data)
- }
- fn read_response_MultiplePermissionsAny(&self, _aidl_reply: std::result::Result<binder::binder_impl::Parcel, binder::StatusCode>) -> binder::Result<()> {
- if let Err(binder::StatusCode::UNKNOWN_TRANSACTION) = _aidl_reply {
- if let Some(_aidl_default_impl) = <Self as IProtected>::getDefaultImpl() {
- return _aidl_default_impl.MultiplePermissionsAny();
- }
- }
- let _aidl_reply = _aidl_reply?;
- let _aidl_status: binder::Status = _aidl_reply.read()?;
- if !_aidl_status.is_ok() { return Err(_aidl_status); }
- Ok(())
- }
-}
-impl IProtected for BpProtected {
- fn PermissionProtected(&self) -> binder::Result<()> {
- let _aidl_data = self.build_parcel_PermissionProtected()?;
- let _aidl_reply = self.binder.submit_transact(transactions::PermissionProtected, _aidl_data, binder::binder_impl::FLAG_PRIVATE_LOCAL);
- self.read_response_PermissionProtected(_aidl_reply)
- }
- fn MultiplePermissionsAll(&self) -> binder::Result<()> {
- let _aidl_data = self.build_parcel_MultiplePermissionsAll()?;
- let _aidl_reply = self.binder.submit_transact(transactions::MultiplePermissionsAll, _aidl_data, binder::binder_impl::FLAG_PRIVATE_LOCAL);
- self.read_response_MultiplePermissionsAll(_aidl_reply)
- }
- fn MultiplePermissionsAny(&self) -> binder::Result<()> {
- let _aidl_data = self.build_parcel_MultiplePermissionsAny()?;
- let _aidl_reply = self.binder.submit_transact(transactions::MultiplePermissionsAny, _aidl_data, binder::binder_impl::FLAG_PRIVATE_LOCAL);
- self.read_response_MultiplePermissionsAny(_aidl_reply)
- }
-}
-impl<P: binder::BinderAsyncPool> IProtectedAsync<P> for BpProtected {
- fn PermissionProtected<'a>(&'a self) -> binder::BoxFuture<'a, binder::Result<()>> {
- let _aidl_data = match self.build_parcel_PermissionProtected() {
- Ok(_aidl_data) => _aidl_data,
- Err(err) => return Box::pin(std::future::ready(Err(err))),
- };
- let binder = self.binder.clone();
- P::spawn(
- move || binder.submit_transact(transactions::PermissionProtected, _aidl_data, binder::binder_impl::FLAG_PRIVATE_LOCAL),
- move |_aidl_reply| async move {
- self.read_response_PermissionProtected(_aidl_reply)
- }
- )
- }
- fn MultiplePermissionsAll<'a>(&'a self) -> binder::BoxFuture<'a, binder::Result<()>> {
- let _aidl_data = match self.build_parcel_MultiplePermissionsAll() {
- Ok(_aidl_data) => _aidl_data,
- Err(err) => return Box::pin(std::future::ready(Err(err))),
- };
- let binder = self.binder.clone();
- P::spawn(
- move || binder.submit_transact(transactions::MultiplePermissionsAll, _aidl_data, binder::binder_impl::FLAG_PRIVATE_LOCAL),
- move |_aidl_reply| async move {
- self.read_response_MultiplePermissionsAll(_aidl_reply)
- }
- )
- }
- fn MultiplePermissionsAny<'a>(&'a self) -> binder::BoxFuture<'a, binder::Result<()>> {
- let _aidl_data = match self.build_parcel_MultiplePermissionsAny() {
- Ok(_aidl_data) => _aidl_data,
- Err(err) => return Box::pin(std::future::ready(Err(err))),
- };
- let binder = self.binder.clone();
- P::spawn(
- move || binder.submit_transact(transactions::MultiplePermissionsAny, _aidl_data, binder::binder_impl::FLAG_PRIVATE_LOCAL),
- move |_aidl_reply| async move {
- self.read_response_MultiplePermissionsAny(_aidl_reply)
- }
- )
- }
-}
-impl IProtected for binder::binder_impl::Binder<BnProtected> {
- fn PermissionProtected(&self) -> binder::Result<()> { self.0.PermissionProtected() }
- fn MultiplePermissionsAll(&self) -> binder::Result<()> { self.0.MultiplePermissionsAll() }
- fn MultiplePermissionsAny(&self) -> binder::Result<()> { self.0.MultiplePermissionsAny() }
-}
-fn on_transact(_aidl_service: &dyn IProtected, _aidl_code: binder::binder_impl::TransactionCode, _aidl_data: &binder::binder_impl::BorrowedParcel<'_>, _aidl_reply: &mut binder::binder_impl::BorrowedParcel<'_>) -> std::result::Result<(), binder::StatusCode> {
- match _aidl_code {
- transactions::PermissionProtected => {
- let _aidl_return = _aidl_service.PermissionProtected();
- match &_aidl_return {
- Ok(_aidl_return) => {
- _aidl_reply.write(&binder::Status::from(binder::StatusCode::OK))?;
- }
- Err(_aidl_status) => _aidl_reply.write(_aidl_status)?
- }
- Ok(())
- }
- transactions::MultiplePermissionsAll => {
- let _aidl_return = _aidl_service.MultiplePermissionsAll();
- match &_aidl_return {
- Ok(_aidl_return) => {
- _aidl_reply.write(&binder::Status::from(binder::StatusCode::OK))?;
- }
- Err(_aidl_status) => _aidl_reply.write(_aidl_status)?
- }
- Ok(())
- }
- transactions::MultiplePermissionsAny => {
- let _aidl_return = _aidl_service.MultiplePermissionsAny();
- match &_aidl_return {
- Ok(_aidl_return) => {
- _aidl_reply.write(&binder::Status::from(binder::StatusCode::OK))?;
- }
- Err(_aidl_status) => _aidl_reply.write(_aidl_status)?
- }
- Ok(())
- }
- _ => Err(binder::StatusCode::UNKNOWN_TRANSACTION)
- }
-}
-pub(crate) mod mangled {
- pub use super::IProtected as _7_android_4_aidl_5_tests_10_permission_10_IProtected;
-}
diff --git a/tests/golden_output/aidl-test-interface-rust-source/gen/android/aidl/tests/permission/IProtected.rs.d b/tests/golden_output/aidl-test-interface-rust-source/gen/android/aidl/tests/permission/IProtected.rs.d
deleted file mode 100644
index 72476b7..0000000
--- a/tests/golden_output/aidl-test-interface-rust-source/gen/android/aidl/tests/permission/IProtected.rs.d
+++ /dev/null
@@ -1,2 +0,0 @@
-out/soong/.intermediates/system/tools/aidl/aidl-test-interface-rust-source/gen/android/aidl/tests/permission/IProtected.rs : \
- system/tools/aidl/tests/android/aidl/tests/permission/IProtected.aidl
diff --git a/tests/golden_output/aidl-test-interface-rust-source/gen/android/aidl/tests/permission/IProtectedInterface.rs b/tests/golden_output/aidl-test-interface-rust-source/gen/android/aidl/tests/permission/IProtectedInterface.rs
deleted file mode 100644
index cdbf3b5..0000000
--- a/tests/golden_output/aidl-test-interface-rust-source/gen/android/aidl/tests/permission/IProtectedInterface.rs
+++ /dev/null
@@ -1,188 +0,0 @@
-#![forbid(unsafe_code)]
-#![rustfmt::skip]
-#![allow(non_upper_case_globals)]
-#![allow(non_snake_case)]
-#[allow(unused_imports)] use binder::binder_impl::IBinderInternal;
-use binder::declare_binder_interface;
-declare_binder_interface! {
- IProtectedInterface["android.aidl.tests.permission.IProtectedInterface"] {
- native: BnProtectedInterface(on_transact),
- proxy: BpProtectedInterface {
- },
- async: IProtectedInterfaceAsync,
- }
-}
-pub trait IProtectedInterface: binder::Interface + Send {
- fn get_descriptor() -> &'static str where Self: Sized { "android.aidl.tests.permission.IProtectedInterface" }
- fn Method1(&self) -> binder::Result<()>;
- fn Method2(&self) -> binder::Result<()>;
- fn getDefaultImpl() -> IProtectedInterfaceDefaultRef where Self: Sized {
- DEFAULT_IMPL.lock().unwrap().clone()
- }
- fn setDefaultImpl(d: IProtectedInterfaceDefaultRef) -> IProtectedInterfaceDefaultRef where Self: Sized {
- std::mem::replace(&mut *DEFAULT_IMPL.lock().unwrap(), d)
- }
-}
-pub trait IProtectedInterfaceAsync<P>: binder::Interface + Send {
- fn get_descriptor() -> &'static str where Self: Sized { "android.aidl.tests.permission.IProtectedInterface" }
- fn Method1<'a>(&'a self) -> binder::BoxFuture<'a, binder::Result<()>>;
- fn Method2<'a>(&'a self) -> binder::BoxFuture<'a, binder::Result<()>>;
-}
-#[::async_trait::async_trait]
-pub trait IProtectedInterfaceAsyncServer: binder::Interface + Send {
- fn get_descriptor() -> &'static str where Self: Sized { "android.aidl.tests.permission.IProtectedInterface" }
- async fn Method1(&self) -> binder::Result<()>;
- async fn Method2(&self) -> binder::Result<()>;
-}
-impl BnProtectedInterface {
- /// Create a new async binder service.
- pub fn new_async_binder<T, R>(inner: T, rt: R, features: binder::BinderFeatures) -> binder::Strong<dyn IProtectedInterface>
- where
- T: IProtectedInterfaceAsyncServer + binder::Interface + Send + Sync + 'static,
- R: binder::binder_impl::BinderAsyncRuntime + Send + Sync + 'static,
- {
- struct Wrapper<T, R> {
- _inner: T,
- _rt: R,
- }
- impl<T, R> binder::Interface for Wrapper<T, R> where T: binder::Interface, R: Send + Sync {
- fn as_binder(&self) -> binder::SpIBinder { self._inner.as_binder() }
- fn dump(&self, _file: &std::fs::File, _args: &[&std::ffi::CStr]) -> std::result::Result<(), binder::StatusCode> { self._inner.dump(_file, _args) }
- }
- impl<T, R> IProtectedInterface for Wrapper<T, R>
- where
- T: IProtectedInterfaceAsyncServer + Send + Sync + 'static,
- R: binder::binder_impl::BinderAsyncRuntime + Send + Sync + 'static,
- {
- fn Method1(&self) -> binder::Result<()> {
- self._rt.block_on(self._inner.Method1())
- }
- fn Method2(&self) -> binder::Result<()> {
- self._rt.block_on(self._inner.Method2())
- }
- }
- let wrapped = Wrapper { _inner: inner, _rt: rt };
- Self::new_binder(wrapped, features)
- }
-}
-pub trait IProtectedInterfaceDefault: Send + Sync {
- fn Method1(&self) -> binder::Result<()> {
- Err(binder::StatusCode::UNKNOWN_TRANSACTION.into())
- }
- fn Method2(&self) -> binder::Result<()> {
- Err(binder::StatusCode::UNKNOWN_TRANSACTION.into())
- }
-}
-pub mod transactions {
- pub const Method1: binder::binder_impl::TransactionCode = binder::binder_impl::FIRST_CALL_TRANSACTION + 0;
- pub const Method2: binder::binder_impl::TransactionCode = binder::binder_impl::FIRST_CALL_TRANSACTION + 1;
-}
-pub type IProtectedInterfaceDefaultRef = Option<std::sync::Arc<dyn IProtectedInterfaceDefault>>;
-use lazy_static::lazy_static;
-lazy_static! {
- static ref DEFAULT_IMPL: std::sync::Mutex<IProtectedInterfaceDefaultRef> = std::sync::Mutex::new(None);
-}
-impl BpProtectedInterface {
- fn build_parcel_Method1(&self) -> binder::Result<binder::binder_impl::Parcel> {
- let mut aidl_data = self.binder.prepare_transact()?;
- Ok(aidl_data)
- }
- fn read_response_Method1(&self, _aidl_reply: std::result::Result<binder::binder_impl::Parcel, binder::StatusCode>) -> binder::Result<()> {
- if let Err(binder::StatusCode::UNKNOWN_TRANSACTION) = _aidl_reply {
- if let Some(_aidl_default_impl) = <Self as IProtectedInterface>::getDefaultImpl() {
- return _aidl_default_impl.Method1();
- }
- }
- let _aidl_reply = _aidl_reply?;
- let _aidl_status: binder::Status = _aidl_reply.read()?;
- if !_aidl_status.is_ok() { return Err(_aidl_status); }
- Ok(())
- }
- fn build_parcel_Method2(&self) -> binder::Result<binder::binder_impl::Parcel> {
- let mut aidl_data = self.binder.prepare_transact()?;
- Ok(aidl_data)
- }
- fn read_response_Method2(&self, _aidl_reply: std::result::Result<binder::binder_impl::Parcel, binder::StatusCode>) -> binder::Result<()> {
- if let Err(binder::StatusCode::UNKNOWN_TRANSACTION) = _aidl_reply {
- if let Some(_aidl_default_impl) = <Self as IProtectedInterface>::getDefaultImpl() {
- return _aidl_default_impl.Method2();
- }
- }
- let _aidl_reply = _aidl_reply?;
- let _aidl_status: binder::Status = _aidl_reply.read()?;
- if !_aidl_status.is_ok() { return Err(_aidl_status); }
- Ok(())
- }
-}
-impl IProtectedInterface for BpProtectedInterface {
- fn Method1(&self) -> binder::Result<()> {
- let _aidl_data = self.build_parcel_Method1()?;
- let _aidl_reply = self.binder.submit_transact(transactions::Method1, _aidl_data, binder::binder_impl::FLAG_PRIVATE_LOCAL);
- self.read_response_Method1(_aidl_reply)
- }
- fn Method2(&self) -> binder::Result<()> {
- let _aidl_data = self.build_parcel_Method2()?;
- let _aidl_reply = self.binder.submit_transact(transactions::Method2, _aidl_data, binder::binder_impl::FLAG_PRIVATE_LOCAL);
- self.read_response_Method2(_aidl_reply)
- }
-}
-impl<P: binder::BinderAsyncPool> IProtectedInterfaceAsync<P> for BpProtectedInterface {
- fn Method1<'a>(&'a self) -> binder::BoxFuture<'a, binder::Result<()>> {
- let _aidl_data = match self.build_parcel_Method1() {
- Ok(_aidl_data) => _aidl_data,
- Err(err) => return Box::pin(std::future::ready(Err(err))),
- };
- let binder = self.binder.clone();
- P::spawn(
- move || binder.submit_transact(transactions::Method1, _aidl_data, binder::binder_impl::FLAG_PRIVATE_LOCAL),
- move |_aidl_reply| async move {
- self.read_response_Method1(_aidl_reply)
- }
- )
- }
- fn Method2<'a>(&'a self) -> binder::BoxFuture<'a, binder::Result<()>> {
- let _aidl_data = match self.build_parcel_Method2() {
- Ok(_aidl_data) => _aidl_data,
- Err(err) => return Box::pin(std::future::ready(Err(err))),
- };
- let binder = self.binder.clone();
- P::spawn(
- move || binder.submit_transact(transactions::Method2, _aidl_data, binder::binder_impl::FLAG_PRIVATE_LOCAL),
- move |_aidl_reply| async move {
- self.read_response_Method2(_aidl_reply)
- }
- )
- }
-}
-impl IProtectedInterface for binder::binder_impl::Binder<BnProtectedInterface> {
- fn Method1(&self) -> binder::Result<()> { self.0.Method1() }
- fn Method2(&self) -> binder::Result<()> { self.0.Method2() }
-}
-fn on_transact(_aidl_service: &dyn IProtectedInterface, _aidl_code: binder::binder_impl::TransactionCode, _aidl_data: &binder::binder_impl::BorrowedParcel<'_>, _aidl_reply: &mut binder::binder_impl::BorrowedParcel<'_>) -> std::result::Result<(), binder::StatusCode> {
- match _aidl_code {
- transactions::Method1 => {
- let _aidl_return = _aidl_service.Method1();
- match &_aidl_return {
- Ok(_aidl_return) => {
- _aidl_reply.write(&binder::Status::from(binder::StatusCode::OK))?;
- }
- Err(_aidl_status) => _aidl_reply.write(_aidl_status)?
- }
- Ok(())
- }
- transactions::Method2 => {
- let _aidl_return = _aidl_service.Method2();
- match &_aidl_return {
- Ok(_aidl_return) => {
- _aidl_reply.write(&binder::Status::from(binder::StatusCode::OK))?;
- }
- Err(_aidl_status) => _aidl_reply.write(_aidl_status)?
- }
- Ok(())
- }
- _ => Err(binder::StatusCode::UNKNOWN_TRANSACTION)
- }
-}
-pub(crate) mod mangled {
- pub use super::IProtectedInterface as _7_android_4_aidl_5_tests_10_permission_19_IProtectedInterface;
-}
diff --git a/tests/golden_output/aidl-test-interface-rust-source/gen/android/aidl/tests/permission/IProtectedInterface.rs.d b/tests/golden_output/aidl-test-interface-rust-source/gen/android/aidl/tests/permission/IProtectedInterface.rs.d
deleted file mode 100644
index 318359f..0000000
--- a/tests/golden_output/aidl-test-interface-rust-source/gen/android/aidl/tests/permission/IProtectedInterface.rs.d
+++ /dev/null
@@ -1,2 +0,0 @@
-out/soong/.intermediates/system/tools/aidl/aidl-test-interface-rust-source/gen/android/aidl/tests/permission/IProtectedInterface.rs : \
- system/tools/aidl/tests/android/aidl/tests/permission/IProtectedInterface.aidl
diff --git a/tests/golden_output/aidl-test-versioned-interface-V1-cpp-source/gen/android/aidl/versioned/tests/BazUnion.cpp b/tests/golden_output/aidl-test-versioned-interface-V1-cpp-source/gen/android/aidl/versioned/tests/BazUnion.cpp
new file mode 100644
index 0000000..eb66154
--- /dev/null
+++ b/tests/golden_output/aidl-test-versioned-interface-V1-cpp-source/gen/android/aidl/versioned/tests/BazUnion.cpp
@@ -0,0 +1,36 @@
+#include <android/aidl/versioned/tests/BazUnion.h>
+
+namespace android {
+namespace aidl {
+namespace versioned {
+namespace tests {
+::android::status_t BazUnion::readFromParcel(const ::android::Parcel* _aidl_parcel) {
+ ::android::status_t _aidl_ret_status;
+ int32_t _aidl_tag;
+ if ((_aidl_ret_status = _aidl_parcel->readInt32(&_aidl_tag)) != ::android::OK) return _aidl_ret_status;
+ switch (static_cast<Tag>(_aidl_tag)) {
+ case intNum: {
+ int32_t _aidl_value;
+ if ((_aidl_ret_status = _aidl_parcel->readInt32(&_aidl_value)) != ::android::OK) return _aidl_ret_status;
+ if constexpr (std::is_trivially_copyable_v<int32_t>) {
+ set<intNum>(_aidl_value);
+ } else {
+ // NOLINTNEXTLINE(performance-move-const-arg)
+ set<intNum>(std::move(_aidl_value));
+ }
+ return ::android::OK; }
+ }
+ return ::android::BAD_VALUE;
+}
+::android::status_t BazUnion::writeToParcel(::android::Parcel* _aidl_parcel) const {
+ ::android::status_t _aidl_ret_status = _aidl_parcel->writeInt32(static_cast<int32_t>(getTag()));
+ if (_aidl_ret_status != ::android::OK) return _aidl_ret_status;
+ switch (getTag()) {
+ case intNum: return _aidl_parcel->writeInt32(get<intNum>());
+ }
+ __assert2(__FILE__, __LINE__, __PRETTY_FUNCTION__, "can't reach here");
+}
+} // namespace tests
+} // namespace versioned
+} // namespace aidl
+} // namespace android
diff --git a/tests/golden_output/aidl-test-versioned-interface-V1-cpp-source/gen/android/aidl/versioned/tests/BazUnion.cpp.d b/tests/golden_output/aidl-test-versioned-interface-V1-cpp-source/gen/android/aidl/versioned/tests/BazUnion.cpp.d
new file mode 100644
index 0000000..616884b
--- /dev/null
+++ b/tests/golden_output/aidl-test-versioned-interface-V1-cpp-source/gen/android/aidl/versioned/tests/BazUnion.cpp.d
@@ -0,0 +1,2 @@
+out/soong/.intermediates/system/tools/aidl/aidl-test-versioned-interface-V1-cpp-source/gen/android/aidl/versioned/tests/BazUnion.cpp : \
+ system/tools/aidl/aidl_api/aidl-test-versioned-interface/1/android/aidl/versioned/tests/BazUnion.aidl
diff --git a/tests/golden_output/aidl-test-versioned-interface-V1-cpp-source/gen/android/aidl/versioned/tests/Foo.cpp b/tests/golden_output/aidl-test-versioned-interface-V1-cpp-source/gen/android/aidl/versioned/tests/Foo.cpp
new file mode 100644
index 0000000..6b93e9f
--- /dev/null
+++ b/tests/golden_output/aidl-test-versioned-interface-V1-cpp-source/gen/android/aidl/versioned/tests/Foo.cpp
@@ -0,0 +1,34 @@
+#include <android/aidl/versioned/tests/Foo.h>
+
+namespace android {
+namespace aidl {
+namespace versioned {
+namespace tests {
+::android::status_t Foo::readFromParcel(const ::android::Parcel* _aidl_parcel) {
+ ::android::status_t _aidl_ret_status = ::android::OK;
+ size_t _aidl_start_pos = _aidl_parcel->dataPosition();
+ int32_t _aidl_parcelable_raw_size = 0;
+ _aidl_ret_status = _aidl_parcel->readInt32(&_aidl_parcelable_raw_size);
+ if (((_aidl_ret_status) != (::android::OK))) {
+ return _aidl_ret_status;
+ }
+ if (_aidl_parcelable_raw_size < 4) return ::android::BAD_VALUE;
+ size_t _aidl_parcelable_size = static_cast<size_t>(_aidl_parcelable_raw_size);
+ if (_aidl_start_pos > SIZE_MAX - _aidl_parcelable_size) return ::android::BAD_VALUE;
+ _aidl_parcel->setDataPosition(_aidl_start_pos + _aidl_parcelable_size);
+ return _aidl_ret_status;
+}
+::android::status_t Foo::writeToParcel(::android::Parcel* _aidl_parcel) const {
+ ::android::status_t _aidl_ret_status = ::android::OK;
+ auto _aidl_start_pos = _aidl_parcel->dataPosition();
+ _aidl_parcel->writeInt32(0);
+ auto _aidl_end_pos = _aidl_parcel->dataPosition();
+ _aidl_parcel->setDataPosition(_aidl_start_pos);
+ _aidl_parcel->writeInt32(_aidl_end_pos - _aidl_start_pos);
+ _aidl_parcel->setDataPosition(_aidl_end_pos);
+ return _aidl_ret_status;
+}
+} // namespace tests
+} // namespace versioned
+} // namespace aidl
+} // namespace android
diff --git a/tests/golden_output/aidl-test-versioned-interface-V1-cpp-source/gen/android/aidl/versioned/tests/Foo.cpp.d b/tests/golden_output/aidl-test-versioned-interface-V1-cpp-source/gen/android/aidl/versioned/tests/Foo.cpp.d
new file mode 100644
index 0000000..637f847
--- /dev/null
+++ b/tests/golden_output/aidl-test-versioned-interface-V1-cpp-source/gen/android/aidl/versioned/tests/Foo.cpp.d
@@ -0,0 +1,2 @@
+out/soong/.intermediates/system/tools/aidl/aidl-test-versioned-interface-V1-cpp-source/gen/android/aidl/versioned/tests/Foo.cpp : \
+ system/tools/aidl/aidl_api/aidl-test-versioned-interface/1/android/aidl/versioned/tests/Foo.aidl
diff --git a/tests/golden_output/aidl-test-versioned-interface-V1-cpp-source/gen/android/aidl/versioned/tests/IFooInterface.cpp b/tests/golden_output/aidl-test-versioned-interface-V1-cpp-source/gen/android/aidl/versioned/tests/IFooInterface.cpp
new file mode 100644
index 0000000..a3aea73
--- /dev/null
+++ b/tests/golden_output/aidl-test-versioned-interface-V1-cpp-source/gen/android/aidl/versioned/tests/IFooInterface.cpp
@@ -0,0 +1,399 @@
+#include <android/aidl/versioned/tests/IFooInterface.h>
+#include <android/aidl/versioned/tests/BpFooInterface.h>
+namespace android {
+namespace aidl {
+namespace versioned {
+namespace tests {
+DO_NOT_DIRECTLY_USE_ME_IMPLEMENT_META_INTERFACE(FooInterface, "android.aidl.versioned.tests.IFooInterface")
+} // namespace tests
+} // namespace versioned
+} // namespace aidl
+} // namespace android
+#include <android/aidl/versioned/tests/BpFooInterface.h>
+#include <android/aidl/versioned/tests/BnFooInterface.h>
+#include <binder/Parcel.h>
+#include <android-base/macros.h>
+
+namespace android {
+namespace aidl {
+namespace versioned {
+namespace tests {
+
+BpFooInterface::BpFooInterface(const ::android::sp<::android::IBinder>& _aidl_impl)
+ : BpInterface<IFooInterface>(_aidl_impl){
+}
+
+::android::binder::Status BpFooInterface::originalApi() {
+ ::android::Parcel _aidl_data;
+ _aidl_data.markForBinder(remoteStrong());
+ ::android::Parcel _aidl_reply;
+ ::android::status_t _aidl_ret_status = ::android::OK;
+ ::android::binder::Status _aidl_status;
+ _aidl_ret_status = _aidl_data.writeInterfaceToken(getInterfaceDescriptor());
+ if (((_aidl_ret_status) != (::android::OK))) {
+ goto _aidl_error;
+ }
+ _aidl_ret_status = remote()->transact(BnFooInterface::TRANSACTION_originalApi, _aidl_data, &_aidl_reply, 0);
+ if (UNLIKELY(_aidl_ret_status == ::android::UNKNOWN_TRANSACTION && IFooInterface::getDefaultImpl())) {
+ return IFooInterface::getDefaultImpl()->originalApi();
+ }
+ if (((_aidl_ret_status) != (::android::OK))) {
+ goto _aidl_error;
+ }
+ _aidl_ret_status = _aidl_status.readFromParcel(_aidl_reply);
+ if (((_aidl_ret_status) != (::android::OK))) {
+ goto _aidl_error;
+ }
+ if (!_aidl_status.isOk()) {
+ return _aidl_status;
+ }
+ _aidl_error:
+ _aidl_status.setFromStatusT(_aidl_ret_status);
+ return _aidl_status;
+}
+
+::android::binder::Status BpFooInterface::acceptUnionAndReturnString(const ::android::aidl::versioned::tests::BazUnion& u, ::std::string* _aidl_return) {
+ ::android::Parcel _aidl_data;
+ _aidl_data.markForBinder(remoteStrong());
+ ::android::Parcel _aidl_reply;
+ ::android::status_t _aidl_ret_status = ::android::OK;
+ ::android::binder::Status _aidl_status;
+ _aidl_ret_status = _aidl_data.writeInterfaceToken(getInterfaceDescriptor());
+ if (((_aidl_ret_status) != (::android::OK))) {
+ goto _aidl_error;
+ }
+ _aidl_ret_status = _aidl_data.writeParcelable(u);
+ if (((_aidl_ret_status) != (::android::OK))) {
+ goto _aidl_error;
+ }
+ _aidl_ret_status = remote()->transact(BnFooInterface::TRANSACTION_acceptUnionAndReturnString, _aidl_data, &_aidl_reply, 0);
+ if (UNLIKELY(_aidl_ret_status == ::android::UNKNOWN_TRANSACTION && IFooInterface::getDefaultImpl())) {
+ return IFooInterface::getDefaultImpl()->acceptUnionAndReturnString(u, _aidl_return);
+ }
+ if (((_aidl_ret_status) != (::android::OK))) {
+ goto _aidl_error;
+ }
+ _aidl_ret_status = _aidl_status.readFromParcel(_aidl_reply);
+ if (((_aidl_ret_status) != (::android::OK))) {
+ goto _aidl_error;
+ }
+ if (!_aidl_status.isOk()) {
+ return _aidl_status;
+ }
+ _aidl_ret_status = _aidl_reply.readUtf8FromUtf16(_aidl_return);
+ if (((_aidl_ret_status) != (::android::OK))) {
+ goto _aidl_error;
+ }
+ _aidl_error:
+ _aidl_status.setFromStatusT(_aidl_ret_status);
+ return _aidl_status;
+}
+
+::android::binder::Status BpFooInterface::ignoreParcelablesAndRepeatInt(const ::android::aidl::versioned::tests::Foo& inFoo, ::android::aidl::versioned::tests::Foo* inoutFoo, ::android::aidl::versioned::tests::Foo* outFoo, int32_t value, int32_t* _aidl_return) {
+ ::android::Parcel _aidl_data;
+ _aidl_data.markForBinder(remoteStrong());
+ ::android::Parcel _aidl_reply;
+ ::android::status_t _aidl_ret_status = ::android::OK;
+ ::android::binder::Status _aidl_status;
+ _aidl_ret_status = _aidl_data.writeInterfaceToken(getInterfaceDescriptor());
+ if (((_aidl_ret_status) != (::android::OK))) {
+ goto _aidl_error;
+ }
+ _aidl_ret_status = _aidl_data.writeParcelable(inFoo);
+ if (((_aidl_ret_status) != (::android::OK))) {
+ goto _aidl_error;
+ }
+ _aidl_ret_status = _aidl_data.writeParcelable(*inoutFoo);
+ if (((_aidl_ret_status) != (::android::OK))) {
+ goto _aidl_error;
+ }
+ _aidl_ret_status = _aidl_data.writeInt32(value);
+ if (((_aidl_ret_status) != (::android::OK))) {
+ goto _aidl_error;
+ }
+ _aidl_ret_status = remote()->transact(BnFooInterface::TRANSACTION_ignoreParcelablesAndRepeatInt, _aidl_data, &_aidl_reply, 0);
+ if (UNLIKELY(_aidl_ret_status == ::android::UNKNOWN_TRANSACTION && IFooInterface::getDefaultImpl())) {
+ return IFooInterface::getDefaultImpl()->ignoreParcelablesAndRepeatInt(inFoo, inoutFoo, outFoo, value, _aidl_return);
+ }
+ if (((_aidl_ret_status) != (::android::OK))) {
+ goto _aidl_error;
+ }
+ _aidl_ret_status = _aidl_status.readFromParcel(_aidl_reply);
+ if (((_aidl_ret_status) != (::android::OK))) {
+ goto _aidl_error;
+ }
+ if (!_aidl_status.isOk()) {
+ return _aidl_status;
+ }
+ _aidl_ret_status = _aidl_reply.readInt32(_aidl_return);
+ if (((_aidl_ret_status) != (::android::OK))) {
+ goto _aidl_error;
+ }
+ _aidl_ret_status = _aidl_reply.readParcelable(inoutFoo);
+ if (((_aidl_ret_status) != (::android::OK))) {
+ goto _aidl_error;
+ }
+ _aidl_ret_status = _aidl_reply.readParcelable(outFoo);
+ if (((_aidl_ret_status) != (::android::OK))) {
+ goto _aidl_error;
+ }
+ _aidl_error:
+ _aidl_status.setFromStatusT(_aidl_ret_status);
+ return _aidl_status;
+}
+
+::android::binder::Status BpFooInterface::returnsLengthOfFooArray(const ::std::vector<::android::aidl::versioned::tests::Foo>& foos, int32_t* _aidl_return) {
+ ::android::Parcel _aidl_data;
+ _aidl_data.markForBinder(remoteStrong());
+ ::android::Parcel _aidl_reply;
+ ::android::status_t _aidl_ret_status = ::android::OK;
+ ::android::binder::Status _aidl_status;
+ _aidl_ret_status = _aidl_data.writeInterfaceToken(getInterfaceDescriptor());
+ if (((_aidl_ret_status) != (::android::OK))) {
+ goto _aidl_error;
+ }
+ _aidl_ret_status = _aidl_data.writeParcelableVector(foos);
+ if (((_aidl_ret_status) != (::android::OK))) {
+ goto _aidl_error;
+ }
+ _aidl_ret_status = remote()->transact(BnFooInterface::TRANSACTION_returnsLengthOfFooArray, _aidl_data, &_aidl_reply, 0);
+ if (UNLIKELY(_aidl_ret_status == ::android::UNKNOWN_TRANSACTION && IFooInterface::getDefaultImpl())) {
+ return IFooInterface::getDefaultImpl()->returnsLengthOfFooArray(foos, _aidl_return);
+ }
+ if (((_aidl_ret_status) != (::android::OK))) {
+ goto _aidl_error;
+ }
+ _aidl_ret_status = _aidl_status.readFromParcel(_aidl_reply);
+ if (((_aidl_ret_status) != (::android::OK))) {
+ goto _aidl_error;
+ }
+ if (!_aidl_status.isOk()) {
+ return _aidl_status;
+ }
+ _aidl_ret_status = _aidl_reply.readInt32(_aidl_return);
+ if (((_aidl_ret_status) != (::android::OK))) {
+ goto _aidl_error;
+ }
+ _aidl_error:
+ _aidl_status.setFromStatusT(_aidl_ret_status);
+ return _aidl_status;
+}
+
+int32_t BpFooInterface::getInterfaceVersion() {
+ if (cached_version_ == -1) {
+ ::android::Parcel data;
+ ::android::Parcel reply;
+ data.writeInterfaceToken(getInterfaceDescriptor());
+ ::android::status_t err = remote()->transact(BnFooInterface::TRANSACTION_getInterfaceVersion, data, &reply);
+ if (err == ::android::OK) {
+ ::android::binder::Status _aidl_status;
+ err = _aidl_status.readFromParcel(reply);
+ if (err == ::android::OK && _aidl_status.isOk()) {
+ cached_version_ = reply.readInt32();
+ }
+ }
+ }
+ return cached_version_;
+}
+
+
+std::string BpFooInterface::getInterfaceHash() {
+ std::lock_guard<std::mutex> lockGuard(cached_hash_mutex_);
+ if (cached_hash_ == "-1") {
+ ::android::Parcel data;
+ ::android::Parcel reply;
+ data.writeInterfaceToken(getInterfaceDescriptor());
+ ::android::status_t err = remote()->transact(BnFooInterface::TRANSACTION_getInterfaceHash, data, &reply);
+ if (err == ::android::OK) {
+ ::android::binder::Status _aidl_status;
+ err = _aidl_status.readFromParcel(reply);
+ if (err == ::android::OK && _aidl_status.isOk()) {
+ reply.readUtf8FromUtf16(&cached_hash_);
+ }
+ }
+ }
+ return cached_hash_;
+}
+
+} // namespace tests
+} // namespace versioned
+} // namespace aidl
+} // namespace android
+#include <android/aidl/versioned/tests/BnFooInterface.h>
+#include <binder/Parcel.h>
+#include <binder/Stability.h>
+
+namespace android {
+namespace aidl {
+namespace versioned {
+namespace tests {
+
+BnFooInterface::BnFooInterface()
+{
+ ::android::internal::Stability::markCompilationUnit(this);
+}
+
+::android::status_t BnFooInterface::onTransact(uint32_t _aidl_code, const ::android::Parcel& _aidl_data, ::android::Parcel* _aidl_reply, uint32_t _aidl_flags) {
+ ::android::status_t _aidl_ret_status = ::android::OK;
+ switch (_aidl_code) {
+ case BnFooInterface::TRANSACTION_originalApi:
+ {
+ if (!(_aidl_data.checkInterface(this))) {
+ _aidl_ret_status = ::android::BAD_TYPE;
+ break;
+ }
+ ::android::binder::Status _aidl_status(originalApi());
+ _aidl_ret_status = _aidl_status.writeToParcel(_aidl_reply);
+ if (((_aidl_ret_status) != (::android::OK))) {
+ break;
+ }
+ if (!_aidl_status.isOk()) {
+ break;
+ }
+ }
+ break;
+ case BnFooInterface::TRANSACTION_acceptUnionAndReturnString:
+ {
+ ::android::aidl::versioned::tests::BazUnion in_u;
+ ::std::string _aidl_return;
+ if (!(_aidl_data.checkInterface(this))) {
+ _aidl_ret_status = ::android::BAD_TYPE;
+ break;
+ }
+ _aidl_ret_status = _aidl_data.readParcelable(&in_u);
+ if (((_aidl_ret_status) != (::android::OK))) {
+ break;
+ }
+ if (auto st = _aidl_data.enforceNoDataAvail(); !st.isOk()) {
+ _aidl_ret_status = st.writeToParcel(_aidl_reply);
+ break;
+ }
+ ::android::binder::Status _aidl_status(acceptUnionAndReturnString(in_u, &_aidl_return));
+ _aidl_ret_status = _aidl_status.writeToParcel(_aidl_reply);
+ if (((_aidl_ret_status) != (::android::OK))) {
+ break;
+ }
+ if (!_aidl_status.isOk()) {
+ break;
+ }
+ _aidl_ret_status = _aidl_reply->writeUtf8AsUtf16(_aidl_return);
+ if (((_aidl_ret_status) != (::android::OK))) {
+ break;
+ }
+ }
+ break;
+ case BnFooInterface::TRANSACTION_ignoreParcelablesAndRepeatInt:
+ {
+ ::android::aidl::versioned::tests::Foo in_inFoo;
+ ::android::aidl::versioned::tests::Foo in_inoutFoo;
+ ::android::aidl::versioned::tests::Foo out_outFoo;
+ int32_t in_value;
+ int32_t _aidl_return;
+ if (!(_aidl_data.checkInterface(this))) {
+ _aidl_ret_status = ::android::BAD_TYPE;
+ break;
+ }
+ _aidl_ret_status = _aidl_data.readParcelable(&in_inFoo);
+ if (((_aidl_ret_status) != (::android::OK))) {
+ break;
+ }
+ _aidl_ret_status = _aidl_data.readParcelable(&in_inoutFoo);
+ if (((_aidl_ret_status) != (::android::OK))) {
+ break;
+ }
+ _aidl_ret_status = _aidl_data.readInt32(&in_value);
+ if (((_aidl_ret_status) != (::android::OK))) {
+ break;
+ }
+ if (auto st = _aidl_data.enforceNoDataAvail(); !st.isOk()) {
+ _aidl_ret_status = st.writeToParcel(_aidl_reply);
+ break;
+ }
+ ::android::binder::Status _aidl_status(ignoreParcelablesAndRepeatInt(in_inFoo, &in_inoutFoo, &out_outFoo, in_value, &_aidl_return));
+ _aidl_ret_status = _aidl_status.writeToParcel(_aidl_reply);
+ if (((_aidl_ret_status) != (::android::OK))) {
+ break;
+ }
+ if (!_aidl_status.isOk()) {
+ break;
+ }
+ _aidl_ret_status = _aidl_reply->writeInt32(_aidl_return);
+ if (((_aidl_ret_status) != (::android::OK))) {
+ break;
+ }
+ _aidl_ret_status = _aidl_reply->writeParcelable(in_inoutFoo);
+ if (((_aidl_ret_status) != (::android::OK))) {
+ break;
+ }
+ _aidl_ret_status = _aidl_reply->writeParcelable(out_outFoo);
+ if (((_aidl_ret_status) != (::android::OK))) {
+ break;
+ }
+ }
+ break;
+ case BnFooInterface::TRANSACTION_returnsLengthOfFooArray:
+ {
+ ::std::vector<::android::aidl::versioned::tests::Foo> in_foos;
+ int32_t _aidl_return;
+ if (!(_aidl_data.checkInterface(this))) {
+ _aidl_ret_status = ::android::BAD_TYPE;
+ break;
+ }
+ _aidl_ret_status = _aidl_data.readParcelableVector(&in_foos);
+ if (((_aidl_ret_status) != (::android::OK))) {
+ break;
+ }
+ if (auto st = _aidl_data.enforceNoDataAvail(); !st.isOk()) {
+ _aidl_ret_status = st.writeToParcel(_aidl_reply);
+ break;
+ }
+ ::android::binder::Status _aidl_status(returnsLengthOfFooArray(in_foos, &_aidl_return));
+ _aidl_ret_status = _aidl_status.writeToParcel(_aidl_reply);
+ if (((_aidl_ret_status) != (::android::OK))) {
+ break;
+ }
+ if (!_aidl_status.isOk()) {
+ break;
+ }
+ _aidl_ret_status = _aidl_reply->writeInt32(_aidl_return);
+ if (((_aidl_ret_status) != (::android::OK))) {
+ break;
+ }
+ }
+ break;
+ case BnFooInterface::TRANSACTION_getInterfaceVersion:
+ {
+ _aidl_data.checkInterface(this);
+ _aidl_reply->writeNoException();
+ _aidl_reply->writeInt32(IFooInterface::VERSION);
+ }
+ break;
+ case BnFooInterface::TRANSACTION_getInterfaceHash:
+ {
+ _aidl_data.checkInterface(this);
+ _aidl_reply->writeNoException();
+ _aidl_reply->writeUtf8AsUtf16(IFooInterface::HASH);
+ }
+ break;
+ default:
+ {
+ _aidl_ret_status = ::android::BBinder::onTransact(_aidl_code, _aidl_data, _aidl_reply, _aidl_flags);
+ }
+ break;
+ }
+ if (_aidl_ret_status == ::android::UNEXPECTED_NULL) {
+ _aidl_ret_status = ::android::binder::Status::fromExceptionCode(::android::binder::Status::EX_NULL_POINTER).writeOverParcel(_aidl_reply);
+ }
+ return _aidl_ret_status;
+}
+
+int32_t BnFooInterface::getInterfaceVersion() {
+ return IFooInterface::VERSION;
+}
+std::string BnFooInterface::getInterfaceHash() {
+ return IFooInterface::HASH;
+}
+} // namespace tests
+} // namespace versioned
+} // namespace aidl
+} // namespace android
diff --git a/tests/golden_output/aidl-test-versioned-interface-V1-cpp-source/gen/android/aidl/versioned/tests/IFooInterface.cpp.d b/tests/golden_output/aidl-test-versioned-interface-V1-cpp-source/gen/android/aidl/versioned/tests/IFooInterface.cpp.d
new file mode 100644
index 0000000..9bee1b6
--- /dev/null
+++ b/tests/golden_output/aidl-test-versioned-interface-V1-cpp-source/gen/android/aidl/versioned/tests/IFooInterface.cpp.d
@@ -0,0 +1,4 @@
+out/soong/.intermediates/system/tools/aidl/aidl-test-versioned-interface-V1-cpp-source/gen/android/aidl/versioned/tests/IFooInterface.cpp : \
+ system/tools/aidl/aidl_api/aidl-test-versioned-interface/1/android/aidl/versioned/tests/IFooInterface.aidl \
+ system/tools/aidl/aidl_api/aidl-test-versioned-interface/1/android/aidl/versioned/tests/BazUnion.aidl \
+ system/tools/aidl/aidl_api/aidl-test-versioned-interface/1/android/aidl/versioned/tests/Foo.aidl
diff --git a/tests/golden_output/aidl-test-versioned-interface-V1-cpp-source/gen/include/android/aidl/versioned/tests/BazUnion.h b/tests/golden_output/aidl-test-versioned-interface-V1-cpp-source/gen/include/android/aidl/versioned/tests/BazUnion.h
new file mode 100644
index 0000000..c8ba05b
--- /dev/null
+++ b/tests/golden_output/aidl-test-versioned-interface-V1-cpp-source/gen/include/android/aidl/versioned/tests/BazUnion.h
@@ -0,0 +1,112 @@
+#pragma once
+
+#include <android/binder_to_string.h>
+#include <binder/Parcel.h>
+#include <binder/Status.h>
+#include <cassert>
+#include <cstdint>
+#include <type_traits>
+#include <utility>
+#include <utils/String16.h>
+#include <variant>
+
+#ifndef __BIONIC__
+#define __assert2(a,b,c,d) ((void)0)
+#endif
+
+namespace android {
+namespace aidl {
+namespace versioned {
+namespace tests {
+class BazUnion : public ::android::Parcelable {
+public:
+ enum Tag : int32_t {
+ intNum = 0, // int intNum;
+ };
+
+ template<typename _Tp>
+ static constexpr bool _not_self = !std::is_same_v<std::remove_cv_t<std::remove_reference_t<_Tp>>, BazUnion>;
+
+ BazUnion() : _value(std::in_place_index<static_cast<size_t>(intNum)>, int32_t(0)) { }
+
+ template <typename _Tp, typename = std::enable_if_t<_not_self<_Tp>>>
+ // NOLINTNEXTLINE(google-explicit-constructor)
+ constexpr BazUnion(_Tp&& _arg)
+ : _value(std::forward<_Tp>(_arg)) {}
+
+ template <size_t _Np, typename... _Tp>
+ constexpr explicit BazUnion(std::in_place_index_t<_Np>, _Tp&&... _args)
+ : _value(std::in_place_index<_Np>, std::forward<_Tp>(_args)...) {}
+
+ template <Tag _tag, typename... _Tp>
+ static BazUnion make(_Tp&&... _args) {
+ return BazUnion(std::in_place_index<static_cast<size_t>(_tag)>, std::forward<_Tp>(_args)...);
+ }
+
+ template <Tag _tag, typename _Tp, typename... _Up>
+ static BazUnion make(std::initializer_list<_Tp> _il, _Up&&... _args) {
+ return BazUnion(std::in_place_index<static_cast<size_t>(_tag)>, std::move(_il), std::forward<_Up>(_args)...);
+ }
+
+ Tag getTag() const {
+ return static_cast<Tag>(_value.index());
+ }
+
+ template <Tag _tag>
+ const auto& get() const {
+ if (getTag() != _tag) { __assert2(__FILE__, __LINE__, __PRETTY_FUNCTION__, "bad access: a wrong tag"); }
+ return std::get<static_cast<size_t>(_tag)>(_value);
+ }
+
+ template <Tag _tag>
+ auto& get() {
+ if (getTag() != _tag) { __assert2(__FILE__, __LINE__, __PRETTY_FUNCTION__, "bad access: a wrong tag"); }
+ return std::get<static_cast<size_t>(_tag)>(_value);
+ }
+
+ template <Tag _tag, typename... _Tp>
+ void set(_Tp&&... _args) {
+ _value.emplace<static_cast<size_t>(_tag)>(std::forward<_Tp>(_args)...);
+ }
+
+ inline bool operator!=(const BazUnion& rhs) const {
+ return _value != rhs._value;
+ }
+ inline bool operator<(const BazUnion& rhs) const {
+ return _value < rhs._value;
+ }
+ inline bool operator<=(const BazUnion& rhs) const {
+ return _value <= rhs._value;
+ }
+ inline bool operator==(const BazUnion& rhs) const {
+ return _value == rhs._value;
+ }
+ inline bool operator>(const BazUnion& rhs) const {
+ return _value > rhs._value;
+ }
+ inline bool operator>=(const BazUnion& rhs) const {
+ return _value >= rhs._value;
+ }
+
+ ::android::status_t readFromParcel(const ::android::Parcel* _aidl_parcel) final;
+ ::android::status_t writeToParcel(::android::Parcel* _aidl_parcel) const final;
+ static const ::android::String16& getParcelableDescriptor() {
+ static const ::android::StaticString16 DESCIPTOR (u"android.aidl.versioned.tests.BazUnion");
+ return DESCIPTOR;
+ }
+ inline std::string toString() const {
+ std::ostringstream os;
+ os << "BazUnion{";
+ switch (getTag()) {
+ case intNum: os << "intNum: " << ::android::internal::ToString(get<intNum>()); break;
+ }
+ os << "}";
+ return os.str();
+ }
+private:
+ std::variant<int32_t> _value;
+}; // class BazUnion
+} // namespace tests
+} // namespace versioned
+} // namespace aidl
+} // namespace android
diff --git a/tests/golden_output/aidl-test-versioned-interface-V1-cpp-source/gen/include/android/aidl/versioned/tests/BnBazUnion.h b/tests/golden_output/aidl-test-versioned-interface-V1-cpp-source/gen/include/android/aidl/versioned/tests/BnBazUnion.h
new file mode 100644
index 0000000..ce72aa3
--- /dev/null
+++ b/tests/golden_output/aidl-test-versioned-interface-V1-cpp-source/gen/include/android/aidl/versioned/tests/BnBazUnion.h
@@ -0,0 +1 @@
+#error TODO(b/111362593) parcelables do not have bn classes
\ No newline at end of file
diff --git a/tests/golden_output/aidl-test-versioned-interface-V1-cpp-source/gen/include/android/aidl/versioned/tests/BnFoo.h b/tests/golden_output/aidl-test-versioned-interface-V1-cpp-source/gen/include/android/aidl/versioned/tests/BnFoo.h
new file mode 100644
index 0000000..ce72aa3
--- /dev/null
+++ b/tests/golden_output/aidl-test-versioned-interface-V1-cpp-source/gen/include/android/aidl/versioned/tests/BnFoo.h
@@ -0,0 +1 @@
+#error TODO(b/111362593) parcelables do not have bn classes
\ No newline at end of file
diff --git a/tests/golden_output/aidl-test-versioned-interface-V1-cpp-source/gen/include/android/aidl/versioned/tests/BnFooInterface.h b/tests/golden_output/aidl-test-versioned-interface-V1-cpp-source/gen/include/android/aidl/versioned/tests/BnFooInterface.h
new file mode 100644
index 0000000..2fc5594
--- /dev/null
+++ b/tests/golden_output/aidl-test-versioned-interface-V1-cpp-source/gen/include/android/aidl/versioned/tests/BnFooInterface.h
@@ -0,0 +1,54 @@
+#pragma once
+
+#include <binder/IInterface.h>
+#include <android/aidl/versioned/tests/IFooInterface.h>
+
+namespace android {
+namespace aidl {
+namespace versioned {
+namespace tests {
+class BnFooInterface : public ::android::BnInterface<IFooInterface> {
+public:
+ static constexpr uint32_t TRANSACTION_originalApi = ::android::IBinder::FIRST_CALL_TRANSACTION + 0;
+ static constexpr uint32_t TRANSACTION_acceptUnionAndReturnString = ::android::IBinder::FIRST_CALL_TRANSACTION + 1;
+ static constexpr uint32_t TRANSACTION_ignoreParcelablesAndRepeatInt = ::android::IBinder::FIRST_CALL_TRANSACTION + 2;
+ static constexpr uint32_t TRANSACTION_returnsLengthOfFooArray = ::android::IBinder::FIRST_CALL_TRANSACTION + 3;
+ static constexpr uint32_t TRANSACTION_getInterfaceVersion = ::android::IBinder::FIRST_CALL_TRANSACTION + 16777214;
+ static constexpr uint32_t TRANSACTION_getInterfaceHash = ::android::IBinder::FIRST_CALL_TRANSACTION + 16777213;
+ explicit BnFooInterface();
+ ::android::status_t onTransact(uint32_t _aidl_code, const ::android::Parcel& _aidl_data, ::android::Parcel* _aidl_reply, uint32_t _aidl_flags) override;
+ int32_t getInterfaceVersion();
+ std::string getInterfaceHash();
+}; // class BnFooInterface
+
+class IFooInterfaceDelegator : public BnFooInterface {
+public:
+ explicit IFooInterfaceDelegator(::android::sp<IFooInterface> &impl) : _aidl_delegate(impl) {}
+
+ ::android::binder::Status originalApi() override {
+ return _aidl_delegate->originalApi();
+ }
+ ::android::binder::Status acceptUnionAndReturnString(const ::android::aidl::versioned::tests::BazUnion& u, ::std::string* _aidl_return) override {
+ return _aidl_delegate->acceptUnionAndReturnString(u, _aidl_return);
+ }
+ ::android::binder::Status ignoreParcelablesAndRepeatInt(const ::android::aidl::versioned::tests::Foo& inFoo, ::android::aidl::versioned::tests::Foo* inoutFoo, ::android::aidl::versioned::tests::Foo* outFoo, int32_t value, int32_t* _aidl_return) override {
+ return _aidl_delegate->ignoreParcelablesAndRepeatInt(inFoo, inoutFoo, outFoo, value, _aidl_return);
+ }
+ ::android::binder::Status returnsLengthOfFooArray(const ::std::vector<::android::aidl::versioned::tests::Foo>& foos, int32_t* _aidl_return) override {
+ return _aidl_delegate->returnsLengthOfFooArray(foos, _aidl_return);
+ }
+ int32_t getInterfaceVersion() override {
+ int32_t _delegator_ver = BnFooInterface::getInterfaceVersion();
+ int32_t _impl_ver = _aidl_delegate->getInterfaceVersion();
+ return _delegator_ver < _impl_ver ? _delegator_ver : _impl_ver;
+ }
+ std::string getInterfaceHash() override {
+ return _aidl_delegate->getInterfaceHash();
+ }
+private:
+ ::android::sp<IFooInterface> _aidl_delegate;
+}; // class IFooInterfaceDelegator
+} // namespace tests
+} // namespace versioned
+} // namespace aidl
+} // namespace android
diff --git a/tests/golden_output/aidl-test-versioned-interface-V1-cpp-source/gen/include/android/aidl/versioned/tests/BpBazUnion.h b/tests/golden_output/aidl-test-versioned-interface-V1-cpp-source/gen/include/android/aidl/versioned/tests/BpBazUnion.h
new file mode 100644
index 0000000..27af6b1
--- /dev/null
+++ b/tests/golden_output/aidl-test-versioned-interface-V1-cpp-source/gen/include/android/aidl/versioned/tests/BpBazUnion.h
@@ -0,0 +1 @@
+#error TODO(b/111362593) parcelables do not have bp classes
\ No newline at end of file
diff --git a/tests/golden_output/aidl-test-versioned-interface-V1-cpp-source/gen/include/android/aidl/versioned/tests/BpFoo.h b/tests/golden_output/aidl-test-versioned-interface-V1-cpp-source/gen/include/android/aidl/versioned/tests/BpFoo.h
new file mode 100644
index 0000000..27af6b1
--- /dev/null
+++ b/tests/golden_output/aidl-test-versioned-interface-V1-cpp-source/gen/include/android/aidl/versioned/tests/BpFoo.h
@@ -0,0 +1 @@
+#error TODO(b/111362593) parcelables do not have bp classes
\ No newline at end of file
diff --git a/tests/golden_output/aidl-test-versioned-interface-V1-cpp-source/gen/include/android/aidl/versioned/tests/BpFooInterface.h b/tests/golden_output/aidl-test-versioned-interface-V1-cpp-source/gen/include/android/aidl/versioned/tests/BpFooInterface.h
new file mode 100644
index 0000000..765d843
--- /dev/null
+++ b/tests/golden_output/aidl-test-versioned-interface-V1-cpp-source/gen/include/android/aidl/versioned/tests/BpFooInterface.h
@@ -0,0 +1,30 @@
+#pragma once
+
+#include <binder/IBinder.h>
+#include <binder/IInterface.h>
+#include <utils/Errors.h>
+#include <android/aidl/versioned/tests/IFooInterface.h>
+
+namespace android {
+namespace aidl {
+namespace versioned {
+namespace tests {
+class BpFooInterface : public ::android::BpInterface<IFooInterface> {
+public:
+ explicit BpFooInterface(const ::android::sp<::android::IBinder>& _aidl_impl);
+ virtual ~BpFooInterface() = default;
+ ::android::binder::Status originalApi() override;
+ ::android::binder::Status acceptUnionAndReturnString(const ::android::aidl::versioned::tests::BazUnion& u, ::std::string* _aidl_return) override;
+ ::android::binder::Status ignoreParcelablesAndRepeatInt(const ::android::aidl::versioned::tests::Foo& inFoo, ::android::aidl::versioned::tests::Foo* inoutFoo, ::android::aidl::versioned::tests::Foo* outFoo, int32_t value, int32_t* _aidl_return) override;
+ ::android::binder::Status returnsLengthOfFooArray(const ::std::vector<::android::aidl::versioned::tests::Foo>& foos, int32_t* _aidl_return) override;
+ int32_t getInterfaceVersion() override;
+ std::string getInterfaceHash() override;
+private:
+ int32_t cached_version_ = -1;
+ std::string cached_hash_ = "-1";
+ std::mutex cached_hash_mutex_;
+}; // class BpFooInterface
+} // namespace tests
+} // namespace versioned
+} // namespace aidl
+} // namespace android
diff --git a/tests/golden_output/aidl-test-versioned-interface-V1-cpp-source/gen/include/android/aidl/versioned/tests/Foo.h b/tests/golden_output/aidl-test-versioned-interface-V1-cpp-source/gen/include/android/aidl/versioned/tests/Foo.h
new file mode 100644
index 0000000..951277e
--- /dev/null
+++ b/tests/golden_output/aidl-test-versioned-interface-V1-cpp-source/gen/include/android/aidl/versioned/tests/Foo.h
@@ -0,0 +1,50 @@
+#pragma once
+
+#include <android/binder_to_string.h>
+#include <binder/Parcel.h>
+#include <binder/Status.h>
+#include <tuple>
+#include <utils/String16.h>
+
+namespace android {
+namespace aidl {
+namespace versioned {
+namespace tests {
+class Foo : public ::android::Parcelable {
+public:
+ inline bool operator!=(const Foo&) const {
+ return std::tie() != std::tie();
+ }
+ inline bool operator<(const Foo&) const {
+ return std::tie() < std::tie();
+ }
+ inline bool operator<=(const Foo&) const {
+ return std::tie() <= std::tie();
+ }
+ inline bool operator==(const Foo&) const {
+ return std::tie() == std::tie();
+ }
+ inline bool operator>(const Foo&) const {
+ return std::tie() > std::tie();
+ }
+ inline bool operator>=(const Foo&) const {
+ return std::tie() >= std::tie();
+ }
+
+ ::android::status_t readFromParcel(const ::android::Parcel* _aidl_parcel) final;
+ ::android::status_t writeToParcel(::android::Parcel* _aidl_parcel) const final;
+ static const ::android::String16& getParcelableDescriptor() {
+ static const ::android::StaticString16 DESCIPTOR (u"android.aidl.versioned.tests.Foo");
+ return DESCIPTOR;
+ }
+ inline std::string toString() const {
+ std::ostringstream os;
+ os << "Foo{";
+ os << "}";
+ return os.str();
+ }
+}; // class Foo
+} // namespace tests
+} // namespace versioned
+} // namespace aidl
+} // namespace android
diff --git a/tests/golden_output/aidl-test-versioned-interface-V1-cpp-source/gen/include/android/aidl/versioned/tests/IFooInterface.h b/tests/golden_output/aidl-test-versioned-interface-V1-cpp-source/gen/include/android/aidl/versioned/tests/IFooInterface.h
new file mode 100644
index 0000000..ea7e344
--- /dev/null
+++ b/tests/golden_output/aidl-test-versioned-interface-V1-cpp-source/gen/include/android/aidl/versioned/tests/IFooInterface.h
@@ -0,0 +1,58 @@
+#pragma once
+
+#include <android/aidl/versioned/tests/BazUnion.h>
+#include <android/aidl/versioned/tests/Foo.h>
+#include <binder/IBinder.h>
+#include <binder/IInterface.h>
+#include <binder/Status.h>
+#include <cstdint>
+#include <string>
+#include <utils/String16.h>
+#include <utils/StrongPointer.h>
+#include <vector>
+
+namespace android {
+namespace aidl {
+namespace versioned {
+namespace tests {
+class IFooInterface : public ::android::IInterface {
+public:
+ DECLARE_META_INTERFACE(FooInterface)
+ const int32_t VERSION = 1;
+ const std::string HASH = "9e7be1859820c59d9d55dd133e71a3687b5d2e5b";
+ virtual ::android::binder::Status originalApi() = 0;
+ virtual ::android::binder::Status acceptUnionAndReturnString(const ::android::aidl::versioned::tests::BazUnion& u, ::std::string* _aidl_return) = 0;
+ virtual ::android::binder::Status ignoreParcelablesAndRepeatInt(const ::android::aidl::versioned::tests::Foo& inFoo, ::android::aidl::versioned::tests::Foo* inoutFoo, ::android::aidl::versioned::tests::Foo* outFoo, int32_t value, int32_t* _aidl_return) = 0;
+ virtual ::android::binder::Status returnsLengthOfFooArray(const ::std::vector<::android::aidl::versioned::tests::Foo>& foos, int32_t* _aidl_return) = 0;
+ virtual int32_t getInterfaceVersion() = 0;
+ virtual std::string getInterfaceHash() = 0;
+}; // class IFooInterface
+
+class IFooInterfaceDefault : public IFooInterface {
+public:
+ ::android::IBinder* onAsBinder() override {
+ return nullptr;
+ }
+ ::android::binder::Status originalApi() override {
+ return ::android::binder::Status::fromStatusT(::android::UNKNOWN_TRANSACTION);
+ }
+ ::android::binder::Status acceptUnionAndReturnString(const ::android::aidl::versioned::tests::BazUnion& /*u*/, ::std::string* /*_aidl_return*/) override {
+ return ::android::binder::Status::fromStatusT(::android::UNKNOWN_TRANSACTION);
+ }
+ ::android::binder::Status ignoreParcelablesAndRepeatInt(const ::android::aidl::versioned::tests::Foo& /*inFoo*/, ::android::aidl::versioned::tests::Foo* /*inoutFoo*/, ::android::aidl::versioned::tests::Foo* /*outFoo*/, int32_t /*value*/, int32_t* /*_aidl_return*/) override {
+ return ::android::binder::Status::fromStatusT(::android::UNKNOWN_TRANSACTION);
+ }
+ ::android::binder::Status returnsLengthOfFooArray(const ::std::vector<::android::aidl::versioned::tests::Foo>& /*foos*/, int32_t* /*_aidl_return*/) override {
+ return ::android::binder::Status::fromStatusT(::android::UNKNOWN_TRANSACTION);
+ }
+ int32_t getInterfaceVersion() override {
+ return 0;
+ }
+ std::string getInterfaceHash() override {
+ return "";
+ }
+}; // class IFooInterfaceDefault
+} // namespace tests
+} // namespace versioned
+} // namespace aidl
+} // namespace android
diff --git a/tests/golden_output/aidl-test-versioned-interface-V2-java-source/gen/timestamp b/tests/golden_output/aidl-test-versioned-interface-V1-cpp-source/gen/timestamp
similarity index 100%
copy from tests/golden_output/aidl-test-versioned-interface-V2-java-source/gen/timestamp
copy to tests/golden_output/aidl-test-versioned-interface-V1-cpp-source/gen/timestamp
diff --git a/tests/golden_output/aidl-test-versioned-interface-V2-java-source/gen/android/aidl/versioned/tests/BazUnion.java b/tests/golden_output/aidl-test-versioned-interface-V1-java-source/gen/android/aidl/versioned/tests/BazUnion.java
similarity index 80%
rename from tests/golden_output/aidl-test-versioned-interface-V2-java-source/gen/android/aidl/versioned/tests/BazUnion.java
rename to tests/golden_output/aidl-test-versioned-interface-V1-java-source/gen/android/aidl/versioned/tests/BazUnion.java
index 7a85c41..29da9c2 100644
--- a/tests/golden_output/aidl-test-versioned-interface-V2-java-source/gen/android/aidl/versioned/tests/BazUnion.java
+++ b/tests/golden_output/aidl-test-versioned-interface-V1-java-source/gen/android/aidl/versioned/tests/BazUnion.java
@@ -5,7 +5,6 @@
public final class BazUnion implements android.os.Parcelable {
// tags for union fields
public final static int intNum = 0; // int intNum;
- public final static int longNum = 1; // long longNum;
private int _tag;
private Object _value;
@@ -44,21 +43,6 @@
_set(intNum, _value);
}
- // long longNum;
-
- public static BazUnion longNum(long _value) {
- return new BazUnion(longNum, _value);
- }
-
- public long getLongNum() {
- _assertTag(longNum);
- return (long) _value;
- }
-
- public void setLongNum(long _value) {
- _set(longNum, _value);
- }
-
public static final android.os.Parcelable.Creator<BazUnion> CREATOR = new android.os.Parcelable.Creator<BazUnion>() {
@Override
public BazUnion createFromParcel(android.os.Parcel _aidl_source) {
@@ -77,9 +61,6 @@
case intNum:
_aidl_parcel.writeInt(getIntNum());
break;
- case longNum:
- _aidl_parcel.writeLong(getLongNum());
- break;
}
}
@@ -92,11 +73,6 @@
_aidl_value = _aidl_parcel.readInt();
_set(_aidl_tag, _aidl_value);
return; }
- case longNum: {
- long _aidl_value;
- _aidl_value = _aidl_parcel.readLong();
- _set(_aidl_tag, _aidl_value);
- return; }
}
throw new IllegalArgumentException("union: unknown tag: " + _aidl_tag);
}
@@ -118,7 +94,6 @@
private String _tagString(int _tag) {
switch (_tag) {
case intNum: return "intNum";
- case longNum: return "longNum";
}
throw new IllegalStateException("unknown field: " + _tag);
}
diff --git a/tests/golden_output/aidl-test-versioned-interface-V1-java-source/gen/android/aidl/versioned/tests/BazUnion.java.d b/tests/golden_output/aidl-test-versioned-interface-V1-java-source/gen/android/aidl/versioned/tests/BazUnion.java.d
new file mode 100644
index 0000000..1c7895a
--- /dev/null
+++ b/tests/golden_output/aidl-test-versioned-interface-V1-java-source/gen/android/aidl/versioned/tests/BazUnion.java.d
@@ -0,0 +1,2 @@
+out/soong/.intermediates/system/tools/aidl/aidl-test-versioned-interface-V1-java-source/gen/android/aidl/versioned/tests/BazUnion.java : \
+ system/tools/aidl/aidl_api/aidl-test-versioned-interface/1/android/aidl/versioned/tests/BazUnion.aidl
diff --git a/tests/golden_output/aidl-test-versioned-interface-V2-java-source/gen/android/aidl/versioned/tests/Foo.java b/tests/golden_output/aidl-test-versioned-interface-V1-java-source/gen/android/aidl/versioned/tests/Foo.java
similarity index 88%
rename from tests/golden_output/aidl-test-versioned-interface-V2-java-source/gen/android/aidl/versioned/tests/Foo.java
rename to tests/golden_output/aidl-test-versioned-interface-V1-java-source/gen/android/aidl/versioned/tests/Foo.java
index e58c2fb..8a5e67e 100644
--- a/tests/golden_output/aidl-test-versioned-interface-V2-java-source/gen/android/aidl/versioned/tests/Foo.java
+++ b/tests/golden_output/aidl-test-versioned-interface-V1-java-source/gen/android/aidl/versioned/tests/Foo.java
@@ -4,7 +4,6 @@
package android.aidl.versioned.tests;
public class Foo implements android.os.Parcelable
{
- public int intDefault42 = 42;
public static final android.os.Parcelable.Creator<Foo> CREATOR = new android.os.Parcelable.Creator<Foo>() {
@Override
public Foo createFromParcel(android.os.Parcel _aidl_source) {
@@ -21,7 +20,6 @@
{
int _aidl_start_pos = _aidl_parcel.dataPosition();
_aidl_parcel.writeInt(0);
- _aidl_parcel.writeInt(intDefault42);
int _aidl_end_pos = _aidl_parcel.dataPosition();
_aidl_parcel.setDataPosition(_aidl_start_pos);
_aidl_parcel.writeInt(_aidl_end_pos - _aidl_start_pos);
@@ -33,8 +31,6 @@
int _aidl_parcelable_size = _aidl_parcel.readInt();
try {
if (_aidl_parcelable_size < 4) throw new android.os.BadParcelableException("Parcelable too small");;
- if (_aidl_parcel.dataPosition() - _aidl_start_pos >= _aidl_parcelable_size) return;
- intDefault42 = _aidl_parcel.readInt();
} finally {
if (_aidl_start_pos > (Integer.MAX_VALUE - _aidl_parcelable_size)) {
throw new android.os.BadParcelableException("Overflow in the size of parcelable");
diff --git a/tests/golden_output/aidl-test-versioned-interface-V1-java-source/gen/android/aidl/versioned/tests/Foo.java.d b/tests/golden_output/aidl-test-versioned-interface-V1-java-source/gen/android/aidl/versioned/tests/Foo.java.d
new file mode 100644
index 0000000..23763bb
--- /dev/null
+++ b/tests/golden_output/aidl-test-versioned-interface-V1-java-source/gen/android/aidl/versioned/tests/Foo.java.d
@@ -0,0 +1,2 @@
+out/soong/.intermediates/system/tools/aidl/aidl-test-versioned-interface-V1-java-source/gen/android/aidl/versioned/tests/Foo.java : \
+ system/tools/aidl/aidl_api/aidl-test-versioned-interface/1/android/aidl/versioned/tests/Foo.aidl
diff --git a/tests/golden_output/aidl-test-versioned-interface-V2-java-source/gen/android/aidl/versioned/tests/IFooInterface.java b/tests/golden_output/aidl-test-versioned-interface-V1-java-source/gen/android/aidl/versioned/tests/IFooInterface.java
similarity index 88%
rename from tests/golden_output/aidl-test-versioned-interface-V2-java-source/gen/android/aidl/versioned/tests/IFooInterface.java
rename to tests/golden_output/aidl-test-versioned-interface-V1-java-source/gen/android/aidl/versioned/tests/IFooInterface.java
index f0f5777..7d66241 100644
--- a/tests/golden_output/aidl-test-versioned-interface-V2-java-source/gen/android/aidl/versioned/tests/IFooInterface.java
+++ b/tests/golden_output/aidl-test-versioned-interface-V1-java-source/gen/android/aidl/versioned/tests/IFooInterface.java
@@ -10,8 +10,8 @@
* getInterfaceVersion} returns as that is the version of the interface
* that the remote object is implementing.
*/
- public static final int VERSION = 2;
- public static final String HASH = "da8c4bc94ca7feff0e0a65563a466787698b5891";
+ public static final int VERSION = 1;
+ public static final String HASH = "9e7be1859820c59d9d55dd133e71a3687b5d2e5b";
/** Default implementation for IFooInterface. */
public static class Default implements android.aidl.versioned.tests.IFooInterface
{
@@ -30,9 +30,6 @@
{
return 0;
}
- @Override public void newApi() throws android.os.RemoteException
- {
- }
@Override
public int getInterfaceVersion() {
return 0;
@@ -145,12 +142,6 @@
reply.writeInt(_result);
break;
}
- case TRANSACTION_newApi:
- {
- this.newApi();
- reply.writeNoException();
- break;
- }
default:
{
return super.onTransact(code, data, reply, flags);
@@ -177,7 +168,7 @@
}
@Override public void originalApi() throws android.os.RemoteException
{
- android.os.Parcel _data = android.os.Parcel.obtain();
+ android.os.Parcel _data = android.os.Parcel.obtain(asBinder());
android.os.Parcel _reply = android.os.Parcel.obtain();
try {
_data.writeInterfaceToken(DESCRIPTOR);
@@ -194,7 +185,7 @@
}
@Override public java.lang.String acceptUnionAndReturnString(android.aidl.versioned.tests.BazUnion u) throws android.os.RemoteException
{
- android.os.Parcel _data = android.os.Parcel.obtain();
+ android.os.Parcel _data = android.os.Parcel.obtain(asBinder());
android.os.Parcel _reply = android.os.Parcel.obtain();
java.lang.String _result;
try {
@@ -215,7 +206,7 @@
}
@Override public int ignoreParcelablesAndRepeatInt(android.aidl.versioned.tests.Foo inFoo, android.aidl.versioned.tests.Foo inoutFoo, android.aidl.versioned.tests.Foo outFoo, int value) throws android.os.RemoteException
{
- android.os.Parcel _data = android.os.Parcel.obtain();
+ android.os.Parcel _data = android.os.Parcel.obtain(asBinder());
android.os.Parcel _reply = android.os.Parcel.obtain();
int _result;
try {
@@ -244,7 +235,7 @@
}
@Override public int returnsLengthOfFooArray(android.aidl.versioned.tests.Foo[] foos) throws android.os.RemoteException
{
- android.os.Parcel _data = android.os.Parcel.obtain();
+ android.os.Parcel _data = android.os.Parcel.obtain(asBinder());
android.os.Parcel _reply = android.os.Parcel.obtain();
int _result;
try {
@@ -263,27 +254,10 @@
}
return _result;
}
- @Override public void newApi() throws android.os.RemoteException
- {
- android.os.Parcel _data = android.os.Parcel.obtain();
- android.os.Parcel _reply = android.os.Parcel.obtain();
- try {
- _data.writeInterfaceToken(DESCRIPTOR);
- boolean _status = mRemote.transact(Stub.TRANSACTION_newApi, _data, _reply, 0);
- if (!_status) {
- throw new android.os.RemoteException("Method newApi is unimplemented.");
- }
- _reply.readException();
- }
- finally {
- _reply.recycle();
- _data.recycle();
- }
- }
@Override
public int getInterfaceVersion() throws android.os.RemoteException {
if (mCachedVersion == -1) {
- android.os.Parcel data = android.os.Parcel.obtain();
+ android.os.Parcel data = android.os.Parcel.obtain(asBinder());
android.os.Parcel reply = android.os.Parcel.obtain();
try {
data.writeInterfaceToken(DESCRIPTOR);
@@ -300,7 +274,7 @@
@Override
public synchronized String getInterfaceHash() throws android.os.RemoteException {
if ("-1".equals(mCachedHash)) {
- android.os.Parcel data = android.os.Parcel.obtain();
+ android.os.Parcel data = android.os.Parcel.obtain(asBinder());
android.os.Parcel reply = android.os.Parcel.obtain();
try {
data.writeInterfaceToken(DESCRIPTOR);
@@ -319,7 +293,6 @@
static final int TRANSACTION_acceptUnionAndReturnString = (android.os.IBinder.FIRST_CALL_TRANSACTION + 1);
static final int TRANSACTION_ignoreParcelablesAndRepeatInt = (android.os.IBinder.FIRST_CALL_TRANSACTION + 2);
static final int TRANSACTION_returnsLengthOfFooArray = (android.os.IBinder.FIRST_CALL_TRANSACTION + 3);
- static final int TRANSACTION_newApi = (android.os.IBinder.FIRST_CALL_TRANSACTION + 4);
static final int TRANSACTION_getInterfaceVersion = (android.os.IBinder.FIRST_CALL_TRANSACTION + 16777214);
static final int TRANSACTION_getInterfaceHash = (android.os.IBinder.FIRST_CALL_TRANSACTION + 16777213);
}
@@ -328,7 +301,6 @@
public java.lang.String acceptUnionAndReturnString(android.aidl.versioned.tests.BazUnion u) throws android.os.RemoteException;
public int ignoreParcelablesAndRepeatInt(android.aidl.versioned.tests.Foo inFoo, android.aidl.versioned.tests.Foo inoutFoo, android.aidl.versioned.tests.Foo outFoo, int value) throws android.os.RemoteException;
public int returnsLengthOfFooArray(android.aidl.versioned.tests.Foo[] foos) throws android.os.RemoteException;
- public void newApi() throws android.os.RemoteException;
public int getInterfaceVersion() throws android.os.RemoteException;
public String getInterfaceHash() throws android.os.RemoteException;
}
diff --git a/tests/golden_output/aidl-test-versioned-interface-V1-java-source/gen/android/aidl/versioned/tests/IFooInterface.java.d b/tests/golden_output/aidl-test-versioned-interface-V1-java-source/gen/android/aidl/versioned/tests/IFooInterface.java.d
new file mode 100644
index 0000000..6875917
--- /dev/null
+++ b/tests/golden_output/aidl-test-versioned-interface-V1-java-source/gen/android/aidl/versioned/tests/IFooInterface.java.d
@@ -0,0 +1,4 @@
+out/soong/.intermediates/system/tools/aidl/aidl-test-versioned-interface-V1-java-source/gen/android/aidl/versioned/tests/IFooInterface.java : \
+ system/tools/aidl/aidl_api/aidl-test-versioned-interface/1/android/aidl/versioned/tests/IFooInterface.aidl \
+ system/tools/aidl/aidl_api/aidl-test-versioned-interface/1/android/aidl/versioned/tests/BazUnion.aidl \
+ system/tools/aidl/aidl_api/aidl-test-versioned-interface/1/android/aidl/versioned/tests/Foo.aidl
diff --git a/tests/golden_output/aidl-test-versioned-interface-V2-java-source/gen/timestamp b/tests/golden_output/aidl-test-versioned-interface-V1-java-source/gen/timestamp
similarity index 100%
rename from tests/golden_output/aidl-test-versioned-interface-V2-java-source/gen/timestamp
rename to tests/golden_output/aidl-test-versioned-interface-V1-java-source/gen/timestamp
diff --git a/tests/golden_output/aidl-test-versioned-interface-V1-ndk-source/gen/android/aidl/versioned/tests/BazUnion.cpp b/tests/golden_output/aidl-test-versioned-interface-V1-ndk-source/gen/android/aidl/versioned/tests/BazUnion.cpp
new file mode 100644
index 0000000..118a85e
--- /dev/null
+++ b/tests/golden_output/aidl-test-versioned-interface-V1-ndk-source/gen/android/aidl/versioned/tests/BazUnion.cpp
@@ -0,0 +1,43 @@
+#include "aidl/android/aidl/versioned/tests/BazUnion.h"
+
+#include <android/binder_parcel_utils.h>
+
+namespace aidl {
+namespace android {
+namespace aidl {
+namespace versioned {
+namespace tests {
+const char* BazUnion::descriptor = "android.aidl.versioned.tests.BazUnion";
+
+binder_status_t BazUnion::readFromParcel(const AParcel* _parcel) {
+ binder_status_t _aidl_ret_status;
+ int32_t _aidl_tag;
+ if ((_aidl_ret_status = ::ndk::AParcel_readData(_parcel, &_aidl_tag)) != STATUS_OK) return _aidl_ret_status;
+ switch (static_cast<Tag>(_aidl_tag)) {
+ case intNum: {
+ int32_t _aidl_value;
+ if ((_aidl_ret_status = ::ndk::AParcel_readData(_parcel, &_aidl_value)) != STATUS_OK) return _aidl_ret_status;
+ if constexpr (std::is_trivially_copyable_v<int32_t>) {
+ set<intNum>(_aidl_value);
+ } else {
+ // NOLINTNEXTLINE(performance-move-const-arg)
+ set<intNum>(std::move(_aidl_value));
+ }
+ return STATUS_OK; }
+ }
+ return STATUS_BAD_VALUE;
+}
+binder_status_t BazUnion::writeToParcel(AParcel* _parcel) const {
+ binder_status_t _aidl_ret_status = ::ndk::AParcel_writeData(_parcel, static_cast<int32_t>(getTag()));
+ if (_aidl_ret_status != STATUS_OK) return _aidl_ret_status;
+ switch (getTag()) {
+ case intNum: return ::ndk::AParcel_writeData(_parcel, get<intNum>());
+ }
+ __assert2(__FILE__, __LINE__, __PRETTY_FUNCTION__, "can't reach here");
+}
+
+} // namespace tests
+} // namespace versioned
+} // namespace aidl
+} // namespace android
+} // namespace aidl
diff --git a/tests/golden_output/aidl-test-versioned-interface-V1-ndk-source/gen/android/aidl/versioned/tests/BazUnion.cpp.d b/tests/golden_output/aidl-test-versioned-interface-V1-ndk-source/gen/android/aidl/versioned/tests/BazUnion.cpp.d
new file mode 100644
index 0000000..b4581bd
--- /dev/null
+++ b/tests/golden_output/aidl-test-versioned-interface-V1-ndk-source/gen/android/aidl/versioned/tests/BazUnion.cpp.d
@@ -0,0 +1,2 @@
+out/soong/.intermediates/system/tools/aidl/aidl-test-versioned-interface-V1-ndk-source/gen/android/aidl/versioned/tests/BazUnion.cpp : \
+ system/tools/aidl/aidl_api/aidl-test-versioned-interface/1/android/aidl/versioned/tests/BazUnion.aidl
diff --git a/tests/golden_output/aidl-test-versioned-interface-V1-ndk-source/gen/android/aidl/versioned/tests/Foo.cpp b/tests/golden_output/aidl-test-versioned-interface-V1-ndk-source/gen/android/aidl/versioned/tests/Foo.cpp
new file mode 100644
index 0000000..fff0be5
--- /dev/null
+++ b/tests/golden_output/aidl-test-versioned-interface-V1-ndk-source/gen/android/aidl/versioned/tests/Foo.cpp
@@ -0,0 +1,41 @@
+#include "aidl/android/aidl/versioned/tests/Foo.h"
+
+#include <android/binder_parcel_utils.h>
+
+namespace aidl {
+namespace android {
+namespace aidl {
+namespace versioned {
+namespace tests {
+const char* Foo::descriptor = "android.aidl.versioned.tests.Foo";
+
+binder_status_t Foo::readFromParcel(const AParcel* _aidl_parcel) {
+ binder_status_t _aidl_ret_status = STATUS_OK;
+ int32_t _aidl_start_pos = AParcel_getDataPosition(_aidl_parcel);
+ int32_t _aidl_parcelable_size = 0;
+ _aidl_ret_status = AParcel_readInt32(_aidl_parcel, &_aidl_parcelable_size);
+ if (_aidl_ret_status != STATUS_OK) return _aidl_ret_status;
+
+ if (_aidl_parcelable_size < 4) return STATUS_BAD_VALUE;
+ if (_aidl_start_pos > INT32_MAX - _aidl_parcelable_size) return STATUS_BAD_VALUE;
+ AParcel_setDataPosition(_aidl_parcel, _aidl_start_pos + _aidl_parcelable_size);
+ return _aidl_ret_status;
+}
+binder_status_t Foo::writeToParcel(AParcel* _aidl_parcel) const {
+ binder_status_t _aidl_ret_status;
+ size_t _aidl_start_pos = AParcel_getDataPosition(_aidl_parcel);
+ _aidl_ret_status = AParcel_writeInt32(_aidl_parcel, 0);
+ if (_aidl_ret_status != STATUS_OK) return _aidl_ret_status;
+
+ size_t _aidl_end_pos = AParcel_getDataPosition(_aidl_parcel);
+ AParcel_setDataPosition(_aidl_parcel, _aidl_start_pos);
+ AParcel_writeInt32(_aidl_parcel, _aidl_end_pos - _aidl_start_pos);
+ AParcel_setDataPosition(_aidl_parcel, _aidl_end_pos);
+ return _aidl_ret_status;
+}
+
+} // namespace tests
+} // namespace versioned
+} // namespace aidl
+} // namespace android
+} // namespace aidl
diff --git a/tests/golden_output/aidl-test-versioned-interface-V1-ndk-source/gen/android/aidl/versioned/tests/Foo.cpp.d b/tests/golden_output/aidl-test-versioned-interface-V1-ndk-source/gen/android/aidl/versioned/tests/Foo.cpp.d
new file mode 100644
index 0000000..df963e3
--- /dev/null
+++ b/tests/golden_output/aidl-test-versioned-interface-V1-ndk-source/gen/android/aidl/versioned/tests/Foo.cpp.d
@@ -0,0 +1,2 @@
+out/soong/.intermediates/system/tools/aidl/aidl-test-versioned-interface-V1-ndk-source/gen/android/aidl/versioned/tests/Foo.cpp : \
+ system/tools/aidl/aidl_api/aidl-test-versioned-interface/1/android/aidl/versioned/tests/Foo.aidl
diff --git a/tests/golden_output/aidl-test-versioned-interface-V1-ndk-source/gen/android/aidl/versioned/tests/IFooInterface.cpp b/tests/golden_output/aidl-test-versioned-interface-V1-ndk-source/gen/android/aidl/versioned/tests/IFooInterface.cpp
new file mode 100644
index 0000000..09eddd5
--- /dev/null
+++ b/tests/golden_output/aidl-test-versioned-interface-V1-ndk-source/gen/android/aidl/versioned/tests/IFooInterface.cpp
@@ -0,0 +1,483 @@
+#include "aidl/android/aidl/versioned/tests/IFooInterface.h"
+
+#include <android/binder_parcel_utils.h>
+#include <aidl/android/aidl/versioned/tests/BnFooInterface.h>
+#include <aidl/android/aidl/versioned/tests/BpFooInterface.h>
+
+namespace aidl {
+namespace android {
+namespace aidl {
+namespace versioned {
+namespace tests {
+static binder_status_t _aidl_android_aidl_versioned_tests_IFooInterface_onTransact(AIBinder* _aidl_binder, transaction_code_t _aidl_code, const AParcel* _aidl_in, AParcel* _aidl_out) {
+ (void)_aidl_in;
+ (void)_aidl_out;
+ binder_status_t _aidl_ret_status = STATUS_UNKNOWN_TRANSACTION;
+ std::shared_ptr<BnFooInterface> _aidl_impl = std::static_pointer_cast<BnFooInterface>(::ndk::ICInterface::asInterface(_aidl_binder));
+ switch (_aidl_code) {
+ case (FIRST_CALL_TRANSACTION + 0 /*originalApi*/): {
+
+ ::ndk::ScopedAStatus _aidl_status = _aidl_impl->originalApi();
+ _aidl_ret_status = AParcel_writeStatusHeader(_aidl_out, _aidl_status.get());
+ if (_aidl_ret_status != STATUS_OK) break;
+
+ if (!AStatus_isOk(_aidl_status.get())) break;
+
+ break;
+ }
+ case (FIRST_CALL_TRANSACTION + 1 /*acceptUnionAndReturnString*/): {
+ ::aidl::android::aidl::versioned::tests::BazUnion in_u;
+ std::string _aidl_return;
+
+ _aidl_ret_status = ::ndk::AParcel_readData(_aidl_in, &in_u);
+ if (_aidl_ret_status != STATUS_OK) break;
+
+ ::ndk::ScopedAStatus _aidl_status = _aidl_impl->acceptUnionAndReturnString(in_u, &_aidl_return);
+ _aidl_ret_status = AParcel_writeStatusHeader(_aidl_out, _aidl_status.get());
+ if (_aidl_ret_status != STATUS_OK) break;
+
+ if (!AStatus_isOk(_aidl_status.get())) break;
+
+ _aidl_ret_status = ::ndk::AParcel_writeData(_aidl_out, _aidl_return);
+ if (_aidl_ret_status != STATUS_OK) break;
+
+ break;
+ }
+ case (FIRST_CALL_TRANSACTION + 2 /*ignoreParcelablesAndRepeatInt*/): {
+ ::aidl::android::aidl::versioned::tests::Foo in_inFoo;
+ ::aidl::android::aidl::versioned::tests::Foo in_inoutFoo;
+ ::aidl::android::aidl::versioned::tests::Foo out_outFoo;
+ int32_t in_value;
+ int32_t _aidl_return;
+
+ _aidl_ret_status = ::ndk::AParcel_readData(_aidl_in, &in_inFoo);
+ if (_aidl_ret_status != STATUS_OK) break;
+
+ _aidl_ret_status = ::ndk::AParcel_readData(_aidl_in, &in_inoutFoo);
+ if (_aidl_ret_status != STATUS_OK) break;
+
+ _aidl_ret_status = ::ndk::AParcel_readData(_aidl_in, &in_value);
+ if (_aidl_ret_status != STATUS_OK) break;
+
+ ::ndk::ScopedAStatus _aidl_status = _aidl_impl->ignoreParcelablesAndRepeatInt(in_inFoo, &in_inoutFoo, &out_outFoo, in_value, &_aidl_return);
+ _aidl_ret_status = AParcel_writeStatusHeader(_aidl_out, _aidl_status.get());
+ if (_aidl_ret_status != STATUS_OK) break;
+
+ if (!AStatus_isOk(_aidl_status.get())) break;
+
+ _aidl_ret_status = ::ndk::AParcel_writeData(_aidl_out, _aidl_return);
+ if (_aidl_ret_status != STATUS_OK) break;
+
+ _aidl_ret_status = ::ndk::AParcel_writeData(_aidl_out, in_inoutFoo);
+ if (_aidl_ret_status != STATUS_OK) break;
+
+ _aidl_ret_status = ::ndk::AParcel_writeData(_aidl_out, out_outFoo);
+ if (_aidl_ret_status != STATUS_OK) break;
+
+ break;
+ }
+ case (FIRST_CALL_TRANSACTION + 3 /*returnsLengthOfFooArray*/): {
+ std::vector<::aidl::android::aidl::versioned::tests::Foo> in_foos;
+ int32_t _aidl_return;
+
+ _aidl_ret_status = ::ndk::AParcel_readData(_aidl_in, &in_foos);
+ if (_aidl_ret_status != STATUS_OK) break;
+
+ ::ndk::ScopedAStatus _aidl_status = _aidl_impl->returnsLengthOfFooArray(in_foos, &_aidl_return);
+ _aidl_ret_status = AParcel_writeStatusHeader(_aidl_out, _aidl_status.get());
+ if (_aidl_ret_status != STATUS_OK) break;
+
+ if (!AStatus_isOk(_aidl_status.get())) break;
+
+ _aidl_ret_status = ::ndk::AParcel_writeData(_aidl_out, _aidl_return);
+ if (_aidl_ret_status != STATUS_OK) break;
+
+ break;
+ }
+ case (FIRST_CALL_TRANSACTION + 16777214 /*getInterfaceVersion*/): {
+ int32_t _aidl_return;
+
+ ::ndk::ScopedAStatus _aidl_status = _aidl_impl->getInterfaceVersion(&_aidl_return);
+ _aidl_ret_status = AParcel_writeStatusHeader(_aidl_out, _aidl_status.get());
+ if (_aidl_ret_status != STATUS_OK) break;
+
+ if (!AStatus_isOk(_aidl_status.get())) break;
+
+ _aidl_ret_status = ::ndk::AParcel_writeData(_aidl_out, _aidl_return);
+ if (_aidl_ret_status != STATUS_OK) break;
+
+ break;
+ }
+ case (FIRST_CALL_TRANSACTION + 16777213 /*getInterfaceHash*/): {
+ std::string _aidl_return;
+
+ ::ndk::ScopedAStatus _aidl_status = _aidl_impl->getInterfaceHash(&_aidl_return);
+ _aidl_ret_status = AParcel_writeStatusHeader(_aidl_out, _aidl_status.get());
+ if (_aidl_ret_status != STATUS_OK) break;
+
+ if (!AStatus_isOk(_aidl_status.get())) break;
+
+ _aidl_ret_status = ::ndk::AParcel_writeData(_aidl_out, _aidl_return);
+ if (_aidl_ret_status != STATUS_OK) break;
+
+ break;
+ }
+ }
+ return _aidl_ret_status;
+}
+
+static AIBinder_Class* _g_aidl_android_aidl_versioned_tests_IFooInterface_clazz = ::ndk::ICInterface::defineClass(IFooInterface::descriptor, _aidl_android_aidl_versioned_tests_IFooInterface_onTransact);
+
+BpFooInterface::BpFooInterface(const ::ndk::SpAIBinder& binder) : BpCInterface(binder) {}
+BpFooInterface::~BpFooInterface() {}
+
+::ndk::ScopedAStatus BpFooInterface::originalApi() {
+ binder_status_t _aidl_ret_status = STATUS_OK;
+ ::ndk::ScopedAStatus _aidl_status;
+ ::ndk::ScopedAParcel _aidl_in;
+ ::ndk::ScopedAParcel _aidl_out;
+
+ _aidl_ret_status = AIBinder_prepareTransaction(asBinder().get(), _aidl_in.getR());
+ if (_aidl_ret_status != STATUS_OK) goto _aidl_error;
+
+ _aidl_ret_status = AIBinder_transact(
+ asBinder().get(),
+ (FIRST_CALL_TRANSACTION + 0 /*originalApi*/),
+ _aidl_in.getR(),
+ _aidl_out.getR(),
+ 0
+ #ifdef BINDER_STABILITY_SUPPORT
+ | FLAG_PRIVATE_LOCAL
+ #endif // BINDER_STABILITY_SUPPORT
+ );
+ if (_aidl_ret_status == STATUS_UNKNOWN_TRANSACTION && IFooInterface::getDefaultImpl()) {
+ _aidl_status = IFooInterface::getDefaultImpl()->originalApi();
+ goto _aidl_status_return;
+ }
+ if (_aidl_ret_status != STATUS_OK) goto _aidl_error;
+
+ _aidl_ret_status = AParcel_readStatusHeader(_aidl_out.get(), _aidl_status.getR());
+ if (_aidl_ret_status != STATUS_OK) goto _aidl_error;
+
+ if (!AStatus_isOk(_aidl_status.get())) goto _aidl_status_return;
+ _aidl_error:
+ _aidl_status.set(AStatus_fromStatus(_aidl_ret_status));
+ _aidl_status_return:
+ return _aidl_status;
+}
+::ndk::ScopedAStatus BpFooInterface::acceptUnionAndReturnString(const ::aidl::android::aidl::versioned::tests::BazUnion& in_u, std::string* _aidl_return) {
+ binder_status_t _aidl_ret_status = STATUS_OK;
+ ::ndk::ScopedAStatus _aidl_status;
+ ::ndk::ScopedAParcel _aidl_in;
+ ::ndk::ScopedAParcel _aidl_out;
+
+ _aidl_ret_status = AIBinder_prepareTransaction(asBinder().get(), _aidl_in.getR());
+ if (_aidl_ret_status != STATUS_OK) goto _aidl_error;
+
+ _aidl_ret_status = ::ndk::AParcel_writeData(_aidl_in.get(), in_u);
+ if (_aidl_ret_status != STATUS_OK) goto _aidl_error;
+
+ _aidl_ret_status = AIBinder_transact(
+ asBinder().get(),
+ (FIRST_CALL_TRANSACTION + 1 /*acceptUnionAndReturnString*/),
+ _aidl_in.getR(),
+ _aidl_out.getR(),
+ 0
+ #ifdef BINDER_STABILITY_SUPPORT
+ | FLAG_PRIVATE_LOCAL
+ #endif // BINDER_STABILITY_SUPPORT
+ );
+ if (_aidl_ret_status == STATUS_UNKNOWN_TRANSACTION && IFooInterface::getDefaultImpl()) {
+ _aidl_status = IFooInterface::getDefaultImpl()->acceptUnionAndReturnString(in_u, _aidl_return);
+ goto _aidl_status_return;
+ }
+ if (_aidl_ret_status != STATUS_OK) goto _aidl_error;
+
+ _aidl_ret_status = AParcel_readStatusHeader(_aidl_out.get(), _aidl_status.getR());
+ if (_aidl_ret_status != STATUS_OK) goto _aidl_error;
+
+ if (!AStatus_isOk(_aidl_status.get())) goto _aidl_status_return;
+ _aidl_ret_status = ::ndk::AParcel_readData(_aidl_out.get(), _aidl_return);
+ if (_aidl_ret_status != STATUS_OK) goto _aidl_error;
+
+ _aidl_error:
+ _aidl_status.set(AStatus_fromStatus(_aidl_ret_status));
+ _aidl_status_return:
+ return _aidl_status;
+}
+::ndk::ScopedAStatus BpFooInterface::ignoreParcelablesAndRepeatInt(const ::aidl::android::aidl::versioned::tests::Foo& in_inFoo, ::aidl::android::aidl::versioned::tests::Foo* in_inoutFoo, ::aidl::android::aidl::versioned::tests::Foo* out_outFoo, int32_t in_value, int32_t* _aidl_return) {
+ binder_status_t _aidl_ret_status = STATUS_OK;
+ ::ndk::ScopedAStatus _aidl_status;
+ ::ndk::ScopedAParcel _aidl_in;
+ ::ndk::ScopedAParcel _aidl_out;
+
+ _aidl_ret_status = AIBinder_prepareTransaction(asBinder().get(), _aidl_in.getR());
+ if (_aidl_ret_status != STATUS_OK) goto _aidl_error;
+
+ _aidl_ret_status = ::ndk::AParcel_writeData(_aidl_in.get(), in_inFoo);
+ if (_aidl_ret_status != STATUS_OK) goto _aidl_error;
+
+ _aidl_ret_status = ::ndk::AParcel_writeData(_aidl_in.get(), *in_inoutFoo);
+ if (_aidl_ret_status != STATUS_OK) goto _aidl_error;
+
+ _aidl_ret_status = ::ndk::AParcel_writeData(_aidl_in.get(), in_value);
+ if (_aidl_ret_status != STATUS_OK) goto _aidl_error;
+
+ _aidl_ret_status = AIBinder_transact(
+ asBinder().get(),
+ (FIRST_CALL_TRANSACTION + 2 /*ignoreParcelablesAndRepeatInt*/),
+ _aidl_in.getR(),
+ _aidl_out.getR(),
+ 0
+ #ifdef BINDER_STABILITY_SUPPORT
+ | FLAG_PRIVATE_LOCAL
+ #endif // BINDER_STABILITY_SUPPORT
+ );
+ if (_aidl_ret_status == STATUS_UNKNOWN_TRANSACTION && IFooInterface::getDefaultImpl()) {
+ _aidl_status = IFooInterface::getDefaultImpl()->ignoreParcelablesAndRepeatInt(in_inFoo, in_inoutFoo, out_outFoo, in_value, _aidl_return);
+ goto _aidl_status_return;
+ }
+ if (_aidl_ret_status != STATUS_OK) goto _aidl_error;
+
+ _aidl_ret_status = AParcel_readStatusHeader(_aidl_out.get(), _aidl_status.getR());
+ if (_aidl_ret_status != STATUS_OK) goto _aidl_error;
+
+ if (!AStatus_isOk(_aidl_status.get())) goto _aidl_status_return;
+ _aidl_ret_status = ::ndk::AParcel_readData(_aidl_out.get(), _aidl_return);
+ if (_aidl_ret_status != STATUS_OK) goto _aidl_error;
+
+ _aidl_ret_status = ::ndk::AParcel_readData(_aidl_out.get(), in_inoutFoo);
+ if (_aidl_ret_status != STATUS_OK) goto _aidl_error;
+
+ _aidl_ret_status = ::ndk::AParcel_readData(_aidl_out.get(), out_outFoo);
+ if (_aidl_ret_status != STATUS_OK) goto _aidl_error;
+
+ _aidl_error:
+ _aidl_status.set(AStatus_fromStatus(_aidl_ret_status));
+ _aidl_status_return:
+ return _aidl_status;
+}
+::ndk::ScopedAStatus BpFooInterface::returnsLengthOfFooArray(const std::vector<::aidl::android::aidl::versioned::tests::Foo>& in_foos, int32_t* _aidl_return) {
+ binder_status_t _aidl_ret_status = STATUS_OK;
+ ::ndk::ScopedAStatus _aidl_status;
+ ::ndk::ScopedAParcel _aidl_in;
+ ::ndk::ScopedAParcel _aidl_out;
+
+ _aidl_ret_status = AIBinder_prepareTransaction(asBinder().get(), _aidl_in.getR());
+ if (_aidl_ret_status != STATUS_OK) goto _aidl_error;
+
+ _aidl_ret_status = ::ndk::AParcel_writeData(_aidl_in.get(), in_foos);
+ if (_aidl_ret_status != STATUS_OK) goto _aidl_error;
+
+ _aidl_ret_status = AIBinder_transact(
+ asBinder().get(),
+ (FIRST_CALL_TRANSACTION + 3 /*returnsLengthOfFooArray*/),
+ _aidl_in.getR(),
+ _aidl_out.getR(),
+ 0
+ #ifdef BINDER_STABILITY_SUPPORT
+ | FLAG_PRIVATE_LOCAL
+ #endif // BINDER_STABILITY_SUPPORT
+ );
+ if (_aidl_ret_status == STATUS_UNKNOWN_TRANSACTION && IFooInterface::getDefaultImpl()) {
+ _aidl_status = IFooInterface::getDefaultImpl()->returnsLengthOfFooArray(in_foos, _aidl_return);
+ goto _aidl_status_return;
+ }
+ if (_aidl_ret_status != STATUS_OK) goto _aidl_error;
+
+ _aidl_ret_status = AParcel_readStatusHeader(_aidl_out.get(), _aidl_status.getR());
+ if (_aidl_ret_status != STATUS_OK) goto _aidl_error;
+
+ if (!AStatus_isOk(_aidl_status.get())) goto _aidl_status_return;
+ _aidl_ret_status = ::ndk::AParcel_readData(_aidl_out.get(), _aidl_return);
+ if (_aidl_ret_status != STATUS_OK) goto _aidl_error;
+
+ _aidl_error:
+ _aidl_status.set(AStatus_fromStatus(_aidl_ret_status));
+ _aidl_status_return:
+ return _aidl_status;
+}
+::ndk::ScopedAStatus BpFooInterface::getInterfaceVersion(int32_t* _aidl_return) {
+ binder_status_t _aidl_ret_status = STATUS_OK;
+ ::ndk::ScopedAStatus _aidl_status;
+ if (_aidl_cached_version != -1) {
+ *_aidl_return = _aidl_cached_version;
+ _aidl_status.set(AStatus_fromStatus(_aidl_ret_status));
+ return _aidl_status;
+ }
+ ::ndk::ScopedAParcel _aidl_in;
+ ::ndk::ScopedAParcel _aidl_out;
+
+ _aidl_ret_status = AIBinder_prepareTransaction(asBinder().get(), _aidl_in.getR());
+ if (_aidl_ret_status != STATUS_OK) goto _aidl_error;
+
+ _aidl_ret_status = AIBinder_transact(
+ asBinder().get(),
+ (FIRST_CALL_TRANSACTION + 16777214 /*getInterfaceVersion*/),
+ _aidl_in.getR(),
+ _aidl_out.getR(),
+ 0
+ #ifdef BINDER_STABILITY_SUPPORT
+ | FLAG_PRIVATE_LOCAL
+ #endif // BINDER_STABILITY_SUPPORT
+ );
+ if (_aidl_ret_status == STATUS_UNKNOWN_TRANSACTION && IFooInterface::getDefaultImpl()) {
+ _aidl_status = IFooInterface::getDefaultImpl()->getInterfaceVersion(_aidl_return);
+ goto _aidl_status_return;
+ }
+ if (_aidl_ret_status != STATUS_OK) goto _aidl_error;
+
+ _aidl_ret_status = AParcel_readStatusHeader(_aidl_out.get(), _aidl_status.getR());
+ if (_aidl_ret_status != STATUS_OK) goto _aidl_error;
+
+ if (!AStatus_isOk(_aidl_status.get())) goto _aidl_status_return;
+ _aidl_ret_status = ::ndk::AParcel_readData(_aidl_out.get(), _aidl_return);
+ if (_aidl_ret_status != STATUS_OK) goto _aidl_error;
+
+ _aidl_cached_version = *_aidl_return;
+ _aidl_error:
+ _aidl_status.set(AStatus_fromStatus(_aidl_ret_status));
+ _aidl_status_return:
+ return _aidl_status;
+}
+::ndk::ScopedAStatus BpFooInterface::getInterfaceHash(std::string* _aidl_return) {
+ binder_status_t _aidl_ret_status = STATUS_OK;
+ ::ndk::ScopedAStatus _aidl_status;
+ const std::lock_guard<std::mutex> lock(_aidl_cached_hash_mutex);
+ if (_aidl_cached_hash != "-1") {
+ *_aidl_return = _aidl_cached_hash;
+ _aidl_status.set(AStatus_fromStatus(_aidl_ret_status));
+ return _aidl_status;
+ }
+ ::ndk::ScopedAParcel _aidl_in;
+ ::ndk::ScopedAParcel _aidl_out;
+
+ _aidl_ret_status = AIBinder_prepareTransaction(asBinder().get(), _aidl_in.getR());
+ if (_aidl_ret_status != STATUS_OK) goto _aidl_error;
+
+ _aidl_ret_status = AIBinder_transact(
+ asBinder().get(),
+ (FIRST_CALL_TRANSACTION + 16777213 /*getInterfaceHash*/),
+ _aidl_in.getR(),
+ _aidl_out.getR(),
+ 0
+ #ifdef BINDER_STABILITY_SUPPORT
+ | FLAG_PRIVATE_LOCAL
+ #endif // BINDER_STABILITY_SUPPORT
+ );
+ if (_aidl_ret_status == STATUS_UNKNOWN_TRANSACTION && IFooInterface::getDefaultImpl()) {
+ _aidl_status = IFooInterface::getDefaultImpl()->getInterfaceHash(_aidl_return);
+ goto _aidl_status_return;
+ }
+ if (_aidl_ret_status != STATUS_OK) goto _aidl_error;
+
+ _aidl_ret_status = AParcel_readStatusHeader(_aidl_out.get(), _aidl_status.getR());
+ if (_aidl_ret_status != STATUS_OK) goto _aidl_error;
+
+ if (!AStatus_isOk(_aidl_status.get())) goto _aidl_status_return;
+ _aidl_ret_status = ::ndk::AParcel_readData(_aidl_out.get(), _aidl_return);
+ if (_aidl_ret_status != STATUS_OK) goto _aidl_error;
+
+ _aidl_cached_hash = *_aidl_return;
+ _aidl_error:
+ _aidl_status.set(AStatus_fromStatus(_aidl_ret_status));
+ _aidl_status_return:
+ return _aidl_status;
+}
+// Source for BnFooInterface
+BnFooInterface::BnFooInterface() {}
+BnFooInterface::~BnFooInterface() {}
+::ndk::SpAIBinder BnFooInterface::createBinder() {
+ AIBinder* binder = AIBinder_new(_g_aidl_android_aidl_versioned_tests_IFooInterface_clazz, static_cast<void*>(this));
+ #ifdef BINDER_STABILITY_SUPPORT
+ AIBinder_markCompilationUnitStability(binder);
+ #endif // BINDER_STABILITY_SUPPORT
+ return ::ndk::SpAIBinder(binder);
+}
+::ndk::ScopedAStatus BnFooInterface::getInterfaceVersion(int32_t* _aidl_return) {
+ *_aidl_return = IFooInterface::version;
+ return ::ndk::ScopedAStatus(AStatus_newOk());
+}
+::ndk::ScopedAStatus BnFooInterface::getInterfaceHash(std::string* _aidl_return) {
+ *_aidl_return = IFooInterface::hash;
+ return ::ndk::ScopedAStatus(AStatus_newOk());
+}
+// Source for IFooInterface
+const char* IFooInterface::descriptor = "android.aidl.versioned.tests.IFooInterface";
+IFooInterface::IFooInterface() {}
+IFooInterface::~IFooInterface() {}
+
+
+std::shared_ptr<IFooInterface> IFooInterface::fromBinder(const ::ndk::SpAIBinder& binder) {
+ if (!AIBinder_associateClass(binder.get(), _g_aidl_android_aidl_versioned_tests_IFooInterface_clazz)) { return nullptr; }
+ std::shared_ptr<::ndk::ICInterface> interface = ::ndk::ICInterface::asInterface(binder.get());
+ if (interface) {
+ return std::static_pointer_cast<IFooInterface>(interface);
+ }
+ return ::ndk::SharedRefBase::make<BpFooInterface>(binder);
+}
+
+binder_status_t IFooInterface::writeToParcel(AParcel* parcel, const std::shared_ptr<IFooInterface>& instance) {
+ return AParcel_writeStrongBinder(parcel, instance ? instance->asBinder().get() : nullptr);
+}
+binder_status_t IFooInterface::readFromParcel(const AParcel* parcel, std::shared_ptr<IFooInterface>* instance) {
+ ::ndk::SpAIBinder binder;
+ binder_status_t status = AParcel_readStrongBinder(parcel, binder.getR());
+ if (status != STATUS_OK) return status;
+ *instance = IFooInterface::fromBinder(binder);
+ return STATUS_OK;
+}
+bool IFooInterface::setDefaultImpl(const std::shared_ptr<IFooInterface>& impl) {
+ // Only one user of this interface can use this function
+ // at a time. This is a heuristic to detect if two different
+ // users in the same process use this function.
+ assert(!IFooInterface::default_impl);
+ if (impl) {
+ IFooInterface::default_impl = impl;
+ return true;
+ }
+ return false;
+}
+const std::shared_ptr<IFooInterface>& IFooInterface::getDefaultImpl() {
+ return IFooInterface::default_impl;
+}
+std::shared_ptr<IFooInterface> IFooInterface::default_impl = nullptr;
+::ndk::ScopedAStatus IFooInterfaceDefault::originalApi() {
+ ::ndk::ScopedAStatus _aidl_status;
+ _aidl_status.set(AStatus_fromStatus(STATUS_UNKNOWN_TRANSACTION));
+ return _aidl_status;
+}
+::ndk::ScopedAStatus IFooInterfaceDefault::acceptUnionAndReturnString(const ::aidl::android::aidl::versioned::tests::BazUnion& /*in_u*/, std::string* /*_aidl_return*/) {
+ ::ndk::ScopedAStatus _aidl_status;
+ _aidl_status.set(AStatus_fromStatus(STATUS_UNKNOWN_TRANSACTION));
+ return _aidl_status;
+}
+::ndk::ScopedAStatus IFooInterfaceDefault::ignoreParcelablesAndRepeatInt(const ::aidl::android::aidl::versioned::tests::Foo& /*in_inFoo*/, ::aidl::android::aidl::versioned::tests::Foo* /*in_inoutFoo*/, ::aidl::android::aidl::versioned::tests::Foo* /*out_outFoo*/, int32_t /*in_value*/, int32_t* /*_aidl_return*/) {
+ ::ndk::ScopedAStatus _aidl_status;
+ _aidl_status.set(AStatus_fromStatus(STATUS_UNKNOWN_TRANSACTION));
+ return _aidl_status;
+}
+::ndk::ScopedAStatus IFooInterfaceDefault::returnsLengthOfFooArray(const std::vector<::aidl::android::aidl::versioned::tests::Foo>& /*in_foos*/, int32_t* /*_aidl_return*/) {
+ ::ndk::ScopedAStatus _aidl_status;
+ _aidl_status.set(AStatus_fromStatus(STATUS_UNKNOWN_TRANSACTION));
+ return _aidl_status;
+}
+::ndk::ScopedAStatus IFooInterfaceDefault::getInterfaceVersion(int32_t* _aidl_return) {
+ *_aidl_return = 0;
+ return ::ndk::ScopedAStatus(AStatus_newOk());
+}
+::ndk::ScopedAStatus IFooInterfaceDefault::getInterfaceHash(std::string* _aidl_return) {
+ *_aidl_return = "";
+ return ::ndk::ScopedAStatus(AStatus_newOk());
+}
+::ndk::SpAIBinder IFooInterfaceDefault::asBinder() {
+ return ::ndk::SpAIBinder();
+}
+bool IFooInterfaceDefault::isRemote() {
+ return false;
+}
+} // namespace tests
+} // namespace versioned
+} // namespace aidl
+} // namespace android
+} // namespace aidl
diff --git a/tests/golden_output/aidl-test-versioned-interface-V1-ndk-source/gen/android/aidl/versioned/tests/IFooInterface.cpp.d b/tests/golden_output/aidl-test-versioned-interface-V1-ndk-source/gen/android/aidl/versioned/tests/IFooInterface.cpp.d
new file mode 100644
index 0000000..762b47b
--- /dev/null
+++ b/tests/golden_output/aidl-test-versioned-interface-V1-ndk-source/gen/android/aidl/versioned/tests/IFooInterface.cpp.d
@@ -0,0 +1,4 @@
+out/soong/.intermediates/system/tools/aidl/aidl-test-versioned-interface-V1-ndk-source/gen/android/aidl/versioned/tests/IFooInterface.cpp : \
+ system/tools/aidl/aidl_api/aidl-test-versioned-interface/1/android/aidl/versioned/tests/IFooInterface.aidl \
+ system/tools/aidl/aidl_api/aidl-test-versioned-interface/1/android/aidl/versioned/tests/BazUnion.aidl \
+ system/tools/aidl/aidl_api/aidl-test-versioned-interface/1/android/aidl/versioned/tests/Foo.aidl
diff --git a/tests/golden_output/aidl-test-versioned-interface-V1-ndk-source/gen/include/aidl/android/aidl/versioned/tests/BazUnion.h b/tests/golden_output/aidl-test-versioned-interface-V1-ndk-source/gen/include/aidl/android/aidl/versioned/tests/BazUnion.h
new file mode 100644
index 0000000..24a8014
--- /dev/null
+++ b/tests/golden_output/aidl-test-versioned-interface-V1-ndk-source/gen/include/aidl/android/aidl/versioned/tests/BazUnion.h
@@ -0,0 +1,121 @@
+#pragma once
+
+#include <cassert>
+#include <cstdint>
+#include <memory>
+#include <optional>
+#include <string>
+#include <type_traits>
+#include <utility>
+#include <variant>
+#include <vector>
+#include <android/binder_interface_utils.h>
+#include <android/binder_parcelable_utils.h>
+#include <android/binder_to_string.h>
+#ifdef BINDER_STABILITY_SUPPORT
+#include <android/binder_stability.h>
+#endif // BINDER_STABILITY_SUPPORT
+
+#ifndef __BIONIC__
+#define __assert2(a,b,c,d) ((void)0)
+#endif
+
+namespace aidl {
+namespace android {
+namespace aidl {
+namespace versioned {
+namespace tests {
+class BazUnion {
+public:
+ typedef std::false_type fixed_size;
+ static const char* descriptor;
+
+ enum Tag : int32_t {
+ intNum = 0, // int intNum;
+ };
+
+ template<typename _Tp>
+ static constexpr bool _not_self = !std::is_same_v<std::remove_cv_t<std::remove_reference_t<_Tp>>, BazUnion>;
+
+ BazUnion() : _value(std::in_place_index<static_cast<size_t>(intNum)>, int32_t(0)) { }
+
+ template <typename _Tp, typename = std::enable_if_t<_not_self<_Tp>>>
+ // NOLINTNEXTLINE(google-explicit-constructor)
+ constexpr BazUnion(_Tp&& _arg)
+ : _value(std::forward<_Tp>(_arg)) {}
+
+ template <size_t _Np, typename... _Tp>
+ constexpr explicit BazUnion(std::in_place_index_t<_Np>, _Tp&&... _args)
+ : _value(std::in_place_index<_Np>, std::forward<_Tp>(_args)...) {}
+
+ template <Tag _tag, typename... _Tp>
+ static BazUnion make(_Tp&&... _args) {
+ return BazUnion(std::in_place_index<static_cast<size_t>(_tag)>, std::forward<_Tp>(_args)...);
+ }
+
+ template <Tag _tag, typename _Tp, typename... _Up>
+ static BazUnion make(std::initializer_list<_Tp> _il, _Up&&... _args) {
+ return BazUnion(std::in_place_index<static_cast<size_t>(_tag)>, std::move(_il), std::forward<_Up>(_args)...);
+ }
+
+ Tag getTag() const {
+ return static_cast<Tag>(_value.index());
+ }
+
+ template <Tag _tag>
+ const auto& get() const {
+ if (getTag() != _tag) { __assert2(__FILE__, __LINE__, __PRETTY_FUNCTION__, "bad access: a wrong tag"); }
+ return std::get<static_cast<size_t>(_tag)>(_value);
+ }
+
+ template <Tag _tag>
+ auto& get() {
+ if (getTag() != _tag) { __assert2(__FILE__, __LINE__, __PRETTY_FUNCTION__, "bad access: a wrong tag"); }
+ return std::get<static_cast<size_t>(_tag)>(_value);
+ }
+
+ template <Tag _tag, typename... _Tp>
+ void set(_Tp&&... _args) {
+ _value.emplace<static_cast<size_t>(_tag)>(std::forward<_Tp>(_args)...);
+ }
+
+ binder_status_t readFromParcel(const AParcel* _parcel);
+ binder_status_t writeToParcel(AParcel* _parcel) const;
+
+ inline bool operator!=(const BazUnion& rhs) const {
+ return _value != rhs._value;
+ }
+ inline bool operator<(const BazUnion& rhs) const {
+ return _value < rhs._value;
+ }
+ inline bool operator<=(const BazUnion& rhs) const {
+ return _value <= rhs._value;
+ }
+ inline bool operator==(const BazUnion& rhs) const {
+ return _value == rhs._value;
+ }
+ inline bool operator>(const BazUnion& rhs) const {
+ return _value > rhs._value;
+ }
+ inline bool operator>=(const BazUnion& rhs) const {
+ return _value >= rhs._value;
+ }
+
+ static const ::ndk::parcelable_stability_t _aidl_stability = ::ndk::STABILITY_LOCAL;
+ inline std::string toString() const {
+ std::ostringstream os;
+ os << "BazUnion{";
+ switch (getTag()) {
+ case intNum: os << "intNum: " << ::android::internal::ToString(get<intNum>()); break;
+ }
+ os << "}";
+ return os.str();
+ }
+private:
+ std::variant<int32_t> _value;
+};
+} // namespace tests
+} // namespace versioned
+} // namespace aidl
+} // namespace android
+} // namespace aidl
diff --git a/tests/golden_output/aidl-test-versioned-interface-V1-ndk-source/gen/include/aidl/android/aidl/versioned/tests/BnBazUnion.h b/tests/golden_output/aidl-test-versioned-interface-V1-ndk-source/gen/include/aidl/android/aidl/versioned/tests/BnBazUnion.h
new file mode 100644
index 0000000..4291108
--- /dev/null
+++ b/tests/golden_output/aidl-test-versioned-interface-V1-ndk-source/gen/include/aidl/android/aidl/versioned/tests/BnBazUnion.h
@@ -0,0 +1 @@
+#error TODO(b/111362593) defined_types do not have bn classes
diff --git a/tests/golden_output/aidl-test-versioned-interface-V1-ndk-source/gen/include/aidl/android/aidl/versioned/tests/BnFoo.h b/tests/golden_output/aidl-test-versioned-interface-V1-ndk-source/gen/include/aidl/android/aidl/versioned/tests/BnFoo.h
new file mode 100644
index 0000000..4291108
--- /dev/null
+++ b/tests/golden_output/aidl-test-versioned-interface-V1-ndk-source/gen/include/aidl/android/aidl/versioned/tests/BnFoo.h
@@ -0,0 +1 @@
+#error TODO(b/111362593) defined_types do not have bn classes
diff --git a/tests/golden_output/aidl-test-versioned-interface-V1-ndk-source/gen/include/aidl/android/aidl/versioned/tests/BnFooInterface.h b/tests/golden_output/aidl-test-versioned-interface-V1-ndk-source/gen/include/aidl/android/aidl/versioned/tests/BnFooInterface.h
new file mode 100644
index 0000000..f464a1e
--- /dev/null
+++ b/tests/golden_output/aidl-test-versioned-interface-V1-ndk-source/gen/include/aidl/android/aidl/versioned/tests/BnFooInterface.h
@@ -0,0 +1,26 @@
+#pragma once
+
+#include "aidl/android/aidl/versioned/tests/IFooInterface.h"
+
+#include <android/binder_ibinder.h>
+
+namespace aidl {
+namespace android {
+namespace aidl {
+namespace versioned {
+namespace tests {
+class BnFooInterface : public ::ndk::BnCInterface<IFooInterface> {
+public:
+ BnFooInterface();
+ virtual ~BnFooInterface();
+ ::ndk::ScopedAStatus getInterfaceVersion(int32_t* _aidl_return) final;
+ ::ndk::ScopedAStatus getInterfaceHash(std::string* _aidl_return) final;
+protected:
+ ::ndk::SpAIBinder createBinder() override;
+private:
+};
+} // namespace tests
+} // namespace versioned
+} // namespace aidl
+} // namespace android
+} // namespace aidl
diff --git a/tests/golden_output/aidl-test-versioned-interface-V1-ndk-source/gen/include/aidl/android/aidl/versioned/tests/BpBazUnion.h b/tests/golden_output/aidl-test-versioned-interface-V1-ndk-source/gen/include/aidl/android/aidl/versioned/tests/BpBazUnion.h
new file mode 100644
index 0000000..e8a0db3
--- /dev/null
+++ b/tests/golden_output/aidl-test-versioned-interface-V1-ndk-source/gen/include/aidl/android/aidl/versioned/tests/BpBazUnion.h
@@ -0,0 +1 @@
+#error TODO(b/111362593) defined_types do not have bp classes
diff --git a/tests/golden_output/aidl-test-versioned-interface-V1-ndk-source/gen/include/aidl/android/aidl/versioned/tests/BpFoo.h b/tests/golden_output/aidl-test-versioned-interface-V1-ndk-source/gen/include/aidl/android/aidl/versioned/tests/BpFoo.h
new file mode 100644
index 0000000..e8a0db3
--- /dev/null
+++ b/tests/golden_output/aidl-test-versioned-interface-V1-ndk-source/gen/include/aidl/android/aidl/versioned/tests/BpFoo.h
@@ -0,0 +1 @@
+#error TODO(b/111362593) defined_types do not have bp classes
diff --git a/tests/golden_output/aidl-test-versioned-interface-V1-ndk-source/gen/include/aidl/android/aidl/versioned/tests/BpFooInterface.h b/tests/golden_output/aidl-test-versioned-interface-V1-ndk-source/gen/include/aidl/android/aidl/versioned/tests/BpFooInterface.h
new file mode 100644
index 0000000..6d4a055
--- /dev/null
+++ b/tests/golden_output/aidl-test-versioned-interface-V1-ndk-source/gen/include/aidl/android/aidl/versioned/tests/BpFooInterface.h
@@ -0,0 +1,31 @@
+#pragma once
+
+#include "aidl/android/aidl/versioned/tests/IFooInterface.h"
+
+#include <android/binder_ibinder.h>
+
+namespace aidl {
+namespace android {
+namespace aidl {
+namespace versioned {
+namespace tests {
+class BpFooInterface : public ::ndk::BpCInterface<IFooInterface> {
+public:
+ explicit BpFooInterface(const ::ndk::SpAIBinder& binder);
+ virtual ~BpFooInterface();
+
+ ::ndk::ScopedAStatus originalApi() override;
+ ::ndk::ScopedAStatus acceptUnionAndReturnString(const ::aidl::android::aidl::versioned::tests::BazUnion& in_u, std::string* _aidl_return) override;
+ ::ndk::ScopedAStatus ignoreParcelablesAndRepeatInt(const ::aidl::android::aidl::versioned::tests::Foo& in_inFoo, ::aidl::android::aidl::versioned::tests::Foo* in_inoutFoo, ::aidl::android::aidl::versioned::tests::Foo* out_outFoo, int32_t in_value, int32_t* _aidl_return) override;
+ ::ndk::ScopedAStatus returnsLengthOfFooArray(const std::vector<::aidl::android::aidl::versioned::tests::Foo>& in_foos, int32_t* _aidl_return) override;
+ ::ndk::ScopedAStatus getInterfaceVersion(int32_t* _aidl_return) override;
+ ::ndk::ScopedAStatus getInterfaceHash(std::string* _aidl_return) override;
+ int32_t _aidl_cached_version = -1;
+ std::string _aidl_cached_hash = "-1";
+ std::mutex _aidl_cached_hash_mutex;
+};
+} // namespace tests
+} // namespace versioned
+} // namespace aidl
+} // namespace android
+} // namespace aidl
diff --git a/tests/golden_output/aidl-test-versioned-interface-V1-ndk-source/gen/include/aidl/android/aidl/versioned/tests/Foo.h b/tests/golden_output/aidl-test-versioned-interface-V1-ndk-source/gen/include/aidl/android/aidl/versioned/tests/Foo.h
new file mode 100644
index 0000000..03bdda9
--- /dev/null
+++ b/tests/golden_output/aidl-test-versioned-interface-V1-ndk-source/gen/include/aidl/android/aidl/versioned/tests/Foo.h
@@ -0,0 +1,60 @@
+#pragma once
+
+#include <cstdint>
+#include <memory>
+#include <optional>
+#include <string>
+#include <vector>
+#include <android/binder_interface_utils.h>
+#include <android/binder_parcelable_utils.h>
+#include <android/binder_to_string.h>
+#ifdef BINDER_STABILITY_SUPPORT
+#include <android/binder_stability.h>
+#endif // BINDER_STABILITY_SUPPORT
+
+namespace aidl {
+namespace android {
+namespace aidl {
+namespace versioned {
+namespace tests {
+class Foo {
+public:
+ typedef std::false_type fixed_size;
+ static const char* descriptor;
+
+
+ binder_status_t readFromParcel(const AParcel* parcel);
+ binder_status_t writeToParcel(AParcel* parcel) const;
+
+ inline bool operator!=(const Foo&) const {
+ return std::tie() != std::tie();
+ }
+ inline bool operator<(const Foo&) const {
+ return std::tie() < std::tie();
+ }
+ inline bool operator<=(const Foo&) const {
+ return std::tie() <= std::tie();
+ }
+ inline bool operator==(const Foo&) const {
+ return std::tie() == std::tie();
+ }
+ inline bool operator>(const Foo&) const {
+ return std::tie() > std::tie();
+ }
+ inline bool operator>=(const Foo&) const {
+ return std::tie() >= std::tie();
+ }
+
+ static const ::ndk::parcelable_stability_t _aidl_stability = ::ndk::STABILITY_LOCAL;
+ inline std::string toString() const {
+ std::ostringstream os;
+ os << "Foo{";
+ os << "}";
+ return os.str();
+ }
+};
+} // namespace tests
+} // namespace versioned
+} // namespace aidl
+} // namespace android
+} // namespace aidl
diff --git a/tests/golden_output/aidl-test-versioned-interface-V1-ndk-source/gen/include/aidl/android/aidl/versioned/tests/IFooInterface.h b/tests/golden_output/aidl-test-versioned-interface-V1-ndk-source/gen/include/aidl/android/aidl/versioned/tests/IFooInterface.h
new file mode 100644
index 0000000..82c80b9
--- /dev/null
+++ b/tests/golden_output/aidl-test-versioned-interface-V1-ndk-source/gen/include/aidl/android/aidl/versioned/tests/IFooInterface.h
@@ -0,0 +1,62 @@
+#pragma once
+
+#include <cstdint>
+#include <memory>
+#include <optional>
+#include <string>
+#include <vector>
+#include <android/binder_interface_utils.h>
+#include <aidl/android/aidl/versioned/tests/BazUnion.h>
+#include <aidl/android/aidl/versioned/tests/Foo.h>
+#ifdef BINDER_STABILITY_SUPPORT
+#include <android/binder_stability.h>
+#endif // BINDER_STABILITY_SUPPORT
+
+namespace aidl {
+namespace android {
+namespace aidl {
+namespace versioned {
+namespace tests {
+class IFooInterface : public ::ndk::ICInterface {
+public:
+ static const char* descriptor;
+ IFooInterface();
+ virtual ~IFooInterface();
+
+ static const int32_t version = 1;
+ static inline const std::string hash = "9e7be1859820c59d9d55dd133e71a3687b5d2e5b";
+ static constexpr uint32_t TRANSACTION_originalApi = FIRST_CALL_TRANSACTION + 0;
+ static constexpr uint32_t TRANSACTION_acceptUnionAndReturnString = FIRST_CALL_TRANSACTION + 1;
+ static constexpr uint32_t TRANSACTION_ignoreParcelablesAndRepeatInt = FIRST_CALL_TRANSACTION + 2;
+ static constexpr uint32_t TRANSACTION_returnsLengthOfFooArray = FIRST_CALL_TRANSACTION + 3;
+
+ static std::shared_ptr<IFooInterface> fromBinder(const ::ndk::SpAIBinder& binder);
+ static binder_status_t writeToParcel(AParcel* parcel, const std::shared_ptr<IFooInterface>& instance);
+ static binder_status_t readFromParcel(const AParcel* parcel, std::shared_ptr<IFooInterface>* instance);
+ static bool setDefaultImpl(const std::shared_ptr<IFooInterface>& impl);
+ static const std::shared_ptr<IFooInterface>& getDefaultImpl();
+ virtual ::ndk::ScopedAStatus originalApi() = 0;
+ virtual ::ndk::ScopedAStatus acceptUnionAndReturnString(const ::aidl::android::aidl::versioned::tests::BazUnion& in_u, std::string* _aidl_return) = 0;
+ virtual ::ndk::ScopedAStatus ignoreParcelablesAndRepeatInt(const ::aidl::android::aidl::versioned::tests::Foo& in_inFoo, ::aidl::android::aidl::versioned::tests::Foo* in_inoutFoo, ::aidl::android::aidl::versioned::tests::Foo* out_outFoo, int32_t in_value, int32_t* _aidl_return) = 0;
+ virtual ::ndk::ScopedAStatus returnsLengthOfFooArray(const std::vector<::aidl::android::aidl::versioned::tests::Foo>& in_foos, int32_t* _aidl_return) = 0;
+ virtual ::ndk::ScopedAStatus getInterfaceVersion(int32_t* _aidl_return) = 0;
+ virtual ::ndk::ScopedAStatus getInterfaceHash(std::string* _aidl_return) = 0;
+private:
+ static std::shared_ptr<IFooInterface> default_impl;
+};
+class IFooInterfaceDefault : public IFooInterface {
+public:
+ ::ndk::ScopedAStatus originalApi() override;
+ ::ndk::ScopedAStatus acceptUnionAndReturnString(const ::aidl::android::aidl::versioned::tests::BazUnion& in_u, std::string* _aidl_return) override;
+ ::ndk::ScopedAStatus ignoreParcelablesAndRepeatInt(const ::aidl::android::aidl::versioned::tests::Foo& in_inFoo, ::aidl::android::aidl::versioned::tests::Foo* in_inoutFoo, ::aidl::android::aidl::versioned::tests::Foo* out_outFoo, int32_t in_value, int32_t* _aidl_return) override;
+ ::ndk::ScopedAStatus returnsLengthOfFooArray(const std::vector<::aidl::android::aidl::versioned::tests::Foo>& in_foos, int32_t* _aidl_return) override;
+ ::ndk::ScopedAStatus getInterfaceVersion(int32_t* _aidl_return) override;
+ ::ndk::ScopedAStatus getInterfaceHash(std::string* _aidl_return) override;
+ ::ndk::SpAIBinder asBinder() override;
+ bool isRemote() override;
+};
+} // namespace tests
+} // namespace versioned
+} // namespace aidl
+} // namespace android
+} // namespace aidl
diff --git a/tests/golden_output/aidl-test-versioned-interface-V2-java-source/gen/timestamp b/tests/golden_output/aidl-test-versioned-interface-V1-ndk-source/gen/timestamp
similarity index 100%
copy from tests/golden_output/aidl-test-versioned-interface-V2-java-source/gen/timestamp
copy to tests/golden_output/aidl-test-versioned-interface-V1-ndk-source/gen/timestamp
diff --git a/tests/golden_output/aidl-test-versioned-interface-V1-rust-source/gen/android/aidl/versioned/tests/BazUnion.rs b/tests/golden_output/aidl-test-versioned-interface-V1-rust-source/gen/android/aidl/versioned/tests/BazUnion.rs
new file mode 100644
index 0000000..5e30930
--- /dev/null
+++ b/tests/golden_output/aidl-test-versioned-interface-V1-rust-source/gen/android/aidl/versioned/tests/BazUnion.rs
@@ -0,0 +1,42 @@
+#![forbid(unsafe_code)]
+#![rustfmt::skip]
+#[derive(Debug)]
+pub enum BazUnion {
+ IntNum(i32),
+}
+impl Default for BazUnion {
+ fn default() -> Self {
+ Self::IntNum(0)
+ }
+}
+impl binder::Parcelable for BazUnion {
+ fn write_to_parcel(&self, parcel: &mut binder::binder_impl::BorrowedParcel) -> std::result::Result<(), binder::StatusCode> {
+ match self {
+ Self::IntNum(v) => {
+ parcel.write(&0i32)?;
+ parcel.write(v)
+ }
+ }
+ }
+ fn read_from_parcel(&mut self, parcel: &binder::binder_impl::BorrowedParcel) -> std::result::Result<(), binder::StatusCode> {
+ let tag: i32 = parcel.read()?;
+ match tag {
+ 0 => {
+ let value: i32 = parcel.read()?;
+ *self = Self::IntNum(value);
+ Ok(())
+ }
+ _ => {
+ Err(binder::StatusCode::BAD_VALUE)
+ }
+ }
+ }
+}
+binder::impl_serialize_for_parcelable!(BazUnion);
+binder::impl_deserialize_for_parcelable!(BazUnion);
+impl binder::binder_impl::ParcelableMetadata for BazUnion {
+ fn get_descriptor() -> &'static str { "android.aidl.versioned.tests.BazUnion" }
+}
+pub(crate) mod mangled {
+ pub use super::BazUnion as _7_android_4_aidl_9_versioned_5_tests_8_BazUnion;
+}
diff --git a/tests/golden_output/aidl-test-versioned-interface-V1-rust-source/gen/android/aidl/versioned/tests/BazUnion.rs.d b/tests/golden_output/aidl-test-versioned-interface-V1-rust-source/gen/android/aidl/versioned/tests/BazUnion.rs.d
new file mode 100644
index 0000000..d46cd01
--- /dev/null
+++ b/tests/golden_output/aidl-test-versioned-interface-V1-rust-source/gen/android/aidl/versioned/tests/BazUnion.rs.d
@@ -0,0 +1,2 @@
+out/soong/.intermediates/system/tools/aidl/aidl-test-versioned-interface-V1-rust-source/gen/android/aidl/versioned/tests/BazUnion.rs : \
+ system/tools/aidl/aidl_api/aidl-test-versioned-interface/1/android/aidl/versioned/tests/BazUnion.aidl
diff --git a/tests/golden_output/aidl-test-versioned-interface-V1-rust-source/gen/android/aidl/versioned/tests/Foo.rs b/tests/golden_output/aidl-test-versioned-interface-V1-rust-source/gen/android/aidl/versioned/tests/Foo.rs
new file mode 100644
index 0000000..30926b7
--- /dev/null
+++ b/tests/golden_output/aidl-test-versioned-interface-V1-rust-source/gen/android/aidl/versioned/tests/Foo.rs
@@ -0,0 +1,31 @@
+#![forbid(unsafe_code)]
+#![rustfmt::skip]
+#[derive(Debug)]
+pub struct Foo {
+}
+impl Default for Foo {
+ fn default() -> Self {
+ Self {
+ }
+ }
+}
+impl binder::Parcelable for Foo {
+ fn write_to_parcel(&self, parcel: &mut binder::binder_impl::BorrowedParcel) -> std::result::Result<(), binder::StatusCode> {
+ parcel.sized_write(|subparcel| {
+ Ok(())
+ })
+ }
+ fn read_from_parcel(&mut self, parcel: &binder::binder_impl::BorrowedParcel) -> std::result::Result<(), binder::StatusCode> {
+ parcel.sized_read(|subparcel| {
+ Ok(())
+ })
+ }
+}
+binder::impl_serialize_for_parcelable!(Foo);
+binder::impl_deserialize_for_parcelable!(Foo);
+impl binder::binder_impl::ParcelableMetadata for Foo {
+ fn get_descriptor() -> &'static str { "android.aidl.versioned.tests.Foo" }
+}
+pub(crate) mod mangled {
+ pub use super::Foo as _7_android_4_aidl_9_versioned_5_tests_3_Foo;
+}
diff --git a/tests/golden_output/aidl-test-versioned-interface-V1-rust-source/gen/android/aidl/versioned/tests/Foo.rs.d b/tests/golden_output/aidl-test-versioned-interface-V1-rust-source/gen/android/aidl/versioned/tests/Foo.rs.d
new file mode 100644
index 0000000..f8b09de
--- /dev/null
+++ b/tests/golden_output/aidl-test-versioned-interface-V1-rust-source/gen/android/aidl/versioned/tests/Foo.rs.d
@@ -0,0 +1,2 @@
+out/soong/.intermediates/system/tools/aidl/aidl-test-versioned-interface-V1-rust-source/gen/android/aidl/versioned/tests/Foo.rs : \
+ system/tools/aidl/aidl_api/aidl-test-versioned-interface/1/android/aidl/versioned/tests/Foo.aidl
diff --git a/tests/golden_output/aidl-test-versioned-interface-V1-rust-source/gen/android/aidl/versioned/tests/IFooInterface.rs b/tests/golden_output/aidl-test-versioned-interface-V1-rust-source/gen/android/aidl/versioned/tests/IFooInterface.rs
new file mode 100644
index 0000000..9898f1e
--- /dev/null
+++ b/tests/golden_output/aidl-test-versioned-interface-V1-rust-source/gen/android/aidl/versioned/tests/IFooInterface.rs
@@ -0,0 +1,435 @@
+#![forbid(unsafe_code)]
+#![rustfmt::skip]
+#![allow(non_upper_case_globals)]
+#![allow(non_snake_case)]
+#[allow(unused_imports)] use binder::binder_impl::IBinderInternal;
+use binder::declare_binder_interface;
+declare_binder_interface! {
+ IFooInterface["android.aidl.versioned.tests.IFooInterface"] {
+ native: BnFooInterface(on_transact),
+ proxy: BpFooInterface {
+ cached_version: std::sync::atomic::AtomicI32 = std::sync::atomic::AtomicI32::new(-1),
+ cached_hash: std::sync::Mutex<Option<String>> = std::sync::Mutex::new(None)
+ },
+ async: IFooInterfaceAsync,
+ }
+}
+pub trait IFooInterface: binder::Interface + Send {
+ fn get_descriptor() -> &'static str where Self: Sized { "android.aidl.versioned.tests.IFooInterface" }
+ fn originalApi(&self) -> binder::Result<()>;
+ fn acceptUnionAndReturnString(&self, _arg_u: &crate::mangled::_7_android_4_aidl_9_versioned_5_tests_8_BazUnion) -> binder::Result<String>;
+ fn ignoreParcelablesAndRepeatInt(&self, _arg_inFoo: &crate::mangled::_7_android_4_aidl_9_versioned_5_tests_3_Foo, _arg_inoutFoo: &mut crate::mangled::_7_android_4_aidl_9_versioned_5_tests_3_Foo, _arg_outFoo: &mut crate::mangled::_7_android_4_aidl_9_versioned_5_tests_3_Foo, _arg_value: i32) -> binder::Result<i32>;
+ fn returnsLengthOfFooArray(&self, _arg_foos: &[crate::mangled::_7_android_4_aidl_9_versioned_5_tests_3_Foo]) -> binder::Result<i32>;
+ fn getInterfaceVersion(&self) -> binder::Result<i32> {
+ Ok(VERSION)
+ }
+ fn getInterfaceHash(&self) -> binder::Result<String> {
+ Ok(HASH.into())
+ }
+ fn getDefaultImpl() -> IFooInterfaceDefaultRef where Self: Sized {
+ DEFAULT_IMPL.lock().unwrap().clone()
+ }
+ fn setDefaultImpl(d: IFooInterfaceDefaultRef) -> IFooInterfaceDefaultRef where Self: Sized {
+ std::mem::replace(&mut *DEFAULT_IMPL.lock().unwrap(), d)
+ }
+}
+pub trait IFooInterfaceAsync<P>: binder::Interface + Send {
+ fn get_descriptor() -> &'static str where Self: Sized { "android.aidl.versioned.tests.IFooInterface" }
+ fn originalApi<'a>(&'a self) -> binder::BoxFuture<'a, binder::Result<()>>;
+ fn acceptUnionAndReturnString<'a>(&'a self, _arg_u: &'a crate::mangled::_7_android_4_aidl_9_versioned_5_tests_8_BazUnion) -> binder::BoxFuture<'a, binder::Result<String>>;
+ fn ignoreParcelablesAndRepeatInt<'a>(&'a self, _arg_inFoo: &'a crate::mangled::_7_android_4_aidl_9_versioned_5_tests_3_Foo, _arg_inoutFoo: &'a mut crate::mangled::_7_android_4_aidl_9_versioned_5_tests_3_Foo, _arg_outFoo: &'a mut crate::mangled::_7_android_4_aidl_9_versioned_5_tests_3_Foo, _arg_value: i32) -> binder::BoxFuture<'a, binder::Result<i32>>;
+ fn returnsLengthOfFooArray<'a>(&'a self, _arg_foos: &'a [crate::mangled::_7_android_4_aidl_9_versioned_5_tests_3_Foo]) -> binder::BoxFuture<'a, binder::Result<i32>>;
+ fn getInterfaceVersion<'a>(&'a self) -> binder::BoxFuture<'a, binder::Result<i32>> {
+ Box::pin(async move { Ok(VERSION) })
+ }
+ fn getInterfaceHash<'a>(&'a self) -> binder::BoxFuture<'a, binder::Result<String>> {
+ Box::pin(async move { Ok(HASH.into()) })
+ }
+}
+#[::async_trait::async_trait]
+pub trait IFooInterfaceAsyncServer: binder::Interface + Send {
+ fn get_descriptor() -> &'static str where Self: Sized { "android.aidl.versioned.tests.IFooInterface" }
+ async fn originalApi(&self) -> binder::Result<()>;
+ async fn acceptUnionAndReturnString(&self, _arg_u: &crate::mangled::_7_android_4_aidl_9_versioned_5_tests_8_BazUnion) -> binder::Result<String>;
+ async fn ignoreParcelablesAndRepeatInt(&self, _arg_inFoo: &crate::mangled::_7_android_4_aidl_9_versioned_5_tests_3_Foo, _arg_inoutFoo: &mut crate::mangled::_7_android_4_aidl_9_versioned_5_tests_3_Foo, _arg_outFoo: &mut crate::mangled::_7_android_4_aidl_9_versioned_5_tests_3_Foo, _arg_value: i32) -> binder::Result<i32>;
+ async fn returnsLengthOfFooArray(&self, _arg_foos: &[crate::mangled::_7_android_4_aidl_9_versioned_5_tests_3_Foo]) -> binder::Result<i32>;
+}
+impl BnFooInterface {
+ /// Create a new async binder service.
+ pub fn new_async_binder<T, R>(inner: T, rt: R, features: binder::BinderFeatures) -> binder::Strong<dyn IFooInterface>
+ where
+ T: IFooInterfaceAsyncServer + binder::Interface + Send + Sync + 'static,
+ R: binder::binder_impl::BinderAsyncRuntime + Send + Sync + 'static,
+ {
+ struct Wrapper<T, R> {
+ _inner: T,
+ _rt: R,
+ }
+ impl<T, R> binder::Interface for Wrapper<T, R> where T: binder::Interface, R: Send + Sync {
+ fn as_binder(&self) -> binder::SpIBinder { self._inner.as_binder() }
+ fn dump(&self, _file: &std::fs::File, _args: &[&std::ffi::CStr]) -> std::result::Result<(), binder::StatusCode> { self._inner.dump(_file, _args) }
+ }
+ impl<T, R> IFooInterface for Wrapper<T, R>
+ where
+ T: IFooInterfaceAsyncServer + Send + Sync + 'static,
+ R: binder::binder_impl::BinderAsyncRuntime + Send + Sync + 'static,
+ {
+ fn originalApi(&self) -> binder::Result<()> {
+ self._rt.block_on(self._inner.originalApi())
+ }
+ fn acceptUnionAndReturnString(&self, _arg_u: &crate::mangled::_7_android_4_aidl_9_versioned_5_tests_8_BazUnion) -> binder::Result<String> {
+ self._rt.block_on(self._inner.acceptUnionAndReturnString(_arg_u))
+ }
+ fn ignoreParcelablesAndRepeatInt(&self, _arg_inFoo: &crate::mangled::_7_android_4_aidl_9_versioned_5_tests_3_Foo, _arg_inoutFoo: &mut crate::mangled::_7_android_4_aidl_9_versioned_5_tests_3_Foo, _arg_outFoo: &mut crate::mangled::_7_android_4_aidl_9_versioned_5_tests_3_Foo, _arg_value: i32) -> binder::Result<i32> {
+ self._rt.block_on(self._inner.ignoreParcelablesAndRepeatInt(_arg_inFoo, _arg_inoutFoo, _arg_outFoo, _arg_value))
+ }
+ fn returnsLengthOfFooArray(&self, _arg_foos: &[crate::mangled::_7_android_4_aidl_9_versioned_5_tests_3_Foo]) -> binder::Result<i32> {
+ self._rt.block_on(self._inner.returnsLengthOfFooArray(_arg_foos))
+ }
+ }
+ let wrapped = Wrapper { _inner: inner, _rt: rt };
+ Self::new_binder(wrapped, features)
+ }
+}
+pub trait IFooInterfaceDefault: Send + Sync {
+ fn originalApi(&self) -> binder::Result<()> {
+ Err(binder::StatusCode::UNKNOWN_TRANSACTION.into())
+ }
+ fn acceptUnionAndReturnString(&self, _arg_u: &crate::mangled::_7_android_4_aidl_9_versioned_5_tests_8_BazUnion) -> binder::Result<String> {
+ Err(binder::StatusCode::UNKNOWN_TRANSACTION.into())
+ }
+ fn ignoreParcelablesAndRepeatInt(&self, _arg_inFoo: &crate::mangled::_7_android_4_aidl_9_versioned_5_tests_3_Foo, _arg_inoutFoo: &mut crate::mangled::_7_android_4_aidl_9_versioned_5_tests_3_Foo, _arg_outFoo: &mut crate::mangled::_7_android_4_aidl_9_versioned_5_tests_3_Foo, _arg_value: i32) -> binder::Result<i32> {
+ Err(binder::StatusCode::UNKNOWN_TRANSACTION.into())
+ }
+ fn returnsLengthOfFooArray(&self, _arg_foos: &[crate::mangled::_7_android_4_aidl_9_versioned_5_tests_3_Foo]) -> binder::Result<i32> {
+ Err(binder::StatusCode::UNKNOWN_TRANSACTION.into())
+ }
+}
+pub mod transactions {
+ pub const originalApi: binder::binder_impl::TransactionCode = binder::binder_impl::FIRST_CALL_TRANSACTION + 0;
+ pub const acceptUnionAndReturnString: binder::binder_impl::TransactionCode = binder::binder_impl::FIRST_CALL_TRANSACTION + 1;
+ pub const ignoreParcelablesAndRepeatInt: binder::binder_impl::TransactionCode = binder::binder_impl::FIRST_CALL_TRANSACTION + 2;
+ pub const returnsLengthOfFooArray: binder::binder_impl::TransactionCode = binder::binder_impl::FIRST_CALL_TRANSACTION + 3;
+ pub const getInterfaceVersion: binder::binder_impl::TransactionCode = binder::binder_impl::FIRST_CALL_TRANSACTION + 16777214;
+ pub const getInterfaceHash: binder::binder_impl::TransactionCode = binder::binder_impl::FIRST_CALL_TRANSACTION + 16777213;
+}
+pub type IFooInterfaceDefaultRef = Option<std::sync::Arc<dyn IFooInterfaceDefault>>;
+use lazy_static::lazy_static;
+lazy_static! {
+ static ref DEFAULT_IMPL: std::sync::Mutex<IFooInterfaceDefaultRef> = std::sync::Mutex::new(None);
+}
+pub const VERSION: i32 = 1;
+pub const HASH: &str = "9e7be1859820c59d9d55dd133e71a3687b5d2e5b";
+impl BpFooInterface {
+ fn build_parcel_originalApi(&self) -> binder::Result<binder::binder_impl::Parcel> {
+ let mut aidl_data = self.binder.prepare_transact()?;
+ Ok(aidl_data)
+ }
+ fn read_response_originalApi(&self, _aidl_reply: std::result::Result<binder::binder_impl::Parcel, binder::StatusCode>) -> binder::Result<()> {
+ if let Err(binder::StatusCode::UNKNOWN_TRANSACTION) = _aidl_reply {
+ if let Some(_aidl_default_impl) = <Self as IFooInterface>::getDefaultImpl() {
+ return _aidl_default_impl.originalApi();
+ }
+ }
+ let _aidl_reply = _aidl_reply?;
+ let _aidl_status: binder::Status = _aidl_reply.read()?;
+ if !_aidl_status.is_ok() { return Err(_aidl_status); }
+ Ok(())
+ }
+ fn build_parcel_acceptUnionAndReturnString(&self, _arg_u: &crate::mangled::_7_android_4_aidl_9_versioned_5_tests_8_BazUnion) -> binder::Result<binder::binder_impl::Parcel> {
+ let mut aidl_data = self.binder.prepare_transact()?;
+ aidl_data.write(_arg_u)?;
+ Ok(aidl_data)
+ }
+ fn read_response_acceptUnionAndReturnString(&self, _arg_u: &crate::mangled::_7_android_4_aidl_9_versioned_5_tests_8_BazUnion, _aidl_reply: std::result::Result<binder::binder_impl::Parcel, binder::StatusCode>) -> binder::Result<String> {
+ if let Err(binder::StatusCode::UNKNOWN_TRANSACTION) = _aidl_reply {
+ if let Some(_aidl_default_impl) = <Self as IFooInterface>::getDefaultImpl() {
+ return _aidl_default_impl.acceptUnionAndReturnString(_arg_u);
+ }
+ }
+ let _aidl_reply = _aidl_reply?;
+ let _aidl_status: binder::Status = _aidl_reply.read()?;
+ if !_aidl_status.is_ok() { return Err(_aidl_status); }
+ let _aidl_return: String = _aidl_reply.read()?;
+ Ok(_aidl_return)
+ }
+ fn build_parcel_ignoreParcelablesAndRepeatInt(&self, _arg_inFoo: &crate::mangled::_7_android_4_aidl_9_versioned_5_tests_3_Foo, _arg_inoutFoo: &mut crate::mangled::_7_android_4_aidl_9_versioned_5_tests_3_Foo, _arg_outFoo: &mut crate::mangled::_7_android_4_aidl_9_versioned_5_tests_3_Foo, _arg_value: i32) -> binder::Result<binder::binder_impl::Parcel> {
+ let mut aidl_data = self.binder.prepare_transact()?;
+ aidl_data.write(_arg_inFoo)?;
+ aidl_data.write(_arg_inoutFoo)?;
+ aidl_data.write(&_arg_value)?;
+ Ok(aidl_data)
+ }
+ fn read_response_ignoreParcelablesAndRepeatInt(&self, _arg_inFoo: &crate::mangled::_7_android_4_aidl_9_versioned_5_tests_3_Foo, _arg_inoutFoo: &mut crate::mangled::_7_android_4_aidl_9_versioned_5_tests_3_Foo, _arg_outFoo: &mut crate::mangled::_7_android_4_aidl_9_versioned_5_tests_3_Foo, _arg_value: i32, _aidl_reply: std::result::Result<binder::binder_impl::Parcel, binder::StatusCode>) -> binder::Result<i32> {
+ if let Err(binder::StatusCode::UNKNOWN_TRANSACTION) = _aidl_reply {
+ if let Some(_aidl_default_impl) = <Self as IFooInterface>::getDefaultImpl() {
+ return _aidl_default_impl.ignoreParcelablesAndRepeatInt(_arg_inFoo, _arg_inoutFoo, _arg_outFoo, _arg_value);
+ }
+ }
+ let _aidl_reply = _aidl_reply?;
+ let _aidl_status: binder::Status = _aidl_reply.read()?;
+ if !_aidl_status.is_ok() { return Err(_aidl_status); }
+ let _aidl_return: i32 = _aidl_reply.read()?;
+ _aidl_reply.read_onto(_arg_inoutFoo)?;
+ _aidl_reply.read_onto(_arg_outFoo)?;
+ Ok(_aidl_return)
+ }
+ fn build_parcel_returnsLengthOfFooArray(&self, _arg_foos: &[crate::mangled::_7_android_4_aidl_9_versioned_5_tests_3_Foo]) -> binder::Result<binder::binder_impl::Parcel> {
+ let mut aidl_data = self.binder.prepare_transact()?;
+ aidl_data.write(_arg_foos)?;
+ Ok(aidl_data)
+ }
+ fn read_response_returnsLengthOfFooArray(&self, _arg_foos: &[crate::mangled::_7_android_4_aidl_9_versioned_5_tests_3_Foo], _aidl_reply: std::result::Result<binder::binder_impl::Parcel, binder::StatusCode>) -> binder::Result<i32> {
+ if let Err(binder::StatusCode::UNKNOWN_TRANSACTION) = _aidl_reply {
+ if let Some(_aidl_default_impl) = <Self as IFooInterface>::getDefaultImpl() {
+ return _aidl_default_impl.returnsLengthOfFooArray(_arg_foos);
+ }
+ }
+ let _aidl_reply = _aidl_reply?;
+ let _aidl_status: binder::Status = _aidl_reply.read()?;
+ if !_aidl_status.is_ok() { return Err(_aidl_status); }
+ let _aidl_return: i32 = _aidl_reply.read()?;
+ Ok(_aidl_return)
+ }
+ fn build_parcel_getInterfaceVersion(&self) -> binder::Result<binder::binder_impl::Parcel> {
+ let mut aidl_data = self.binder.prepare_transact()?;
+ Ok(aidl_data)
+ }
+ fn read_response_getInterfaceVersion(&self, _aidl_reply: std::result::Result<binder::binder_impl::Parcel, binder::StatusCode>) -> binder::Result<i32> {
+ let _aidl_reply = _aidl_reply?;
+ let _aidl_status: binder::Status = _aidl_reply.read()?;
+ if !_aidl_status.is_ok() { return Err(_aidl_status); }
+ let _aidl_return: i32 = _aidl_reply.read()?;
+ self.cached_version.store(_aidl_return, std::sync::atomic::Ordering::Relaxed);
+ Ok(_aidl_return)
+ }
+ fn build_parcel_getInterfaceHash(&self) -> binder::Result<binder::binder_impl::Parcel> {
+ let mut aidl_data = self.binder.prepare_transact()?;
+ Ok(aidl_data)
+ }
+ fn read_response_getInterfaceHash(&self, _aidl_reply: std::result::Result<binder::binder_impl::Parcel, binder::StatusCode>) -> binder::Result<String> {
+ let _aidl_reply = _aidl_reply?;
+ let _aidl_status: binder::Status = _aidl_reply.read()?;
+ if !_aidl_status.is_ok() { return Err(_aidl_status); }
+ let _aidl_return: String = _aidl_reply.read()?;
+ *self.cached_hash.lock().unwrap() = Some(_aidl_return.clone());
+ Ok(_aidl_return)
+ }
+}
+impl IFooInterface for BpFooInterface {
+ fn originalApi(&self) -> binder::Result<()> {
+ let _aidl_data = self.build_parcel_originalApi()?;
+ let _aidl_reply = self.binder.submit_transact(transactions::originalApi, _aidl_data, binder::binder_impl::FLAG_PRIVATE_LOCAL);
+ self.read_response_originalApi(_aidl_reply)
+ }
+ fn acceptUnionAndReturnString(&self, _arg_u: &crate::mangled::_7_android_4_aidl_9_versioned_5_tests_8_BazUnion) -> binder::Result<String> {
+ let _aidl_data = self.build_parcel_acceptUnionAndReturnString(_arg_u)?;
+ let _aidl_reply = self.binder.submit_transact(transactions::acceptUnionAndReturnString, _aidl_data, binder::binder_impl::FLAG_PRIVATE_LOCAL);
+ self.read_response_acceptUnionAndReturnString(_arg_u, _aidl_reply)
+ }
+ fn ignoreParcelablesAndRepeatInt(&self, _arg_inFoo: &crate::mangled::_7_android_4_aidl_9_versioned_5_tests_3_Foo, _arg_inoutFoo: &mut crate::mangled::_7_android_4_aidl_9_versioned_5_tests_3_Foo, _arg_outFoo: &mut crate::mangled::_7_android_4_aidl_9_versioned_5_tests_3_Foo, _arg_value: i32) -> binder::Result<i32> {
+ let _aidl_data = self.build_parcel_ignoreParcelablesAndRepeatInt(_arg_inFoo, _arg_inoutFoo, _arg_outFoo, _arg_value)?;
+ let _aidl_reply = self.binder.submit_transact(transactions::ignoreParcelablesAndRepeatInt, _aidl_data, binder::binder_impl::FLAG_PRIVATE_LOCAL);
+ self.read_response_ignoreParcelablesAndRepeatInt(_arg_inFoo, _arg_inoutFoo, _arg_outFoo, _arg_value, _aidl_reply)
+ }
+ fn returnsLengthOfFooArray(&self, _arg_foos: &[crate::mangled::_7_android_4_aidl_9_versioned_5_tests_3_Foo]) -> binder::Result<i32> {
+ let _aidl_data = self.build_parcel_returnsLengthOfFooArray(_arg_foos)?;
+ let _aidl_reply = self.binder.submit_transact(transactions::returnsLengthOfFooArray, _aidl_data, binder::binder_impl::FLAG_PRIVATE_LOCAL);
+ self.read_response_returnsLengthOfFooArray(_arg_foos, _aidl_reply)
+ }
+ fn getInterfaceVersion(&self) -> binder::Result<i32> {
+ let _aidl_version = self.cached_version.load(std::sync::atomic::Ordering::Relaxed);
+ if _aidl_version != -1 { return Ok(_aidl_version); }
+ let _aidl_data = self.build_parcel_getInterfaceVersion()?;
+ let _aidl_reply = self.binder.submit_transact(transactions::getInterfaceVersion, _aidl_data, binder::binder_impl::FLAG_PRIVATE_LOCAL);
+ self.read_response_getInterfaceVersion(_aidl_reply)
+ }
+ fn getInterfaceHash(&self) -> binder::Result<String> {
+ {
+ let _aidl_hash_lock = self.cached_hash.lock().unwrap();
+ if let Some(ref _aidl_hash) = *_aidl_hash_lock {
+ return Ok(_aidl_hash.clone());
+ }
+ }
+ let _aidl_data = self.build_parcel_getInterfaceHash()?;
+ let _aidl_reply = self.binder.submit_transact(transactions::getInterfaceHash, _aidl_data, binder::binder_impl::FLAG_PRIVATE_LOCAL);
+ self.read_response_getInterfaceHash(_aidl_reply)
+ }
+}
+impl<P: binder::BinderAsyncPool> IFooInterfaceAsync<P> for BpFooInterface {
+ fn originalApi<'a>(&'a self) -> binder::BoxFuture<'a, binder::Result<()>> {
+ let _aidl_data = match self.build_parcel_originalApi() {
+ Ok(_aidl_data) => _aidl_data,
+ Err(err) => return Box::pin(std::future::ready(Err(err))),
+ };
+ let binder = self.binder.clone();
+ P::spawn(
+ move || binder.submit_transact(transactions::originalApi, _aidl_data, binder::binder_impl::FLAG_PRIVATE_LOCAL),
+ move |_aidl_reply| async move {
+ self.read_response_originalApi(_aidl_reply)
+ }
+ )
+ }
+ fn acceptUnionAndReturnString<'a>(&'a self, _arg_u: &'a crate::mangled::_7_android_4_aidl_9_versioned_5_tests_8_BazUnion) -> binder::BoxFuture<'a, binder::Result<String>> {
+ let _aidl_data = match self.build_parcel_acceptUnionAndReturnString(_arg_u) {
+ Ok(_aidl_data) => _aidl_data,
+ Err(err) => return Box::pin(std::future::ready(Err(err))),
+ };
+ let binder = self.binder.clone();
+ P::spawn(
+ move || binder.submit_transact(transactions::acceptUnionAndReturnString, _aidl_data, binder::binder_impl::FLAG_PRIVATE_LOCAL),
+ move |_aidl_reply| async move {
+ self.read_response_acceptUnionAndReturnString(_arg_u, _aidl_reply)
+ }
+ )
+ }
+ fn ignoreParcelablesAndRepeatInt<'a>(&'a self, _arg_inFoo: &'a crate::mangled::_7_android_4_aidl_9_versioned_5_tests_3_Foo, _arg_inoutFoo: &'a mut crate::mangled::_7_android_4_aidl_9_versioned_5_tests_3_Foo, _arg_outFoo: &'a mut crate::mangled::_7_android_4_aidl_9_versioned_5_tests_3_Foo, _arg_value: i32) -> binder::BoxFuture<'a, binder::Result<i32>> {
+ let _aidl_data = match self.build_parcel_ignoreParcelablesAndRepeatInt(_arg_inFoo, _arg_inoutFoo, _arg_outFoo, _arg_value) {
+ Ok(_aidl_data) => _aidl_data,
+ Err(err) => return Box::pin(std::future::ready(Err(err))),
+ };
+ let binder = self.binder.clone();
+ P::spawn(
+ move || binder.submit_transact(transactions::ignoreParcelablesAndRepeatInt, _aidl_data, binder::binder_impl::FLAG_PRIVATE_LOCAL),
+ move |_aidl_reply| async move {
+ self.read_response_ignoreParcelablesAndRepeatInt(_arg_inFoo, _arg_inoutFoo, _arg_outFoo, _arg_value, _aidl_reply)
+ }
+ )
+ }
+ fn returnsLengthOfFooArray<'a>(&'a self, _arg_foos: &'a [crate::mangled::_7_android_4_aidl_9_versioned_5_tests_3_Foo]) -> binder::BoxFuture<'a, binder::Result<i32>> {
+ let _aidl_data = match self.build_parcel_returnsLengthOfFooArray(_arg_foos) {
+ Ok(_aidl_data) => _aidl_data,
+ Err(err) => return Box::pin(std::future::ready(Err(err))),
+ };
+ let binder = self.binder.clone();
+ P::spawn(
+ move || binder.submit_transact(transactions::returnsLengthOfFooArray, _aidl_data, binder::binder_impl::FLAG_PRIVATE_LOCAL),
+ move |_aidl_reply| async move {
+ self.read_response_returnsLengthOfFooArray(_arg_foos, _aidl_reply)
+ }
+ )
+ }
+ fn getInterfaceVersion<'a>(&'a self) -> binder::BoxFuture<'a, binder::Result<i32>> {
+ let _aidl_version = self.cached_version.load(std::sync::atomic::Ordering::Relaxed);
+ if _aidl_version != -1 { return Box::pin(std::future::ready(Ok(_aidl_version))); }
+ let _aidl_data = match self.build_parcel_getInterfaceVersion() {
+ Ok(_aidl_data) => _aidl_data,
+ Err(err) => return Box::pin(std::future::ready(Err(err))),
+ };
+ let binder = self.binder.clone();
+ P::spawn(
+ move || binder.submit_transact(transactions::getInterfaceVersion, _aidl_data, binder::binder_impl::FLAG_PRIVATE_LOCAL),
+ move |_aidl_reply| async move {
+ self.read_response_getInterfaceVersion(_aidl_reply)
+ }
+ )
+ }
+ fn getInterfaceHash<'a>(&'a self) -> binder::BoxFuture<'a, binder::Result<String>> {
+ {
+ let _aidl_hash_lock = self.cached_hash.lock().unwrap();
+ if let Some(ref _aidl_hash) = *_aidl_hash_lock {
+ return Box::pin(std::future::ready(Ok(_aidl_hash.clone())));
+ }
+ }
+ let _aidl_data = match self.build_parcel_getInterfaceHash() {
+ Ok(_aidl_data) => _aidl_data,
+ Err(err) => return Box::pin(std::future::ready(Err(err))),
+ };
+ let binder = self.binder.clone();
+ P::spawn(
+ move || binder.submit_transact(transactions::getInterfaceHash, _aidl_data, binder::binder_impl::FLAG_PRIVATE_LOCAL),
+ move |_aidl_reply| async move {
+ self.read_response_getInterfaceHash(_aidl_reply)
+ }
+ )
+ }
+}
+impl IFooInterface for binder::binder_impl::Binder<BnFooInterface> {
+ fn originalApi(&self) -> binder::Result<()> { self.0.originalApi() }
+ fn acceptUnionAndReturnString(&self, _arg_u: &crate::mangled::_7_android_4_aidl_9_versioned_5_tests_8_BazUnion) -> binder::Result<String> { self.0.acceptUnionAndReturnString(_arg_u) }
+ fn ignoreParcelablesAndRepeatInt(&self, _arg_inFoo: &crate::mangled::_7_android_4_aidl_9_versioned_5_tests_3_Foo, _arg_inoutFoo: &mut crate::mangled::_7_android_4_aidl_9_versioned_5_tests_3_Foo, _arg_outFoo: &mut crate::mangled::_7_android_4_aidl_9_versioned_5_tests_3_Foo, _arg_value: i32) -> binder::Result<i32> { self.0.ignoreParcelablesAndRepeatInt(_arg_inFoo, _arg_inoutFoo, _arg_outFoo, _arg_value) }
+ fn returnsLengthOfFooArray(&self, _arg_foos: &[crate::mangled::_7_android_4_aidl_9_versioned_5_tests_3_Foo]) -> binder::Result<i32> { self.0.returnsLengthOfFooArray(_arg_foos) }
+ fn getInterfaceVersion(&self) -> binder::Result<i32> { self.0.getInterfaceVersion() }
+ fn getInterfaceHash(&self) -> binder::Result<String> { self.0.getInterfaceHash() }
+}
+fn on_transact(_aidl_service: &dyn IFooInterface, _aidl_code: binder::binder_impl::TransactionCode, _aidl_data: &binder::binder_impl::BorrowedParcel<'_>, _aidl_reply: &mut binder::binder_impl::BorrowedParcel<'_>) -> std::result::Result<(), binder::StatusCode> {
+ match _aidl_code {
+ transactions::originalApi => {
+ let _aidl_return = _aidl_service.originalApi();
+ match &_aidl_return {
+ Ok(_aidl_return) => {
+ _aidl_reply.write(&binder::Status::from(binder::StatusCode::OK))?;
+ }
+ Err(_aidl_status) => _aidl_reply.write(_aidl_status)?
+ }
+ Ok(())
+ }
+ transactions::acceptUnionAndReturnString => {
+ let _arg_u: crate::mangled::_7_android_4_aidl_9_versioned_5_tests_8_BazUnion = _aidl_data.read()?;
+ let _aidl_return = _aidl_service.acceptUnionAndReturnString(&_arg_u);
+ match &_aidl_return {
+ Ok(_aidl_return) => {
+ _aidl_reply.write(&binder::Status::from(binder::StatusCode::OK))?;
+ _aidl_reply.write(_aidl_return)?;
+ }
+ Err(_aidl_status) => _aidl_reply.write(_aidl_status)?
+ }
+ Ok(())
+ }
+ transactions::ignoreParcelablesAndRepeatInt => {
+ let _arg_inFoo: crate::mangled::_7_android_4_aidl_9_versioned_5_tests_3_Foo = _aidl_data.read()?;
+ let mut _arg_inoutFoo: crate::mangled::_7_android_4_aidl_9_versioned_5_tests_3_Foo = _aidl_data.read()?;
+ let mut _arg_outFoo: crate::mangled::_7_android_4_aidl_9_versioned_5_tests_3_Foo = Default::default();
+ let _arg_value: i32 = _aidl_data.read()?;
+ let _aidl_return = _aidl_service.ignoreParcelablesAndRepeatInt(&_arg_inFoo, &mut _arg_inoutFoo, &mut _arg_outFoo, _arg_value);
+ match &_aidl_return {
+ Ok(_aidl_return) => {
+ _aidl_reply.write(&binder::Status::from(binder::StatusCode::OK))?;
+ _aidl_reply.write(_aidl_return)?;
+ _aidl_reply.write(&_arg_inoutFoo)?;
+ _aidl_reply.write(&_arg_outFoo)?;
+ }
+ Err(_aidl_status) => _aidl_reply.write(_aidl_status)?
+ }
+ Ok(())
+ }
+ transactions::returnsLengthOfFooArray => {
+ let _arg_foos: Vec<crate::mangled::_7_android_4_aidl_9_versioned_5_tests_3_Foo> = _aidl_data.read()?;
+ let _aidl_return = _aidl_service.returnsLengthOfFooArray(&_arg_foos);
+ match &_aidl_return {
+ Ok(_aidl_return) => {
+ _aidl_reply.write(&binder::Status::from(binder::StatusCode::OK))?;
+ _aidl_reply.write(_aidl_return)?;
+ }
+ Err(_aidl_status) => _aidl_reply.write(_aidl_status)?
+ }
+ Ok(())
+ }
+ transactions::getInterfaceVersion => {
+ let _aidl_return = _aidl_service.getInterfaceVersion();
+ match &_aidl_return {
+ Ok(_aidl_return) => {
+ _aidl_reply.write(&binder::Status::from(binder::StatusCode::OK))?;
+ _aidl_reply.write(_aidl_return)?;
+ }
+ Err(_aidl_status) => _aidl_reply.write(_aidl_status)?
+ }
+ Ok(())
+ }
+ transactions::getInterfaceHash => {
+ let _aidl_return = _aidl_service.getInterfaceHash();
+ match &_aidl_return {
+ Ok(_aidl_return) => {
+ _aidl_reply.write(&binder::Status::from(binder::StatusCode::OK))?;
+ _aidl_reply.write(_aidl_return)?;
+ }
+ Err(_aidl_status) => _aidl_reply.write(_aidl_status)?
+ }
+ Ok(())
+ }
+ _ => Err(binder::StatusCode::UNKNOWN_TRANSACTION)
+ }
+}
+pub(crate) mod mangled {
+ pub use super::IFooInterface as _7_android_4_aidl_9_versioned_5_tests_13_IFooInterface;
+}
diff --git a/tests/golden_output/aidl-test-versioned-interface-V1-rust-source/gen/android/aidl/versioned/tests/IFooInterface.rs.d b/tests/golden_output/aidl-test-versioned-interface-V1-rust-source/gen/android/aidl/versioned/tests/IFooInterface.rs.d
new file mode 100644
index 0000000..b93c4ba
--- /dev/null
+++ b/tests/golden_output/aidl-test-versioned-interface-V1-rust-source/gen/android/aidl/versioned/tests/IFooInterface.rs.d
@@ -0,0 +1,4 @@
+out/soong/.intermediates/system/tools/aidl/aidl-test-versioned-interface-V1-rust-source/gen/android/aidl/versioned/tests/IFooInterface.rs : \
+ system/tools/aidl/aidl_api/aidl-test-versioned-interface/1/android/aidl/versioned/tests/IFooInterface.aidl \
+ system/tools/aidl/aidl_api/aidl-test-versioned-interface/1/android/aidl/versioned/tests/BazUnion.aidl \
+ system/tools/aidl/aidl_api/aidl-test-versioned-interface/1/android/aidl/versioned/tests/Foo.aidl
diff --git a/tests/golden_output/aidl-test-versioned-interface-V2-java-source/gen/timestamp b/tests/golden_output/aidl-test-versioned-interface-V1-rust-source/gen/timestamp
similarity index 100%
copy from tests/golden_output/aidl-test-versioned-interface-V2-java-source/gen/timestamp
copy to tests/golden_output/aidl-test-versioned-interface-V1-rust-source/gen/timestamp
diff --git a/tests/golden_output/aidl-test-versioned-interface-V2-java-source/gen/android/aidl/versioned/tests/BazUnion.java.d b/tests/golden_output/aidl-test-versioned-interface-V2-java-source/gen/android/aidl/versioned/tests/BazUnion.java.d
deleted file mode 100644
index 68d7b75..0000000
--- a/tests/golden_output/aidl-test-versioned-interface-V2-java-source/gen/android/aidl/versioned/tests/BazUnion.java.d
+++ /dev/null
@@ -1,2 +0,0 @@
-out/soong/.intermediates/system/tools/aidl/aidl-test-versioned-interface-V2-java-source/gen/android/aidl/versioned/tests/BazUnion.java : \
- system/tools/aidl/aidl_api/aidl-test-versioned-interface/2/android/aidl/versioned/tests/BazUnion.aidl
diff --git a/tests/golden_output/aidl-test-versioned-interface-V2-java-source/gen/android/aidl/versioned/tests/Foo.java.d b/tests/golden_output/aidl-test-versioned-interface-V2-java-source/gen/android/aidl/versioned/tests/Foo.java.d
deleted file mode 100644
index b7db41a..0000000
--- a/tests/golden_output/aidl-test-versioned-interface-V2-java-source/gen/android/aidl/versioned/tests/Foo.java.d
+++ /dev/null
@@ -1,2 +0,0 @@
-out/soong/.intermediates/system/tools/aidl/aidl-test-versioned-interface-V2-java-source/gen/android/aidl/versioned/tests/Foo.java : \
- system/tools/aidl/aidl_api/aidl-test-versioned-interface/2/android/aidl/versioned/tests/Foo.aidl
diff --git a/tests/golden_output/aidl-test-versioned-interface-V2-java-source/gen/android/aidl/versioned/tests/IFooInterface.java.d b/tests/golden_output/aidl-test-versioned-interface-V2-java-source/gen/android/aidl/versioned/tests/IFooInterface.java.d
deleted file mode 100644
index b6dd541..0000000
--- a/tests/golden_output/aidl-test-versioned-interface-V2-java-source/gen/android/aidl/versioned/tests/IFooInterface.java.d
+++ /dev/null
@@ -1,4 +0,0 @@
-out/soong/.intermediates/system/tools/aidl/aidl-test-versioned-interface-V2-java-source/gen/android/aidl/versioned/tests/IFooInterface.java : \
- system/tools/aidl/aidl_api/aidl-test-versioned-interface/2/android/aidl/versioned/tests/IFooInterface.aidl \
- system/tools/aidl/aidl_api/aidl-test-versioned-interface/2/android/aidl/versioned/tests/BazUnion.aidl \
- system/tools/aidl/aidl_api/aidl-test-versioned-interface/2/android/aidl/versioned/tests/Foo.aidl
diff --git a/tests/golden_output/aidl_test_loggable_interface-cpp-source/gen/android/aidl/loggable/Union.cpp b/tests/golden_output/aidl_test_loggable_interface-cpp-source/gen/android/aidl/loggable/Union.cpp
index 092692e..09e1cc5 100644
--- a/tests/golden_output/aidl_test_loggable_interface-cpp-source/gen/android/aidl/loggable/Union.cpp
+++ b/tests/golden_output/aidl_test_loggable_interface-cpp-source/gen/android/aidl/loggable/Union.cpp
@@ -7,7 +7,7 @@
::android::status_t _aidl_ret_status;
int32_t _aidl_tag;
if ((_aidl_ret_status = _aidl_parcel->readInt32(&_aidl_tag)) != ::android::OK) return _aidl_ret_status;
- switch (_aidl_tag) {
+ switch (static_cast<Tag>(_aidl_tag)) {
case num: {
int32_t _aidl_value;
if ((_aidl_ret_status = _aidl_parcel->readInt32(&_aidl_value)) != ::android::OK) return _aidl_ret_status;
@@ -32,7 +32,7 @@
return ::android::BAD_VALUE;
}
::android::status_t Union::writeToParcel(::android::Parcel* _aidl_parcel) const {
- ::android::status_t _aidl_ret_status = _aidl_parcel->writeInt32(getTag());
+ ::android::status_t _aidl_ret_status = _aidl_parcel->writeInt32(static_cast<int32_t>(getTag()));
if (_aidl_ret_status != ::android::OK) return _aidl_ret_status;
switch (getTag()) {
case num: return _aidl_parcel->writeInt32(get<num>());
diff --git a/tests/golden_output/aidl_test_loggable_interface-cpp-source/gen/include/android/aidl/loggable/Union.h b/tests/golden_output/aidl_test_loggable_interface-cpp-source/gen/include/android/aidl/loggable/Union.h
index 918f117..fbaf018 100644
--- a/tests/golden_output/aidl_test_loggable_interface-cpp-source/gen/include/android/aidl/loggable/Union.h
+++ b/tests/golden_output/aidl_test_loggable_interface-cpp-source/gen/include/android/aidl/loggable/Union.h
@@ -28,7 +28,7 @@
template<typename _Tp>
static constexpr bool _not_self = !std::is_same_v<std::remove_cv_t<std::remove_reference_t<_Tp>>, Union>;
- Union() : _value(std::in_place_index<num>, int32_t(43)) { }
+ Union() : _value(std::in_place_index<static_cast<size_t>(num)>, int32_t(43)) { }
template <typename _Tp, typename = std::enable_if_t<_not_self<_Tp>>>
// NOLINTNEXTLINE(google-explicit-constructor)
@@ -41,12 +41,12 @@
template <Tag _tag, typename... _Tp>
static Union make(_Tp&&... _args) {
- return Union(std::in_place_index<_tag>, std::forward<_Tp>(_args)...);
+ return Union(std::in_place_index<static_cast<size_t>(_tag)>, std::forward<_Tp>(_args)...);
}
template <Tag _tag, typename _Tp, typename... _Up>
static Union make(std::initializer_list<_Tp> _il, _Up&&... _args) {
- return Union(std::in_place_index<_tag>, std::move(_il), std::forward<_Up>(_args)...);
+ return Union(std::in_place_index<static_cast<size_t>(_tag)>, std::move(_il), std::forward<_Up>(_args)...);
}
Tag getTag() const {
@@ -56,18 +56,18 @@
template <Tag _tag>
const auto& get() const {
if (getTag() != _tag) { __assert2(__FILE__, __LINE__, __PRETTY_FUNCTION__, "bad access: a wrong tag"); }
- return std::get<_tag>(_value);
+ return std::get<static_cast<size_t>(_tag)>(_value);
}
template <Tag _tag>
auto& get() {
if (getTag() != _tag) { __assert2(__FILE__, __LINE__, __PRETTY_FUNCTION__, "bad access: a wrong tag"); }
- return std::get<_tag>(_value);
+ return std::get<static_cast<size_t>(_tag)>(_value);
}
template <Tag _tag, typename... _Tp>
void set(_Tp&&... _args) {
- _value.emplace<_tag>(std::forward<_Tp>(_args)...);
+ _value.emplace<static_cast<size_t>(_tag)>(std::forward<_Tp>(_args)...);
}
inline bool operator!=(const Union& rhs) const {
diff --git a/tests/golden_output/aidl_test_loggable_interface-ndk-source/gen/android/aidl/loggable/Union.cpp b/tests/golden_output/aidl_test_loggable_interface-ndk-source/gen/android/aidl/loggable/Union.cpp
index aec5ed6..2d8191e 100644
--- a/tests/golden_output/aidl_test_loggable_interface-ndk-source/gen/android/aidl/loggable/Union.cpp
+++ b/tests/golden_output/aidl_test_loggable_interface-ndk-source/gen/android/aidl/loggable/Union.cpp
@@ -12,7 +12,7 @@
binder_status_t _aidl_ret_status;
int32_t _aidl_tag;
if ((_aidl_ret_status = ::ndk::AParcel_readData(_parcel, &_aidl_tag)) != STATUS_OK) return _aidl_ret_status;
- switch (_aidl_tag) {
+ switch (static_cast<Tag>(_aidl_tag)) {
case num: {
int32_t _aidl_value;
if ((_aidl_ret_status = ::ndk::AParcel_readData(_parcel, &_aidl_value)) != STATUS_OK) return _aidl_ret_status;
@@ -37,7 +37,7 @@
return STATUS_BAD_VALUE;
}
binder_status_t Union::writeToParcel(AParcel* _parcel) const {
- binder_status_t _aidl_ret_status = ::ndk::AParcel_writeData(_parcel, getTag());
+ binder_status_t _aidl_ret_status = ::ndk::AParcel_writeData(_parcel, static_cast<int32_t>(getTag()));
if (_aidl_ret_status != STATUS_OK) return _aidl_ret_status;
switch (getTag()) {
case num: return ::ndk::AParcel_writeData(_parcel, get<num>());
diff --git a/tests/golden_output/aidl_test_loggable_interface-ndk-source/gen/include/aidl/android/aidl/loggable/Union.h b/tests/golden_output/aidl_test_loggable_interface-ndk-source/gen/include/aidl/android/aidl/loggable/Union.h
index ceb63ac..2969134 100644
--- a/tests/golden_output/aidl_test_loggable_interface-ndk-source/gen/include/aidl/android/aidl/loggable/Union.h
+++ b/tests/golden_output/aidl_test_loggable_interface-ndk-source/gen/include/aidl/android/aidl/loggable/Union.h
@@ -37,7 +37,7 @@
template<typename _Tp>
static constexpr bool _not_self = !std::is_same_v<std::remove_cv_t<std::remove_reference_t<_Tp>>, Union>;
- Union() : _value(std::in_place_index<num>, int32_t(43)) { }
+ Union() : _value(std::in_place_index<static_cast<size_t>(num)>, int32_t(43)) { }
template <typename _Tp, typename = std::enable_if_t<_not_self<_Tp>>>
// NOLINTNEXTLINE(google-explicit-constructor)
@@ -50,12 +50,12 @@
template <Tag _tag, typename... _Tp>
static Union make(_Tp&&... _args) {
- return Union(std::in_place_index<_tag>, std::forward<_Tp>(_args)...);
+ return Union(std::in_place_index<static_cast<size_t>(_tag)>, std::forward<_Tp>(_args)...);
}
template <Tag _tag, typename _Tp, typename... _Up>
static Union make(std::initializer_list<_Tp> _il, _Up&&... _args) {
- return Union(std::in_place_index<_tag>, std::move(_il), std::forward<_Up>(_args)...);
+ return Union(std::in_place_index<static_cast<size_t>(_tag)>, std::move(_il), std::forward<_Up>(_args)...);
}
Tag getTag() const {
@@ -65,18 +65,18 @@
template <Tag _tag>
const auto& get() const {
if (getTag() != _tag) { __assert2(__FILE__, __LINE__, __PRETTY_FUNCTION__, "bad access: a wrong tag"); }
- return std::get<_tag>(_value);
+ return std::get<static_cast<size_t>(_tag)>(_value);
}
template <Tag _tag>
auto& get() {
if (getTag() != _tag) { __assert2(__FILE__, __LINE__, __PRETTY_FUNCTION__, "bad access: a wrong tag"); }
- return std::get<_tag>(_value);
+ return std::get<static_cast<size_t>(_tag)>(_value);
}
template <Tag _tag, typename... _Tp>
void set(_Tp&&... _args) {
- _value.emplace<_tag>(std::forward<_Tp>(_args)...);
+ _value.emplace<static_cast<size_t>(_tag)>(std::forward<_Tp>(_args)...);
}
binder_status_t readFromParcel(const AParcel* _parcel);
diff --git a/tests/golden_test.sh b/tests/golden_test.sh
index 547999e..86a5d1a 100755
--- a/tests/golden_test.sh
+++ b/tests/golden_test.sh
@@ -39,13 +39,16 @@
modules=(
"aidl-test-interface-cpp-source"
"aidl-test-interface-java-source"
- "aidl-test-versioned-interface-V2-java-source"
+ "aidl-test-versioned-interface-V1-cpp-source"
+ "aidl-test-versioned-interface-V1-java-source"
+ "aidl-test-versioned-interface-V1-ndk-source"
+ "aidl-test-versioned-interface-V1-rust-source"
"aidl-test-interface-ndk-source"
"aidl-test-interface-rust-source"
"aidl_test_loggable_interface-cpp-source"
"aidl_test_loggable_interface-java-source"
"aidl_test_loggable_interface-ndk-source"
- "aidl-test-interface-platform-java-source"
+ "aidl-test-interface-permission-java-source"
"aidl-test-fixedsizearray-cpp-source"
"aidl-test-fixedsizearray-java-source"
"aidl-test-fixedsizearray-ndk-source"
diff --git a/tests/rust/test_client.rs b/tests/rust/test_client.rs
index 1d75234..35c3af3 100644
--- a/tests/rust/test_client.rs
+++ b/tests/rust/test_client.rs
@@ -887,7 +887,7 @@
.expect("did not get binder service");
let ret = service.acceptUnionAndReturnString(&BazUnion::LongNum(42));
- assert!(!ret.is_ok());
+ assert!(ret.is_err());
let main_service = get_test_service();
let backend = main_service.getBackendType().expect("error getting backend type");