I think of open-source developers as people with a certain sense of social responsibility. In that regard, why would someone decide to contribute to Android? Why help Google make more money? How does the society benefit from such a contribution?
The external contributors to the Android codebase are not private hackers. They are companies with business models that depend on the support of the Android platform.
If you look at the email addresses of the contributors to the official Android sourcecode repository you will see that the vast majority of contributors seem to be Google employees. But if you look further, you will occasionally see contributions from people working at companies like:
- Qualcom (makes hardware for Android phones)
- Jetbrains (makes development tools for Android)
- Ittiam Systems (Develops video formats which Android can play)
- Various companies surrounding the ARM ecosystem
What do all these companies have in common? They are providing hardware or software which has strategic interests in the Android ecosystem. They want their products to be able to work flawlessly in, on or with Android devices. So they are providing the sourcecode to the Android project which ensures that.
This helps both Google and these companies. Google gets more features for their operating system and these companies get more happy end-users who use their products through the Android operating system.
This is actually a pattern which is anything but uncommon in the world of Open Source. The cliché of open source projects being developed by global teams of private volunteers driven by purely altruistic motivation is no longer true. Most of the large open source projects of today are mostly collaborations between large companies with aligning strategic interests. Even the Linux kernel is now mostly developed by companies.
Disclaimer: I haven't contributed to Android in any way, but I've been actively contributing to other open source projects.
Why help Google make more money? How does the society benefit from such a contribution?
Aspect 1 of 2: The Contributors' Objective
There may be all kinds of idealistic goals to open source software development, such as promoting the thought of giving away knowledge, and the results of it, for free, so as to making those things available to anyone. Possibly also to break the power of walled garden ecosystems under the control of large corporations.
While I certainly am in favour of such goals, I feel that my personal, concrete motivation when I contribute to some project - the one that brings me to the keyboard, that makes me enthusiastic about coding and rejoice when I've completed a feature or task - is much more "hands-on" (and probably not at all unusual): I love creating something that is useful to several people and simplifies or improves their lives.
In fact, that is also my motivation to work in my paid-for, non-open-source-related day-to-day job.
Based upon this rationale, it is easy to see how contributing to a widely used system can motivate people; whatever they create might pretty immediately benefit thousands of users.
Aspect 2 of 2: The Underlying Assumption
Beside the above statements, I would like to point out that what I perceive as your implied assumption - the contribution benefits Google, so it doesn't benefit the society - is based upon a misconception. The mere fact that someone else gains something on the path from your contribution to the end users' benefit does not reduce the end users' benefit in any way.
Be aware that we're doing the very same thing here, right now: We write questions and answers to help one another, while the company that runs the Stack Exchange Network makes some revenue. IMHO, this is totally fine.1
Hence, it is well possible that contributors to Android see their work as a benefit to society and accept that helping Google make more money is a sufficiently unproblematic side-effect that occurs at the same time without diminishing the former goal.
1: There are plenty of ways how this model can go wrong or be abused. A company who thrives on their users' content could hide that content behind a paywall, or change its business goals in such a way that the content is hardly of any use anymore for the people the platform was intended for. I'm merely saying that as long as these things do not occur, there is nothing wrong with the model.
In the core Android OS space, much of the free software effort is on alternative ROMs1, such as LineageOS, /e/, Paranoid Android, and the like. Many of these projects have removing Google's control as a principal aim: right now, the very first line on /e/'s website says "WE’RE OPEN! You can still shop for our unGoogled smartphones here". Nearly all install without the Google-tied core apps by default; you can put them back, by installing one of the compilations thereof such as MindTheGapps, but there has to be a deliberate decision, by you, at ROM installation time, to do so.
In the application space, much application development goes on without Google, and many apps are distributed with strongly-free licences. The classic repository of these is F-Droid, but you can go straight to a project's website (by way of random example, see Simple Email) and get an APK built by the authors, or indeed just get the source and build it yourself, should you so wish.
So it is perfectly possible to run a phone using Google-free Android, and only free apps. Indeed, I have used such a phone as my day-to-day handset for about a decade now. I haven't paid Google a penny, and to the best of my knowledge it has neither view into nor control over what I'm doing on my handset, so I don't see how Google has received any benefit from any of the considerable free-software development effort that has got me to this point. I don't know if you think such an outcome has social utility, but I certainly do, and I am very grateful to the hordes of free software developers on whose effort I rely.
1"ROM" being Android-speak for "operating system".
So there's a bug in an Android comapatibility library. If you change the icon of a FloatingActionButton after it's been laid out (I wanted to animate it), the display doesn't update. I download the source, make the one-line code fix, and used the modified version in my sources.
At that point, I can either file the bug report, and have the change show up in production source about 6 months later, or I can file the bug report with corrected sources atached, and have the changes show up in the next minor release, preferably before my product goes live.
Open Source Android is an incredible blessing.
First of all, Android != Google. Yes, Android is maintained and mostly developed by Google, and a key factor in Google’s business plans, but it is still open in the sense that the community can take it, fork it and use it any way they like, which includes use cases which might go against Google’s interests.
I think of open-source developers as people with a certain sense of social responsibility. In that regard, why would someone decide to contribute to Android?
As others have stated already, many contributors are major companies who themselves depend on Android for their own profit. If I were to nitpick, those with a sense of social responsibility develop free (as in free speech, not as in free beer) software, whereas those who develop open-source software believe that joining forces with other programmers solving a similar problem means more bang for fewer bucks for everyone involved.
Why help Google make more money?
The same could be said of anyone who contributes to the Linux kernel, or any of the many of widely-used libraries out there. Many of these are part of some company’s cash cow, and contributing to these projects might help a lot of companies make more money. (In particular, one of the products built upon the Linux kernel is Android.) So that is not exclusive to Android.
How does the society benefit from such a contribution?
As long as Google keeps Android an open-source project, they get an improved, feature-complete mobile operating system.
Personally, I entered the smartphone world in 2010 with a Freerunner. After trying the factory-installed SHR as well as FDOM (both being mobile-adapted Linux distributions) and finding neither of them suitable for everyday use, I checked out Android and had a clear favorite at once. Three devices later, I am still with Android (now on LineageOS), without any of the Google apps. I benefit from the OS and the open-source ecosystem around it (most notably F-Droid), but the only time Google has made a profit from it was when I bought my old Nexus S (which I promptly reinstalled with Cyanogenmod).
That being said, I asked a question a while back which approaches the Google vs. FOSS dilemma from the other side and which you might find interesting: Why is Android frequently taunted as “evil” in the FOSS community?
I've been contributing to various FLOSS projects over almost two decades now, and the dominant motivation for most if not all of my contributions wasn't some ideal of building a better future for the mankind. It was scratching my own itch. I know this also applies to many other contributors.
It always starts with a bug in a tool that you're using, or with a missing tool that you really need, or a bug in the Linux kernel that affects your company or your customers. Most of the time, waiting for someone else to do the work isn't really practical (like, the boss wants that issue fixed ASAP). So you go ahead and fix the bug (or develop that tool).
After that, job done, right? Well, there are two options:
- Keep that patch to yourself, have to apply it every time the software gets an update, keep distributing patched kernel versions to your customers. The rest of the world misses out, someone else will inevitably have to re-do the same work to fix it for themselves as well. But at least you don't support your competitors or Google.
- Submit that patch upstream, release that tool. This may have the nice effect of taking a part of the maintenance burden off your shoulders. You just tell your customers to update to a particular kernel version. Also, you get the complimentary warm fuzzies for making the world a better place.
Given that the second option doesn't cost you much extra (if anything), I don't find it too surprising that many developers opt for it.