An Oracle lawyer has blurted out in court how much money Google has made from Android – figures that the web giant has fiercely fought to keep secret.

And those numbers are: US$31bn in revenue, and US$22bn in profit, since 2008, when Android was launched. This money comes from Google's cut from sales made via the Google Play store and adverts shown in apps.

Oracle is in the middle of suing Google in the US for copyright infringement, accusing the search kingpin of ripping off the Java language APIs in Android. Oracle acquired Java when it bought Sun Microsystems in 2010, and promptly sued Google for using its class library API on Android without paying a dime for it.

In effect, Oracle is arguing that it can copyright software interfaces – not the software itself, just the way it interfaces with other code.

Android initially used a Java class library derived from Apache's open-source Harmony project, and is in the process of switching to code from the open-source OpenJDK project, which is developed by Oracle.

Regardless of that switch, Oracle wants a hefty chunk of money – as much as $1bn – that Google made from Android between 2008 and last year. Over the past few weeks, the pair have been squabbling over exactly how much Google has been coining it from the mobile operating system. Oracle, which spent US$5.6bn acquiring Sun and its Java platforms, wants stats and figures on Android's use.

On January 14, Oracle lawyer Annette Hurst revealed during a San Francisco court hearing details of Android's financial performance, using figures derived from Google's own internal numbers that were supposed to be under a protection order during the copyright battle.

"Look at the extraordinary magnitude of commerciality here,” Hurst told the court while spelling out the revenue and profit.

It also emerged during the proceedings that Apple was paid $1bn by Google in 2014 to keep its search engine as the default on iPhones.

Google pleaded with the court to remove the financial information from the hearing's transcripts, and place the numbers under seal. After that request was shot down on January 19, the next day Google begged the court [PDF] to reconsider. In a filing, Google lawyer Edward Bayley wrote:

During the January 14, 2016 discovery hearing on Oracle's Motion to Compel, counsel for Oracle disclosed information regarding Google's sensitive, non-public revenues and profits associated with Android. This information was derived from internal Google financial documents that Google has designated as "HIGHLY CONFIDENTIAL — ATTORNEY'S EYES ONLY" under the Protective Order that governs this case. Google does not publicly allocate revenues or profits to Android separate and apart from Google's general business. Google considers that non-public financial data to be highly sensitive, and public disclosure of the information described herein could have significant negative effects on Google's business.

Magistrate Judge Donna Ryu is considering [PDF] Google's latest plea.

You can follow the drama along at home using case ID number 3:10-cv-03561 in the northern district of California. The transcripts from last week's hearing are not due to be published until April, though. ®