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

Commit 8244a8b3 authored by Steven Moreland's avatar Steven Moreland Committed by Cherrypicker Worker
Browse files

libbinder_ndk: ScopedAStatus ostream<<

For developer convenience.

Bug: N/A
Test: binderVendorDoubleLoadTest
Change-Id: I3ca6c67a30682d53dc4767695f19436e5ef992c3
(cherry picked from commit 9afdc0f1)
Merged-In: I3ca6c67a30682d53dc4767695f19436e5ef992c3
parent 662365a8
Loading
Loading
Loading
Loading
+7 −2
Original line number Original line Diff line number Diff line
@@ -30,11 +30,11 @@
#include <android/binder_internal_logging.h>
#include <android/binder_internal_logging.h>
#include <android/binder_parcel.h>
#include <android/binder_parcel.h>
#include <android/binder_status.h>
#include <android/binder_status.h>

#include <assert.h>
#include <assert.h>

#include <unistd.h>
#include <unistd.h>

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


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