From 606454c2f8e3acfa51ffbadc5697d98c39d390fa Mon Sep 17 00:00:00 2001 From: Stanislav Zholnin Date: Wed, 27 Nov 2019 15:31:49 +0000 Subject: [PATCH] Add atom for reporting of AppOps access messages (including stack traces). Bug: 146045420 Test: builds, can't be tested on its own Change-Id: I4e07c297a43048fa7aeafb043f712d420f704447 --- cmds/statsd/src/atoms.proto | 37 +++++++++++++++++++++++++++++++++++-- 1 file changed, 35 insertions(+), 2 deletions(-) diff --git a/cmds/statsd/src/atoms.proto b/cmds/statsd/src/atoms.proto index 2bacfbc573959..c4d9d24d24d38 100644 --- a/cmds/statsd/src/atoms.proto +++ b/cmds/statsd/src/atoms.proto @@ -337,7 +337,7 @@ message Atom { } // Pulled events will start at field 10000. - // Next: 10069 + // Next: 10070 oneof pulled { WifiBytesTransfer wifi_bytes_transfer = 10000; WifiBytesTransferByFgBg wifi_bytes_transfer_by_fg_bg = 10001; @@ -407,6 +407,7 @@ message Atom { NotificationRemoteViews notification_remote_views = 10066; DangerousPermissionStateSampled dangerous_permission_state_sampled = 10067; GraphicsStats graphics_stats = 10068; + RuntimeAppOpsAccess runtime_app_ops_access = 10069; } // DO NOT USE field numbers above 100,000 in AOSP. @@ -6846,7 +6847,7 @@ message AppOps { // Uid of the package requesting the op optional int32 uid = 1 [(is_uid) = true]; - // Nmae of the package performing the op + // Name of the package performing the op optional string package_name = 2; // operation id; maps to the OP_* constants in AppOpsManager.java @@ -7632,3 +7633,35 @@ message GraphicsStats { // more apps are running / rendering. optional bool is_today = 16; } + +/** + * Message related to dangerous (runtime) app ops access + */ +message RuntimeAppOpsAccess { + // Uid of the package accessing app op + optional int32 uid = 1 [(is_uid) = true]; + + // Name of the package accessing app op + optional string package_name = 2; + + // operation id; maps to the OP_* constants in AppOpsManager.java + optional int32 op_id = 3; + + // feature id; provided by developer when accessing related API, limited at 50 chars by API. + // Features must be provided through manifest using tag available in R and above. + optional string feature_id = 4; + + // message related to app op access, limited to 600 chars by API + optional string message = 5; + + enum SamplingStrategy { + DEFAULT = 0; + UNIFORM = 1; + RARELY_USED = 2; + } + + // sampling strategy used to collect this message + optional SamplingStrategy sampling_strategy = 6; +} + +