time_in_state: handle SDK sandbox UIDs

Add a check to detect UIDs in the SDK sandbox range. CPU times for
these UIDs will be attributed to corresponding app UID, calculated by
subtracting a fixed offset from the current UID. We also attribute
these times to AID_SDK_SANDBOX, a UID reserved specifically for the
purpose of collecting aggregate stats across all SDK sandbox uids.

To avoid redundant code, factor out per-UID accounting logic into a
helper function that we can call twice in this new case.

Add a new test case to verify such UIDs are handled correctly.

Test: atest --test-mapping system/bpfprogs
Bug: 219080829
Signed-off-by: Connor O'Brien <connoro@google.com>
Change-Id: I6aa5404a2201c2583e7b6a1292d3c80b9e3ec5cb
2 files changed
tree: e6140a0f4342ce098cdda4030a748b1d6867ece3
  1. test/
  2. Android.bp
  3. fuse_media.c
  4. LICENSE
  5. METADATA
  6. OWNERS
  7. PREUPLOAD.cfg
  8. TEST_MAPPING
  9. time_in_state.c
  10. time_in_state_test.cpp