The actual processing happens on a microcontroller, not on the main application core. In some cases it is a small hexagon core on the main CPU, in other cases an actually separate Cortex-M3 (or the like). Doing this sort of thing on the main CPU would cause too much power draw due to frequent wakes.
The microcontroller OS code lives here: https://android.googlesource.com/device/google/contexthub/+/... It supports loading binary "micro-apps" (with optional encryption and/or signing) and provides them an API to use to gain sensor data access. Sensor drivers are also loaded as micro-apps. As is the "communicate with the main android CPU" code. It is also a micro-app. The OS itself is little more than an event loop, some power management, timer provider, and the loader of micro-apps in a particular format.
Activity detection is one of such micro-apps and is, as far as I know, not itself open source.
Source: I was the TL for this project back in the day
The microcontroller OS code lives here: https://android.googlesource.com/device/google/contexthub/+/... It supports loading binary "micro-apps" (with optional encryption and/or signing) and provides them an API to use to gain sensor data access. Sensor drivers are also loaded as micro-apps. As is the "communicate with the main android CPU" code. It is also a micro-app. The OS itself is little more than an event loop, some power management, timer provider, and the loader of micro-apps in a particular format.
Activity detection is one of such micro-apps and is, as far as I know, not itself open source.
Source: I was the TL for this project back in the day