Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit bb206054 authored by shafik's avatar shafik Committed by Nandana Dutt
Browse files

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
parent 2a02c8e3
Loading
Loading
Loading
Loading
+27 −0
Original line number Diff line number Diff line
@@ -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.
 *
+3 −0
Original line number Diff line number Diff line
@@ -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);
        }
    }