What is the exact functionality of Google Play Services & Google Services Framework (gapps)? Is there an official or unofficial description of what is the exact functionality of Google Play Services and Google Services Framework (gapps) apart from things related to the Play Store account-related functions?

From my understanding it includes at least:


GPS location
ads, tracking and stats
GCM (Google cloud messaging for push notifications)
everything related to managing Google accounts, services and Google user profile data.
apparently some machine learning pre-trained models for voice recognition, TTS, keyboard gesture typing.


What else?

The question came up after I noticed that for example the Google Podcasts app size is only about 300Kb and it won't work without gapps, so that indicates that some core functionality is already in gapps. 

The combined size of Google Services Framework + Google Play services is over 700MB — this is enough for an entire operating system. So what exactly does this code do?


 Update: correction about the Google Podcasts app — I have identified that the tiny size of the app is explained by its dependency on the Google app and not just the GSF.
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.

FURTHER READING:


Install Google Play Services without Google Play Store
What Is Google Play Services? Why Do You Need It?
GMS Certification for Android 9 Pie Based Devices
The facts about Google Mobile Services (GMS) in the Enterprise