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 android.os.statsd.telephony;
20
21import "frameworks/proto_logging/stats/atoms.proto";
22import "frameworks/proto_logging/stats/atom_field_options.proto";
23import "frameworks/proto_logging/stats/enums/telephony/enums.proto";
24
25option java_package = "com.android.os.telephony";
26option java_multiple_files = true;
27
28extend Atom {
29    optional CellularRadioPowerStateChanged cellular_radio_power_state_changed = 713 [(module) = "telephony"];
30    optional EmergencyNumbersInfo emergency_numbers_info = 10180 [(module) = "telephony"];
31    optional DataNetworkValidation data_network_validation = 10207 [(module) = "telephony"];
32    optional DataRatStateChanged data_rat_state_changed = 854 [(module) = "telephony"];
33    optional ConnectedChannelChanged connected_channel_changed = 882 [(module) = "telephony"];
34    // 10208 is reserved due to removing the old atom.
35}
36
37message CellularRadioPowerStateChanged {
38    optional android.telephony.CellularRadioPowerStateEnum state = 1
39            [(state_field_option).exclusive_state = true, (state_field_option).nested = false];
40}
41
42/**
43 * pulled atom to capture all emergency numbers information stored.
44 */
45message EmergencyNumbersInfo {
46    // flag for db version ignored
47    optional bool is_db_version_ignored = 1;
48
49    // version number read from assets
50    optional int32 asset_version = 2;
51
52    // version number from OTA updated DB
53    optional int32 ota_version = 3;
54
55    // the emergency number
56    optional string number = 4;
57
58    // iso code for the country
59    optional string country_iso = 5;
60
61    // Carrier mnc
62    optional string mnc = 6;
63
64    // call route associated with emergency number.
65    optional android.telephony.CallRoute route = 7;
66
67    // list of URNs associated with emergency number.
68    repeated string urns = 8;
69
70    // service categories of the emergency number.
71    repeated android.telephony.ServiceCategory service_categories = 9;
72
73    // sources of the captured emergency number.
74    repeated android.telephony.Source sources = 10;
75}
76
77/**
78 * Pulls information for a data network validation
79 *
80 * Each pull creates multiple atoms, one for each data network validation.
81 *
82 * Pulled from:
83 *   frameworks/opt/telephony/src/java/com/android/internal/telephony/metrics/MetricsCollector.java
84 */
85message DataNetworkValidation {
86    // Data RAT when network validation was performed
87    // Used as a dimension
88    optional android.telephony.NetworkTypeEnum network_type = 1;
89
90    // APN type bitmask where network verification was performed
91    // @ApnType in frameworks/base/telephony/java/android/telephony/Annotation.java
92    optional int32 apn_type_bitmask = 2;
93
94    // Signal strength when network validation was performed
95    optional android.telephony.SignalStrengthEnum signal_strength = 3;
96
97    // Result of network validation for one request
98    optional android.telephony.NetworkValidationResult validation_result = 4;
99
100    // The time in milliseconds from requesting network validation to receiving
101    optional int64 elapsed_time_in_millis = 5;
102
103    // Boolean that handover attempted during validation.
104    optional bool handover_attempted = 6;
105
106    // Number of network validation
107    optional int32 network_validation_count = 7;
108}
109
110/**
111 * Data connection changing event.
112 *
113 * Logged from:
114 *   frameworks/opt/telephony/src/java/com/android/internal/telephony/metrics/DataConnectionStateTracker.java
115 */
116message DataRatStateChanged {
117    enum DataRat {
118        DATA_RAT_UNSPECIFIED = 0;
119        NO_SIM = 1;
120        DATA_RAT_2G = 2;
121        DATA_RAT_3G = 3;
122        DATA_RAT_4G_LTE = 4;
123        DATA_RAT_5G_NSA_LTE = 5;
124        DATA_RAT_5G_NSA_FR1 = 6;
125        DATA_RAT_5G_NSA_FR2 = 7;
126        DATA_RAT_5G_SA_FR1 = 8;
127        DATA_RAT_5G_SA_FR2 = 9;
128    }
129
130    optional DataRat data_rat = 1 [
131    (state_field_option).exclusive_state = true,
132    (state_field_option).nested = false
133  ];
134}
135
136/**
137 * Physical channel changing event.
138 *
139 * Logged from:
140 *   frameworks/opt/telephony/src/java/com/android/internal/telephony/metrics/DataConnectionStateTracker.java
141 */
142message ConnectedChannelChanged {
143    enum ChannelCount {
144        CHANNEL_COUNT_UNSPECIFIED = 0;
145        // CHANNEL_COUNT_ONE indicates there is 0 or 1 connected channel
146        CHANNEL_COUNT_ONE = 1;
147        // CHANNEL_COUNT_TWO indicates there are 2 connected channels
148        CHANNEL_COUNT_TWO = 2;
149        CHANNEL_COUNT_THREE = 3;
150        CHANNEL_COUNT_FOUR = 4;
151        CHANNEL_COUNT_FIVE = 5;
152    }
153
154    optional ChannelCount connected_channel_count = 1 [
155    (state_field_option).exclusive_state = true,
156    (state_field_option).nested = false
157  ];
158}
159