diff options
author | Bryse Flowers <bflowers@codeaurora.org> | 2015-12-21 12:36:34 -0800 |
---|---|---|
committer | Marcos Marado <mmarado@cyngn.com> | 2016-05-05 10:19:01 -0700 |
commit | a77b5bc9da5d2516c601fae49772801af6c51a33 (patch) | |
tree | ec3a709be54e54d13d7720fd5def0cee903c030b /services/core | |
parent | a429e470bbc079115d0cda0a3b48ddaee5811a0e (diff) | |
download | frameworks_base-a77b5bc9da5d2516c601fae49772801af6c51a33.zip frameworks_base-a77b5bc9da5d2516c601fae49772801af6c51a33.tar.gz frameworks_base-a77b5bc9da5d2516c601fae49772801af6c51a33.tar.bz2 |
server: modify network stat plugin framework
Add setUpstream function from Tethering to handle IPv6-only
Tethering.
TICKET: PAELLA-86
Change-Id: I38392d0678df027c54469564746ee5d9897f5829
Diffstat (limited to 'services/core')
-rw-r--r-- | services/core/java/com/android/server/NetPluginDelegate.java (renamed from services/core/java/com/android/server/net/NetPluginDelegate.java) | 24 | ||||
-rw-r--r-- | services/core/java/com/android/server/connectivity/Tethering.java | 4 | ||||
-rw-r--r-- | services/core/java/com/android/server/net/NetworkPolicyManagerService.java | 1 | ||||
-rw-r--r-- | services/core/java/com/android/server/net/NetworkStatsService.java | 1 |
4 files changed, 23 insertions, 7 deletions
diff --git a/services/core/java/com/android/server/net/NetPluginDelegate.java b/services/core/java/com/android/server/NetPluginDelegate.java index 6716a6b..18365f1 100644 --- a/services/core/java/com/android/server/net/NetPluginDelegate.java +++ b/services/core/java/com/android/server/NetPluginDelegate.java @@ -27,17 +27,16 @@ *IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -package com.android.server.net; +package com.android.server; import dalvik.system.PathClassLoader; -import java.lang.reflect.Constructor; - import android.util.Slog; +import android.net.Network; import android.net.NetworkStats; import android.util.Log; -class NetPluginDelegate { +public class NetPluginDelegate { private static final String TAG = "ConnectivityExtension"; private static final boolean LOGV = false; @@ -47,7 +46,7 @@ class NetPluginDelegate { private static boolean extensionFailed; - static void getTetherStats(NetworkStats uidStats, NetworkStats devStats, + public static void getTetherStats(NetworkStats uidStats, NetworkStats devStats, NetworkStats xtStats) { if (!loadTetherExtJar()) { return; @@ -60,9 +59,10 @@ class NetPluginDelegate { e.printStackTrace(); Log.w(TAG, "error in invoke method"); } + if (LOGV) Slog.v(TAG, "getTetherStats() X"); } - static void setQuota(String iface, long quota) { + public static void setQuota(String iface, long quota) { if (!loadTetherExtJar()) { return; } @@ -72,8 +72,20 @@ class NetPluginDelegate { } catch (Exception ex) { Log.w(TAG, "Error calling setQuota Method on extension jar"); } + if (LOGV) Slog.v(TAG, "setQuota(" + iface + ", " + quota + ") X"); } + public static void setUpstream(Network net) { + if (LOGV) Slog.v(TAG, "setUpstream(" + net + ") E"); + loadTetherExtJar(); + try { + tetherExtensionClass.getMethod("setUpstream", Network.class).invoke( + tetherExtensionObj, net); + } catch (Exception ex) { + Log.w(TAG, "Error calling setUpstream Method on extension jar"); + } + if (LOGV) Slog.v(TAG, "setUpstream(" + net + ") E"); + } private static boolean loadTetherExtJar() { diff --git a/services/core/java/com/android/server/connectivity/Tethering.java b/services/core/java/com/android/server/connectivity/Tethering.java index 3472db2..60d6772 100644 --- a/services/core/java/com/android/server/connectivity/Tethering.java +++ b/services/core/java/com/android/server/connectivity/Tethering.java @@ -59,6 +59,7 @@ import com.android.internal.util.IState; import com.android.internal.util.State; import com.android.internal.util.StateMachine; import com.android.server.IoThread; +import com.android.server.NetPluginDelegate; import com.android.server.net.BaseNetworkObserver; import java.io.FileDescriptor; @@ -1595,6 +1596,8 @@ public class Tethering extends BaseNetworkObserver { sendMessageDelayed(CMD_RETRY_UPSTREAM, UPSTREAM_SETTLE_TIME_MS); } } else { + Network network = getConnectivityManager().getNetworkForType(upType); + NetPluginDelegate.setUpstream(network); LinkProperties linkProperties = getConnectivityManager().getLinkProperties(upType); if (linkProperties != null) { @@ -1629,7 +1632,6 @@ public class Tethering extends BaseNetworkObserver { } } try { - Network network = getConnectivityManager().getNetworkForType(upType); if (network == null) { Log.e(TAG, "No Network for upstream type " + upType + "!"); } diff --git a/services/core/java/com/android/server/net/NetworkPolicyManagerService.java b/services/core/java/com/android/server/net/NetworkPolicyManagerService.java index db24b3a..1738684 100644 --- a/services/core/java/com/android/server/net/NetworkPolicyManagerService.java +++ b/services/core/java/com/android/server/net/NetworkPolicyManagerService.java @@ -162,6 +162,7 @@ import com.android.internal.util.IndentingPrintWriter; import com.android.server.DeviceIdleController; import com.android.server.EventLogTags; import com.android.server.LocalServices; +import com.android.server.NetPluginDelegate; import com.google.android.collect.Lists; import org.xmlpull.v1.XmlPullParser; diff --git a/services/core/java/com/android/server/net/NetworkStatsService.java b/services/core/java/com/android/server/net/NetworkStatsService.java index dce601b..963aa7c 100644 --- a/services/core/java/com/android/server/net/NetworkStatsService.java +++ b/services/core/java/com/android/server/net/NetworkStatsService.java @@ -123,6 +123,7 @@ import com.android.internal.util.FileRotator; import com.android.internal.util.IndentingPrintWriter; import com.android.server.EventLogTags; import com.android.server.LocalServices; +import com.android.server.NetPluginDelegate; import com.android.server.connectivity.Tethering; import java.io.File; |