Ubuntu One for Music source code on launchpad contains libGoogleAnalytics.jar which is proprietary. The license declares Gnu Affero Gpl license. Is this legal and why is it done?
Well, to cover your licensing query, anyone who contributes code to Ubuntu One, and several other Canonical projects, must sign a contribution agreement which contains the following clause:
This means Canonical can release it simultaneously under as many different licences as they like, as long as one of them is the license the code was initially contributed under. So the source code on Launchpad might be AGPL, but the binary on Android Market isn't necessarily. So this situation is exactly why the contribution agreement exists.
Note that the libGoogleAnalytics.jar has just been removed from the launchpad source, see this bug report.