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

Commit 10e1a94e authored by Jason Monk's avatar Jason Monk
Browse files

Choose correct network template for data history

Bug: 19921796
Change-Id: I90376ed0314c47fcbee21c81b85f60d3cc3312a6
parent 59de14e2
Loading
Loading
Loading
Loading
+11 −1
Original line number Diff line number Diff line
@@ -246,7 +246,7 @@ public class InstalledAppDetails extends AppInfoBase
        AppItem app = new AppItem(mAppEntry.info.uid);
        app.addUid(mAppEntry.info.uid);
        getLoaderManager().restartLoader(LOADER_CHART_DATA,
                ChartDataLoader.buildArgs(NetworkTemplate.buildTemplateMobileWildcard(), app),
                ChartDataLoader.buildArgs(getTemplate(getContext()), app),
                mDataCallbacks);
        new BatteryUpdater().execute();
    }
@@ -698,6 +698,16 @@ public class InstalledAppDetails extends AppInfoBase
        return true;
    }

    private static NetworkTemplate getTemplate(Context context) {
        if (DataUsageSummary.hasReadyMobileRadio(context)) {
            return NetworkTemplate.buildTemplateMobileWildcard();
        }
        if (DataUsageSummary.hasWifiRadio(context)) {
            return NetworkTemplate.buildTemplateWifiWildcard();
        }
        return NetworkTemplate.buildTemplateEthernet();
    }

    public static CharSequence getNotificationSummary(AppEntry appEntry, Context context) {
        return getNotificationSummary(appEntry, context, new NotificationBackend());
    }