Copy, paste, lawsuit
This week the US Supreme Court ruled in favor of Google in its 10-year legal battle against software giant Oracle, which had accused Google of copying around 12,000 lines of code during Google's development of Android — its mobile operating system software.
The code in question was from Oracle's Java application programming interface, and Oracle was hoping that it might be owed up to $9 billion in compensation, as Android went on to become the dominant operating system for mobile phones around the world. The Supreme Court saw things differently and ruled 6 to 2 that Google's use of the code counted as "fair use" under US copyright law.
The rise of Android
Back in 2009 making hardware (the smartphones themselves) was already enough of a challenge, and many manufacturers were loathe to either pay up for operating software, or invest a huge chunk of money in building their own. Google's master move was to make Android free and open source, allowing companies to build and customize on top of the Android OS, at no cost.
That model meant that, slowly but surely, pretty much every manufacturer except Apple abandoned their own operating systems in favor of Android, and at the latest count Android is the OS of choice for more than 70% of the mobile smartphone market according to data from StatCounter.
Android might be (mostly) free at the point of use, but it's a huge revenue generator for Google. The Google Play Store is the official app store for Android devices, and it's very likely a big chunk of the $21bn of revenue that Google reported as "other revenues" in 2020. On top of that you can add on all the revenue from Google Search, YouTube and other Google apps that usually come pre-loaded on Android devices.