Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit e7e25662 authored by Steve Kondik's avatar Steve Kondik
Browse files

net: Don't spam logs when ConnectivityExt isn't available

Change-Id: Idc7d128e84f54a89f9a45cb2ac474461e3152808
parent 815d19d7
Loading
Loading
Loading
Loading
+24 −16
Original line number Diff line number Diff line
@@ -45,9 +45,13 @@ class NetPluginDelegate {
    private static Class tetherExtensionClass = null;
    private static Object tetherExtensionObj = null;

    private static boolean extensionFailed;

    static void getTetherStats(NetworkStats uidStats, NetworkStats devStats,
            NetworkStats xtStats) {
        loadTetherExtJar();
        if (!loadTetherExtJar()) {
            return;
        }
        try {
            tetherExtensionClass.getMethod("getTetherStats", NetworkStats.class,
                    NetworkStats.class, NetworkStats.class).invoke(tetherExtensionObj, uidStats,
@@ -59,7 +63,9 @@ class NetPluginDelegate {
    }

    static void setQuota(String iface, long quota) {
        loadTetherExtJar();
        if (!loadTetherExtJar()) {
            return;
        }
        try {
            tetherExtensionClass.getMethod("setQuota", String.class, long.class).invoke(
                    tetherExtensionObj, iface, quota);
@@ -70,10 +76,10 @@ class NetPluginDelegate {



    private static void loadTetherExtJar() {
    private static boolean loadTetherExtJar() {
        final String realProvider = "com.qualcomm.qti.tetherstatsextension.TetherStatsReporting";
        final String realProviderPath = "/system/framework/ConnectivityExt.jar";
            if (tetherExtensionClass == null && tetherExtensionObj == null) {
        if (!extensionFailed && tetherExtensionClass == null && tetherExtensionObj == null) {
            if (LOGV) Slog.v(TAG, "loading ConnectivityExt jar");
            try {

@@ -84,10 +90,12 @@ class NetPluginDelegate {
                tetherExtensionObj = tetherExtensionClass.newInstance();
                if (LOGV)
                    Slog.v(TAG, "ConnectivityExt jar loaded");
                extensionFailed = false;
            } catch (Exception e) {
                    e.printStackTrace();
                    Log.w(TAG, "unable to ConnectivityExt jar");
                Log.w(TAG, "Connectivity extension is not available");
                extensionFailed = true;
            }
        }
        return !extensionFailed;
    }
}