diff options
| author | 2020-10-05 20:02:32 +0000 | |
|---|---|---|
| committer | 2020-10-05 20:02:32 +0000 | |
| commit | bf6faacc4cb6d816f195a42f1b2859970a804bbc (patch) | |
| tree | c94fa5b252137c4f6b4b260eeaa087cb5a013530 | |
| parent | 1888cfce092b530d0bad89faed7b1480f7a74430 (diff) | |
| parent | 944c37817d1157be0bd1d5017dfce1280ee58bcb (diff) | |
Merge "libbinder: writeInterfaceToken char16_t* variant" am: d0f1f1e365 am: 944c37817d
Original change: https://android-review.googlesource.com/c/platform/frameworks/native/+/1444735
Change-Id: I5e33c49e6f8b3d8e9d382675e37e9ee83061d6e3
| -rw-r--r-- | libs/binder/Parcel.cpp | 7 | ||||
| -rw-r--r-- | libs/binder/include/binder/Parcel.h | 1 |
2 files changed, 7 insertions, 1 deletions
diff --git a/libs/binder/Parcel.cpp b/libs/binder/Parcel.cpp index 19f3606bfa..a9c19b3d86 100644 --- a/libs/binder/Parcel.cpp +++ b/libs/binder/Parcel.cpp @@ -527,14 +527,19 @@ constexpr int32_t kHeader = B_PACK_CHARS('S', 'Y', 'S', 'T'); // Write RPC headers. (previously just the interface token) status_t Parcel::writeInterfaceToken(const String16& interface) { + return writeInterfaceToken(interface.string(), interface.size()); +} + +status_t Parcel::writeInterfaceToken(const char16_t* str, size_t len) { const IPCThreadState* threadState = IPCThreadState::self(); writeInt32(threadState->getStrictModePolicy() | STRICT_MODE_PENALTY_GATHER); updateWorkSourceRequestHeaderPosition(); writeInt32(threadState->shouldPropagateWorkSource() ? threadState->getCallingWorkSourceUid() : IPCThreadState::kUnsetWorkSource); writeInt32(kHeader); + // currently the interface identification token is just its name as a string - return writeString16(interface); + return writeString16(str, len); } bool Parcel::replaceCallingWorkSourceUid(uid_t uid) diff --git a/libs/binder/include/binder/Parcel.h b/libs/binder/include/binder/Parcel.h index b6cfb8ec0f..fbfd6c5d71 100644 --- a/libs/binder/include/binder/Parcel.h +++ b/libs/binder/include/binder/Parcel.h @@ -86,6 +86,7 @@ public: // Writes the RPC header. status_t writeInterfaceToken(const String16& interface); + status_t writeInterfaceToken(const char16_t* str, size_t len); // Parses the RPC header, returning true if the interface name // in the header matches the expected interface from the caller. |