diff options
author | 2020-06-17 14:49:31 +0100 | |
---|---|---|
committer | 2020-06-26 19:02:26 +0000 | |
commit | bb206054d580c59b0e4ed1a63fb9acae02a3d0e6 (patch) | |
tree | 4a832a66f5f577b34480b8cf09c66c29e112bb13 /cmds | |
parent | 2a02c8e38190aeaa772ee9ab849a78c4137ca141 (diff) |
Add atom for general external storage access stats
Define a new pulled atom which will be logged in MediaProvider.
The atom collects general access stats for external storage:
* Total number of accesses
* Total number of file path accesses
* Total number of secondary storage accesses
* List of accesses mime types
Test: build
Test: make statsd_testdrive ; ./out/host/linux-x86/bin/statsd_testdrive \
-p com.google.android.providers.media.module 10085
Bug: 149669087
Change-Id: Ic0ebb040a05ec06603f1a617f290af6a2f21916d
Diffstat (limited to 'cmds')
-rw-r--r-- | cmds/statsd/src/atoms.proto | 27 | ||||
-rw-r--r-- | cmds/statsd/tools/localtools/src/com/android/statsd/shelltools/testdrive/TestDrive.java | 3 |
2 files changed, 30 insertions, 0 deletions
diff --git a/cmds/statsd/src/atoms.proto b/cmds/statsd/src/atoms.proto index dc20a02156cb..64d76f137602 100644 --- a/cmds/statsd/src/atoms.proto +++ b/cmds/statsd/src/atoms.proto @@ -588,6 +588,8 @@ message Atom { BytesTransferByTagAndMetered bytes_transfer_by_tag_and_metered = 10083 [(module) = "framework"]; DNDModeProto dnd_mode_rule = 10084 [(module) = "framework"]; + GeneralExternalStorageAccessStats general_external_storage_access_stats = + 10085 [(module) = "mediaprovider"]; } // DO NOT USE field numbers above 100,000 in AOSP. @@ -4542,6 +4544,31 @@ message VmsClientConnectionStateChanged { optional State state = 2; } +message MimeTypes { + repeated string mime_types = 1; +} + +/** + * Logs statistics regarding accesses to external storage. + * All stats are normalized for one day period. + * + * Logged from: + * packages/providers/MediaProvider/src/com/android/providers/media/MediaProvider.java + */ +message GeneralExternalStorageAccessStats { + optional int32 uid = 1 [(is_uid) = true]; + // Total number of accesses like creation, open, delete and rename/update. + // Includes file path and ContentResolver accesses + optional uint32 total_accesses = 2; + // Number of file path accesses, as opposed to file path and ContentResolver. + optional uint32 file_path_accesses = 3; + // Number of accesses on secondary volumes like SD cards. + // Includes file path and ContentResolver accesses + optional uint32 secondary_storage_accesses = 4; + // Comma-separated list of mime types that were accessed. + optional MimeTypes mime_types_accessed = 5; +} + /** * Logs when MediaProvider has successfully finished scanning a storage volume. * diff --git a/cmds/statsd/tools/localtools/src/com/android/statsd/shelltools/testdrive/TestDrive.java b/cmds/statsd/tools/localtools/src/com/android/statsd/shelltools/testdrive/TestDrive.java index 6384fb12ca68..51bcad115cc5 100644 --- a/cmds/statsd/tools/localtools/src/com/android/statsd/shelltools/testdrive/TestDrive.java +++ b/cmds/statsd/tools/localtools/src/com/android/statsd/shelltools/testdrive/TestDrive.java @@ -342,6 +342,9 @@ public class TestDrive { .addPullAtomPackages(PullAtomPackages.newBuilder() .setAtomId(Atom.TRAIN_INFO_FIELD_NUMBER) .addPackages("AID_STATSD")) + .addPullAtomPackages(PullAtomPackages.newBuilder() + .setAtomId(Atom.GENERAL_EXTERNAL_STORAGE_ACCESS_STATS_FIELD_NUMBER) + .addPackages("com.google.android.providers.media.module")) .setHashStringsInMetricReport(false); } } |