Revert "Revert "Add a way to turn off unique_fd's operator int.""
The original commit broke aosp-master-with-phones, because of
vendor libraries the depended on the int versions of libbase functions.
This patch reverts the revert, and also adds ABI-compatibility shims for
the replaced functions.
This reverts commit 2c58e1924a7bf1b44049764fddb40c1704dc288f.
Bug: http://b/131312539
Test: treehugger
Test: forrest run of aosp-master-with-phones
Change-Id: I75cc84ec8d963e20862f7662e8e2f409471f41cc
diff --git a/adb/shell_protocol.h b/adb/shell_protocol.h
index 2c82689..4aab813 100644
--- a/adb/shell_protocol.h
+++ b/adb/shell_protocol.h
@@ -21,6 +21,7 @@
#include <android-base/macros.h>
#include "adb.h"
+#include "adb_unique_fd.h"
// Class to send and receive shell protocol packets.
//
@@ -60,7 +61,7 @@
// should be dynamically allocated on the heap instead.
//
// |fd| is an open file descriptor to be used to send or receive packets.
- explicit ShellProtocol(int fd);
+ explicit ShellProtocol(borrowed_fd fd);
virtual ~ShellProtocol();
// Returns a pointer to the data buffer.
@@ -103,7 +104,7 @@
kHeaderSize = sizeof(Id) + sizeof(length_t)
};
- int fd_;
+ borrowed_fd fd_;
char buffer_[kBufferSize];
size_t data_length_ = 0, bytes_left_ = 0;