| 1 |
/* |
| 2 |
* Copyright (C) 2018 The Android Open Source Project |
| 3 |
* |
| 4 |
* Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 |
* you may not use this file except in compliance with the License. |
| 6 |
* You may obtain a copy of the License at |
| 7 |
* |
| 8 |
* http://www.apache.org/licenses/LICENSE-2.0 |
| 9 |
* |
| 10 |
* Unless required by applicable law or agreed to in writing, software |
| 11 |
* distributed under the License is distributed on an "AS IS" BASIS, |
| 12 |
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 |
* See the License for the specific language governing permissions and |
| 14 |
* limitations under the License. |
| 15 |
*/ |
| 16 |
|
| 17 |
syntax = "proto2"; |
| 18 |
package com.android.server.usage; |
| 19 |
import "frameworks/base/core/proto/android/content/configuration.proto"; |
| 20 |
import "frameworks/base/core/proto/android/privacy.proto"; |
| 21 |
|
| 22 |
option java_multiple_files = true; |
| 23 |
|
| 24 |
message IntervalStatsProto { |
| 25 |
message StringPool { |
| 26 |
optional int32 size = 1; |
| 27 |
repeated string strings = 2; |
| 28 |
} |
| 29 |
|
| 30 |
message CountAndTime { |
| 31 |
optional int32 count = 1; |
| 32 |
optional int64 time_ms = 2; |
| 33 |
} |
| 34 |
|
| 35 |
// Stores the relevant information from a UsageStats |
| 36 |
message UsageStats { |
| 37 |
message ChooserAction { |
| 38 |
message CategoryCount { |
| 39 |
optional string name = 1; |
| 40 |
optional int32 count = 3; |
| 41 |
} |
| 42 |
optional string name = 1; |
| 43 |
repeated CategoryCount counts = 3; |
| 44 |
} |
| 45 |
optional string package = 1; |
| 46 |
// package_index contains the index + 1 of the package name in the string pool |
| 47 |
optional int32 package_index = 2; |
| 48 |
// Time attributes stored as an offset of the IntervalStats's beginTime. |
| 49 |
optional int64 last_time_active_ms = 3; |
| 50 |
optional int64 total_time_active_ms = 4; |
| 51 |
optional int32 last_event = 5; |
| 52 |
optional int32 app_launch_count = 6; |
| 53 |
repeated ChooserAction chooser_actions = 7; |
| 54 |
// Time attributes stored as an offset of the IntervalStats's beginTime. |
| 55 |
optional int64 last_time_service_used_ms = 8; |
| 56 |
optional int64 total_time_service_used_ms = 9; |
| 57 |
// Time attributes stored as an offset of the IntervalStats's beginTime. |
| 58 |
optional int64 last_time_visible_ms = 10; |
| 59 |
optional int64 total_time_visible_ms = 11; |
| 60 |
// Time attributes stored as an offset of the IntervalStats's beginTime. |
| 61 |
optional int64 last_time_component_used_ms = 12; |
| 62 |
} |
| 63 |
|
| 64 |
// Stores the relevant information an IntervalStats will have about a Configuration |
| 65 |
message Configuration { |
| 66 |
optional .android.content.ConfigurationProto config = 1; |
| 67 |
optional int64 last_time_active_ms = 2; |
| 68 |
optional int64 total_time_active_ms = 3; |
| 69 |
optional int32 count = 4; |
| 70 |
optional bool active = 5; |
| 71 |
} |
| 72 |
|
| 73 |
// Stores the relevant information from a UsageEvents.Event |
| 74 |
message Event { |
| 75 |
optional string package = 1; |
| 76 |
// package_index contains the index + 1 of the package name in the string pool |
| 77 |
optional int32 package_index = 2; |
| 78 |
optional string class = 3; |
| 79 |
// class_index contains the index + 1 of the class name in the string pool |
| 80 |
optional int32 class_index = 4; |
| 81 |
optional int64 time_ms = 5; |
| 82 |
optional int32 flags = 6; |
| 83 |
optional int32 type = 7; |
| 84 |
optional .android.content.ConfigurationProto config = 8; |
| 85 |
optional string shortcut_id = 9; |
| 86 |
optional int32 standby_bucket = 11; |
| 87 |
optional string notification_channel = 12; |
| 88 |
// notification_channel_index contains the index + 1 of the channel name in the string pool |
| 89 |
optional int32 notification_channel_index = 13; |
| 90 |
// If class field is an Activity, instance_id is a unique id of the |
| 91 |
// Activity object. |
| 92 |
optional int32 instance_id = 14; |
| 93 |
// task_root_package_index contains the index + 1 of the task root package name in the string |
| 94 |
// pool |
| 95 |
optional int32 task_root_package_index = 15; |
| 96 |
// task_root_class_index contains the index + 1 of the task root class name in the string pool |
| 97 |
optional int32 task_root_class_index = 16; |
| 98 |
// locus_id_index contains the index + 1 of the locus id in the string pool |
| 99 |
optional int32 locus_id_index = 17; |
| 100 |
} |
| 101 |
|
| 102 |
// The following fields contain supplemental data used to build IntervalStats, such as a string |
| 103 |
// pool. |
| 104 |
optional int64 end_time_ms = 1; |
| 105 |
// stringpool contains all the package and class names used by UsageStats and Event |
| 106 |
// They will hold a number that is equal to the index + 1 of their string in the pool |
| 107 |
optional StringPool stringpool = 2; |
| 108 |
optional int32 major_version = 3; |
| 109 |
optional int32 minor_version = 4; |
| 110 |
|
| 111 |
// The following fields contain aggregated usage stats data |
| 112 |
optional CountAndTime interactive = 10; |
| 113 |
optional CountAndTime non_interactive = 11; |
| 114 |
optional CountAndTime keyguard_shown = 12; |
| 115 |
optional CountAndTime keyguard_hidden = 13; |
| 116 |
|
| 117 |
// The following fields contain listed usage stats data |
| 118 |
repeated UsageStats packages = 20; |
| 119 |
repeated Configuration configurations = 21; |
| 120 |
repeated Event event_log = 22; |
| 121 |
} |