Revert "Expose correct FileDescriptor in DatagramSocketAdaptor"
This reverts commit 60692ecdd181104a05e9f9d0a789c7bf1734f4f2.
Bug: 26292854
Change-Id: Ic7b5c04be44bd0a2706bb614deb6f2c23592a588
diff --git a/luni/src/test/java/libcore/java/nio/channels/DatagramChannelTest.java b/luni/src/test/java/libcore/java/nio/channels/DatagramChannelTest.java
index ef73a4f..efcfece 100644
--- a/luni/src/test/java/libcore/java/nio/channels/DatagramChannelTest.java
+++ b/luni/src/test/java/libcore/java/nio/channels/DatagramChannelTest.java
@@ -153,13 +153,6 @@
dc.close();
}
- // http://b/26292854
- public void test_getFileDescriptor() throws Exception {
- DatagramSocket socket = DatagramChannel.open().socket();
- socket.getReuseAddress();
- assertNotNull(socket.getFileDescriptor$());
- }
-
private static InetAddress getNonLoopbackNetworkInterfaceAddress(boolean ipv4) throws IOException {
Enumeration<NetworkInterface> networkInterfaces = NetworkInterface.getNetworkInterfaces();
while (networkInterfaces.hasMoreElements()) {
diff --git a/ojluni/src/main/java/java/net/DatagramSocket.java b/ojluni/src/main/java/java/net/DatagramSocket.java
index 9d5da0b..8ce4da8 100755
--- a/ojluni/src/main/java/java/net/DatagramSocket.java
+++ b/ojluni/src/main/java/java/net/DatagramSocket.java
@@ -1292,7 +1292,7 @@
}
/* @hide */
- public FileDescriptor getFileDescriptor$() {
+ public final FileDescriptor getFileDescriptor$() {
return impl.fd;
}
diff --git a/ojluni/src/main/java/sun/nio/ch/DatagramChannelImpl.java b/ojluni/src/main/java/sun/nio/ch/DatagramChannelImpl.java
index e4d24a5..9715df8 100755
--- a/ojluni/src/main/java/sun/nio/ch/DatagramChannelImpl.java
+++ b/ojluni/src/main/java/sun/nio/ch/DatagramChannelImpl.java
@@ -51,8 +51,7 @@
private static NativeDispatcher nd = new DatagramDispatcher();
// Our file descriptor
- // Android-changed: Make the fd package visible so that we can expose it through DatagramSocketAdaptor.
- final FileDescriptor fd;
+ private final FileDescriptor fd;
// fd value needed for dev/poll. This value will remain valid
// even after the value in the file descriptor object has been set to -1
diff --git a/ojluni/src/main/java/sun/nio/ch/DatagramSocketAdaptor.java b/ojluni/src/main/java/sun/nio/ch/DatagramSocketAdaptor.java
index 1abacbd..7efdb8f 100755
--- a/ojluni/src/main/java/sun/nio/ch/DatagramSocketAdaptor.java
+++ b/ojluni/src/main/java/sun/nio/ch/DatagramSocketAdaptor.java
@@ -370,12 +370,6 @@
return dc;
}
- /* @hide */
- @Override
- public final FileDescriptor getFileDescriptor$() {
- return dc.fd;
- }
-
/*
* A dummy implementation of DatagramSocketImpl that can be passed to the
* DatagramSocket constructor so that no native resources are allocated in