Add SUPL-specific network bcast
Move SUPL CONNECTIVITY_ACTION bcasts to a different, hidden intent to reduce the churn of apps when SUPL comes/goes. Short term hack until SUPL moves to use the new APIs and there's no bcast. bug:23350688 Change-Id: I3dc14b42afa72465260aa41ccedfe1df27baabd9
This commit is contained in:
@@ -99,6 +99,16 @@ public class ConnectivityManager {
|
||||
@SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION)
|
||||
public static final String CONNECTIVITY_ACTION = "android.net.conn.CONNECTIVITY_CHANGE";
|
||||
|
||||
/**
|
||||
* A temporary hack until SUPL system can get off the legacy APIS.
|
||||
* They do too many network requests and the long list of apps listening
|
||||
* and waking due to the CONNECTIVITY_ACTION bcast makes it expensive.
|
||||
* Use this bcast intent instead for SUPL requests.
|
||||
* @hide
|
||||
*/
|
||||
public static final String CONNECTIVITY_ACTION_SUPL =
|
||||
"android.net.conn.CONNECTIVITY_CHANGE_SUPL";
|
||||
|
||||
/**
|
||||
* The device has connected to a network that has presented a captive
|
||||
* portal, which is blocking Internet connectivity. The user was presented
|
||||
|
||||
@@ -1524,10 +1524,14 @@ public class ConnectivityService extends IConnectivityManager.Stub
|
||||
|
||||
final long ident = Binder.clearCallingIdentity();
|
||||
if (ConnectivityManager.CONNECTIVITY_ACTION.equals(intent.getAction())) {
|
||||
final NetworkInfo ni = intent.getParcelableExtra(
|
||||
ConnectivityManager.EXTRA_NETWORK_INFO);
|
||||
if (ni.getType() == ConnectivityManager.TYPE_MOBILE_SUPL) {
|
||||
intent.setAction(ConnectivityManager.CONNECTIVITY_ACTION_SUPL);
|
||||
intent.addFlags(Intent.FLAG_RECEIVER_REGISTERED_ONLY);
|
||||
}
|
||||
final IBatteryStats bs = BatteryStatsService.getService();
|
||||
try {
|
||||
NetworkInfo ni = intent.getParcelableExtra(
|
||||
ConnectivityManager.EXTRA_NETWORK_INFO);
|
||||
bs.noteConnectivityChanged(intent.getIntExtra(
|
||||
ConnectivityManager.EXTRA_NETWORK_TYPE, ConnectivityManager.TYPE_NONE),
|
||||
ni != null ? ni.getState().toString() : "?");
|
||||
|
||||
Reference in New Issue
Block a user