Introduce immediate CONNECTIVITY_ACTION variant.

New broadcast that is dispatched immediately after connectivity
changes have been handled by ConnectivityService, bypassing any
applicable CONNECTIVITY_CHANGE_DELAY.

Also protect CONNECTIVITY_CHANGE broadcasts, since they should only
be sent by system.

Bug: 5198167
Change-Id: I75f1fb44b21da1879f0ab960bcaa481126d70fde
This commit is contained in:
Jeff Sharkey
2011-08-29 16:02:57 -07:00
parent dcaeff3175
commit b4d8c1fd1c

View File

@@ -24,7 +24,7 @@ import static android.Manifest.permission.READ_NETWORK_USAGE_HISTORY;
import static android.content.Intent.ACTION_SHUTDOWN;
import static android.content.Intent.ACTION_UID_REMOVED;
import static android.content.Intent.EXTRA_UID;
import static android.net.ConnectivityManager.CONNECTIVITY_ACTION;
import static android.net.ConnectivityManager.CONNECTIVITY_ACTION_IMMEDIATE;
import static android.net.NetworkStats.IFACE_ALL;
import static android.net.NetworkStats.SET_ALL;
import static android.net.NetworkStats.SET_DEFAULT;
@@ -239,7 +239,7 @@ public class NetworkStatsService extends INetworkStatsService.Stub {
}
// watch for network interfaces to be claimed
final IntentFilter connFilter = new IntentFilter(CONNECTIVITY_ACTION);
final IntentFilter connFilter = new IntentFilter(CONNECTIVITY_ACTION_IMMEDIATE);
mContext.registerReceiver(mConnReceiver, connFilter, CONNECTIVITY_INTERNAL, mHandler);
// listen for periodic polling events