Combine network subtypes by default.

Subtype controls (3G-vs-4G) aren't exposed in the UI, so tracking
data with that granularity creates unnecessary overhead. For example,
some GSM networks can regularly flap between two subtypes.

Bug: 6118868
Change-Id: Id098891dba52336d00d0f96632a7924e228b4713
This commit is contained in:
Jeff Sharkey
2012-03-16 11:11:54 -07:00
parent 69e1f3ae65
commit 8e38f3ddde
3 changed files with 33 additions and 8 deletions

View File

@@ -26,6 +26,7 @@ import static android.content.Intent.ACTION_UID_REMOVED;
import static android.content.Intent.EXTRA_UID;
import static android.net.ConnectivityManager.ACTION_TETHER_STATE_CHANGED;
import static android.net.ConnectivityManager.CONNECTIVITY_ACTION_IMMEDIATE;
import static android.net.NetworkIdentity.COMBINE_SUBTYPE_ENABLED;
import static android.net.NetworkStats.IFACE_ALL;
import static android.net.NetworkStats.SET_ALL;
import static android.net.NetworkStats.SET_DEFAULT;
@@ -304,7 +305,9 @@ public class NetworkStatsService extends INetworkStatsService.Stub {
// watch for networkType changes that aren't broadcast through
// CONNECTIVITY_ACTION_IMMEDIATE above.
mTeleManager.listen(mPhoneListener, LISTEN_DATA_CONNECTION_STATE);
if (!COMBINE_SUBTYPE_ENABLED) {
mTeleManager.listen(mPhoneListener, LISTEN_DATA_CONNECTION_STATE);
}
registerPollAlarmLocked();
registerGlobalAlert();
@@ -325,7 +328,9 @@ public class NetworkStatsService extends INetworkStatsService.Stub {
mContext.unregisterReceiver(mRemovedReceiver);
mContext.unregisterReceiver(mShutdownReceiver);
mTeleManager.listen(mPhoneListener, LISTEN_NONE);
if (!COMBINE_SUBTYPE_ENABLED) {
mTeleManager.listen(mPhoneListener, LISTEN_NONE);
}
final long currentTime = mTime.hasCache() ? mTime.currentTimeMillis()
: System.currentTimeMillis();