Add AStatus to libbinder_ndk.
This object encapsulates the way that Java AIDL (the SDK) Statuses work
by wrapping the C++ Status class which also encapsulates this.
Test: runtests.sh
Bug: 111445392
Change-Id: I6cc9bd20cf4f83f49d1a546ae7b1e10734fc6535
diff --git a/libs/binder/ndk/status_internal.h b/libs/binder/ndk/status_internal.h
index 41b124c..8c32baf 100644
--- a/libs/binder/ndk/status_internal.h
+++ b/libs/binder/ndk/status_internal.h
@@ -21,6 +21,17 @@
#include <binder/Status.h>
#include <utils/Errors.h>
+struct AStatus {
+ AStatus() {} // ok
+ AStatus(::android::binder::Status&& status) : mStatus(std::move(status)) {}
+
+ ::android::binder::Status* get() { return &mStatus; }
+ const ::android::binder::Status* get() const { return &mStatus; }
+
+private:
+ ::android::binder::Status mStatus;
+};
+
// This collapses the statuses into the declared range.
binder_status_t PruneStatusT(android::status_t status);