summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael W <baddaemon87@gmail.com>2021-01-09 23:47:16 +0100
committerMichael W <baddaemon87@gmail.com>2021-01-10 16:51:20 +0100
commitafc820bfbbe5f0929cbce36814dfc1c590bc9737 (patch)
tree593be3f31cd429c0754eca30465b252480efb4c5
parentb5e155e310411a7fc13a890bbbdf1372bce855ac (diff)
LineageParts: Stats: Improve getting a valid carrier name
* Looking at our stats server, there are a lot of unknown carriers * "Unknown" may be the result of the device not being registered to a network when the stats are collected, so in these cases we would simply go by whoever provided the SIM Change-Id: I659c96d0d683109a75d9e12daa1d6fa457eb4840
-rw-r--r--src/org/lineageos/lineageparts/lineagestats/Utilities.java8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/org/lineageos/lineageparts/lineagestats/Utilities.java b/src/org/lineageos/lineageparts/lineagestats/Utilities.java
index 511f6ed..8d69690 100644
--- a/src/org/lineageos/lineageparts/lineagestats/Utilities.java
+++ b/src/org/lineageos/lineageparts/lineagestats/Utilities.java
@@ -1,5 +1,6 @@
/*
* Copyright (C) 2012 The CyanogenMod Project
+ * Copyright (C) 2021 The LineageOS Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -40,7 +41,12 @@ public class Utilities {
TelephonyManager tm = context.getSystemService(TelephonyManager.class);
String carrier = tm.getNetworkOperatorName();
if (TextUtils.isEmpty(carrier)) {
- carrier = "Unknown";
+ String simOperator = tm.getSimOperatorName();
+ if (!TextUtils.isEmpty(simOperator)) {
+ carrier = simOperator;
+ } else {
+ carrier = "Unknown";
+ }
}
return carrier;
}