summaryrefslogtreecommitdiffstats
path: root/core
diff options
context:
space:
mode:
authorRobert Greenwalt <rgreenwalt@google.com>2014-05-12 18:25:56 +0000
committerAndroid Git Automerger <android-git-automerger@android.com>2014-05-12 18:25:56 +0000
commit424047eeceb22f71e720b0a3b97230c04951b707 (patch)
treef843676ecf16dd14a5700eab175c7c80e0113a66 /core
parentb3cc9e4c9fbc22c5750619ac3cfde5bb3e832315 (diff)
parent82f421ad83cea68df9803d5cd85ed7b190497d5d (diff)
downloadframeworks_base-424047eeceb22f71e720b0a3b97230c04951b707.zip
frameworks_base-424047eeceb22f71e720b0a3b97230c04951b707.tar.gz
frameworks_base-424047eeceb22f71e720b0a3b97230c04951b707.tar.bz2
am 2fbcff12: Merge "First pass on multinetwork framework"
* commit '2fbcff12a6e8413f5dcab1cc591573dcb88dd588': First pass on multinetwork framework
Diffstat (limited to 'core')
-rw-r--r--core/java/android/net/BaseNetworkStateTracker.java11
-rw-r--r--core/java/android/net/ConnectivityManager.java5
-rw-r--r--core/java/android/net/Network.aidl20
-rw-r--r--core/java/android/net/Network.java59
-rw-r--r--core/java/android/net/NetworkStateTracker.java10
-rw-r--r--core/java/android/os/INetworkManagementService.aidl10
6 files changed, 115 insertions, 0 deletions
diff --git a/core/java/android/net/BaseNetworkStateTracker.java b/core/java/android/net/BaseNetworkStateTracker.java
index 804f8ee..862d59e 100644
--- a/core/java/android/net/BaseNetworkStateTracker.java
+++ b/core/java/android/net/BaseNetworkStateTracker.java
@@ -45,6 +45,7 @@ public abstract class BaseNetworkStateTracker implements NetworkStateTracker {
protected NetworkInfo mNetworkInfo;
protected LinkProperties mLinkProperties;
protected LinkCapabilities mLinkCapabilities;
+ protected Network mNetwork = new Network(ConnectivityManager.INVALID_NET_ID);
private AtomicBoolean mTeardownRequested = new AtomicBoolean(false);
private AtomicBoolean mPrivateDnsRouteSet = new AtomicBoolean(false);
@@ -201,4 +202,14 @@ public abstract class BaseNetworkStateTracker implements NetworkStateTracker {
public void stopSampling(SamplingDataTracker.SamplingSnapshot s) {
// nothing to do
}
+
+ @Override
+ public void setNetId(int netId) {
+ mNetwork = new Network(netId);
+ }
+
+ @Override
+ public Network getNetwork() {
+ return mNetwork;
+ }
}
diff --git a/core/java/android/net/ConnectivityManager.java b/core/java/android/net/ConnectivityManager.java
index 30d7043..3e00250 100644
--- a/core/java/android/net/ConnectivityManager.java
+++ b/core/java/android/net/ConnectivityManager.java
@@ -408,6 +408,11 @@ public class ConnectivityManager {
*/
public static final int CONNECTIVITY_CHANGE_DELAY_DEFAULT = 3000;
+ /**
+ * @hide
+ */
+ public final static int INVALID_NET_ID = 0;
+
private final IConnectivityManager mService;
private final String mPackageName;
diff --git a/core/java/android/net/Network.aidl b/core/java/android/net/Network.aidl
new file mode 100644
index 0000000..73ba1af
--- /dev/null
+++ b/core/java/android/net/Network.aidl
@@ -0,0 +1,20 @@
+/*
+**
+** 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 Network;
diff --git a/core/java/android/net/Network.java b/core/java/android/net/Network.java
new file mode 100644
index 0000000..f82bc22
--- /dev/null
+++ b/core/java/android/net/Network.java
@@ -0,0 +1,59 @@
+/*
+ * 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.Parcelable;
+import android.os.Parcel;
+
+
+/**
+ * Identifies the Network.
+ * @hide
+ */
+public class Network implements Parcelable {
+
+ public final int netId;
+
+ public Network(int netId) {
+ this.netId = netId;
+ }
+
+ public Network(Network that) {
+ this.netId = that.netId;
+ }
+
+ // implement the Parcelable interface
+ public int describeContents() {
+ return 0;
+ }
+ public void writeToParcel(Parcel dest, int flags) {
+ dest.writeInt(netId);
+ }
+
+ public static final Creator<Network> CREATOR =
+ new Creator<Network>() {
+ public Network createFromParcel(Parcel in) {
+ int netId = in.readInt();
+
+ return new Network(netId);
+ }
+
+ public Network[] newArray(int size) {
+ return new Network[size];
+ }
+ };
+}
diff --git a/core/java/android/net/NetworkStateTracker.java b/core/java/android/net/NetworkStateTracker.java
index c49b1d1..29b57a5 100644
--- a/core/java/android/net/NetworkStateTracker.java
+++ b/core/java/android/net/NetworkStateTracker.java
@@ -250,4 +250,14 @@ public interface NetworkStateTracker {
*/
public void stopSampling(SamplingDataTracker.SamplingSnapshot s);
+ /*
+ * Record the current netId
+ */
+ public void setNetId(int netId);
+
+ /*
+ * ?
+ */
+ public Network getNetwork();
+
}
diff --git a/core/java/android/os/INetworkManagementService.aidl b/core/java/android/os/INetworkManagementService.aidl
index f5ff185..9e03f95 100644
--- a/core/java/android/os/INetworkManagementService.aidl
+++ b/core/java/android/os/INetworkManagementService.aidl
@@ -455,4 +455,14 @@ interface INetworkManagementService
* Check whether the mobile radio is currently active.
*/
boolean isNetworkActive();
+
+ /**
+ * setup a new network
+ */
+ void createNetwork(int netId, String iface);
+
+ /**
+ * remove a network
+ */
+ void removeNetwork(int netId);
}