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/RpcState.cpp b/libs/binder/RpcState.cpp
index aa26b91..26a2f4f 100644
--- a/libs/binder/RpcState.cpp
+++ b/libs/binder/RpcState.cpp
@@ -19,8 +19,8 @@
#include "RpcState.h"
#include <android-base/macros.h>
+#include <android-base/scopeguard.h>
#include <binder/BpBinder.h>
-#include <binder/Functional.h>
#include <binder/IPCThreadState.h>
#include <binder/RpcServer.h>
@@ -39,8 +39,6 @@
namespace android {
-using namespace android::binder::impl;
-
#if RPC_FLAKE_PRONE
void rpcMaybeWaitToFlake() {
[[clang::no_destroy]] static std::random_device r;
@@ -813,11 +811,11 @@
origGuard = kernelBinderState->pushGetCallingSpGuard(&spGuard);
}
- auto guardUnguard = make_scope_guard([&]() {
+ base::ScopeGuard guardUnguard = [&]() {
if (kernelBinderState != nullptr) {
kernelBinderState->restoreGetCallingSpGuard(origGuard);
}
- });
+ };
#endif // BINDER_WITH_KERNEL_IPC
switch (command.command) {