diff options
author | Jeff Sharkey <jsharkey@android.com> | 2012-04-06 11:21:28 -0700 |
---|---|---|
committer | Jeff Sharkey <jsharkey@android.com> | 2012-04-06 11:47:25 -0700 |
commit | 08ce99e224145759904bbd6ae36e0b2bf4b0e4e6 (patch) | |
tree | 5edaca2a7df78690817e2639eda0de529487a836 /src/com/android/settings/net | |
parent | 11ca81e1f0f95e6ace612045c14ebd38e00fd819 (diff) | |
download | packages_apps_Settings-08ce99e224145759904bbd6ae36e0b2bf4b0e4e6.tar.gz packages_apps_Settings-08ce99e224145759904bbd6ae36e0b2bf4b0e4e6.tar.bz2 packages_apps_Settings-08ce99e224145759904bbd6ae36e0b2bf4b0e4e6.zip |
Move to INetworkStatsSession with lifecycle.
Explicitly communicate lifecycle, enabling system_server to cache
stats when actively being used.
Bug: 6236498
Change-Id: Ieecc4b1d4fd46aeb5207c4ba9b450e04e9438d00
Diffstat (limited to 'src/com/android/settings/net')
-rw-r--r-- | src/com/android/settings/net/ChartDataLoader.java | 12 | ||||
-rw-r--r-- | src/com/android/settings/net/SummaryForAllUidLoader.java | 11 |
2 files changed, 11 insertions, 12 deletions
diff --git a/src/com/android/settings/net/ChartDataLoader.java b/src/com/android/settings/net/ChartDataLoader.java index 172d37734..830d00649 100644 --- a/src/com/android/settings/net/ChartDataLoader.java +++ b/src/com/android/settings/net/ChartDataLoader.java @@ -24,7 +24,7 @@ import static android.net.NetworkStatsHistory.FIELD_TX_BYTES; import android.content.AsyncTaskLoader; import android.content.Context; -import android.net.INetworkStatsService; +import android.net.INetworkStatsSession; import android.net.NetworkStatsHistory; import android.net.NetworkTemplate; import android.os.Bundle; @@ -40,7 +40,7 @@ public class ChartDataLoader extends AsyncTaskLoader<ChartData> { private static final String KEY_APP = "app"; private static final String KEY_FIELDS = "fields"; - private final INetworkStatsService mStatsService; + private final INetworkStatsSession mSession; private final Bundle mArgs; public static Bundle buildArgs(NetworkTemplate template, AppItem app) { @@ -55,9 +55,9 @@ public class ChartDataLoader extends AsyncTaskLoader<ChartData> { return args; } - public ChartDataLoader(Context context, INetworkStatsService statsService, Bundle args) { + public ChartDataLoader(Context context, INetworkStatsSession session, Bundle args) { super(context); - mStatsService = statsService; + mSession = session; mArgs = args; } @@ -85,7 +85,7 @@ public class ChartDataLoader extends AsyncTaskLoader<ChartData> { private ChartData loadInBackground(NetworkTemplate template, AppItem app, int fields) throws RemoteException { final ChartData data = new ChartData(); - data.network = mStatsService.getHistoryForNetwork(template, fields); + data.network = mSession.getHistoryForNetwork(template, fields); if (app != null) { data.detailDefault = null; @@ -128,7 +128,7 @@ public class ChartDataLoader extends AsyncTaskLoader<ChartData> { private NetworkStatsHistory collectHistoryForUid( NetworkTemplate template, int uid, int set, NetworkStatsHistory existing) throws RemoteException { - final NetworkStatsHistory history = mStatsService.getHistoryForUid( + final NetworkStatsHistory history = mSession.getHistoryForUid( template, uid, set, TAG_NONE, FIELD_RX_BYTES | FIELD_TX_BYTES); if (existing != null) { diff --git a/src/com/android/settings/net/SummaryForAllUidLoader.java b/src/com/android/settings/net/SummaryForAllUidLoader.java index c01de4539..68dc79920 100644 --- a/src/com/android/settings/net/SummaryForAllUidLoader.java +++ b/src/com/android/settings/net/SummaryForAllUidLoader.java @@ -18,7 +18,7 @@ package com.android.settings.net; import android.content.AsyncTaskLoader; import android.content.Context; -import android.net.INetworkStatsService; +import android.net.INetworkStatsSession; import android.net.NetworkStats; import android.net.NetworkTemplate; import android.os.Bundle; @@ -29,7 +29,7 @@ public class SummaryForAllUidLoader extends AsyncTaskLoader<NetworkStats> { private static final String KEY_START = "start"; private static final String KEY_END = "end"; - private final INetworkStatsService mStatsService; + private final INetworkStatsSession mSession; private final Bundle mArgs; public static Bundle buildArgs(NetworkTemplate template, long start, long end) { @@ -40,10 +40,9 @@ public class SummaryForAllUidLoader extends AsyncTaskLoader<NetworkStats> { return args; } - public SummaryForAllUidLoader( - Context context, INetworkStatsService statsService, Bundle args) { + public SummaryForAllUidLoader(Context context, INetworkStatsSession session, Bundle args) { super(context); - mStatsService = statsService; + mSession = session; mArgs = args; } @@ -60,7 +59,7 @@ public class SummaryForAllUidLoader extends AsyncTaskLoader<NetworkStats> { final long end = mArgs.getLong(KEY_END); try { - return mStatsService.getSummaryForAllUid(template, start, end, false); + return mSession.getSummaryForAllUid(template, start, end, false); } catch (RemoteException e) { return null; } |