Add statistics logging for MediaProvider.
As part of becoming a Mainline module, we need to understand basic
information about the health of our module in the wild. For the
MediaProvider module, we're interested in identifying these cases:
-- When scan operations result in an unexpectedly large number of
inserts, updates, or deletes in proportion to the total number of
files indexed. This typically indicates user data loss or a missing
database upgrade step.
-- When the overall duration of scan operations becomes significantly
slower in relation to the number of files indexed. This typically
indicates an indexing performance regression.
-- When a scan operation skips over an entire directory tree. This
can indicate an app placing ".nomedia" files in unexpected locations.
-- When a large number of media files are deleted by a specific
app. This can help identify data loss bugs caused by MediaProvider
directly, or attribute data loss bugs in other apps.
-- When database upgrade/downgrade operations take a substantial
amount of time in proportion to the total number of files. This
typically indicates a performance regression.
-- When performing idle maintenance, a large number of stale or
expiring media can indicate an invalidation bug.
Bug: 143723019
Test: manual
Change-Id: I89c5b5b51a843a67348a7bb4b8e6ac01fb2b15b9
diff --git a/cmds/statsd/src/StatsService.cpp b/cmds/statsd/src/StatsService.cpp
index 1fd3abf..e8c0e15 100644
--- a/cmds/statsd/src/StatsService.cpp
+++ b/cmds/statsd/src/StatsService.cpp
@@ -1275,7 +1275,7 @@
// Permission check not necessary as it's meant for applications to write to
// statsd.
android::util::stats_write(util::APP_BREADCRUMB_REPORTED,
- IPCThreadState::self()->getCallingUid(), label,
+ (int32_t) IPCThreadState::self()->getCallingUid(), label,
state);
return Status::ok();
}