Michael Wachenschwanz | c8c2636 | 2018-09-07 14:59:25 -0700 | [diff] [blame] | 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"; |
Joe Onorato | 99598ee | 2019-02-11 15:55:13 +0000 | [diff] [blame] | 20 | import "frameworks/base/core/proto/android/privacy.proto"; |
Michael Wachenschwanz | c8c2636 | 2018-09-07 14:59:25 -0700 | [diff] [blame] | 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; |
Hui Yu | e361a23 | 2018-10-04 15:05:21 -0700 | [diff] [blame] | 48 | // Time attributes stored as an offset of the IntervalStats's beginTime. |
Michael Wachenschwanz | c8c2636 | 2018-09-07 14:59:25 -0700 | [diff] [blame] | 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; |
Hui Yu | e361a23 | 2018-10-04 15:05:21 -0700 | [diff] [blame] | 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; |
Hui Yu | 03d1240 | 2018-12-06 18:00:37 -0800 | [diff] [blame] | 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; |
Michael Wachenschwanz | c8c2636 | 2018-09-07 14:59:25 -0700 | [diff] [blame] | 60 | } |
| 61 | |
| 62 | // Stores the relevant information an IntervalStats will have about a Configuration |
| 63 | message Configuration { |
| 64 | optional .android.content.ConfigurationProto config = 1; |
| 65 | optional int64 last_time_active_ms = 2; |
| 66 | optional int64 total_time_active_ms = 3; |
| 67 | optional int32 count = 4; |
| 68 | optional bool active = 5; |
| 69 | } |
| 70 | |
| 71 | // Stores the relevant information from a UsageEvents.Event |
| 72 | message Event { |
| 73 | optional string package = 1; |
| 74 | // package_index contains the index + 1 of the package name in the string pool |
| 75 | optional int32 package_index = 2; |
| 76 | optional string class = 3; |
| 77 | // class_index contains the index + 1 of the class name in the string pool |
| 78 | optional int32 class_index = 4; |
| 79 | optional int64 time_ms = 5; |
| 80 | optional int32 flags = 6; |
| 81 | optional int32 type = 7; |
| 82 | optional .android.content.ConfigurationProto config = 8; |
| 83 | optional string shortcut_id = 9; |
| 84 | optional int32 standby_bucket = 11; |
| 85 | optional string notification_channel = 12; |
Michael Wachenschwanz | c90bc15 | 2018-09-10 15:17:57 -0700 | [diff] [blame] | 86 | // notification_channel_index contains the index + 1 of the channel name in the string pool |
| 87 | optional int32 notification_channel_index = 13; |
Hui Yu | 03d1240 | 2018-12-06 18:00:37 -0800 | [diff] [blame] | 88 | // If class field is an Activity, instance_id is a unique id of the |
| 89 | // Activity object. |
| 90 | optional int32 instance_id = 14; |
Michael Wachenschwanz | 0b4ab1f | 2019-01-07 13:59:10 -0800 | [diff] [blame] | 91 | // task_root_package_index contains the index + 1 of the task root package name in the string |
| 92 | // pool |
| 93 | optional int32 task_root_package_index = 15; |
| 94 | // task_root_class_index contains the index + 1 of the task root class name in the string pool |
| 95 | optional int32 task_root_class_index = 16; |
Michael Wachenschwanz | c8c2636 | 2018-09-07 14:59:25 -0700 | [diff] [blame] | 96 | } |
| 97 | |
| 98 | // The following fields contain supplemental data used to build IntervalStats, such as a string |
| 99 | // pool. |
| 100 | optional int64 end_time_ms = 1; |
| 101 | // stringpool contains all the package and class names used by UsageStats and Event |
| 102 | // They will hold a number that is equal to the index + 1 of their string in the pool |
| 103 | optional StringPool stringpool = 2; |
Hui Yu | e361a23 | 2018-10-04 15:05:21 -0700 | [diff] [blame] | 104 | optional int32 major_version = 3; |
| 105 | optional int32 minor_version = 4; |
Michael Wachenschwanz | c8c2636 | 2018-09-07 14:59:25 -0700 | [diff] [blame] | 106 | |
| 107 | // The following fields contain aggregated usage stats data |
| 108 | optional CountAndTime interactive = 10; |
| 109 | optional CountAndTime non_interactive = 11; |
| 110 | optional CountAndTime keyguard_shown = 12; |
| 111 | optional CountAndTime keyguard_hidden = 13; |
| 112 | |
| 113 | // The following fields contain listed usage stats data |
| 114 | repeated UsageStats packages = 20; |
| 115 | repeated Configuration configurations = 21; |
| 116 | repeated Event event_log = 22; |
Michael Wachenschwanz | c8c2636 | 2018-09-07 14:59:25 -0700 | [diff] [blame] | 117 | } |