1/* 2 * Copyright (C) 2024 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 android.os.statsd.broadcasts; 20 21import "frameworks/proto_logging/stats/atoms.proto"; 22import "frameworks/proto_logging/stats/atom_field_options.proto"; 23import "frameworks/proto_logging/stats/enums/app_shared/app_enums.proto"; 24 25option java_package = "com.android.os.broadcasts"; 26option java_multiple_files = true; 27 28extend Atom { 29 optional BroadcastSent broadcast_sent = 922 [(module) = "framework"]; 30 optional BroadcastProcessed broadcast_processed = 1028 [(module) = "framework"]; 31} 32 33/** 34 * Logged when a broadcast is sent. 35 * 36 * Logged from: 37 * frameworks/base/services/core/java/com/android/server/am/ActivityManagerService.java 38 * 39 * Logging frequency (based on the data from traces): 40 * Max count / min - 858 41 * P99 count / min - 442 42 */ 43message BroadcastSent { 44 // The action of the broadcast intent 45 optional string intent_action = 1; 46 // The flags used for the broadcast intent. These could be any flags that can be set 47 // via Intent#setFlags() API. 48 optional int32 intent_flags = 2; 49 // The flags that are set in the broadcast intent by the sender. These could be any flags 50 // that can be set via Intent#setFlags() API. 51 optional int32 original_intent_flags = 3; 52 // The uid of the broadcast sender 53 optional int32 sender_uid = 4 [(is_uid) = true]; 54 // The uid of the real broadcast sender if the broadcast is triggered from PendingIntent 55 optional int32 real_sender_uid = 5 [(is_uid) = true]; 56 // Whether the broadcast is targeting a package 57 optional bool package_targeted = 6; 58 // Whether the broadcast is targeting a component 59 optional bool component_targeted = 7; 60 // No. of target broadcast receivers 61 optional int32 num_receivers = 8; 62 63 enum Result { 64 UNKNOWN = 0; 65 SUCCESS = 1; 66 FAILED_STICKY_CANT_HAVE_PERMISSION = 2; 67 FAILED_USER_STOPPED = 3; 68 } 69 // The result of sending a broadcast 70 optional Result result = 9; 71 72 // The delivery group policy set for the broadcast 73 optional android.app.BroadcastDeliveryGroupPolicy delivery_group_policy = 10; 74 // The procstate of the sender process 75 optional android.app.ProcessStateEnum sender_proc_state = 11; 76 // The procstate of the sender uid 77 optional android.app.ProcessStateEnum sender_uid_state = 12; 78 // Type of broadcast 79 repeated android.app.BroadcastType broadcast_types = 13; 80} 81 82/** 83 * Logged when a process completely finishes processing of a broadcast. 84 * 85 * Logged from: 86 * frameworks/base/services/core/java/com/android/server/am/BroadcastQueueImpl.java 87 * 88 * Logging frequency (based on the existing metrics): 89 * Avg frequency per device: 30K per day. 90 */ 91message BroadcastProcessed { 92 // The action of the broadcast intent. 93 optional string intent_action = 1; 94 // The uid of the broadcast sender. 95 optional int32 sender_uid = 2 [(is_uid) = true]; 96 // The uid of the broadcast receiver. 97 optional int32 receiver_uid = 3 [(is_uid) = true]; 98 // Total number of receivers for this intent_action inside a process. 99 optional int32 num_receivers = 4; 100 // The name of the process receiving this broadcast. 101 optional string receiver_process_name = 5; 102 // Time taken by all the receivers to process this broadcast. 103 optional int64 total_time_millis = 6; 104 // Maximum time taken by a receiver to process this broadcast. 105 optional int64 max_time_millis = 7; 106 // Type of broadcast. 107 repeated android.app.BroadcastType broadcast_types = 8; 108} 109