I don’t understand why Google didn’t just made Android closed source. They would’ve made custom roms impossible and therefore more able to control and spy on it’s users. Why did Google made Android open source, while Microsoft’s Windows is still closed source to this day?
The GPL. Linux (which Android uses) is licensed under the GPL license, which protects the libre/open source project and stops it from being turned closed source by someone else. Other parts of Android are the same.