diff options
author | Chia-chi Yeh <chiachi@android.com> | 2011-06-15 17:07:27 -0700 |
---|---|---|
committer | Chia-chi Yeh <chiachi@android.com> | 2011-06-15 17:08:58 -0700 |
commit | 04ba25c418bc4538e9dc0f047cfb9608d358f679 (patch) | |
tree | 2e090c0fdb1540e4bb2cbfa1373be2645330cc5a /core | |
parent | f530da67b4f9ffa55bb8a1c05390c6f7f87fe4ba (diff) | |
download | frameworks_base-04ba25c418bc4538e9dc0f047cfb9608d358f679.zip frameworks_base-04ba25c418bc4538e9dc0f047cfb9608d358f679.tar.gz frameworks_base-04ba25c418bc4538e9dc0f047cfb9608d358f679.tar.bz2 |
VPN: migrate from generic Bundle to our own Parcelable VpnConfig.
Note that VpnConfig is for internal use only.
Also remove hidden methods from ConnectivityManager.
Change-Id: Ic298c4dc9a2c6c452bd8f4be6fa84e7ac489c0c4
Diffstat (limited to 'core')
-rw-r--r-- | core/java/android/net/ConnectivityManager.java | 40 | ||||
-rw-r--r-- | core/java/android/net/IConnectivityManager.aidl | 5 | ||||
-rw-r--r-- | core/java/com/android/internal/net/VpnConfig.aidl | 19 | ||||
-rw-r--r-- | core/java/com/android/internal/net/VpnConfig.java | 80 |
4 files changed, 102 insertions, 42 deletions
diff --git a/core/java/android/net/ConnectivityManager.java b/core/java/android/net/ConnectivityManager.java index 3025462..2242e9e 100644 --- a/core/java/android/net/ConnectivityManager.java +++ b/core/java/android/net/ConnectivityManager.java @@ -19,7 +19,6 @@ 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; @@ -758,43 +757,4 @@ 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 7f3775d..fba16e1 100644 --- a/core/java/android/net/IConnectivityManager.aidl +++ b/core/java/android/net/IConnectivityManager.aidl @@ -20,10 +20,11 @@ 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; +import com.android.internal.net.VpnConfig; + /** * Interface that answers queries about, and allows changing, the * state of network connectivity. @@ -102,5 +103,5 @@ interface IConnectivityManager String prepareVpn(String packageName); - ParcelFileDescriptor establishVpn(in Bundle config); + ParcelFileDescriptor establishVpn(in VpnConfig config); } diff --git a/core/java/com/android/internal/net/VpnConfig.aidl b/core/java/com/android/internal/net/VpnConfig.aidl new file mode 100644 index 0000000..be1684c --- /dev/null +++ b/core/java/com/android/internal/net/VpnConfig.aidl @@ -0,0 +1,19 @@ +/* + * Copyright (C) 2011 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.android.internal.net; + +parcelable VpnConfig; diff --git a/core/java/com/android/internal/net/VpnConfig.java b/core/java/com/android/internal/net/VpnConfig.java new file mode 100644 index 0000000..18d9ec4 --- /dev/null +++ b/core/java/com/android/internal/net/VpnConfig.java @@ -0,0 +1,80 @@ +/* + * Copyright (C) 2011 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.android.internal.net; + +import android.os.Parcel; +import android.os.Parcelable; + +/** + * A simple container used to carry information in VpnBuilder, VpnDialogs, + * and com.android.server.connectivity.Vpn. Internal use only. + * + * @hide + */ +public class VpnConfig implements Parcelable { + + public String packageName; + public String sessionName; + public String interfaceName; + public String configureActivity; + public int mtu = -1; + public String addresses; + public String routes; + public String dnsServers; + public long startTime = -1; + + @Override + public int describeContents() { + return 0; + } + + @Override + public void writeToParcel(Parcel out, int flags) { + out.writeString(packageName); + out.writeString(sessionName); + out.writeString(interfaceName); + out.writeString(configureActivity); + out.writeInt(mtu); + out.writeString(addresses); + out.writeString(routes); + out.writeString(dnsServers); + out.writeLong(startTime); + } + + public static final Parcelable.Creator<VpnConfig> CREATOR = + new Parcelable.Creator<VpnConfig>() { + @Override + public VpnConfig createFromParcel(Parcel in) { + VpnConfig config = new VpnConfig(); + config.packageName = in.readString(); + config.sessionName = in.readString(); + config.interfaceName = in.readString(); + config.configureActivity = in.readString(); + config.mtu = in.readInt(); + config.addresses = in.readString(); + config.routes = in.readString(); + config.dnsServers = in.readString(); + config.startTime = in.readLong(); + return config; + } + + @Override + public VpnConfig[] newArray(int size) { + return new VpnConfig[size]; + } + }; +} |