Skip to content

Commit 043eec6

Browse files
authored
Merge d8b3976 into 35e5bd8
2 parents 35e5bd8 + d8b3976 commit 043eec6

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

transport/transport-backend-cct/src/main/java/com/google/android/datatransport/cct/CctTransportBackend.java

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,14 @@ private static TelephonyManager getTelephonyManager(Context context) {
133133
return (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE);
134134
}
135135

136+
private static String getMccMncOrEmpty(Context context) {
137+
String value = getTelephonyManager(context).getSimOperator();
138+
if (value != null) {
139+
return value;
140+
}
141+
return "";
142+
}
143+
136144
private static int getPackageVersionCode(Context context) {
137145
try {
138146
int packageVersionCode =
@@ -165,7 +173,7 @@ public EventInternal decorate(EventInternal eventInternal) {
165173
.addMetadata(KEY_MOBILE_SUBTYPE, getNetSubtypeValue(networkInfo))
166174
.addMetadata(KEY_COUNTRY, Locale.getDefault().getCountry())
167175
.addMetadata(KEY_LOCALE, Locale.getDefault().getLanguage())
168-
.addMetadata(KEY_MCC_MNC, getTelephonyManager(applicationContext).getSimOperator())
176+
.addMetadata(KEY_MCC_MNC, getMccMncOrEmpty(applicationContext))
169177
.addMetadata(
170178
KEY_APPLICATION_BUILD, Integer.toString(getPackageVersionCode(applicationContext)))
171179
.build();

0 commit comments

Comments
 (0)