1syntax = "proto2"; 2 3option java_multiple_files = true; 4option java_package = "com.android.settings.fuelgauge.batteryusage"; 5option java_outer_classname = "AppUsageEventProto"; 6 7enum AppUsageEventType { 8 UNKNOWN = 0; 9 ACTIVITY_RESUMED = 1; 10 ACTIVITY_STOPPED = 2; 11 DEVICE_SHUTDOWN = 3; 12} 13 14message AppUsageEvent { 15 // Timestamp of the usage event. 16 optional int64 timestamp = 1; 17 // Type of the usage event. 18 optional AppUsageEventType type = 2; 19 // Package name of the app. 20 optional string package_name = 3; 21 // Instance ID for the activity. This is important for matching events of 22 // different event types for the same instance because an activity can be 23 // instantiated multiple times. Only available on Q builds after Dec 13 2018. 24 optional int32 instance_id = 4; 25 // Package name of the task root. For example, if a Twitter activity starts a 26 // Chrome activity within the same task, then while package_name is Chrome, 27 // task_root_package_name will be Twitter. 28 // Note: Activities that are task roots themselves (most activities) will have 29 // this field is populated as package_name. 30 // Note: The task root might be missing due to b/123404490. 31 optional string task_root_package_name = 5; 32 optional int64 user_id = 6; 33 optional int64 uid = 7; 34} 35 36// Represents a continuous period of time when an app is used. 37message AppUsagePeriod { 38 // Start of the usage period. 39 optional int64 start_time = 1; 40 // End of the usage period. 41 optional int64 end_time = 2; 42} 43 44enum AppUsageEndPointType { 45 START = 1; 46 END = 2; 47} 48 49// The endpoint (the beginning or the end) of an AppUsagePeriod. 50message AppUsageEndPoint { 51 // Type of the end point. 52 optional AppUsageEndPointType type = 1; 53 // Timestamp of the end point. 54 optional int64 timestamp = 2; 55} 56