Google Play Services (
com.google.android.gms) is an app which works in collaboration with a number of other closed-source apps to provide Google Mobile Services (GMS) to Android users. To quote a few of them are Google Ads, Firebase Analytics, authentication (of Google account login, saving credentials from other apps, through SMS), Google Cast devices, Game Manager, Drive, Cloud Messaging (push notifications), Google Fit, Location Provider, Maps, Instant Apps, nearby devices, search predictions, Google+, SafetyNet, Tasks, Wallet etc. Further details can be found here and here. Play Store (
com.android.vending) provides additional APIs/services like In-App Purchases, App Licensing and Play Protect.
From your comment:
So is it only APIs for app integration, or is there also Google's internal proprietary code for analytics, usage tracking, metrics etc?
Developers can tell better, but AFAIU everything is proprietary except the API interferes. Google's own proprietary apps like YouTube, Chrome, Gmail, Maps, Gboard, Messages etc. rely on these APIs/services, and mostly refuse to work without GMS on device. In addition to those, OEMs are bound in contracts to ship their devices with Play Services pre-installed as system apps. App developers find it more convenient to build their apps with Google APIs. In fact many AOSP features are becoming dependent on Google's proprietary products unnoticeably. Quoted from here:
The Doze restriction on network access is also likely to affect your app, especially if the app relies on real-time messages such as tickles or notifications. If your app requires a persistent connection to the network to receive messages, you should use Firebase Cloud Messaging (FCM) if possible.
FCM is optimized to work with Doze and App Standby idle modes by means of high-priority FCM messages.
If you have GMS installed on your device,
dumpsys activity services will usually show more than a dozen Google services running in background like MeasurementBrokerService, PersistentBoundBrokerService, ContextManagerService and GcmService etc.
Also, how is the functionality split between Google Play Services and the Google Services Framework?
There are a number of apps which work in background with Play Services like Services Library, Shared Library, Carrier Setup, Market Feedback Agent, Backup Transport, Config Updater, Contacts Sync, Partner Setup and so on. A more exhaustive list can be found here. Google Services Framework (
com.google.android.gsf) is also one of these apps (sharing UID with
com.google.android.gms) which is mainly about Cloud Messaging (FCM) but there isn't a clear line (at least officially spoken) between functionality of different components of GMS suite.