libbinder: disable implicit unique_fd get
Considered dangerous, since we will be using more unique_fd here soon.
Bug: N/A
Test: build
Change-Id: I35dcbb889527cdbfd16e7feb9c2611fe3cb11f68
diff --git a/libs/binder/Android.bp b/libs/binder/Android.bp
index e0d5378..45e9775 100644
--- a/libs/binder/Android.bp
+++ b/libs/binder/Android.bp
@@ -146,6 +146,7 @@
"-Wextra",
"-Werror",
"-Wzero-as-null-pointer-constant",
+ "-DANDROID_BASE_UNIQUE_FD_DISABLE_IMPLICIT_CONVERSION",
],
product_variables: {
binder32bit: {
diff --git a/libs/binder/include/binder/ParcelFileDescriptor.h b/libs/binder/include/binder/ParcelFileDescriptor.h
index 71e1d3c..fdd5397 100644
--- a/libs/binder/include/binder/ParcelFileDescriptor.h
+++ b/libs/binder/include/binder/ParcelFileDescriptor.h
@@ -44,22 +44,22 @@
android::status_t readFromParcel(const android::Parcel* parcel) override;
inline bool operator!=(const ParcelFileDescriptor& rhs) const {
- return mFd != rhs.mFd;
+ return mFd.get() != rhs.mFd.get();
}
inline bool operator<(const ParcelFileDescriptor& rhs) const {
- return mFd < rhs.mFd;
+ return mFd.get() < rhs.mFd.get();
}
inline bool operator<=(const ParcelFileDescriptor& rhs) const {
- return mFd <= rhs.mFd;
+ return mFd.get() <= rhs.mFd.get();
}
inline bool operator==(const ParcelFileDescriptor& rhs) const {
- return mFd == rhs.mFd;
+ return mFd.get() == rhs.mFd.get();
}
inline bool operator>(const ParcelFileDescriptor& rhs) const {
- return mFd > rhs.mFd;
+ return mFd.get() > rhs.mFd.get();
}
inline bool operator>=(const ParcelFileDescriptor& rhs) const {
- return mFd >= rhs.mFd;
+ return mFd.get() >= rhs.mFd.get();
}
private:
android::base::unique_fd mFd;