• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1/*
2 * Copyright (C) 2021 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";
18package com.android.server.criticalevents;
19
20option java_multiple_files = true;
21
22// Output proto containing recent critical events for inclusion in logs such as ANR files.
23// Do not change the field names since this data is dumped to ANR files in textproto format.
24message CriticalEventLogProto {
25  // Timestamp when the log snapshot was generated.
26  // Required.
27  optional int64 timestamp_ms = 1;
28
29  // Max age of events that are included in this proto.
30  // Required.
31  optional int32 window_ms = 2;
32
33  // Max number of events in the log.
34  // Note: if the number of events is equal to the capacity then it is likely the actual time range
35  // covered by the log is shorter than window_ms.
36  // Required.
37  optional int32 capacity = 3;
38
39  // Recent critical events.
40  repeated CriticalEventProto events = 4;
41}
42
43// On-disk storage of events.
44message CriticalEventLogStorageProto {
45  repeated CriticalEventProto events = 1;
46}
47
48// A "critical" event such as an ANR or watchdog.
49// Do not change the field names since this data is dumped to ANR files in textproto format.
50message CriticalEventProto {
51  // Timestamp of the event.
52  // Required.
53  optional int64 timestamp_ms = 1;
54
55  // Required.
56  oneof event {
57    Watchdog watchdog = 2;
58    HalfWatchdog half_watchdog = 3;
59    AppNotResponding anr = 4;
60    JavaCrash java_crash = 5;
61    NativeCrash native_crash = 6;
62    SystemServerStarted system_server_started = 7;
63    InstallPackages install_packages = 8;
64    ExcessiveBinderCalls excessive_binder_calls = 9;
65  }
66
67  message ExcessiveBinderCalls {
68    // The uid sending many calls.
69    optional int32 uid = 1;
70  }
71
72  message InstallPackages {}
73
74  message SystemServerStarted {}
75
76  message Watchdog {
77    // The watchdog subject.
78    // Required.
79    optional string subject = 1;
80
81    // Unique identifier of the watchdog.
82    // Can be used to join with other data for this watchdog such as stack dumps & perfetto traces.
83    // Generated in {@link com.android.server.Watchdog#run}.
84    // Required.
85    optional string uuid = 2;
86  }
87
88  message HalfWatchdog {
89    // The half-watchdog subject.
90    // Required.
91    optional string subject = 1;
92  }
93
94  message AppNotResponding {
95    // The ANR subject.
96    // Optional, may be redacted for privacy.
97    optional string subject = 1;
98
99    // Name of the ANRing process.
100    // Optional, may be redacted for privacy.
101    optional string process = 2;
102
103    // PID of the ANRing process.
104    // Required.
105    optional int32 pid = 3;
106
107    // UID of the ANRing process.
108    // Required.
109    optional int32 uid = 4;
110
111    // Category of the ANRing process (DATA_APP, SYSTEM_APP, etc).
112    // Required.
113    optional ProcessClass process_class = 5;
114  }
115
116  message JavaCrash {
117    // The crash exception class.
118    // Optional, may be redacted for privacy.
119    optional string exception_class = 1;
120
121    // Name of the crashed process.
122    // Optional, may be redacted for privacy.
123    optional string process = 2;
124
125    // PID of the crashed process.
126    // Required.
127    optional int32 pid = 3;
128
129    // UID of the crashed process.
130    // Required.
131    optional int32 uid = 4;
132
133    // Category of the crashed process (DATA_APP, SYSTEM_APP, etc).
134    // Required.
135    optional ProcessClass process_class = 5;
136  }
137
138  message NativeCrash {
139    // Name of the crashed process.
140    // Optional, may be redacted for privacy.
141    optional string process = 1;
142
143    // PID of the crashed process.
144    // Required.
145    optional int32 pid = 2;
146
147    // UID of the crashed process.
148    // Required.
149    optional int32 uid = 3;
150
151    // Category of the crashed process (DATA_APP, SYSTEM_APP, etc).
152    // Required.
153    optional ProcessClass process_class = 4;
154  }
155
156
157  // Mirrors definition & values in {@link android.server.ServerProtoEnums}.
158  enum ProcessClass {
159    PROCESS_CLASS_UNKNOWN = 0;
160    DATA_APP = 1;
161    SYSTEM_APP = 2;
162    SYSTEM_SERVER = 3;
163  }
164}