About "No network connection" popup:
This popup is shown by Browser when it "thinks" it detected that network is down (it also sets its field mIsNetworkUp = false then).
It is done on receiving intent CONNECTIVITY_ACTION.
this is where intent CONNECTIVITY_ACTION comes from:
telephony framework ->
PhoneBase.notifyDataConnection() -> DefaultPhoneNotifier.notifyDataConnection() -> TelephonyRegistry.notifyDataConnection() ->
TelephonyRegistry.broadcastDataConnectionStateChanged() -> send intent ACTION_ANY_DATA_CONNECTION_STATE_CHANGED
MobileDataStateReceiver.onReceive ACTION_ANY_DATA_CONNECTION_STATE_CHANGED ->
NetworkStateTracker.setDetailedState() -> ConnectivityService.MyHandler.handleMessage() EVENT_STATE_CHANGED ->
ConnectivityManager.handleDisconnect() -> send intent CONNECTIVITY_ACTION
Browser shows "No network connection" popup if "EXTRA_NETWORK_INFO" from intent CONNECTIVITY_ACTION says it's unavailable (NetwotkInfo.isAvailable() returns false)
in documentation to ConnectivityManager.CONNECTIVITY_ACTION, one can read (please note marked fragment ***):
51 * If this is a connection that was the result of failing over from a
52 * disconnected network, then the FAILOVER_CONNECTION boolean extra is
53 * set to true.
54 * <p/>
55 * For a loss of connectivity, if the connectivity manager is attempting
56 * to connect (or has already connected) to another network, the
57 * NetworkInfo for the new network is also passed as an extra. This lets
58 * any receivers of the broadcast know that ***they should not necessarily
59 * tell the user that no data traffic will be possible. Instead, the
60 * reciever should expect another broadcast soon, indicating either that
61 * the failover attempt succeeded (and so there is still overall data
62 * connectivity), or that the failover attempt failed, meaning that all
This popup is shown by Browser when it "thinks" it detected that network is down (it also sets its field mIsNetworkUp = false then).
It is done on receiving intent CONNECTIVITY_ACTION.
this is where intent CONNECTIVITY_ACTION comes from:
telephony framework ->
PhoneBase.notifyDataConnection() -> DefaultPhoneNotifier.notifyDataConnection() -> TelephonyRegistry.notifyDataConnection() ->
TelephonyRegistry.broadcastDataConnectionStateChanged() -> send intent ACTION_ANY_DATA_CONNECTION_STATE_CHANGED
MobileDataStateReceiver.onReceive ACTION_ANY_DATA_CONNECTION_STATE_CHANGED ->
NetworkStateTracker.setDetailedState() -> ConnectivityService.MyHandler.handleMessage() EVENT_STATE_CHANGED ->
ConnectivityManager.handleDisconnect() -> send intent CONNECTIVITY_ACTION
Browser shows "No network connection" popup if "EXTRA_NETWORK_INFO" from intent CONNECTIVITY_ACTION says it's unavailable (NetwotkInfo.isAvailable() returns false)
in documentation to ConnectivityManager.CONNECTIVITY_ACTION, one can read (please note marked fragment ***):
51 * If this is a connection that was the result of failing over from a
52 * disconnected network, then the FAILOVER_CONNECTION boolean extra is
53 * set to true.
54 * <p/>
55 * For a loss of connectivity, if the connectivity manager is attempting
56 * to connect (or has already connected) to another network, the
57 * NetworkInfo for the new network is also passed as an extra. This lets
58 * any receivers of the broadcast know that ***they should not necessarily
59 * tell the user that no data traffic will be possible. Instead, the
60 * reciever should expect another broadcast soon, indicating either that
61 * the failover attempt succeeded (and so there is still overall data
62 * connectivity), or that the failover attempt failed, meaning that all
63 * connectivity has been lost.***
一半都是根据cs来判断的,ps一半不判断。据说htc是根据了ps来判断的,这要根据具体的运营商来定制了