1/*
2 * Copyright (C) 2023 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
17syntax = "proto2";
18
19package com.android.car.watchdog;
20
21option java_multiple_files = true;
22
23message CarWatchdogDumpProto {
24  optional bool current_garage_mode = 1;
25  optional SystemHealthDump system_health_dump = 2;
26  optional PerformanceDump performance_dump = 3;
27
28  message SystemHealthDump {
29    repeated RegisteredClient registered_clients = 1;
30    repeated int32 stopped_users = 2;
31  }
32
33  message RegisteredClient {
34    optional int64 pid = 1;
35    optional UserPackageInfo user_package_info = 2;
36    optional HealthCheckTimeout health_check_timeout = 3;
37  }
38
39  enum HealthCheckTimeout {
40    HEALTH_CHECK_TIMEOUT_UNSPECIFIED = 0;
41    CRITICAL = 1;
42    MODERATE = 2;
43    NORMAL = 3;
44  }
45}
46
47message UserPackageInfo {
48  optional int32 user_id = 1;
49  optional string package_name = 2;
50}
51
52message PerformanceDump {
53  optional UxState current_ux_state = 1;
54  repeated UserPackageInfo disabled_user_packages = 2;
55  optional int64 uid_io_usage_summary_top_count = 3;
56  optional int64 io_usage_summary_min_system_total_written_bytes = 4;
57  optional int64 package_killable_state_reset_days = 5;
58  optional int64 recurring_overuse_period_days = 6;
59  optional int64 resource_overuse_notification_base_id = 7;
60  optional int64 resource_overuse_notification_max_offset = 8;
61  optional bool is_connected_to_daemon = 9;
62  optional bool is_heads_up_notification_sent = 10;
63  optional int64 current_overuse_notification_id_offset = 11;
64  optional bool is_garage_mode_active = 12;
65  optional int64 overuse_handling_delay_millis = 13;
66  optional DateTime last_system_io_usage_summary_reported_utc_datetime = 14;
67  optional DateTime last_uid_io_usage_summary_reported_utc_datetime = 15;
68  repeated UsageByUserPackage usage_by_user_packages = 16;
69  repeated ResourceOveruseListenerInfo overuse_listener_infos = 17;
70  repeated ResourceOveruseListenerInfo system_overuse_listener_infos = 18;
71  repeated string default_not_killable_generic_packages = 19;
72  repeated UserPackageInfo user_notifiable_packages = 20;
73  repeated UserPackageInfo active_user_notifications = 21;
74  repeated UserPackageInfo actionable_user_packages = 22;
75  optional bool is_pending_resource_overuse_configurations_request = 23;
76  optional OveruseConfigurationCacheDump overuse_configuration_cache_dump = 24;
77
78  message OveruseConfigurationCacheDump {
79    repeated string safe_to_kill_system_packages = 1;
80    repeated string safe_to_kill_vendor_packages = 2;
81    repeated string vendor_package_prefixes = 3;
82    repeated PackageByAppCategory packages_by_app_category = 4;
83    repeated IoThresholdByComponent generic_io_thresholds_by_component = 5;
84    repeated IoThresholdByPackage io_thresholds_by_package = 6;
85    repeated IoThresholdByAppCategory thresholds_by_app_category = 7;
86  }
87
88  message PackageByAppCategory {
89    optional ApplicationCategory application_category = 1;
90    repeated string package_name = 2;
91  }
92
93  message IoThresholdByComponent {
94    optional ComponentType component_type = 1;
95    optional PerStateBytes threshold = 2;
96  }
97
98  message IoThresholdByPackage {
99    optional ComponentType package_type = 1;
100    optional PerStateBytes threshold = 2;
101    optional string package_name = 3;
102  }
103
104  message IoThresholdByAppCategory {
105    optional ApplicationCategory application_category = 1;
106    optional PerStateBytes threshold = 2;
107  }
108
109  message UsageByUserPackage {
110    optional UserPackageInfo user_package_info = 1;
111    optional KillableState killable_state = 2;
112    optional PackageIoUsage package_io_usage = 3;
113  }
114
115  message PackageIoUsage {
116    optional IoOveruseStats io_overuse_stats = 1;
117    optional PerStateBytes forgiven_write_bytes = 2;
118    optional int64 forgiven_overuses = 3;
119    optional int64 historical_not_forgiven_overuses = 4;
120    optional int64 total_times_killed = 5;
121  }
122
123  message IoOveruseStats {
124    optional bool killable_on_overuse = 1;
125    optional PerStateBytes remaining_write_bytes = 2;
126    optional int64 start_time = 3;
127    optional int64 duration = 4;
128    optional PerStateBytes written_bytes = 5;
129    optional int64 total_overuses = 6;
130  }
131
132  message PerStateBytes {
133    optional int64 foreground_bytes = 1;
134    optional int64 background_bytes = 2;
135    optional int64 garagemode_bytes = 3;
136  }
137
138  message ResourceOveruseListenerInfo {
139    optional int64 flag = 1;
140    optional int64 pid = 2;
141    optional UserPackageInfo user_package_info = 3;
142  }
143
144  enum UxState {
145    UX_STATE_UNSPECIFIED = 0;
146    UX_STATE_NO_DISTRACTION = 1;
147    UX_STATE_USER_NOTIFICATION = 2;
148    UX_STATE_NO_INTERACTION = 3;
149  }
150
151  enum KillableState {
152    KILLABLE_STATE_UNSPECIFIED = 0;
153    KILLABLE_STATE_YES = 1;
154    KILLABLE_STATE_NO = 2;
155    KILLABLE_STATE_NEVER = 3;
156  }
157
158  enum ApplicationCategory {
159    APPLICATION_CATEGORY_UNSPECIFIED = 0;
160    OTHERS = 1;
161    MAPS = 2;
162    MEDIA = 3;
163  }
164
165  enum ComponentType {
166    COMPONENT_TYPE_UNSPECIFIED = 0;
167    SYSTEM = 1;
168    VENDOR = 2;
169    THIRD_PARTY = 3;
170  }
171}
172
173message DateTime {
174  optional Date date = 1;
175  optional TimeOfDay time_of_day = 2;
176}
177
178// Represents a whole or partial calendar date, such as a birthday. The time of
179// day and time zone are either specified elsewhere or are insignificant. The
180// date is relative to the Gregorian Calendar. This can represent one of the
181// following:
182//
183// * A full date, with non-zero year, month, and day values
184// * A month and day value, with a zero year, such as an anniversary
185// * A year on its own, with zero month and day values
186// * A year and month value, with a zero day, such as a credit card expiration
187// date
188//
189// Related types are [google.type.TimeOfDay][google.type.TimeOfDay] and
190// `google.protobuf.Timestamp`.
191//
192// Copied from:
193// https://github.com/googleapis/googleapis/blob/master/google/type/date.proto
194message Date {
195  // Year of the date. Must be from 1 to 9999, or 0 to specify a date without
196  // a year.
197  optional int32 year = 1;
198
199  // Month of a year. Must be from 1 to 12, or 0 to specify a year without a
200  // month and day.
201  optional int32 month = 2;
202
203  // Day of a month. Must be from 1 to 31 and valid for the year and month, or 0
204  // to specify a year by itself or a year and month where the day isn't
205  // significant.
206  optional int32 day = 3;
207}
208
209// Represents a time of day. The date and time zone are either not significant
210// or are specified elsewhere. An API may choose to allow leap seconds. Related
211// types are [google.type.Date][google.type.Date] and
212// `google.protobuf.Timestamp`.
213//
214// Copied from:
215// https://github.com/googleapis/googleapis/blob/master/google/type/timeofday.proto
216message TimeOfDay {
217  // Hours of day in 24 hour format. Should be from 0 to 23. An API may choose
218  // to allow the value "24:00:00" for scenarios like business closing time.
219  optional int32 hours = 1;
220
221  // Minutes of hour of day. Must be from 0 to 59.
222  optional int32 minutes = 2;
223
224  // Seconds of minutes of the time. Must normally be from 0 to 59. An API may
225  // allow the value 60 if it allows leap-seconds.
226  optional int32 seconds = 3;
227
228  // Fractions of seconds in nanoseconds. Must be from 0 to 999,999,999.
229  optional int32 nanos = 4;
230}
231