| 1 |
/* |
| 2 |
* Copyright (C) 2019 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 |
/** |
| 25 |
* Obfuscated version of android.service.IntervalStatsProto (usagestatsservice.proto). |
| 26 |
*/ |
| 27 |
message IntervalStatsObfuscatedProto { |
| 28 |
|
| 29 |
message CountAndTime { |
| 30 |
optional int32 count = 1; |
| 31 |
optional int64 time_ms = 2; |
| 32 |
} |
| 33 |
|
| 34 |
// Stores the relevant information an IntervalStats will have about a Configuration |
| 35 |
message Configuration { |
| 36 |
optional .android.content.ConfigurationProto config = 1; |
| 37 |
optional int64 last_time_active_ms = 2; |
| 38 |
optional int64 total_time_active_ms = 3; |
| 39 |
optional int32 count = 4; |
| 40 |
optional bool active = 5; |
| 41 |
} |
| 42 |
|
| 43 |
|
| 44 |
// Stores the information of last time a package is used by any users |
| 45 |
message PackageUsage { |
| 46 |
optional string package_name = 1; |
| 47 |
optional int64 time_ms = 2; |
| 48 |
} |
| 49 |
|
| 50 |
// The following fields contain supplemental data used to build IntervalStats. |
| 51 |
optional int64 end_time_ms = 1; |
| 52 |
optional int32 major_version = 2; |
| 53 |
optional int32 minor_version = 3; |
| 54 |
|
| 55 |
// The following fields contain aggregated usage stats data |
| 56 |
optional CountAndTime interactive = 10; |
| 57 |
optional CountAndTime non_interactive = 11; |
| 58 |
optional CountAndTime keyguard_shown = 12; |
| 59 |
optional CountAndTime keyguard_hidden = 13; |
| 60 |
|
| 61 |
// The following fields contain listed usage stats data |
| 62 |
repeated UsageStatsObfuscatedProto packages = 20; |
| 63 |
repeated Configuration configurations = 21; |
| 64 |
repeated EventObfuscatedProto event_log = 22; |
| 65 |
// The following field is only used to persist the reported events before a user unlock |
| 66 |
repeated PendingEventProto pending_events = 23; |
| 67 |
// The following field is only used to persist the user-agnostic package usage before shut down |
| 68 |
repeated PackageUsage package_usage = 24; |
| 69 |
} |
| 70 |
|
| 71 |
/** |
| 72 |
* Stores the relevant information from an obfuscated UsageStats. |
| 73 |
*/ |
| 74 |
message UsageStatsObfuscatedProto { |
| 75 |
message ChooserAction { |
| 76 |
message CategoryCount { |
| 77 |
optional int32 category_token = 1; |
| 78 |
optional int32 count = 2; |
| 79 |
} |
| 80 |
optional int32 action_token = 1; |
| 81 |
repeated CategoryCount counts = 2; |
| 82 |
} |
| 83 |
optional int32 package_token = 1; |
| 84 |
optional int64 last_time_active_ms = 3; |
| 85 |
optional int64 total_time_active_ms = 4; |
| 86 |
optional int32 last_event = 5; |
| 87 |
optional int32 app_launch_count = 6; |
| 88 |
repeated ChooserAction chooser_actions = 7; |
| 89 |
optional int64 last_time_service_used_ms = 8; |
| 90 |
optional int64 total_time_service_used_ms = 9; |
| 91 |
optional int64 last_time_visible_ms = 10; |
| 92 |
optional int64 total_time_visible_ms = 11; |
| 93 |
optional int64 last_time_component_used_ms = 12; |
| 94 |
} |
| 95 |
|
| 96 |
/** |
| 97 |
* Stores the relevant information from an obfuscated Event. |
| 98 |
*/ |
| 99 |
message EventObfuscatedProto { |
| 100 |
optional int32 package_token = 1; |
| 101 |
optional int32 class_token = 2; |
| 102 |
optional int64 time_ms = 3; |
| 103 |
optional int32 flags = 4; |
| 104 |
optional int32 type = 5; |
| 105 |
optional .android.content.ConfigurationProto config = 6; |
| 106 |
optional int32 shortcut_id_token = 7; |
| 107 |
optional int32 standby_bucket = 8; |
| 108 |
optional int32 notification_channel_id_token = 9; |
| 109 |
optional int32 instance_id = 10; |
| 110 |
optional int32 task_root_package_token = 11; |
| 111 |
optional int32 task_root_class_token = 12; |
| 112 |
optional int32 locus_id_token = 13; |
| 113 |
} |
| 114 |
|
| 115 |
/** |
| 116 |
* This message stores all of the fields in an Event object as strings instead of tokens. |
| 117 |
*/ |
| 118 |
message PendingEventProto { |
| 119 |
optional string package_name = 1; |
| 120 |
optional string class_name = 2; |
| 121 |
optional int64 time_ms = 3; |
| 122 |
optional int32 flags = 4; |
| 123 |
optional int32 type = 5; |
| 124 |
optional .android.content.ConfigurationProto config = 6; |
| 125 |
optional string shortcut_id = 7 [(.android.privacy).dest = DEST_EXPLICIT]; |
| 126 |
optional int32 standby_bucket = 8; |
| 127 |
optional string notification_channel_id = 9 [(.android.privacy).dest = DEST_EXPLICIT]; |
| 128 |
optional int32 instance_id = 10; |
| 129 |
optional string task_root_package = 11; |
| 130 |
optional string task_root_class = 12; |
| 131 |
optional string locus_id = 13 [(.android.privacy).dest = DEST_EXPLICIT]; |
| 132 |
} |
| 133 |
|
| 134 |
/** |
| 135 |
* A proto message representing the obfuscated tokens mappings for Usage Stats. |
| 136 |
*/ |
| 137 |
message ObfuscatedPackagesProto { |
| 138 |
message PackagesMap { |
| 139 |
optional int32 package_token = 1; |
| 140 |
// The list of strings for each package where their indices are the token |
| 141 |
repeated string strings = 2 [(.android.privacy).dest = DEST_EXPLICIT]; |
| 142 |
} |
| 143 |
|
| 144 |
optional int32 counter = 1; |
| 145 |
// Stores the mappings for every package |
| 146 |
repeated PackagesMap packages_map = 2; |
| 147 |
} |