Use --min_sdk_version to use newer APIs for Java
With min_sdk_version, we can use Parcel's newer APIs to generate better
(or smaller) code.
Since writeTypedObject is guarded with min_sdk_version,
DEFAULT_SDK_VERSION_JAVA is set to 1.
Bug: 205052430
Test: atest aidl_integration_test
(uses newer APIs)
Change-Id: I55206d4c0632221b3d11f9d9249a13749ed92d84
diff --git a/aidl_to_java.cpp b/aidl_to_java.cpp
index d2bf5a2..5df5ad4 100644
--- a/aidl_to_java.cpp
+++ b/aidl_to_java.cpp
@@ -201,11 +201,15 @@
}
}
-bool WriteToParcelFor(const CodeGeneratorContext& c) {
+void WriteToParcelFor(const CodeGeneratorContext& c) {
static map<string, function<void(const CodeGeneratorContext&)>> method_map{
{"boolean",
[](const CodeGeneratorContext& c) {
- c.writer << c.parcel << ".writeInt(((" << c.var << ")?(1):(0)));\n";
+ if (c.min_sdk_version >= 29u) {
+ c.writer << c.parcel << ".writeBoolean(" << c.var << ");\n";
+ } else {
+ c.writer << c.parcel << ".writeInt(((" << c.var << ")?(1):(0)));\n";
+ }
}},
{"boolean[]",
[](const CodeGeneratorContext& c) {
@@ -304,6 +308,7 @@
*c.type.GetTypeParameters()[1].get(),
c.parcel,
"v",
+ c.min_sdk_version,
c.is_return_value,
c.is_classloader_created,
c.filename,
@@ -336,19 +341,23 @@
}},
{"ParcelFileDescriptor",
[](const CodeGeneratorContext& c) {
- // This is same as writeTypedObject which was introduced with SDK 23.
- // Keeping below code so that the generated code is buildable with older SDK.
- c.writer << "if ((" << c.var << "!=null)) {\n";
- c.writer.Indent();
- c.writer << c.parcel << ".writeInt(1);\n";
- c.writer << c.var << ".writeToParcel(" << c.parcel << ", " << GetFlagFor(c) << ");\n";
- c.writer.Dedent();
- c.writer << "}\n";
- c.writer << "else {\n";
- c.writer.Indent();
- c.writer << c.parcel << ".writeInt(0);\n";
- c.writer.Dedent();
- c.writer << "}\n";
+ if (c.min_sdk_version >= 23u) {
+ c.writer << c.parcel << ".writeTypedObject(" << c.var << ", " << GetFlagFor(c) << ");\n";
+ } else {
+ // This is same as writeTypedObject which was introduced with SDK 23.
+ // Keeping below code so that the generated code is buildable with older SDK.
+ c.writer << "if ((" << c.var << "!=null)) {\n";
+ c.writer.Indent();
+ c.writer << c.parcel << ".writeInt(1);\n";
+ c.writer << c.var << ".writeToParcel(" << c.parcel << ", " << GetFlagFor(c) << ");\n";
+ c.writer.Dedent();
+ c.writer << "}\n";
+ c.writer << "else {\n";
+ c.writer.Indent();
+ c.writer << c.parcel << ".writeInt(0);\n";
+ c.writer.Dedent();
+ c.writer << "}\n";
+ }
}},
{"ParcelFileDescriptor[]",
[](const CodeGeneratorContext& c) {
@@ -403,32 +412,30 @@
c.writer.Dedent();
c.writer << "}\n";
} else {
- // Why don't we use writeStrongInterface which does the exact same thing?
- // Keeping below code just not to break unit tests.
- c.writer << c.parcel << ".writeStrongBinder((((" << c.var << "!=null))?"
- << "(" << c.var << ".asBinder()):(null)));\n";
+ c.writer << c.parcel << ".writeStrongInterface(" << c.var << ");\n";
}
} else if (t->AsParcelable() != nullptr) {
if (c.type.IsArray()) {
c.writer << c.parcel << ".writeTypedArray(" << c.var << ", " << GetFlagFor(c) << ");\n";
} else {
- // This is same as writeTypedObject.
- // Keeping below code just not to break tests.
- c.writer << "if ((" << c.var << "!=null)) {\n";
- c.writer.Indent();
- c.writer << c.parcel << ".writeInt(1);\n";
- c.writer << c.var << ".writeToParcel(" << c.parcel << ", " << GetFlagFor(c) << ");\n";
- c.writer.Dedent();
- c.writer << "}\n";
- c.writer << "else {\n";
- c.writer.Indent();
- c.writer << c.parcel << ".writeInt(0);\n";
- c.writer.Dedent();
- c.writer << "}\n";
+ if (c.min_sdk_version >= 23u) {
+ c.writer << c.parcel << ".writeTypedObject(" << c.var << ", " << GetFlagFor(c) << ");\n";
+ } else {
+ c.writer << "if ((" << c.var << "!=null)) {\n";
+ c.writer.Indent();
+ c.writer << c.parcel << ".writeInt(1);\n";
+ c.writer << c.var << ".writeToParcel(" << c.parcel << ", " << GetFlagFor(c) << ");\n";
+ c.writer.Dedent();
+ c.writer << "}\n";
+ c.writer << "else {\n";
+ c.writer.Indent();
+ c.writer << c.parcel << ".writeInt(0);\n";
+ c.writer.Dedent();
+ c.writer << "}\n";
+ }
}
}
}
- return true;
}
// Ensures that a variable is initialized to refer to the classloader
@@ -447,7 +454,11 @@
static map<string, function<void(const CodeGeneratorContext&)>> method_map{
{"boolean",
[](const CodeGeneratorContext& c) {
- c.writer << c.var << " = (0!=" << c.parcel << ".readInt());\n";
+ if (c.min_sdk_version >= 29u) {
+ c.writer << c.var << " = " << c.parcel << ".readBoolean();\n";
+ } else {
+ c.writer << c.var << " = (0!=" << c.parcel << ".readInt());\n";
+ }
}},
{"boolean[]",
[](const CodeGeneratorContext& c) {
@@ -548,6 +559,7 @@
*c.type.GetTypeParameters()[1].get(),
c.parcel,
"v",
+ c.min_sdk_version,
c.is_return_value,
c.is_classloader_created,
c.filename,
@@ -583,19 +595,23 @@
}},
{"ParcelFileDescriptor",
[](const CodeGeneratorContext& c) {
- // This is same as readTypedObject which was introduced with SDK 23.
- // Keeping below code so that the generated code is buildable with older SDK.
- c.writer << "if ((0!=" << c.parcel << ".readInt())) {\n";
- c.writer.Indent();
- c.writer << c.var << " = " << "android.os.ParcelFileDescriptor.CREATOR.createFromParcel(" << c.parcel
- << ");\n";
- c.writer.Dedent();
- c.writer << "}\n";
- c.writer << "else {\n";
- c.writer.Indent();
- c.writer << c.var << " = null;\n";
- c.writer.Dedent();
- c.writer << "}\n";
+ if (c.min_sdk_version >= 23u) {
+ c.writer << c.var << " = " << c.parcel
+ << ".readTypedObject(android.os.ParcelFileDescriptor.CREATOR);\n";
+ } else {
+ c.writer << "if ((0!=" << c.parcel << ".readInt())) {\n";
+ c.writer.Indent();
+ c.writer << c.var << " = "
+ << "android.os.ParcelFileDescriptor.CREATOR.createFromParcel(" << c.parcel
+ << ");\n";
+ c.writer.Dedent();
+ c.writer << "}\n";
+ c.writer << "else {\n";
+ c.writer.Indent();
+ c.writer << c.var << " = null;\n";
+ c.writer.Dedent();
+ c.writer << "}\n";
+ }
}},
{"ParcelFileDescriptor[]",
[](const CodeGeneratorContext& c) {
@@ -604,18 +620,23 @@
}},
{"CharSequence",
[](const CodeGeneratorContext& c) {
- // We have written 0 for null CharSequence.
- c.writer << "if (0!=" << c.parcel << ".readInt()) {\n";
- c.writer.Indent();
- c.writer << c.var << " = android.text.TextUtils.CHAR_SEQUENCE_CREATOR.createFromParcel("
- << c.parcel << ");\n";
- c.writer.Dedent();
- c.writer << "}\n";
- c.writer << "else {\n";
- c.writer.Indent();
- c.writer << c.var << " = null;\n";
- c.writer.Dedent();
- c.writer << "}\n";
+ if (c.min_sdk_version >= 23u) {
+ c.writer << c.var << " = " << c.parcel
+ << ".readTypedObject(android.text.TextUtils.CHAR_SEQUENCE_CREATOR);\n";
+ } else {
+ // We have written 0 for null CharSequence.
+ c.writer << "if (0!=" << c.parcel << ".readInt()) {\n";
+ c.writer.Indent();
+ c.writer << c.var << " = android.text.TextUtils.CHAR_SEQUENCE_CREATOR.createFromParcel("
+ << c.parcel << ");\n";
+ c.writer.Dedent();
+ c.writer << "}\n";
+ c.writer << "else {\n";
+ c.writer.Indent();
+ c.writer << c.var << " = null;\n";
+ c.writer.Dedent();
+ c.writer << "}\n";
+ }
}},
{"ParcelableHolder",
[](const CodeGeneratorContext& c) {
@@ -663,19 +684,24 @@
c.writer << c.var << " = " << c.parcel << ".createTypedArray("
<< JavaNameOf(c.type, c.typenames) << ".CREATOR);\n";
} else {
- // This is same as readTypedObject.
- // Keeping below code just not to break unit tests.
- c.writer << "if ((0!=" << c.parcel << ".readInt())) {\n";
- c.writer.Indent();
- c.writer << c.var << " = " << c.type.GetName() << ".CREATOR.createFromParcel(" << c.parcel
- << ");\n";
- c.writer.Dedent();
- c.writer << "}\n";
- c.writer << "else {\n";
- c.writer.Indent();
- c.writer << c.var << " = null;\n";
- c.writer.Dedent();
- c.writer << "}\n";
+ if (c.min_sdk_version >= 23u) {
+ c.writer << c.var << " = " << c.parcel << ".readTypedObject(" << c.type.GetName()
+ << ".CREATOR);\n";
+ } else {
+ // This is same as readTypedObject.
+ // Keeping below code just not to break unit tests.
+ c.writer << "if ((0!=" << c.parcel << ".readInt())) {\n";
+ c.writer.Indent();
+ c.writer << c.var << " = " << c.type.GetName() << ".CREATOR.createFromParcel(" << c.parcel
+ << ");\n";
+ c.writer.Dedent();
+ c.writer << "}\n";
+ c.writer << "else {\n";
+ c.writer.Indent();
+ c.writer << c.var << " = null;\n";
+ c.writer.Dedent();
+ c.writer << "}\n";
+ }
}
}
}
@@ -751,6 +777,7 @@
*c.type.GetTypeParameters()[1].get(),
c.parcel,
"v",
+ c.min_sdk_version,
c.is_return_value,
c.is_classloader_created,
c.filename,
diff --git a/aidl_to_java.h b/aidl_to_java.h
index 2ebe2c3..9ea6b3e 100644
--- a/aidl_to_java.h
+++ b/aidl_to_java.h
@@ -60,7 +60,7 @@
const AidlTypeSpecifier& type;
const string parcel;
const string var;
-
+ const uint32_t min_sdk_version;
// Set to true when the marshalled data will be returned to the client
// This is given as a hint to the Parcelable that is being marshalled
// so that the Parcelable can release its resource after the marshalling
@@ -89,7 +89,7 @@
};
// Writes code fragment that writes a variable to the parcel.
-bool WriteToParcelFor(const CodeGeneratorContext& c);
+void WriteToParcelFor(const CodeGeneratorContext& c);
// Writes code fragment that reads data from the parcel into a variable. When
// the variable type is array or List, the array or List is created.
diff --git a/generate_java.cpp b/generate_java.cpp
index 50deea5..b972417 100644
--- a/generate_java.cpp
+++ b/generate_java.cpp
@@ -436,6 +436,7 @@
.type = field->GetType(),
.parcel = parcel_variable->name,
.var = field->GetName(),
+ .min_sdk_version = options.GetMinSdkVersion(),
.is_return_value = false,
};
WriteToParcelFor(context);
@@ -759,6 +760,7 @@
.type = type,
.parcel = parcel,
.var = name,
+ .min_sdk_version = options.GetMinSdkVersion(),
.is_return_value = false,
};
WriteToParcelFor(context);
diff --git a/generate_java_binder.cpp b/generate_java_binder.cpp
index 07ac008..dc3d1e0 100644
--- a/generate_java_binder.cpp
+++ b/generate_java_binder.cpp
@@ -394,18 +394,19 @@
addTo->Add(lencheck);
}
-static void GenerateWriteToParcel(const AidlTypeSpecifier& type,
- std::shared_ptr<StatementBlock> addTo,
- std::shared_ptr<Variable> v, std::shared_ptr<Variable> parcel,
- bool is_return_value, const AidlTypenames& typenames) {
+static void GenerateWriteToParcel(std::shared_ptr<StatementBlock> addTo,
+ const AidlTypenames& typenames, const AidlTypeSpecifier& type,
+ const std::string& parcel, const std::string& var,
+ uint32_t min_sdk_version, bool is_return_value) {
string code;
CodeWriterPtr writer = CodeWriter::ForString(&code);
CodeGeneratorContext context{
.writer = *(writer.get()),
.typenames = typenames,
.type = type,
- .parcel = parcel->name,
- .var = v->name,
+ .parcel = parcel,
+ .var = var,
+ .min_sdk_version = min_sdk_version,
.is_return_value = is_return_value,
};
WriteToParcelFor(context);
@@ -602,6 +603,7 @@
.type = arg->GetType(),
.parcel = transact_data->name,
.var = v->name,
+ .min_sdk_version = options.GetMinSdkVersion(),
.is_classloader_created = &is_classloader_created};
CreateFromParcelFor(context);
writer->Close();
@@ -641,16 +643,17 @@
}
// marshall the return value
- GenerateWriteToParcel(method.GetType(), statements, _result, transact_reply, true, typenames);
+ GenerateWriteToParcel(statements, typenames, method.GetType(), transact_reply->name,
+ _result->name, options.GetMinSdkVersion(), /*is_return_value=*/true);
}
// out parameters
int i = 0;
for (const std::unique_ptr<AidlArgument>& arg : method.GetArguments()) {
std::shared_ptr<Variable> v = stubArgs.Get(i++);
-
if (arg->GetDirection() & AidlArgument::OUT_DIR) {
- GenerateWriteToParcel(arg->GetType(), statements, v, transact_reply, true, typenames);
+ GenerateWriteToParcel(statements, typenames, arg->GetType(), transact_reply->name, v->name,
+ options.GetMinSdkVersion(), /*is_return_value=*/true);
}
}
}
@@ -789,7 +792,8 @@
std::vector<std::shared_ptr<Expression>>{std::make_shared<FieldVariable>(v, "length")}));
tryStatement->statements->Add(checklen);
} else if (dir & AidlArgument::IN_DIR) {
- GenerateWriteToParcel(arg->GetType(), tryStatement->statements, v, _data, false, typenames);
+ GenerateWriteToParcel(tryStatement->statements, typenames, arg->GetType(), _data->name,
+ v->name, options.GetMinSdkVersion(), /*is_return_value=*/false);
}
}
diff --git a/options.cpp b/options.cpp
index 3806fca..13fad03 100644
--- a/options.cpp
+++ b/options.cpp
@@ -119,9 +119,9 @@
<< " --min_sdk_version=<version>" << endl
<< " Minimum SDK version that the generated code should support." << endl
<< " Defaults to " << DEFAULT_SDK_VERSION_JAVA << " for --lang=java, " << endl
- << " " << DEFAULT_SDK_VERSION_CPP << "for --lang=cpp, " << endl
- << " " << DEFAULT_SDK_VERSION_NDK << "for --lang=ndk, " << endl
- << " " << DEFAULT_SDK_VERSION_RUST << "for --lang=rust, " << endl
+ << " " << DEFAULT_SDK_VERSION_CPP << " for --lang=cpp, " << endl
+ << " " << DEFAULT_SDK_VERSION_NDK << " for --lang=ndk, " << endl
+ << " " << DEFAULT_SDK_VERSION_RUST << " for --lang=rust, " << endl
<< " -t, --trace" << endl
<< " Include tracing code for systrace. Note that if either" << endl
<< " the client or service code is not auto-generated by this" << endl
diff --git a/options.h b/options.h
index 98d818e..a391332 100644
--- a/options.h
+++ b/options.h
@@ -29,10 +29,9 @@
using std::vector;
// The oldest SDK version that is supported for each backend. For non-Java backends, these are the
-// platform SDK version where the support for the backend was added. For Java backend, this should
-// ideally be 1, but is actually 23 as the generated code uses some APIs (like
-// `Parcel.writeTypedObject`) added in 23.
-constexpr uint32_t DEFAULT_SDK_VERSION_JAVA = 23;
+// platform SDK version where the support for the backend was added. For Java backend, this is 1.
+// TODO(b/205065703) switch back to DEFAULT_SDK_VERSION_JAVA = 23
+constexpr uint32_t DEFAULT_SDK_VERSION_JAVA = 1;
constexpr uint32_t DEFAULT_SDK_VERSION_CPP = 23;
constexpr uint32_t DEFAULT_SDK_VERSION_NDK = 29;
constexpr uint32_t DEFAULT_SDK_VERSION_RUST = 31;
diff --git a/options_unittest.cpp b/options_unittest.cpp
index d2ae0d9..1121402 100644
--- a/options_unittest.cpp
+++ b/options_unittest.cpp
@@ -484,7 +484,8 @@
TEST(OptionsTest, RejectOldMinSdkVersion) {
const char* args[] = {
- "aidl", "--lang=java", "--min_sdk_version=22", "--out=out", "input.aidl", nullptr,
+ "aidl", "--lang=cpp", "--min_sdk_version=22", "--out=out", "--header_out=out",
+ "input.aidl", nullptr,
};
CaptureStderr();
auto options = GetOptions(args);
diff --git a/tests/golden_output/aidl-test-interface-java-source/gen/android/aidl/tests/ArrayOfInterfaces.java b/tests/golden_output/aidl-test-interface-java-source/gen/android/aidl/tests/ArrayOfInterfaces.java
index c59e83f..05fcd74 100644
--- a/tests/golden_output/aidl-test-interface-java-source/gen/android/aidl/tests/ArrayOfInterfaces.java
+++ b/tests/golden_output/aidl-test-interface-java-source/gen/android/aidl/tests/ArrayOfInterfaces.java
@@ -345,8 +345,8 @@
android.aidl.tests.ArrayOfInterfaces.IEmptyInterface[] _result;
try {
_data.writeInterfaceToken(DESCRIPTOR);
- _data.writeStrongBinder((((iface!=null))?(iface.asBinder()):(null)));
- _data.writeStrongBinder((((nullable_iface!=null))?(nullable_iface.asBinder()):(null)));
+ _data.writeStrongInterface(iface);
+ _data.writeStrongInterface(nullable_iface);
{
android.os.IBinder[] _binder_arr = null;
if (iface_array_in != null) {
@@ -497,8 +497,8 @@
{
int _aidl_start_pos = _aidl_parcel.dataPosition();
_aidl_parcel.writeInt(0);
- _aidl_parcel.writeStrongBinder((((iface!=null))?(iface.asBinder()):(null)));
- _aidl_parcel.writeStrongBinder((((nullable_iface!=null))?(nullable_iface.asBinder()):(null)));
+ _aidl_parcel.writeStrongInterface(iface);
+ _aidl_parcel.writeStrongInterface(nullable_iface);
{
android.os.IBinder[] _binder_arr = null;
if (iface_array != null) {
@@ -702,10 +702,10 @@
_aidl_parcel.writeInt(_tag);
switch (_tag) {
case iface:
- _aidl_parcel.writeStrongBinder((((getIface()!=null))?(getIface().asBinder()):(null)));
+ _aidl_parcel.writeStrongInterface(getIface());
break;
case nullable_iface:
- _aidl_parcel.writeStrongBinder((((getNullable_iface()!=null))?(getNullable_iface().asBinder()):(null)));
+ _aidl_parcel.writeStrongInterface(getNullable_iface());
break;
case iface_array:
{
diff --git a/tests/golden_output/aidl-test-interface-java-source/gen/android/aidl/tests/ITestService.java b/tests/golden_output/aidl-test-interface-java-source/gen/android/aidl/tests/ITestService.java
index 8bea771..7c1300c 100644
--- a/tests/golden_output/aidl-test-interface-java-source/gen/android/aidl/tests/ITestService.java
+++ b/tests/golden_output/aidl-test-interface-java-source/gen/android/aidl/tests/ITestService.java
@@ -348,10 +348,10 @@
case TRANSACTION_RepeatBoolean:
{
boolean _arg0;
- _arg0 = (0!=data.readInt());
+ _arg0 = data.readBoolean();
boolean _result = this.RepeatBoolean(_arg0);
reply.writeNoException();
- reply.writeInt(((_result)?(1):(0)));
+ reply.writeBoolean(_result);
break;
}
case TRANSACTION_RepeatByte:
@@ -648,7 +648,7 @@
_arg0 = data.readString();
android.aidl.tests.INamedCallback _result = this.GetOtherTestService(_arg0);
reply.writeNoException();
- reply.writeStrongBinder((((_result!=null))?(_result.asBinder()):(null)));
+ reply.writeStrongInterface(_result);
break;
}
case TRANSACTION_VerifyName:
@@ -659,7 +659,7 @@
_arg1 = data.readString();
boolean _result = this.VerifyName(_arg0, _arg1);
reply.writeNoException();
- reply.writeInt(((_result)?(1):(0)));
+ reply.writeBoolean(_result);
break;
}
case TRANSACTION_GetInterfaceArray:
@@ -698,7 +698,7 @@
_arg1 = data.createStringArray();
boolean _result = this.VerifyNamesWithInterfaceArray(_arg0, _arg1);
reply.writeNoException();
- reply.writeInt(((_result)?(1):(0)));
+ reply.writeBoolean(_result);
break;
}
case TRANSACTION_GetNullableInterfaceArray:
@@ -737,7 +737,7 @@
_arg1 = data.createStringArray();
boolean _result = this.VerifyNamesWithNullableInterfaceArray(_arg0, _arg1);
reply.writeNoException();
- reply.writeInt(((_result)?(1):(0)));
+ reply.writeBoolean(_result);
break;
}
case TRANSACTION_ReverseStringList:
@@ -755,21 +755,10 @@
case TRANSACTION_RepeatParcelFileDescriptor:
{
android.os.ParcelFileDescriptor _arg0;
- if ((0!=data.readInt())) {
- _arg0 = android.os.ParcelFileDescriptor.CREATOR.createFromParcel(data);
- }
- else {
- _arg0 = null;
- }
+ _arg0 = data.readTypedObject(android.os.ParcelFileDescriptor.CREATOR);
android.os.ParcelFileDescriptor _result = this.RepeatParcelFileDescriptor(_arg0);
reply.writeNoException();
- if ((_result!=null)) {
- reply.writeInt(1);
- _result.writeToParcel(reply, android.os.Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
- }
- else {
- reply.writeInt(0);
- }
+ reply.writeTypedObject(_result, android.os.Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
break;
}
case TRANSACTION_ReverseParcelFileDescriptorArray:
@@ -855,21 +844,10 @@
case TRANSACTION_RepeatNullableParcelable:
{
android.aidl.tests.ITestService.Empty _arg0;
- if ((0!=data.readInt())) {
- _arg0 = android.aidl.tests.ITestService.Empty.CREATOR.createFromParcel(data);
- }
- else {
- _arg0 = null;
- }
+ _arg0 = data.readTypedObject(android.aidl.tests.ITestService.Empty.CREATOR);
android.aidl.tests.ITestService.Empty _result = this.RepeatNullableParcelable(_arg0);
reply.writeNoException();
- if ((_result!=null)) {
- reply.writeInt(1);
- _result.writeToParcel(reply, android.os.Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
- }
- else {
- reply.writeInt(0);
- }
+ reply.writeTypedObject(_result, android.os.Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
break;
}
case TRANSACTION_RepeatNullableParcelableArray:
@@ -991,72 +969,39 @@
case TRANSACTION_GetCallback:
{
boolean _arg0;
- _arg0 = (0!=data.readInt());
+ _arg0 = data.readBoolean();
android.aidl.tests.INamedCallback _result = this.GetCallback(_arg0);
reply.writeNoException();
- reply.writeStrongBinder((((_result!=null))?(_result.asBinder()):(null)));
+ reply.writeStrongInterface(_result);
break;
}
case TRANSACTION_FillOutStructuredParcelable:
{
android.aidl.tests.StructuredParcelable _arg0;
- if ((0!=data.readInt())) {
- _arg0 = android.aidl.tests.StructuredParcelable.CREATOR.createFromParcel(data);
- }
- else {
- _arg0 = null;
- }
+ _arg0 = data.readTypedObject(android.aidl.tests.StructuredParcelable.CREATOR);
this.FillOutStructuredParcelable(_arg0);
reply.writeNoException();
- if ((_arg0!=null)) {
- reply.writeInt(1);
- _arg0.writeToParcel(reply, android.os.Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
- }
- else {
- reply.writeInt(0);
- }
+ reply.writeTypedObject(_arg0, android.os.Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
break;
}
case TRANSACTION_RepeatExtendableParcelable:
{
android.aidl.tests.extension.ExtendableParcelable _arg0;
- if ((0!=data.readInt())) {
- _arg0 = android.aidl.tests.extension.ExtendableParcelable.CREATOR.createFromParcel(data);
- }
- else {
- _arg0 = null;
- }
+ _arg0 = data.readTypedObject(android.aidl.tests.extension.ExtendableParcelable.CREATOR);
android.aidl.tests.extension.ExtendableParcelable _arg1;
_arg1 = new android.aidl.tests.extension.ExtendableParcelable();
this.RepeatExtendableParcelable(_arg0, _arg1);
reply.writeNoException();
- if ((_arg1!=null)) {
- reply.writeInt(1);
- _arg1.writeToParcel(reply, android.os.Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
- }
- else {
- reply.writeInt(0);
- }
+ reply.writeTypedObject(_arg1, android.os.Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
break;
}
case TRANSACTION_ReverseList:
{
android.aidl.tests.RecursiveList _arg0;
- if ((0!=data.readInt())) {
- _arg0 = android.aidl.tests.RecursiveList.CREATOR.createFromParcel(data);
- }
- else {
- _arg0 = null;
- }
+ _arg0 = data.readTypedObject(android.aidl.tests.RecursiveList.CREATOR);
android.aidl.tests.RecursiveList _result = this.ReverseList(_arg0);
reply.writeNoException();
- if ((_result!=null)) {
- reply.writeInt(1);
- _result.writeToParcel(reply, android.os.Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
- }
- else {
- reply.writeInt(0);
- }
+ reply.writeTypedObject(_result, android.os.Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
break;
}
case TRANSACTION_ReverseIBinderArray:
@@ -1099,14 +1044,14 @@
{
android.aidl.tests.IOldName _result = this.GetOldNameInterface();
reply.writeNoException();
- reply.writeStrongBinder((((_result!=null))?(_result.asBinder()):(null)));
+ reply.writeStrongInterface(_result);
break;
}
case TRANSACTION_GetNewNameInterface:
{
android.aidl.tests.INewName _result = this.GetNewNameInterface();
reply.writeNoException();
- reply.writeStrongBinder((((_result!=null))?(_result.asBinder()):(null)));
+ reply.writeStrongInterface(_result);
break;
}
case TRANSACTION_GetCppJavaTests:
@@ -1232,7 +1177,7 @@
boolean _result;
try {
_data.writeInterfaceToken(DESCRIPTOR);
- _data.writeInt(((token)?(1):(0)));
+ _data.writeBoolean(token);
boolean _status = mRemote.transact(Stub.TRANSACTION_RepeatBoolean, _data, _reply, android.os.IBinder.FLAG_CLEAR_BUF);
if (!_status) {
if (getDefaultImpl() != null) {
@@ -1863,7 +1808,7 @@
boolean _result;
try {
_data.writeInterfaceToken(DESCRIPTOR);
- _data.writeStrongBinder((((service!=null))?(service.asBinder()):(null)));
+ _data.writeStrongInterface(service);
_data.writeString(name);
boolean _status = mRemote.transact(Stub.TRANSACTION_VerifyName, _data, _reply, android.os.IBinder.FLAG_CLEAR_BUF);
if (!_status) {
@@ -2050,13 +1995,7 @@
android.os.ParcelFileDescriptor _result;
try {
_data.writeInterfaceToken(DESCRIPTOR);
- if ((read!=null)) {
- _data.writeInt(1);
- read.writeToParcel(_data, 0);
- }
- else {
- _data.writeInt(0);
- }
+ _data.writeTypedObject(read, 0);
boolean _status = mRemote.transact(Stub.TRANSACTION_RepeatParcelFileDescriptor, _data, _reply, android.os.IBinder.FLAG_CLEAR_BUF);
if (!_status) {
if (getDefaultImpl() != null) {
@@ -2284,13 +2223,7 @@
android.aidl.tests.ITestService.Empty _result;
try {
_data.writeInterfaceToken(DESCRIPTOR);
- if ((input!=null)) {
- _data.writeInt(1);
- input.writeToParcel(_data, 0);
- }
- else {
- _data.writeInt(0);
- }
+ _data.writeTypedObject(input, 0);
boolean _status = mRemote.transact(Stub.TRANSACTION_RepeatNullableParcelable, _data, _reply, android.os.IBinder.FLAG_CLEAR_BUF);
if (!_status) {
if (getDefaultImpl() != null) {
@@ -2592,7 +2525,7 @@
android.aidl.tests.INamedCallback _result;
try {
_data.writeInterfaceToken(DESCRIPTOR);
- _data.writeInt(((return_null)?(1):(0)));
+ _data.writeBoolean(return_null);
boolean _status = mRemote.transact(Stub.TRANSACTION_GetCallback, _data, _reply, android.os.IBinder.FLAG_CLEAR_BUF);
if (!_status) {
if (getDefaultImpl() != null) {
@@ -2617,13 +2550,7 @@
android.os.Parcel _reply = android.os.Parcel.obtain();
try {
_data.writeInterfaceToken(DESCRIPTOR);
- if ((parcel!=null)) {
- _data.writeInt(1);
- parcel.writeToParcel(_data, 0);
- }
- else {
- _data.writeInt(0);
- }
+ _data.writeTypedObject(parcel, 0);
boolean _status = mRemote.transact(Stub.TRANSACTION_FillOutStructuredParcelable, _data, _reply, android.os.IBinder.FLAG_CLEAR_BUF);
if (!_status) {
if (getDefaultImpl() != null) {
@@ -2648,13 +2575,7 @@
android.os.Parcel _reply = android.os.Parcel.obtain();
try {
_data.writeInterfaceToken(DESCRIPTOR);
- if ((ep!=null)) {
- _data.writeInt(1);
- ep.writeToParcel(_data, 0);
- }
- else {
- _data.writeInt(0);
- }
+ _data.writeTypedObject(ep, 0);
boolean _status = mRemote.transact(Stub.TRANSACTION_RepeatExtendableParcelable, _data, _reply, android.os.IBinder.FLAG_CLEAR_BUF);
if (!_status) {
if (getDefaultImpl() != null) {
@@ -2680,13 +2601,7 @@
android.aidl.tests.RecursiveList _result;
try {
_data.writeInterfaceToken(DESCRIPTOR);
- if ((list!=null)) {
- _data.writeInt(1);
- list.writeToParcel(_data, 0);
- }
- else {
- _data.writeInt(0);
- }
+ _data.writeTypedObject(list, 0);
boolean _status = mRemote.transact(Stub.TRANSACTION_ReverseList, _data, _reply, android.os.IBinder.FLAG_CLEAR_BUF);
if (!_status) {
if (getDefaultImpl() != null) {
@@ -3218,38 +3133,14 @@
_aidl_parcel.writeBinderArray(nullable_binder_array);
_aidl_parcel.writeBinderList(binder_list);
_aidl_parcel.writeBinderList(nullable_binder_list);
- if ((pfd!=null)) {
- _aidl_parcel.writeInt(1);
- pfd.writeToParcel(_aidl_parcel, 0);
- }
- else {
- _aidl_parcel.writeInt(0);
- }
- if ((nullable_pfd!=null)) {
- _aidl_parcel.writeInt(1);
- nullable_pfd.writeToParcel(_aidl_parcel, 0);
- }
- else {
- _aidl_parcel.writeInt(0);
- }
+ _aidl_parcel.writeTypedObject(pfd, 0);
+ _aidl_parcel.writeTypedObject(nullable_pfd, 0);
_aidl_parcel.writeTypedArray(pfd_array, 0);
_aidl_parcel.writeTypedArray(nullable_pfd_array, 0);
_aidl_parcel.writeTypedList(pfd_list);
_aidl_parcel.writeTypedList(nullable_pfd_list);
- if ((parcel!=null)) {
- _aidl_parcel.writeInt(1);
- parcel.writeToParcel(_aidl_parcel, 0);
- }
- else {
- _aidl_parcel.writeInt(0);
- }
- if ((nullable_parcel!=null)) {
- _aidl_parcel.writeInt(1);
- nullable_parcel.writeToParcel(_aidl_parcel, 0);
- }
- else {
- _aidl_parcel.writeInt(0);
- }
+ _aidl_parcel.writeTypedObject(parcel, 0);
+ _aidl_parcel.writeTypedObject(nullable_parcel, 0);
_aidl_parcel.writeTypedArray(parcel_array, 0);
_aidl_parcel.writeTypedArray(nullable_parcel_array, 0);
_aidl_parcel.writeTypedList(parcel_list);
diff --git a/tests/golden_output/aidl-test-interface-java-source/gen/android/aidl/tests/ParcelableForToString.java b/tests/golden_output/aidl-test-interface-java-source/gen/android/aidl/tests/ParcelableForToString.java
index 9c1bb13..bd5ef0d 100644
--- a/tests/golden_output/aidl-test-interface-java-source/gen/android/aidl/tests/ParcelableForToString.java
+++ b/tests/golden_output/aidl-test-interface-java-source/gen/android/aidl/tests/ParcelableForToString.java
@@ -53,37 +53,19 @@
_aidl_parcel.writeFloatArray(floatArray);
_aidl_parcel.writeByte(byteValue);
_aidl_parcel.writeByteArray(byteArray);
- _aidl_parcel.writeInt(((booleanValue)?(1):(0)));
+ _aidl_parcel.writeBoolean(booleanValue);
_aidl_parcel.writeBooleanArray(booleanArray);
_aidl_parcel.writeString(stringValue);
_aidl_parcel.writeStringArray(stringArray);
_aidl_parcel.writeStringList(stringList);
- if ((parcelableValue!=null)) {
- _aidl_parcel.writeInt(1);
- parcelableValue.writeToParcel(_aidl_parcel, 0);
- }
- else {
- _aidl_parcel.writeInt(0);
- }
+ _aidl_parcel.writeTypedObject(parcelableValue, 0);
_aidl_parcel.writeTypedArray(parcelableArray, 0);
_aidl_parcel.writeInt(enumValue);
_aidl_parcel.writeIntArray(enumArray);
_aidl_parcel.writeStringArray(nullArray);
_aidl_parcel.writeStringList(nullList);
- if ((parcelableGeneric!=null)) {
- _aidl_parcel.writeInt(1);
- parcelableGeneric.writeToParcel(_aidl_parcel, 0);
- }
- else {
- _aidl_parcel.writeInt(0);
- }
- if ((unionValue!=null)) {
- _aidl_parcel.writeInt(1);
- unionValue.writeToParcel(_aidl_parcel, 0);
- }
- else {
- _aidl_parcel.writeInt(0);
- }
+ _aidl_parcel.writeTypedObject(parcelableGeneric, 0);
+ _aidl_parcel.writeTypedObject(unionValue, 0);
int _aidl_end_pos = _aidl_parcel.dataPosition();
_aidl_parcel.setDataPosition(_aidl_start_pos);
_aidl_parcel.writeInt(_aidl_end_pos - _aidl_start_pos);
diff --git a/tests/golden_output/aidl-test-interface-java-source/gen/android/aidl/tests/RecursiveList.java b/tests/golden_output/aidl-test-interface-java-source/gen/android/aidl/tests/RecursiveList.java
index b4bf48b..0de55c4 100644
--- a/tests/golden_output/aidl-test-interface-java-source/gen/android/aidl/tests/RecursiveList.java
+++ b/tests/golden_output/aidl-test-interface-java-source/gen/android/aidl/tests/RecursiveList.java
@@ -23,13 +23,7 @@
int _aidl_start_pos = _aidl_parcel.dataPosition();
_aidl_parcel.writeInt(0);
_aidl_parcel.writeInt(value);
- if ((next!=null)) {
- _aidl_parcel.writeInt(1);
- next.writeToParcel(_aidl_parcel, 0);
- }
- else {
- _aidl_parcel.writeInt(0);
- }
+ _aidl_parcel.writeTypedObject(next, 0);
int _aidl_end_pos = _aidl_parcel.dataPosition();
_aidl_parcel.setDataPosition(_aidl_start_pos);
_aidl_parcel.writeInt(_aidl_end_pos - _aidl_start_pos);
diff --git a/tests/golden_output/aidl-test-interface-java-source/gen/android/aidl/tests/StructuredParcelable.java b/tests/golden_output/aidl-test-interface-java-source/gen/android/aidl/tests/StructuredParcelable.java
index 48cddc5..96bbf4c 100644
--- a/tests/golden_output/aidl-test-interface-java-source/gen/android/aidl/tests/StructuredParcelable.java
+++ b/tests/golden_output/aidl-test-interface-java-source/gen/android/aidl/tests/StructuredParcelable.java
@@ -91,13 +91,13 @@
_aidl_parcel.writeByte(byteDefaultsToFour);
_aidl_parcel.writeInt(intDefaultsToFive);
_aidl_parcel.writeLong(longDefaultsToNegativeSeven);
- _aidl_parcel.writeInt(((booleanDefaultsToTrue)?(1):(0)));
+ _aidl_parcel.writeBoolean(booleanDefaultsToTrue);
_aidl_parcel.writeInt(((int)charDefaultsToC));
_aidl_parcel.writeFloat(floatDefaultsToPi);
_aidl_parcel.writeDouble(doubleWithDefault);
_aidl_parcel.writeIntArray(arrayDefaultsTo123);
_aidl_parcel.writeIntArray(arrayDefaultsToEmpty);
- _aidl_parcel.writeInt(((boolDefault)?(1):(0)));
+ _aidl_parcel.writeBoolean(boolDefault);
_aidl_parcel.writeByte(byteDefault);
_aidl_parcel.writeInt(intDefault);
_aidl_parcel.writeLong(longDefault);
@@ -129,20 +129,8 @@
_aidl_parcel.writeString(addString1);
_aidl_parcel.writeString(addString2);
_aidl_parcel.writeInt(shouldSetBit0AndBit2);
- if ((u!=null)) {
- _aidl_parcel.writeInt(1);
- u.writeToParcel(_aidl_parcel, 0);
- }
- else {
- _aidl_parcel.writeInt(0);
- }
- if ((shouldBeConstS1!=null)) {
- _aidl_parcel.writeInt(1);
- shouldBeConstS1.writeToParcel(_aidl_parcel, 0);
- }
- else {
- _aidl_parcel.writeInt(0);
- }
+ _aidl_parcel.writeTypedObject(u, 0);
+ _aidl_parcel.writeTypedObject(shouldBeConstS1, 0);
_aidl_parcel.writeInt(defaultWithFoo);
int _aidl_end_pos = _aidl_parcel.dataPosition();
_aidl_parcel.setDataPosition(_aidl_start_pos);
diff --git a/tests/golden_output/aidl-test-interface-java-source/gen/android/aidl/tests/UnionWithFd.java b/tests/golden_output/aidl-test-interface-java-source/gen/android/aidl/tests/UnionWithFd.java
index d40983d..8a72489 100644
--- a/tests/golden_output/aidl-test-interface-java-source/gen/android/aidl/tests/UnionWithFd.java
+++ b/tests/golden_output/aidl-test-interface-java-source/gen/android/aidl/tests/UnionWithFd.java
@@ -78,13 +78,7 @@
_aidl_parcel.writeInt(getNum());
break;
case pfd:
- if ((getPfd()!=null)) {
- _aidl_parcel.writeInt(1);
- getPfd().writeToParcel(_aidl_parcel, 0);
- }
- else {
- _aidl_parcel.writeInt(0);
- }
+ _aidl_parcel.writeTypedObject(getPfd(), 0);
break;
}
}
diff --git a/tests/golden_output/aidl-test-interface-java-source/gen/android/aidl/tests/extension/MyExt2.java b/tests/golden_output/aidl-test-interface-java-source/gen/android/aidl/tests/extension/MyExt2.java
index fd0662c..bd8be0b 100644
--- a/tests/golden_output/aidl-test-interface-java-source/gen/android/aidl/tests/extension/MyExt2.java
+++ b/tests/golden_output/aidl-test-interface-java-source/gen/android/aidl/tests/extension/MyExt2.java
@@ -24,13 +24,7 @@
int _aidl_start_pos = _aidl_parcel.dataPosition();
_aidl_parcel.writeInt(0);
_aidl_parcel.writeInt(a);
- if ((b!=null)) {
- _aidl_parcel.writeInt(1);
- b.writeToParcel(_aidl_parcel, 0);
- }
- else {
- _aidl_parcel.writeInt(0);
- }
+ _aidl_parcel.writeTypedObject(b, 0);
_aidl_parcel.writeString(c);
int _aidl_end_pos = _aidl_parcel.dataPosition();
_aidl_parcel.setDataPosition(_aidl_start_pos);
diff --git a/tests/golden_output/aidl-test-interface-java-source/gen/android/aidl/tests/nested/INestedService.java b/tests/golden_output/aidl-test-interface-java-source/gen/android/aidl/tests/nested/INestedService.java
index fce8464..a8cb28b 100644
--- a/tests/golden_output/aidl-test-interface-java-source/gen/android/aidl/tests/nested/INestedService.java
+++ b/tests/golden_output/aidl-test-interface-java-source/gen/android/aidl/tests/nested/INestedService.java
@@ -65,21 +65,10 @@
case TRANSACTION_flipStatus:
{
android.aidl.tests.nested.ParcelableWithNested _arg0;
- if ((0!=data.readInt())) {
- _arg0 = android.aidl.tests.nested.ParcelableWithNested.CREATOR.createFromParcel(data);
- }
- else {
- _arg0 = null;
- }
+ _arg0 = data.readTypedObject(android.aidl.tests.nested.ParcelableWithNested.CREATOR);
android.aidl.tests.nested.INestedService.Result _result = this.flipStatus(_arg0);
reply.writeNoException();
- if ((_result!=null)) {
- reply.writeInt(1);
- _result.writeToParcel(reply, android.os.Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
- }
- else {
- reply.writeInt(0);
- }
+ reply.writeTypedObject(_result, android.os.Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
break;
}
case TRANSACTION_flipStatusWithCallback:
@@ -121,13 +110,7 @@
android.aidl.tests.nested.INestedService.Result _result;
try {
_data.writeInterfaceToken(DESCRIPTOR);
- if ((p!=null)) {
- _data.writeInt(1);
- p.writeToParcel(_data, 0);
- }
- else {
- _data.writeInt(0);
- }
+ _data.writeTypedObject(p, 0);
boolean _status = mRemote.transact(Stub.TRANSACTION_flipStatus, _data, _reply, 0);
if (!_status) {
if (getDefaultImpl() != null) {
@@ -155,7 +138,7 @@
try {
_data.writeInterfaceToken(DESCRIPTOR);
_data.writeByte(status);
- _data.writeStrongBinder((((cb!=null))?(cb.asBinder()):(null)));
+ _data.writeStrongInterface(cb);
boolean _status = mRemote.transact(Stub.TRANSACTION_flipStatusWithCallback, _data, _reply, 0);
if (!_status) {
if (getDefaultImpl() != null) {
diff --git a/tests/golden_output/aidl-test-interface-java-source/gen/android/aidl/tests/unions/UnionInUnion.java b/tests/golden_output/aidl-test-interface-java-source/gen/android/aidl/tests/unions/UnionInUnion.java
index 9194f58..bef06d7 100644
--- a/tests/golden_output/aidl-test-interface-java-source/gen/android/aidl/tests/unions/UnionInUnion.java
+++ b/tests/golden_output/aidl-test-interface-java-source/gen/android/aidl/tests/unions/UnionInUnion.java
@@ -75,13 +75,7 @@
_aidl_parcel.writeInt(_tag);
switch (_tag) {
case first:
- if ((getFirst()!=null)) {
- _aidl_parcel.writeInt(1);
- getFirst().writeToParcel(_aidl_parcel, 0);
- }
- else {
- _aidl_parcel.writeInt(0);
- }
+ _aidl_parcel.writeTypedObject(getFirst(), 0);
break;
case second:
_aidl_parcel.writeInt(getSecond());
diff --git a/tests/golden_output/aidl_test_loggable_interface-java-source/gen/android/aidl/loggable/Data.java b/tests/golden_output/aidl_test_loggable_interface-java-source/gen/android/aidl/loggable/Data.java
index 4e1ebfd..698b281 100644
--- a/tests/golden_output/aidl_test_loggable_interface-java-source/gen/android/aidl/loggable/Data.java
+++ b/tests/golden_output/aidl_test_loggable_interface-java-source/gen/android/aidl/loggable/Data.java
@@ -26,13 +26,7 @@
_aidl_parcel.writeInt(0);
_aidl_parcel.writeInt(num);
_aidl_parcel.writeString(str);
- if ((nestedUnion!=null)) {
- _aidl_parcel.writeInt(1);
- nestedUnion.writeToParcel(_aidl_parcel, 0);
- }
- else {
- _aidl_parcel.writeInt(0);
- }
+ _aidl_parcel.writeTypedObject(nestedUnion, 0);
_aidl_parcel.writeByte(nestedEnum);
int _aidl_end_pos = _aidl_parcel.dataPosition();
_aidl_parcel.setDataPosition(_aidl_start_pos);
diff --git a/tests/golden_output/aidl_test_loggable_interface-java-source/gen/android/aidl/loggable/ILoggableInterface.java b/tests/golden_output/aidl_test_loggable_interface-java-source/gen/android/aidl/loggable/ILoggableInterface.java
index 9927faf..373c8cd 100644
--- a/tests/golden_output/aidl_test_loggable_interface-java-source/gen/android/aidl/loggable/ILoggableInterface.java
+++ b/tests/golden_output/aidl_test_loggable_interface-java-source/gen/android/aidl/loggable/ILoggableInterface.java
@@ -64,7 +64,7 @@
try {
android.os.Trace.traceBegin(android.os.Trace.TRACE_TAG_AIDL, "AIDL::java::ILoggableInterface::LogThis::server");
boolean _arg0;
- _arg0 = (0!=data.readInt());
+ _arg0 = data.readBoolean();
boolean[] _arg1;
_arg1 = data.createBooleanArray();
byte _arg2;
@@ -98,21 +98,11 @@
java.util.List<java.lang.String> _arg16;
_arg16 = data.createStringArrayList();
android.aidl.loggable.Data _arg17;
- if ((0!=data.readInt())) {
- _arg17 = android.aidl.loggable.Data.CREATOR.createFromParcel(data);
- }
- else {
- _arg17 = null;
- }
+ _arg17 = data.readTypedObject(android.aidl.loggable.Data.CREATOR);
android.os.IBinder _arg18;
_arg18 = data.readStrongBinder();
android.os.ParcelFileDescriptor _arg19;
- if ((0!=data.readInt())) {
- _arg19 = android.os.ParcelFileDescriptor.CREATOR.createFromParcel(data);
- }
- else {
- _arg19 = null;
- }
+ _arg19 = data.readTypedObject(android.os.ParcelFileDescriptor.CREATOR);
android.os.ParcelFileDescriptor[] _arg20;
_arg20 = data.createTypedArray(android.os.ParcelFileDescriptor.CREATOR);
java.lang.String[] _result = this.LogThis(_arg0, _arg1, _arg2, _arg3, _arg4, _arg5, _arg6, _arg7, _arg8, _arg9, _arg10, _arg11, _arg12, _arg13, _arg14, _arg15, _arg16, _arg17, _arg18, _arg19, _arg20);
@@ -127,13 +117,7 @@
reply.writeDoubleArray(_arg13);
reply.writeStringArray(_arg15);
reply.writeStringList(_arg16);
- if ((_arg19!=null)) {
- reply.writeInt(1);
- _arg19.writeToParcel(reply, android.os.Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
- }
- else {
- reply.writeInt(0);
- }
+ reply.writeTypedObject(_arg19, android.os.Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
reply.writeTypedArray(_arg20, android.os.Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
}
finally {
@@ -171,7 +155,7 @@
try {
android.os.Trace.traceBegin(android.os.Trace.TRACE_TAG_AIDL, "AIDL::java::ILoggableInterface::LogThis::client");
_data.writeInterfaceToken(DESCRIPTOR);
- _data.writeInt(((boolValue)?(1):(0)));
+ _data.writeBoolean(boolValue);
_data.writeBooleanArray(boolArray);
_data.writeByte(byteValue);
_data.writeByteArray(byteArray);
@@ -188,21 +172,9 @@
_data.writeString(stringValue);
_data.writeStringArray(stringArray);
_data.writeStringList(listValue);
- if ((dataValue!=null)) {
- _data.writeInt(1);
- dataValue.writeToParcel(_data, 0);
- }
- else {
- _data.writeInt(0);
- }
+ _data.writeTypedObject(dataValue, 0);
_data.writeStrongBinder(binderValue);
- if ((pfdValue!=null)) {
- _data.writeInt(1);
- pfdValue.writeToParcel(_data, 0);
- }
- else {
- _data.writeInt(0);
- }
+ _data.writeTypedObject(pfdValue, 0);
_data.writeTypedArray(pfdArray, 0);
boolean _status = mRemote.transact(Stub.TRANSACTION_LogThis, _data, _reply, 0);
if (!_status) {