Merge "Choose correct network template for data history" into mnc-dev

This commit is contained in:
Jason Monk
2015-05-08 18:13:13 +00:00
committed by Android (Google) Code Review

View File

@@ -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);
if (mPackageInfo != null) {
new BatteryUpdater().execute();
@@ -700,6 +700,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());
}