diff options
Diffstat (limited to 'core')
-rw-r--r-- | core/java/android/net/ConnectivityManager.java | 4 | ||||
-rw-r--r-- | core/java/android/net/IConnectivityManager.aidl | 3 | ||||
-rw-r--r-- | core/java/android/net/NetworkAgent.java | 7 | ||||
-rw-r--r-- | core/java/android/net/NetworkMisc.aidl | 19 | ||||
-rw-r--r-- | core/java/android/net/NetworkMisc.java | 57 | ||||
-rw-r--r-- | core/java/android/net/VpnService.java | 2 | ||||
-rw-r--r-- | core/java/android/os/INetworkManagementService.aidl | 2 | ||||
-rw-r--r-- | core/java/com/android/internal/net/VpnConfig.java | 3 |
8 files changed, 91 insertions, 6 deletions
diff --git a/core/java/android/net/ConnectivityManager.java b/core/java/android/net/ConnectivityManager.java index 0df4d45..30be4da 100644 --- a/core/java/android/net/ConnectivityManager.java +++ b/core/java/android/net/ConnectivityManager.java @@ -2068,9 +2068,9 @@ public class ConnectivityManager { /** {@hide} */ public void registerNetworkAgent(Messenger messenger, NetworkInfo ni, LinkProperties lp, - NetworkCapabilities nc, int score) { + NetworkCapabilities nc, int score, NetworkMisc misc) { try { - mService.registerNetworkAgent(messenger, ni, lp, nc, score); + mService.registerNetworkAgent(messenger, ni, lp, nc, score, misc); } catch (RemoteException e) { } } diff --git a/core/java/android/net/IConnectivityManager.aidl b/core/java/android/net/IConnectivityManager.aidl index 8b12fb8..35f1305 100644 --- a/core/java/android/net/IConnectivityManager.aidl +++ b/core/java/android/net/IConnectivityManager.aidl @@ -22,6 +22,7 @@ import android.net.LinkProperties; import android.net.Network; import android.net.NetworkCapabilities; import android.net.NetworkInfo; +import android.net.NetworkMisc; import android.net.NetworkQuotaInfo; import android.net.NetworkRequest; import android.net.NetworkState; @@ -150,7 +151,7 @@ interface IConnectivityManager void unregisterNetworkFactory(in Messenger messenger); void registerNetworkAgent(in Messenger messenger, in NetworkInfo ni, in LinkProperties lp, - in NetworkCapabilities nc, int score); + in NetworkCapabilities nc, int score, in NetworkMisc misc); NetworkRequest requestNetwork(in NetworkCapabilities networkCapabilities, in Messenger messenger, int timeoutSec, in IBinder binder, int legacy); diff --git a/core/java/android/net/NetworkAgent.java b/core/java/android/net/NetworkAgent.java index 41eab02..a365af0 100644 --- a/core/java/android/net/NetworkAgent.java +++ b/core/java/android/net/NetworkAgent.java @@ -108,6 +108,11 @@ public abstract class NetworkAgent extends Handler { public NetworkAgent(Looper looper, Context context, String logTag, NetworkInfo ni, NetworkCapabilities nc, LinkProperties lp, int score) { + this(looper, context, logTag, ni, nc, lp, score, null); + } + + public NetworkAgent(Looper looper, Context context, String logTag, NetworkInfo ni, + NetworkCapabilities nc, LinkProperties lp, int score, NetworkMisc misc) { super(looper); LOG_TAG = logTag; mContext = context; @@ -119,7 +124,7 @@ public abstract class NetworkAgent extends Handler { ConnectivityManager cm = (ConnectivityManager)mContext.getSystemService( Context.CONNECTIVITY_SERVICE); cm.registerNetworkAgent(new Messenger(this), new NetworkInfo(ni), - new LinkProperties(lp), new NetworkCapabilities(nc), score); + new LinkProperties(lp), new NetworkCapabilities(nc), score, misc); } @Override diff --git a/core/java/android/net/NetworkMisc.aidl b/core/java/android/net/NetworkMisc.aidl new file mode 100644 index 0000000..c65583f --- /dev/null +++ b/core/java/android/net/NetworkMisc.aidl @@ -0,0 +1,19 @@ +/* + * Copyright (C) 2014 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 android.net; + +parcelable NetworkMisc; diff --git a/core/java/android/net/NetworkMisc.java b/core/java/android/net/NetworkMisc.java new file mode 100644 index 0000000..34f6cf4 --- /dev/null +++ b/core/java/android/net/NetworkMisc.java @@ -0,0 +1,57 @@ +/* + * Copyright (C) 2014 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 android.net; + +import android.os.Parcel; +import android.os.Parcelable; + +/** + * A grab-bag of information (metadata, policies, properties, etc) about a {@link Network}. + * + * @hide + */ +public class NetworkMisc implements Parcelable { + /** + * If the {@link Network} is a VPN, whether apps are allowed to bypass the VPN. This is set by + * a {@link VpnService} and used by {@link ConnectivityService} when creating a VPN. + */ + public boolean allowBypass; + + @Override + public int describeContents() { + return 0; + } + + @Override + public void writeToParcel(Parcel out, int flags) { + out.writeInt(allowBypass ? 1 : 0); + } + + public static final Creator<NetworkMisc> CREATOR = new Creator<NetworkMisc>() { + @Override + public NetworkMisc createFromParcel(Parcel in) { + NetworkMisc networkMisc = new NetworkMisc(); + networkMisc.allowBypass = in.readInt() != 0; + return networkMisc; + } + + @Override + public NetworkMisc[] newArray(int size) { + return new NetworkMisc[size]; + } + }; +} diff --git a/core/java/android/net/VpnService.java b/core/java/android/net/VpnService.java index 3fd415f..4b07e3f 100644 --- a/core/java/android/net/VpnService.java +++ b/core/java/android/net/VpnService.java @@ -563,7 +563,7 @@ public class VpnService extends Service { * @return this {@link Builder} object to facilitate chaining of method calls. */ public Builder allowBypass() { - // TODO + mConfig.allowBypass = true; return this; } diff --git a/core/java/android/os/INetworkManagementService.aidl b/core/java/android/os/INetworkManagementService.aidl index c1e6664..c467d4a 100644 --- a/core/java/android/os/INetworkManagementService.aidl +++ b/core/java/android/os/INetworkManagementService.aidl @@ -367,7 +367,7 @@ interface INetworkManagementService /** * Setup a new VPN. */ - void createVirtualNetwork(int netId, boolean hasDNS); + void createVirtualNetwork(int netId, boolean hasDNS, boolean secure); /** * Remove a network. diff --git a/core/java/com/android/internal/net/VpnConfig.java b/core/java/com/android/internal/net/VpnConfig.java index c552a41..dac59f9 100644 --- a/core/java/com/android/internal/net/VpnConfig.java +++ b/core/java/com/android/internal/net/VpnConfig.java @@ -74,6 +74,7 @@ public class VpnConfig implements Parcelable { public long startTime = -1; public boolean legacy; public boolean blocking; + public boolean allowBypass; public void addLegacyRoutes(String routesStr) { if (routesStr.trim().equals("")) { @@ -122,6 +123,7 @@ public class VpnConfig implements Parcelable { out.writeLong(startTime); out.writeInt(legacy ? 1 : 0); out.writeInt(blocking ? 1 : 0); + out.writeInt(allowBypass ? 1 : 0); } public static final Parcelable.Creator<VpnConfig> CREATOR = @@ -141,6 +143,7 @@ public class VpnConfig implements Parcelable { config.startTime = in.readLong(); config.legacy = in.readInt() != 0; config.blocking = in.readInt() != 0; + config.allowBypass = in.readInt() != 0; return config; } |