Choose correct network template for data history

Bug: 19921796
Change-Id: I90376ed0314c47fcbee21c81b85f60d3cc3312a6
This commit is contained in:
Jason Monk
2015-05-08 11:24:03 -04:00
parent 59de14e219
commit 10e1a94ef7

View File

@@ -246,7 +246,7 @@ public class InstalledAppDetails extends AppInfoBase
AppItem app = new AppItem(mAppEntry.info.uid); AppItem app = new AppItem(mAppEntry.info.uid);
app.addUid(mAppEntry.info.uid); app.addUid(mAppEntry.info.uid);
getLoaderManager().restartLoader(LOADER_CHART_DATA, getLoaderManager().restartLoader(LOADER_CHART_DATA,
ChartDataLoader.buildArgs(NetworkTemplate.buildTemplateMobileWildcard(), app), ChartDataLoader.buildArgs(getTemplate(getContext()), app),
mDataCallbacks); mDataCallbacks);
new BatteryUpdater().execute(); new BatteryUpdater().execute();
} }
@@ -698,6 +698,16 @@ public class InstalledAppDetails extends AppInfoBase
return true; 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) { public static CharSequence getNotificationSummary(AppEntry appEntry, Context context) {
return getNotificationSummary(appEntry, context, new NotificationBackend()); return getNotificationSummary(appEntry, context, new NotificationBackend());
} }