basis of reverse engineering
Google used the clean-room-developed Apache Harmony project for Android, which yes, used the same API call structure. They re-wrote all the content of those APIs to match up, but not using any of the actual Sun code. This is how reverse-engineering works (see BIOS, Linux, ... for examples).
If I took, say, one of the Harry Potter books, grabbed up the chapter titles BUT wrote new material under each, and put it out under a new title, would Rowling have any grounds for infringement? Doubtful.
Oracle is widely believed to have bought up Sun specifically to monetize Java (initially they'd only wanted the software side of the business and not SPARC; McNealy insisted on the whole bundle). Then Android went and took over the mobile world and Larry got peeved no one wanted to pony up for Java ME, so he unleashed the lawyers. Until Oracle threw in the patent issue, which sent it to the patent-friendly appeals court, they'd been losing consistently. Now Google is trying to hold onto that by begging the Supremes to ignore common engineering practice and make Google pay out.