diff options
author | Chia-chi Yeh <chiachi@android.com> | 2011-05-23 17:26:46 -0700 |
---|---|---|
committer | Chia-chi Yeh <chiachi@android.com> | 2011-06-08 14:16:42 -0700 |
commit | ff3bdca31f4cf2bd607519b276dd175763aa1784 (patch) | |
tree | 61bea91f9ae3f7c94f0f666696e150134b6a844d /core/java | |
parent | 9eb5847777b317991a44c01b901f35d99485c733 (diff) | |
download | frameworks_base-ff3bdca31f4cf2bd607519b276dd175763aa1784.zip frameworks_base-ff3bdca31f4cf2bd607519b276dd175763aa1784.tar.gz frameworks_base-ff3bdca31f4cf2bd607519b276dd175763aa1784.tar.bz2 |
The service part of the user space VPN support.
The dialogs will be in another change.
Change-Id: I0cdfd2ef21ffd40ee955b3cbde5ada65dbfdb0bc
Diffstat (limited to 'core/java')
-rw-r--r-- | core/java/android/net/ConnectivityManager.java | 41 | ||||
-rw-r--r-- | core/java/android/net/IConnectivityManager.aidl | 8 |
2 files changed, 49 insertions, 0 deletions
diff --git a/core/java/android/net/ConnectivityManager.java b/core/java/android/net/ConnectivityManager.java index ea750da..3025462 100644 --- a/core/java/android/net/ConnectivityManager.java +++ b/core/java/android/net/ConnectivityManager.java @@ -19,6 +19,8 @@ package android.net; import android.annotation.SdkConstant; import android.annotation.SdkConstant.SdkConstantType; import android.os.Binder; +import android.os.Bundle; +import android.os.ParcelFileDescriptor; import android.os.RemoteException; import java.net.InetAddress; @@ -756,4 +758,43 @@ public class ConnectivityManager { } catch (RemoteException e) { } } + + /** + * Protect a socket from routing changes. This method is limited to VPN + * applications, and it is always hidden to avoid direct use. + * @hide + */ + public void protectVpn(ParcelFileDescriptor socket) { + try { + mService.protectVpn(socket); + } catch (RemoteException e) { + } + } + + /** + * Prepare for a VPN application. This method is limited to VpnDialogs, + * and it is always hidden to avoid direct use. + * @hide + */ + public String prepareVpn(String packageName) { + try { + return mService.prepareVpn(packageName); + } catch (RemoteException e) { + return null; + } + } + + /** + * Configure a TUN interface and return its file descriptor. Parameters + * are encoded and opaque to this class. This method is limited to VPN + * applications, and it is always hidden to avoid direct use. + * @hide + */ + public ParcelFileDescriptor establishVpn(Bundle config) { + try { + return mService.establishVpn(config); + } catch (RemoteException e) { + return null; + } + } } diff --git a/core/java/android/net/IConnectivityManager.aidl b/core/java/android/net/IConnectivityManager.aidl index 07f6cec..7f3775d 100644 --- a/core/java/android/net/IConnectivityManager.aidl +++ b/core/java/android/net/IConnectivityManager.aidl @@ -20,7 +20,9 @@ import android.net.LinkProperties; import android.net.NetworkInfo; import android.net.NetworkState; import android.net.ProxyProperties; +import android.os.Bundle; import android.os.IBinder; +import android.os.ParcelFileDescriptor; /** * Interface that answers queries about, and allows changing, the @@ -95,4 +97,10 @@ interface IConnectivityManager ProxyProperties getProxy(); void setDataDependency(int networkType, boolean met); + + void protectVpn(in ParcelFileDescriptor socket); + + String prepareVpn(String packageName); + + ParcelFileDescriptor establishVpn(in Bundle config); } |