summaryrefslogtreecommitdiffstats
path: root/src/com/android/settings/net
diff options
context:
space:
mode:
authorJeff Sharkey <jsharkey@android.com>2012-03-21 17:09:07 -0700
committerJeff Sharkey <jsharkey@android.com>2012-03-22 11:10:45 -0700
commitef6e1ff728bdf67e222d4d3452f5f354f519556f (patch)
tree355e6f0256919d4a8cf465344effe71625520123 /src/com/android/settings/net
parent686d1ee97addc1c0f6b9bab5d961f9cf2f6ecd03 (diff)
downloadpackages_apps_Settings-ef6e1ff728bdf67e222d4d3452f5f354f519556f.tar.gz
packages_apps_Settings-ef6e1ff728bdf67e222d4d3452f5f354f519556f.tar.bz2
packages_apps_Settings-ef6e1ff728bdf67e222d4d3452f5f354f519556f.zip
Cluster apps by user in Data Usage.
When displaying apps that have used data, cluster all app usage together regardless of profile/user. Always persist policy rules using primary UID (the UID under the default user). Bug: 6140462 Change-Id: Ia00bb42b26987553926f4027583dbe03b3bafba1
Diffstat (limited to 'src/com/android/settings/net')
-rw-r--r--src/com/android/settings/net/ChartDataLoader.java24
1 files changed, 14 insertions, 10 deletions
diff --git a/src/com/android/settings/net/ChartDataLoader.java b/src/com/android/settings/net/ChartDataLoader.java
index 09e6e3b6e..172d37734 100644
--- a/src/com/android/settings/net/ChartDataLoader.java
+++ b/src/com/android/settings/net/ChartDataLoader.java
@@ -30,25 +30,27 @@ import android.net.NetworkTemplate;
import android.os.Bundle;
import android.os.RemoteException;
+import com.android.settings.DataUsageSummary.AppItem;
+
/**
* Loader for historical chart data for both network and UID details.
*/
public class ChartDataLoader extends AsyncTaskLoader<ChartData> {
private static final String KEY_TEMPLATE = "template";
- private static final String KEY_UIDS = "uids";
+ private static final String KEY_APP = "app";
private static final String KEY_FIELDS = "fields";
private final INetworkStatsService mStatsService;
private final Bundle mArgs;
- public static Bundle buildArgs(NetworkTemplate template, int[] uids) {
- return buildArgs(template, uids, FIELD_RX_BYTES | FIELD_TX_BYTES);
+ public static Bundle buildArgs(NetworkTemplate template, AppItem app) {
+ return buildArgs(template, app, FIELD_RX_BYTES | FIELD_TX_BYTES);
}
- public static Bundle buildArgs(NetworkTemplate template, int[] uids, int fields) {
+ public static Bundle buildArgs(NetworkTemplate template, AppItem app, int fields) {
final Bundle args = new Bundle();
args.putParcelable(KEY_TEMPLATE, template);
- args.putIntArray(KEY_UIDS, uids);
+ args.putParcelable(KEY_APP, app);
args.putInt(KEY_FIELDS, fields);
return args;
}
@@ -68,11 +70,11 @@ public class ChartDataLoader extends AsyncTaskLoader<ChartData> {
@Override
public ChartData loadInBackground() {
final NetworkTemplate template = mArgs.getParcelable(KEY_TEMPLATE);
- final int[] uids = mArgs.getIntArray(KEY_UIDS);
+ final AppItem app = mArgs.getParcelable(KEY_APP);
final int fields = mArgs.getInt(KEY_FIELDS);
try {
- return loadInBackground(template, uids, fields);
+ return loadInBackground(template, app, fields);
} catch (RemoteException e) {
// since we can't do much without history, and we don't want to
// leave with half-baked UI, we bail hard.
@@ -80,17 +82,19 @@ public class ChartDataLoader extends AsyncTaskLoader<ChartData> {
}
}
- private ChartData loadInBackground(NetworkTemplate template, int[] uids, int fields)
+ private ChartData loadInBackground(NetworkTemplate template, AppItem app, int fields)
throws RemoteException {
final ChartData data = new ChartData();
data.network = mStatsService.getHistoryForNetwork(template, fields);
- if (uids != null) {
+ if (app != null) {
data.detailDefault = null;
data.detailForeground = null;
// load stats for current uid and template
- for (int uid : uids) {
+ final int size = app.uids.size();
+ for (int i = 0; i < size; i++) {
+ final int uid = app.uids.keyAt(i);
data.detailDefault = collectHistoryForUid(
template, uid, SET_DEFAULT, data.detailDefault);
data.detailForeground = collectHistoryForUid(