1 /*
2  * Copyright (C) 2022 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 
17 package com.android.cellbroadcastservice;
18 
19 /**
20  * Utility for metrics of cellbroadcast to check-in easy and simple
21  */
22 public class CellBroadcastMetrics {
23     private static final String TAG = "CellBroadcastMetrics";
24 
25     // Values for CellBroadcastMessageReported.type
26     public static final int RPT_UNKNOWN =
27             CellBroadcastModuleStatsLog.CELL_BROADCAST_MESSAGE_REPORTED__TYPE__UNKNOWN_TYPE;
28     public static final int RPT_GSM =
29             CellBroadcastModuleStatsLog.CELL_BROADCAST_MESSAGE_REPORTED__TYPE__GSM;
30     public static final int RPT_CDMA =
31             CellBroadcastModuleStatsLog.CELL_BROADCAST_MESSAGE_REPORTED__TYPE__CDMA;
32     public static final int RPT_SPC =
33             CellBroadcastModuleStatsLog.CELL_BROADCAST_MESSAGE_REPORTED__TYPE__CDMA_SPC;
34 
35     // Values for CellBroadcastMessageReported.source
36     public static final int SRC_UNKNOWN =
37             CellBroadcastModuleStatsLog.CELL_BROADCAST_MESSAGE_REPORTED__SOURCE__UNKNOWN_SOURCE;
38     public static final int SRC_FWK =
39             CellBroadcastModuleStatsLog.CELL_BROADCAST_MESSAGE_REPORTED__SOURCE__FRAMEWORK;
40     public static final int SRC_CBS =
41             CellBroadcastModuleStatsLog.CELL_BROADCAST_MESSAGE_REPORTED__SOURCE__CB_SERVICE;
42     public static final int SRC_CBR =
43             CellBroadcastModuleStatsLog.CELL_BROADCAST_MESSAGE_REPORTED__SOURCE__CB_RECEIVER_APP;
44 
45     // Values for CellBroadcastMessageError.type
46     public static final int ERR_UNKNOWN =
47             CellBroadcastModuleStatsLog.CELL_BROADCAST_MESSAGE_ERROR__TYPE__UNKNOWN_TYPE;
48     public static final int ERR_CDMA_DECODING =
49             CellBroadcastModuleStatsLog.CELL_BROADCAST_MESSAGE_ERROR__TYPE__CDMA_DECODING_ERROR;
50     public static final int ERR_SCP_EMPTY =
51             CellBroadcastModuleStatsLog.CELL_BROADCAST_MESSAGE_ERROR__TYPE__CDMA_SCP_EMPTY;
52     public static final int ERR_SCP_HANDLING =
53             CellBroadcastModuleStatsLog.CELL_BROADCAST_MESSAGE_ERROR__TYPE__CDMA_SCP_HANDLING_ERROR;
54     public static final int ERR_GSM_INVALID_HEADER =
55             CellBroadcastModuleStatsLog
56                     .CELL_BROADCAST_MESSAGE_ERROR__TYPE__GSM_INVALID_HEADER_LENGTH;
57     public static final int ERR_GSM_UNSUPPORTED_HEADER_MSG =
58             CellBroadcastModuleStatsLog
59                     .CELL_BROADCAST_MESSAGE_ERROR__TYPE__GSM_UNSUPPORTED_HEADER_MESSAGE_TYPE;
60     public static final int ERR_GSM_UNSUPPORTED_HEADER_DCS =
61             CellBroadcastModuleStatsLog
62                     .CELL_BROADCAST_MESSAGE_ERROR__TYPE__GSM_UNSUPPORTED_HEADER_DATA_CODING_SCHEME;
63     public static final int ERR_GSM_INVALID_PDU =
64             CellBroadcastModuleStatsLog.CELL_BROADCAST_MESSAGE_ERROR__TYPE__GSM_INVALID_PDU;
65     public static final int ERR_GSM_INVALID_GEO_FENCING_DATA =
66             CellBroadcastModuleStatsLog
67                     .CELL_BROADCAST_MESSAGE_ERROR__TYPE__GSM_INVALID_GEO_FENCING_DATA;
68     public static final int ERR_GSM_UMTS_INVALID_WAC =
69             CellBroadcastModuleStatsLog.CELL_BROADCAST_MESSAGE_ERROR__TYPE__GSM_UMTS_INVALID_WAC;
70     public static final int ERR_FAILED_TO_INSERT_TO_DB =
71             CellBroadcastModuleStatsLog.CELL_BROADCAST_MESSAGE_ERROR__TYPE__FAILED_TO_INSERT_TO_DB;
72     public static final int ERR_UNEXPECTED_GEOMETRY_FROM_FWK =
73             CellBroadcastModuleStatsLog
74                     .CELL_BROADCAST_MESSAGE_ERROR__TYPE__UNEXPECTED_GEOMETRY_FROM_FWK;
75     public static final int ERR_UNEXPECTED_GSM_MSG_FROM_FWK =
76             CellBroadcastModuleStatsLog
77                     .CELL_BROADCAST_MESSAGE_ERROR__TYPE__UNEXPECTED_GSM_MESSAGE_TYPE_FROM_FWK;
78     public static final int ERR_UNEXPECTED_CDMA_MSG_FROM_FWK =
79             CellBroadcastModuleStatsLog
80                     .CELL_BROADCAST_MESSAGE_ERROR__TYPE__UNEXPECTED_CDMA_MESSAGE_TYPE_FROM_FWK;
81     public static final int ERR_UNEXPECTED_SPC_MSG_FROM_FWK =
82             CellBroadcastModuleStatsLog
83                     .CELL_BROADCAST_MESSAGE_ERROR__TYPE__UNEXPECTED_CDMA_SCP_MESSAGE_TYPE_FROM_FWK;
84     public static final int ERR_NO_CONNECTION_TO_CBS =
85             CellBroadcastModuleStatsLog
86                     .CELL_BROADCAST_MESSAGE_ERROR__TYPE__NO_CONNECTION_TO_CB_SERVICE;
87 
88     // Values for CellBroadcastMessageFiltered.type
89     public static final int FILTER_UNKNOWN =
90             CellBroadcastModuleStatsLog.CELL_BROADCAST_MESSAGE_FILTERED__TYPE__UNKNOWN_TYPE;
91     public static final int FILTER_GSM =
92             CellBroadcastModuleStatsLog.CELL_BROADCAST_MESSAGE_FILTERED__TYPE__GSM;
93     public static final int FILTER_CDMA =
94             CellBroadcastModuleStatsLog.CELL_BROADCAST_MESSAGE_FILTERED__TYPE__CDMA;
95     public static final int FILTER_SPC =
96             CellBroadcastModuleStatsLog.CELL_BROADCAST_MESSAGE_FILTERED__TYPE__CDMA_SPC;
97 
98     // Values for CellBroadcastMessageFiltered.filter
99     public static final int FILTER_NOTFILTERED =
100             CellBroadcastModuleStatsLog.CELL_BROADCAST_MESSAGE_FILTERED__FILTER__NOT_FILTERED;
101     public static final int FILTER_DUPLICATE =
102             CellBroadcastModuleStatsLog.CELL_BROADCAST_MESSAGE_FILTERED__FILTER__DUPLICATE_MESSAGE;
103     public static final int FILTER_GEOFENCED =
104             CellBroadcastModuleStatsLog.CELL_BROADCAST_MESSAGE_FILTERED__FILTER__GEOFENCED_MESSAGE;
105     public static final int FILTER_AREAINFO =
106             CellBroadcastModuleStatsLog.CELL_BROADCAST_MESSAGE_FILTERED__FILTER__AREA_INFO_MESSAGE;
107     public static final int FILTER_DISABLEDBYOEM =
108             CellBroadcastModuleStatsLog.CELL_BROADCAST_MESSAGE_FILTERED__FILTER__DISABLED_BY_OEM;
109     public static final int FILTER_NOTSHOW_ECBM =
110             CellBroadcastModuleStatsLog.CELL_BROADCAST_MESSAGE_FILTERED__FILTER__NOTSHOW_ECBM;
111     public static final int FILTER_NOTSHOW_USERPREF =
112             CellBroadcastModuleStatsLog.CELL_BROADCAST_MESSAGE_FILTERED__FILTER__NOTSHOW_USER_PREF;
113     public static final int FILTER_NOTSHOW_EMPTYBODY =
114             CellBroadcastModuleStatsLog.CELL_BROADCAST_MESSAGE_FILTERED__FILTER__NOTSHOW_EMPTY_BODY;
115     public static final int FILTER_NOTSHOW_MISMATCH_PREF_SECONDLANG =
116             CellBroadcastModuleStatsLog
117                     .CELL_BROADCAST_MESSAGE_FILTERED__FILTER__NOTSHOW_MISMATCH_PREF_SECOND_LANG;
118     public static final int FILTER_NOTSHOW_PREF_SECONDLANG_OFF =
119             CellBroadcastModuleStatsLog
120                     .CELL_BROADCAST_MESSAGE_FILTERED__FILTER__NOTSHOW_PREF_SECONDLANG_OFF;
121     public static final int FILTER_NOTSHOW_MISMATCH_DEVICE_LANG_SETTING =
122             CellBroadcastModuleStatsLog
123                     .CELL_BROADCAST_MESSAGE_FILTERED__FILTER__NOTSHOW_MISMATCH_DEVICE_LANG_SETTING;
124     public static final int FILTER_NOTSHOW_TESTMODE =
125             CellBroadcastModuleStatsLog
126                     .CELL_BROADCAST_MESSAGE_FILTERED__FILTER__NOTSHOW_MESSAGE_FOR_TESTMODE;
127     public static final int FILTER_NOTSHOW_FILTERED =
128             CellBroadcastModuleStatsLog
129                     .CELL_BROADCAST_MESSAGE_FILTERED__FILTER__NOTSHOW_FILTER_STRING;
130 
131     // Values for CellBroadcastError.source
132     public static final int ERRSRC_UNKNOWN =
133             CellBroadcastModuleStatsLog.CELL_BROADCAST_MODULE_ERROR_REPORTED__SOURCE__UNKNOWN_SOURCE;
134     public static final int ERRSRC_FWK =
135             CellBroadcastModuleStatsLog.CELL_BROADCAST_MODULE_ERROR_REPORTED__SOURCE__FRAMEWORK;
136     public static final int ERRSRC_CBS =
137             CellBroadcastModuleStatsLog.CELL_BROADCAST_MODULE_ERROR_REPORTED__SOURCE__CB_SERVICE;
138     public static final int ERRSRC_CBR =
139             CellBroadcastModuleStatsLog.CELL_BROADCAST_MODULE_ERROR_REPORTED__SOURCE__CB_RECEIVER_APP;
140 
141     // Values for CellBroadcastError.type
142     public static final int ERRTYPE_UNKNOWN =
143             CellBroadcastModuleStatsLog.CELL_BROADCAST_MODULE_ERROR_REPORTED__TYPE__ERROR_UNKNOWN;
144     public static final int ERRTYPE_BADCONFIG =
145             CellBroadcastModuleStatsLog.CELL_BROADCAST_MODULE_ERROR_REPORTED__TYPE__ERROR_BAD_CONFIG;
146     public static final int ERRTYPE_DBMIGRATION =
147             CellBroadcastModuleStatsLog.CELL_BROADCAST_MODULE_ERROR_REPORTED__TYPE__ERROR_DB_MIGRATION;
148     public static final int ERRTYPE_DEFAULTRES =
149             CellBroadcastModuleStatsLog.CELL_BROADCAST_MODULE_ERROR_REPORTED__TYPE__ERROR_DEFAULT_RES;
150     public static final int ERRTYPE_ENABLECHANNEL =
151             CellBroadcastModuleStatsLog.CELL_BROADCAST_MODULE_ERROR_REPORTED__TYPE__ERROR_ENABLE_CHANNEL;
152     public static final int ERRTYPE_GETLOCATION =
153             CellBroadcastModuleStatsLog.CELL_BROADCAST_MODULE_ERROR_REPORTED__TYPE__ERROR_GET_LOCATION;
154     public static final int ERRTYPE_MISSINGRES =
155             CellBroadcastModuleStatsLog.CELL_BROADCAST_MODULE_ERROR_REPORTED__TYPE__ERROR_MISSING_RES;
156     public static final int ERRTYPE_PLAYFLASH =
157             CellBroadcastModuleStatsLog.CELL_BROADCAST_MODULE_ERROR_REPORTED__TYPE__ERROR_PLAY_FLASH;
158     public static final int ERRTYPE_PLAYSOUND =
159             CellBroadcastModuleStatsLog.CELL_BROADCAST_MODULE_ERROR_REPORTED__TYPE__ERROR_PLAY_SOUND;
160     public static final int ERRTYPE_PLAYTTS =
161             CellBroadcastModuleStatsLog.CELL_BROADCAST_MODULE_ERROR_REPORTED__TYPE__ERROR_PLAY_TTS;
162     public static final int ERRTYPE_PREFMIGRATION =
163             CellBroadcastModuleStatsLog.CELL_BROADCAST_MODULE_ERROR_REPORTED__TYPE__ERROR_PREF_MIGRATION;
164     public static final int ERRTYPE_PROVIDERINIT =
165             CellBroadcastModuleStatsLog.CELL_BROADCAST_MODULE_ERROR_REPORTED__TYPE__ERROR_PROVIDER_INIT;
166     public static final int ERRTYPE_CHANNEL_R =
167             CellBroadcastModuleStatsLog.CELL_BROADCAST_MODULE_ERROR_REPORTED__TYPE__ERROR_RESET_CHANNEL_R;
168     public static final int ERRTYPE_STATUSBAR =
169             CellBroadcastModuleStatsLog.CELL_BROADCAST_MODULE_ERROR_REPORTED__TYPE__ERROR_STATUS_BAR;
170     public static final int ERRTYPE_REMINDERINTERVAL =
171             CellBroadcastModuleStatsLog.CELL_BROADCAST_MODULE_ERROR_REPORTED__TYPE__ERROR_REMINDER_INTERVAL;
172     public static final int ERRTYPE_ICONRESOURCE =
173             CellBroadcastModuleStatsLog.CELL_BROADCAST_MODULE_ERROR_REPORTED__TYPE__ERROR_ICON_RESOURCE;
174     public static final int ERRTYPE_CHANNELRANGEPARSE =
175             CellBroadcastModuleStatsLog
176                     .CELL_BROADCAST_MODULE_ERROR_REPORTED__TYPE__ERROR_CHANNEL_RANGE_PARSE;
177     public static final int ERRTYPE_DBINIT =
178             CellBroadcastModuleStatsLog.CELL_BROADCAST_MODULE_ERROR_REPORTED__TYPE__ERROR_DB_INIT;
179     public static final int ERRTYPE_NOTFOUND_DEFAULTCBRPKGS =
180             CellBroadcastModuleStatsLog
181                     .CELL_BROADCAST_MODULE_ERROR_REPORTED__TYPE__ERROR_NOT_FOUND_DEFAULT_CBR_PKGS;
182     public static final int ERRTYPE_FOUND_MULTIPLECBRPKGS =
183             CellBroadcastModuleStatsLog
184                     .CELL_BROADCAST_MODULE_ERROR_REPORTED__TYPE__ERROR_FOUND_MULTIPLE_CBR_PKGS;
185 }
186