| /* |
| * Copyright (C) 2019 The Android Open Source Project |
| * |
| * Licensed under the Apache License, Version 2.0 (the "License"); |
| * you may not use this file except in compliance with the License. |
| * You may obtain a copy of the License at |
| * |
| * http://www.apache.org/licenses/LICENSE-2.0 |
| * |
| * Unless required by applicable law or agreed to in writing, software |
| * distributed under the License is distributed on an "AS IS" BASIS, |
| * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| * See the License for the specific language governing permissions and |
| * limitations under the License. |
| */ |
| |
| syntax = "proto2"; |
| package com.android.server.usage; |
| import "frameworks/base/core/proto/android/content/configuration.proto"; |
| import "frameworks/base/core/proto/android/privacy.proto"; |
| |
| option java_multiple_files = true; |
| |
| /** |
| * Obfuscated version of android.service.IntervalStatsProto (usagestatsservice.proto). |
| */ |
| message IntervalStatsObfuscatedProto { |
| |
| message CountAndTime { |
| optional int32 count = 1; |
| optional int64 time_ms = 2; |
| } |
| |
| // Stores the relevant information an IntervalStats will have about a Configuration |
| message Configuration { |
| optional .android.content.ConfigurationProto config = 1; |
| optional int64 last_time_active_ms = 2; |
| optional int64 total_time_active_ms = 3; |
| optional int32 count = 4; |
| optional bool active = 5; |
| } |
| |
| // The following fields contain supplemental data used to build IntervalStats. |
| optional int64 end_time_ms = 1; |
| optional int32 major_version = 2; |
| optional int32 minor_version = 3; |
| |
| // The following fields contain aggregated usage stats data |
| optional CountAndTime interactive = 10; |
| optional CountAndTime non_interactive = 11; |
| optional CountAndTime keyguard_shown = 12; |
| optional CountAndTime keyguard_hidden = 13; |
| |
| // The following fields contain listed usage stats data |
| repeated UsageStatsObfuscatedProto packages = 20; |
| repeated Configuration configurations = 21; |
| repeated EventObfuscatedProto event_log = 22; |
| // The following field is only used to persist the reported events before a user unlock |
| repeated PendingEventProto pending_events = 23; |
| } |
| |
| /** |
| * Stores the relevant information from an obfuscated UsageStats. |
| */ |
| message UsageStatsObfuscatedProto { |
| message ChooserAction { |
| message CategoryCount { |
| optional int32 category_token = 1; |
| optional int32 count = 2; |
| } |
| optional int32 action_token = 1; |
| repeated CategoryCount counts = 2; |
| } |
| optional int32 package_token = 1; |
| optional int64 last_time_active_ms = 3; |
| optional int64 total_time_active_ms = 4; |
| optional int32 last_event = 5; |
| optional int32 app_launch_count = 6; |
| repeated ChooserAction chooser_actions = 7; |
| optional int64 last_time_service_used_ms = 8; |
| optional int64 total_time_service_used_ms = 9; |
| optional int64 last_time_visible_ms = 10; |
| optional int64 total_time_visible_ms = 11; |
| } |
| |
| /** |
| * Stores the relevant information from an obfuscated Event. |
| */ |
| message EventObfuscatedProto { |
| optional int32 package_token = 1; |
| optional int32 class_token = 2; |
| optional int64 time_ms = 3; |
| optional int32 flags = 4; |
| optional int32 type = 5; |
| optional .android.content.ConfigurationProto config = 6; |
| optional int32 shortcut_id_token = 7; |
| optional int32 standby_bucket = 8; |
| optional int32 notification_channel_id_token = 9; |
| optional int32 instance_id = 10; |
| optional int32 task_root_package_token = 11; |
| optional int32 task_root_class_token = 12; |
| optional int32 locus_id_token = 13; |
| } |
| |
| /** |
| * This message stores all of the fields in an Event object as strings instead of tokens. |
| */ |
| message PendingEventProto { |
| optional string package_name = 1; |
| optional string class_name = 2; |
| optional int64 time_ms = 3; |
| optional int32 flags = 4; |
| optional int32 type = 5; |
| optional .android.content.ConfigurationProto config = 6; |
| optional string shortcut_id = 7; |
| optional int32 standby_bucket = 8; |
| optional string notification_channel_id = 9; |
| optional int32 instance_id = 10; |
| optional string task_root_package = 11; |
| optional string task_root_class = 12; |
| optional string locus_id = 13; |
| } |
| |
| /** |
| * A proto message representing the obfuscated tokens mappings for Usage Stats. |
| */ |
| message ObfuscatedPackagesProto { |
| message PackagesMap { |
| optional int32 package_token = 1; |
| // The list of strings for each package where their indices are the token |
| repeated string strings = 2; |
| } |
| |
| optional int32 counter = 1; |
| // Stores the mappings for every package |
| repeated PackagesMap packages_map = 2; |
| } |