Merge "IpSec - API Tweak for removeTransportModeTransform" am: 6725ff729b am: d58b237445

am: a2411eb8ee

Change-Id: I479c24d9ac5d4b022ec6310395fdb4274cfd5598
This commit is contained in:
nharold
2018-01-17 20:50:14 +00:00
committed by android-build-merger
3 changed files with 15 additions and 21 deletions

View File

@@ -45,5 +45,5 @@ interface IIpSecService
void applyTransportModeTransform(in ParcelFileDescriptor socket, int direction, int transformId); void applyTransportModeTransform(in ParcelFileDescriptor socket, int direction, int transformId);
void removeTransportModeTransforms(in ParcelFileDescriptor socket, int transformId); void removeTransportModeTransforms(in ParcelFileDescriptor socket);
} }

View File

@@ -405,62 +405,56 @@ public final class IpSecManager {
/** /**
* Remove an IPsec transform from a stream socket. * Remove an IPsec transform from a stream socket.
* *
* <p>Once removed, traffic on the socket will not be encrypted. This operation will succeed * <p>Once removed, traffic on the socket will not be encrypted. Removing transforms from a
* regardless of the state of the transform. Removing a transform from a socket allows the * socket allows the socket to be reused for communication in the clear.
* socket to be reused for communication in the clear.
* *
* <p>If an {@code IpSecTransform} object applied to this socket was deallocated by calling * <p>If an {@code IpSecTransform} object applied to this socket was deallocated by calling
* {@link IpSecTransform#close()}, then communication on the socket will fail until this method * {@link IpSecTransform#close()}, then communication on the socket will fail until this method
* is called. * is called.
* *
* @param socket a socket that previously had a transform applied to it * @param socket a socket that previously had a transform applied to it
* @param transform the IPsec Transform that was previously applied to the given socket
* @throws IOException indicating that the transform could not be removed from the socket * @throws IOException indicating that the transform could not be removed from the socket
*/ */
public void removeTransportModeTransforms(Socket socket, IpSecTransform transform) public void removeTransportModeTransforms(Socket socket)
throws IOException { throws IOException {
removeTransportModeTransforms(socket.getFileDescriptor$(), transform); removeTransportModeTransforms(socket.getFileDescriptor$());
} }
/** /**
* Remove an IPsec transform from a datagram socket. * Remove an IPsec transform from a datagram socket.
* *
* <p>Once removed, traffic on the socket will not be encrypted. This operation will succeed * <p>Once removed, traffic on the socket will not be encrypted. Removing transforms from a
* regardless of the state of the transform. Removing a transform from a socket allows the * socket allows the socket to be reused for communication in the clear.
* socket to be reused for communication in the clear.
* *
* <p>If an {@code IpSecTransform} object applied to this socket was deallocated by calling * <p>If an {@code IpSecTransform} object applied to this socket was deallocated by calling
* {@link IpSecTransform#close()}, then communication on the socket will fail until this method * {@link IpSecTransform#close()}, then communication on the socket will fail until this method
* is called. * is called.
* *
* @param socket a socket that previously had a transform applied to it * @param socket a socket that previously had a transform applied to it
* @param transform the IPsec Transform that was previously applied to the given socket
* @throws IOException indicating that the transform could not be removed from the socket * @throws IOException indicating that the transform could not be removed from the socket
*/ */
public void removeTransportModeTransforms(DatagramSocket socket, IpSecTransform transform) public void removeTransportModeTransforms(DatagramSocket socket)
throws IOException { throws IOException {
removeTransportModeTransforms(socket.getFileDescriptor$(), transform); removeTransportModeTransforms(socket.getFileDescriptor$());
} }
/** /**
* Remove an IPsec transform from a socket. * Remove an IPsec transform from a socket.
* *
* <p>Once removed, traffic on the socket will not be encrypted. This operation will succeed * <p>Once removed, traffic on the socket will not be encrypted. Removing transforms from a
* regardless of the state of the transform. Removing a transform from a socket allows the * socket allows the socket to be reused for communication in the clear.
* socket to be reused for communication in the clear.
* *
* <p>If an {@code IpSecTransform} object applied to this socket was deallocated by calling * <p>If an {@code IpSecTransform} object applied to this socket was deallocated by calling
* {@link IpSecTransform#close()}, then communication on the socket will fail until this method * {@link IpSecTransform#close()}, then communication on the socket will fail until this method
* is called. * is called.
* *
* @param socket a socket that previously had a transform applied to it * @param socket a socket that previously had a transform applied to it
* @param transform the IPsec Transform that was previously applied to the given socket
* @throws IOException indicating that the transform could not be removed from the socket * @throws IOException indicating that the transform could not be removed from the socket
*/ */
public void removeTransportModeTransforms(FileDescriptor socket, IpSecTransform transform) public void removeTransportModeTransforms(FileDescriptor socket)
throws IOException { throws IOException {
try (ParcelFileDescriptor pfd = ParcelFileDescriptor.dup(socket)) { try (ParcelFileDescriptor pfd = ParcelFileDescriptor.dup(socket)) {
mService.removeTransportModeTransforms(pfd, transform.getResourceId()); mService.removeTransportModeTransforms(pfd);
} catch (RemoteException e) { } catch (RemoteException e) {
throw e.rethrowFromSystemServer(); throw e.rethrowFromSystemServer();
} }

View File

@@ -1235,8 +1235,8 @@ public class IpSecService extends IIpSecService.Stub {
* reserved for future improved input validation. * reserved for future improved input validation.
*/ */
@Override @Override
public synchronized void removeTransportModeTransforms( public synchronized void removeTransportModeTransforms(ParcelFileDescriptor socket)
ParcelFileDescriptor socket, int resourceId) throws RemoteException { throws RemoteException {
try { try {
mSrvConfig mSrvConfig
.getNetdInstance() .getNetdInstance()