Revert "Use std::unique_ptr instead of ScopeGuard"
Revert submission 2780893
Reason for revert: breaking boot tests
Bug: 308214260
Reverted changes: /q/submissionid:2780893
Change-Id: I7a4ee9a45583a8a1d4a33447de55c63e6ce9d42a
diff --git a/libs/binder/RpcSession.cpp b/libs/binder/RpcSession.cpp
index 524b54c..fa8f2b5 100644
--- a/libs/binder/RpcSession.cpp
+++ b/libs/binder/RpcSession.cpp
@@ -27,8 +27,8 @@
#include <string_view>
#include <android-base/macros.h>
+#include <android-base/scopeguard.h>
#include <binder/BpBinder.h>
-#include <binder/Functional.h>
#include <binder/Parcel.h>
#include <binder/RpcServer.h>
#include <binder/RpcTransportRaw.h>
@@ -52,7 +52,6 @@
namespace android {
-using namespace android::binder::impl;
using base::unique_fd;
RpcSession::RpcSession(std::unique_ptr<RpcTransportCtx> ctx) : mCtx(std::move(ctx)) {
@@ -498,7 +497,7 @@
if (auto status = initShutdownTrigger(); status != OK) return status;
auto oldProtocolVersion = mProtocolVersion;
- auto cleanup = make_scope_guard([&] {
+ auto cleanup = base::ScopeGuard([&] {
// if any threads are started, shut them down
(void)shutdownAndWait(true);
@@ -578,7 +577,7 @@
if (status_t status = connectAndInit(mId, true /*incoming*/); status != OK) return status;
}
- cleanup.release();
+ cleanup.Disable();
return OK;
}