Use ParcelFileDescriptor instead of FileDescriptor in INetd.aidl
Stable aidl won't support FileDescriptor but ParcelFileDescriptor.
In order to migrate to stable aidl, replace all FileDescriptor in
INdetd.aidl.
Test: built, flashed, booted
system/netd/tests/runtests.sh passes
Change-Id: I331626346959f127b4c1cb2ece33db37cb8dc550
diff --git a/server/NetdNativeService.cpp b/server/NetdNativeService.cpp
index 3e153ec..fdf55b4 100644
--- a/server/NetdNativeService.cpp
+++ b/server/NetdNativeService.cpp
@@ -50,6 +50,7 @@
using android::base::StringPrintf;
using android::net::TetherStatsParcel;
using android::net::UidRangeParcel;
+using android::os::ParcelFileDescriptor;
namespace android {
namespace net {
@@ -738,13 +739,14 @@
: binder::Status::fromExceptionCode(binder::Status::EX_ILLEGAL_ARGUMENT);
}
-binder::Status NetdNativeService::ipSecSetEncapSocketOwner(const android::base::unique_fd& socket,
- int newUid) {
+binder::Status NetdNativeService::ipSecSetEncapSocketOwner(const ParcelFileDescriptor& socket,
+ int newUid) {
ENFORCE_PERMISSION(NETWORK_STACK)
gLog.log("ipSecSetEncapSocketOwner()");
uid_t callerUid = IPCThreadState::self()->getCallingUid();
- return asBinderStatus(gCtls->xfrmCtrl.ipSecSetEncapSocketOwner(socket, newUid, callerUid));
+ return asBinderStatus(
+ gCtls->xfrmCtrl.ipSecSetEncapSocketOwner(socket.get(), newUid, callerUid));
}
binder::Status NetdNativeService::ipSecAllocateSpi(
@@ -794,31 +796,21 @@
}
binder::Status NetdNativeService::ipSecApplyTransportModeTransform(
- const android::base::unique_fd& socket,
- int32_t transformId,
- int32_t direction,
- const std::string& sourceAddress,
- const std::string& destinationAddress,
- int32_t spi) {
+ const ParcelFileDescriptor& socket, int32_t transformId, int32_t direction,
+ const std::string& sourceAddress, const std::string& destinationAddress, int32_t spi) {
// Necessary locking done in IpSecService and kernel
ENFORCE_PERMISSION(CONNECTIVITY_INTERNAL);
gLog.log("ipSecApplyTransportModeTransform()");
return asBinderStatus(gCtls->xfrmCtrl.ipSecApplyTransportModeTransform(
- socket,
- transformId,
- direction,
- sourceAddress,
- destinationAddress,
- spi));
+ socket.get(), transformId, direction, sourceAddress, destinationAddress, spi));
}
binder::Status NetdNativeService::ipSecRemoveTransportModeTransform(
- const android::base::unique_fd& socket) {
+ const ParcelFileDescriptor& socket) {
// Necessary locking done in IpSecService and kernel
ENFORCE_PERMISSION(CONNECTIVITY_INTERNAL);
gLog.log("ipSecRemoveTransportModeTransform()");
- return asBinderStatus(gCtls->xfrmCtrl.ipSecRemoveTransportModeTransform(
- socket));
+ return asBinderStatus(gCtls->xfrmCtrl.ipSecRemoveTransportModeTransform(socket.get()));
}
binder::Status NetdNativeService::ipSecAddSecurityPolicy(int32_t transformId, int32_t selAddrFamily,