Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 944c3781 authored by Steven Moreland's avatar Steven Moreland Committed by Automerger Merge Worker
Browse files

Merge "libbinder: writeInterfaceToken char16_t* variant" am: d0f1f1e3

Original change: https://android-review.googlesource.com/c/platform/frameworks/native/+/1444735

Change-Id: Iae158c1beab46e8cbbf7308204988847dc616ca9
parents c5457479 d0f1f1e3
Loading
Loading
Loading
Loading
+6 −1
Original line number Diff line number Diff line
@@ -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)
+1 −0
Original line number Diff line number Diff line
@@ -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.