Load app usage events data in the hourly job.

Test: make RunSettingsRoboTests + manual
Bug: 260964679
Change-Id: Iaccaa77bd52fb7356cdcb786c64523f21040b128
This commit is contained in:
Kuan Wang
2022-12-08 10:21:43 +08:00
parent 52ad3ba925
commit 6c4f83f33d
29 changed files with 1590 additions and 93 deletions

View File

@@ -13,4 +13,12 @@ java_library {
type: "lite",
},
srcs: ["fuelgauge_usage_state.proto"],
}
java_library {
name: "app-usage-event-protos-lite",
proto: {
type: "lite",
},
srcs: ["app_usage_event.proto"],
}

View File

@@ -0,0 +1,34 @@
syntax = "proto2";
option java_multiple_files = true;
option java_package = "com.android.settings.fuelgauge.batteryusage";
option java_outer_classname = "AppUsageEventProto";
enum AppUsageEventType {
UNKNOWN = 0;
ACTIVITY_RESUMED = 1;
ACTIVITY_STOPPED = 2;
DEVICE_SHUTDOWN = 3;
}
message AppUsageEvent {
// Timestamp of the usage event.
optional int64 timestamp = 1;
// Type of the usage event.
optional AppUsageEventType type = 2;
// Package name of the app.
optional string package_name = 3;
// Instance ID for the activity. This is important for matching events of
// different event types for the same instance because an activity can be
// instantiated multiple times. Only available on Q builds after Dec 13 2018.
optional int32 instance_id = 4;
// Package name of the task root. For example, if a Twitter activity starts a
// Chrome activity within the same task, then while package_name is Chrome,
// task_root_package_name will be Twitter.
// Note: Activities that are task roots themselves (most activities) will have
// this field is populated as package_name.
// Note: The task root might be missing due to b/123404490.
optional string task_root_package_name = 5;
optional int64 user_id = 6;
optional int64 uid = 7;
}