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

Commit 9afdc0f1 authored by Steven Moreland's avatar Steven Moreland
Browse files

libbinder_ndk: ScopedAStatus ostream<<

For developer convenience.

Bug: N/A
Test: binderVendorDoubleLoadTest
Change-Id: I3ca6c67a30682d53dc4767695f19436e5ef992c3
parent 9302d381
Loading
Loading
Loading
Loading
+7 −2
Original line number Diff line number Diff line
@@ -30,11 +30,11 @@
#include <android/binder_internal_logging.h>
#include <android/binder_parcel.h>
#include <android/binder_status.h>

#include <assert.h>

#include <unistd.h>

#include <cstddef>
#include <iostream>
#include <string>

namespace ndk {
@@ -315,6 +315,11 @@ class ScopedAStatus : public impl::ScopedAResource<AStatus*, AStatus_delete, nul
    }
};

static inline std::ostream& operator<<(std::ostream& os, const ScopedAStatus& status) {
    return os << status.getDescription();
    return os;
}

/**
 * Convenience wrapper. See AIBinder_DeathRecipient.
 */
+1 −1
Original line number Diff line number Diff line
@@ -106,7 +106,7 @@ TEST(DoubleBinder, CallIntoNdk) {
        std::string outString;
        ScopedAStatus status = server->RepeatString("foo", &outString);
        EXPECT_EQ(STATUS_OK, AStatus_getExceptionCode(status.get()))
                << serviceName << " " << status.getDescription();
                << serviceName << " " << status;
        EXPECT_EQ("foo", outString) << serviceName;
    }
}