This is an update/replacement for pull request https://github.com/piwik/piwik/pull/160
Unit test failures are fixed and commits are squashed to 4 chunks.
We plan to use DevicesDetection plugin only going forward. Therefore would you consider instead adding the right detection to the UserAgentParserEnhanced? see: http://dev.piwik.org/trac/ticket/3962#ticket
I prefer not to make changes to UserAgentParser before 2.0 since it could introduce regressions (this code is not well tested unfortunately, but UserAgentParserEnhanced has reasonnable test suite)