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

Commit dcd60141 authored by yinxu's avatar yinxu
Browse files

Make UiccProfile#getOperatorBrandOverride work as before

UiccProfile#getOperatorBrandOverride should work exactly the same as the
old UiccCard#getOperatorBrandOverride

Test: Basic telephony sanity
Bug: 64131518
Change-Id: I7a297ea25a4327eb26c0652ee8f0f62c29e03057
parent 1076d8a7
Loading
Loading
Loading
Loading
+18 −1
Original line number Diff line number Diff line
@@ -32,11 +32,13 @@ import android.os.AsyncResult;
import android.os.Binder;
import android.os.Handler;
import android.os.Message;
import android.os.PersistableBundle;
import android.os.Registrant;
import android.os.RegistrantList;
import android.os.UserHandle;
import android.preference.PreferenceManager;
import android.provider.Settings;
import android.telephony.CarrierConfigManager;
import android.telephony.Rlog;
import android.telephony.ServiceState;
import android.telephony.SubscriptionManager;
@@ -54,6 +56,7 @@ import com.android.internal.telephony.MccTable;
import com.android.internal.telephony.Phone;
import com.android.internal.telephony.PhoneConstants;
import com.android.internal.telephony.PhoneFactory;
import com.android.internal.telephony.SubscriptionController;
import com.android.internal.telephony.TelephonyIntents;
import com.android.internal.telephony.cat.CatService;
import com.android.internal.telephony.uicc.IccCardApplicationStatus.AppType;
@@ -1324,7 +1327,21 @@ public class UiccProfile extends Handler implements IccCard {
            return null;
        }
        SharedPreferences sp = PreferenceManager.getDefaultSharedPreferences(mContext);
        return sp.getString(OPERATOR_BRAND_OVERRIDE_PREFIX + iccId, null);
        String brandName = sp.getString(OPERATOR_BRAND_OVERRIDE_PREFIX + iccId, null);
        if (brandName == null) {
            // Check if  CarrierConfig sets carrier name
            CarrierConfigManager manager = (CarrierConfigManager)
                    mContext.getSystemService(Context.CARRIER_CONFIG_SERVICE);
            int subId = SubscriptionController.getInstance().getSubIdUsingPhoneId(mPhoneId);
            if (manager != null) {
                PersistableBundle bundle = manager.getConfigForSubId(subId);
                if (bundle != null && bundle.getBoolean(
                        CarrierConfigManager.KEY_CARRIER_NAME_OVERRIDE_BOOL)) {
                    brandName = bundle.getString(CarrierConfigManager.KEY_CARRIER_NAME_STRING);
                }
            }
        }
        return brandName;
    }

    /**