From f5ef0acb9fcc4377191160b321e766c464eb6878 Mon Sep 17 00:00:00 2001 From: Yi Jin Date: Mon, 4 Dec 2017 14:29:37 -0800 Subject: [PATCH] Define fields in incident header and add a new proto to log internal incidentd metadata Bug: 65451198 Test: N/A Change-Id: Iaa3329ab06ccb2060f9e7a01d61bd8b808a507e1 --- core/proto/android/os/incident.proto | 11 +++++++- core/proto/android/os/incidentheader.proto | 32 ++++++++++++++++------ 2 files changed, 34 insertions(+), 9 deletions(-) diff --git a/core/proto/android/os/incident.proto b/core/proto/android/os/incident.proto index 8ed958dcfec49..4015a7e7cea96 100644 --- a/core/proto/android/os/incident.proto +++ b/core/proto/android/os/incident.proto @@ -45,12 +45,21 @@ import "frameworks/base/libs/incident/proto/android/section.proto"; package android.os; +// This field contains internal metadata associated with an incident report, +// such as the section ids and privacy policy specs from caller as well as how long +// and how many bytes a section takes, etc. +message IncidentMetadata { + +} + // privacy field options must not be set at this level because all // the sections are able to be controlled and configured by section ids. // Instead privacy field options need to be configured in each section proto message. message IncidentProto { - // Incident header + // Incident header from callers repeated IncidentHeaderProto header = 1; + // Internal metadata of incidentd + optional IncidentMetadata metadata = 2; // Device information optional SystemPropertiesProto system_properties = 1000 [ diff --git a/core/proto/android/os/incidentheader.proto b/core/proto/android/os/incidentheader.proto index ce924da5ee3a5..f0c736a866a60 100644 --- a/core/proto/android/os/incidentheader.proto +++ b/core/proto/android/os/incidentheader.proto @@ -16,18 +16,34 @@ syntax = "proto2"; option java_multiple_files = true; -option java_outer_classname = "IncidentHeaderProtoMetadata"; package android.os; +// IncidentHeaderProto contains extra information the caller of incidentd want to +// attach in an incident report, the data should just be informative. message IncidentHeaderProto { - enum Cause { - CAUSE_UNKNOWN = 0; - CAUSE_USER = 1; - CAUSE_ANR = 2; - CAUSE_CRASH = 3; + + // From statsd config, the name of the anomaly, usually human readable. + optional string incident_name = 1; + + // Format a human readable reason why an incident report is requested. + // It's optional and may directly come from a user clicking the bug-report button. + optional string reason = 2; + + // From statsd, the metric which causes the anomaly triggered. + optional string metric_name = 3; + + // From statsd, the metric value exceeds the threshold. This is useful for + // ValueMetric and GaugeMetric. + oneof metric_value { + int64 int64_value = 4; + double double_value = 5; } - optional Cause cause = 1; + // Defines which stats config used to fire the request. + message StatsdConfigKey { + optional int32 uid = 1; + optional string name = 2; + } + optional StatsdConfigKey config_key = 6; } -