How does Android measure connectivity state? I know Android has some sort of connectivity measurement, because when there's connectivity the wifi or phone network icons will turn either green or blue, depending on the Android version.

In my opinion, this measurement isn't perfect, because although it will indicate accurately the absence of connectivity (e.g., lost wifi connectivity), it is not so accurate when the phone is connected to the Internet: at work, my Defy running Cyanogen 9 (Android 4.0.4) has icons that are always gray, no matter what, even when the connection is obviously up (see image below).

I wonder how, exactly, Android measures the connectivity status. Is it by performing a ping or other sort of probing of a server? By listening to a port? By testing if some protocol is enabled? Or what? This accepted answer to a closely related question doesn't seem to answer it.
All of the information about it is pretty vague. Probably because they don't want people attacking a particular Google server.

For instance, the Samsung Galaxy Tab 10.1 owners manual has this to say:


  Note: Network status icons turn blue if you have a Google Account added to
  your tablet and the tablet is connected to Google services for syncing
  your Gmail, Calendar events, contacts, backing up your settings, and
  so on. If you do not have a Google Account or if, for example, you are
  connected to a Wi-Fi network that is not connected to the Internet, the
  network icons are gray.