diff options
author | Android Build Coastguard Worker <android-build-coastguard-worker@google.com> | 2024-04-09 23:21:31 +0000 |
---|---|---|
committer | Android Build Coastguard Worker <android-build-coastguard-worker@google.com> | 2024-04-09 23:21:31 +0000 |
commit | 244787f61c033dd8b5710873cc4e027d92a717c8 (patch) | |
tree | 3516d34bf340b273d89ef72cd6a7ecda713697ab | |
parent | 46df037e15c1ee65afc7a9f2d7fbdeb1bf67769a (diff) | |
parent | b1e80e259a89e48487b712f0098661a09869b787 (diff) | |
download | dittosuite-244787f61c033dd8b5710873cc4e027d92a717c8.tar.gz |
Snap for 11692525 from b1e80e259a89e48487b712f0098661a09869b787 to sdk-release
Change-Id: I7fb8d52c048355d4bf4c5e7f1d8661358fce4cf1
-rw-r--r-- | example/android/binder_nested_parcel.ditto | 28 | ||||
-rw-r--r-- | schema/benchmark.proto | 12 | ||||
-rw-r--r-- | src/binder_request.cpp | 17 |
3 files changed, 54 insertions, 3 deletions
diff --git a/example/android/binder_nested_parcel.ditto b/example/android/binder_nested_parcel.ditto new file mode 100644 index 0000000..6541eeb --- /dev/null +++ b/example/android/binder_nested_parcel.ditto @@ -0,0 +1,28 @@ +main: { + binder_request: { + generic_service: { + name: "package", + # getServiceInfo + code: 14, + # component + parcel_input: [{ + type: PARCEL, + nested_parcel : { + parcel_inputs: [ + # package name + { + type: STRING_16, + data: "com.google.android.apps.wallpaper" + }, + # class name + { + type: STRING_16, + data: "com.google.android.apps.wallpaper.backdrop.BackdropRotationTask" + } + ] + } + }] + }, + } +}, +global {}
\ No newline at end of file diff --git a/schema/benchmark.proto b/schema/benchmark.proto index 166b7f8..a17ec4d 100644 --- a/schema/benchmark.proto +++ b/schema/benchmark.proto @@ -41,6 +41,9 @@ message BinderRequest { }; message GenericService { message ParcelInput { + message NestedParcel { + repeated ParcelInput parcel_inputs = 1; + } enum Type { // Write the 32-bit integer into the send parcel. I32 = 0; @@ -58,17 +61,20 @@ message BinderRequest { // Write a file descriptor for the file with given path into the send // parcel. FD_PATH = 6; - // Data: FD number - // Write the file descriptor into the send parcel. - FD = 8; // Data: File name // Write an ashmem file descriptor for a region containing the data // from file the given path into the send parcel. ASHMEM_FD_PATH = 7; + // Data: FD number + // Write the file descriptor into the send parcel. + FD = 8; + // Parcel input that is nested inside. + PARCEL = 9; } optional Type type = 1; oneof data_oneof { string data = 2; + NestedParcel nested_parcel = 3; } } optional string name = 1; diff --git a/src/binder_request.cpp b/src/binder_request.cpp index 321c926..37c4f27 100644 --- a/src/binder_request.cpp +++ b/src/binder_request.cpp @@ -181,6 +181,23 @@ int ParseParcelString(const google::protobuf::RepeatedPtrField } break; } + case dittosuiteproto::BinderRequest_GenericService_ParcelInput_Type_PARCEL: { + int res = 0; + auto inputs = it.nested_parcel().parcel_inputs(); + if (inputs.size() == 0) { + // Null parcelable flag. + res = parcel.writeInt32(0); + } else { + // Non-Null parcelable flag. + res = parcel.writeInt32(1); + if (res < 0) return res; + res = ParseParcelString(it.nested_parcel().parcel_inputs(), parcel); + } + if (res < 0) { + return res; + } + break; + } default: break; } |