Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 1d966fe3 authored by Michael W's avatar Michael W
Browse files

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
parent 8e5017d2
Loading
Loading
Loading
Loading
+7 −1
Original line number Diff line number Diff line
/*
 * 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,8 +41,13 @@ public class Utilities {
        TelephonyManager tm = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE);
        String carrier = tm.getNetworkOperatorName();
        if (TextUtils.isEmpty(carrier)) {
            String simOperator = tm.getSimOperatorName();
            if (!TextUtils.isEmpty(simOperator)) {
                carrier = simOperator;
            } else {
                carrier = "Unknown";
            }
        }
        return carrier;
    }