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/java/com/android/server/net | |
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/java/com/android/server/net')
3 files changed, 2 insertions, 101 deletions
diff --git a/services/core/java/com/android/server/net/NetPluginDelegate.java b/services/core/java/com/android/server/net/NetPluginDelegate.java deleted file mode 100644 index 6716a6b..0000000 --- a/services/core/java/com/android/server/net/NetPluginDelegate.java +++ /dev/null @@ -1,101 +0,0 @@ -/* - *Copyright (c) 2015, The Linux Foundation. All rights reserved. - * - *Redistribution and use in source and binary forms, with or without - *modification, are permitted provided that the following conditions are - *met: - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * * Neither the name of The Linux Foundation nor the names of its - * contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - *THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED - *WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - *MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT - *ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS - *BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - *CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - *SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR - *BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - *WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE - *OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN - *IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -package com.android.server.net; - -import dalvik.system.PathClassLoader; - -import java.lang.reflect.Constructor; - -import android.util.Slog; -import android.net.NetworkStats; -import android.util.Log; - -class NetPluginDelegate { - - private static final String TAG = "ConnectivityExtension"; - private static final boolean LOGV = false; - - private static Class tetherExtensionClass = null; - private static Object tetherExtensionObj = null; - - private static boolean extensionFailed; - - static void getTetherStats(NetworkStats uidStats, NetworkStats devStats, - NetworkStats xtStats) { - if (!loadTetherExtJar()) { - return; - } - try { - tetherExtensionClass.getMethod("getTetherStats", NetworkStats.class, - NetworkStats.class, NetworkStats.class).invoke(tetherExtensionObj, uidStats, - devStats, xtStats); - } catch (Exception e) { - e.printStackTrace(); - Log.w(TAG, "error in invoke method"); - } - } - - static void setQuota(String iface, long quota) { - if (!loadTetherExtJar()) { - return; - } - try { - tetherExtensionClass.getMethod("setQuota", String.class, long.class).invoke( - tetherExtensionObj, iface, quota); - } catch (Exception ex) { - Log.w(TAG, "Error calling setQuota Method on extension jar"); - } - } - - - - private static boolean loadTetherExtJar() { - final String realProvider = "com.qualcomm.qti.tetherstatsextension.TetherStatsReporting"; - final String realProviderPath = "/system/framework/ConnectivityExt.jar"; - if (!extensionFailed && tetherExtensionClass == null && tetherExtensionObj == null) { - if (LOGV) Slog.v(TAG, "loading ConnectivityExt jar"); - try { - - PathClassLoader classLoader = new PathClassLoader(realProviderPath, - ClassLoader.getSystemClassLoader()); - - tetherExtensionClass = classLoader.loadClass(realProvider); - tetherExtensionObj = tetherExtensionClass.newInstance(); - if (LOGV) - Slog.v(TAG, "ConnectivityExt jar loaded"); - extensionFailed = false; - } catch (Exception e) { - Log.w(TAG, "Connectivity extension is not available"); - extensionFailed = true; - } - } - return !extensionFailed; - } -} 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; |