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

Commit cabbc51f authored by Pengquan Meng's avatar Pengquan Meng
Browse files

Add brandOverride back to IccRecord

During the spn refactor ag/7013869, we remove the brand override from
IccRecord. This will cause a problem when the ApnSettingUtils use spn to
match mvno.

We add the brandOverride back to the IccRecord and create a method to
get the service provider with brandOverride.

Bug: 139056894
Test: build
Change-Id: I041dce4d55c79442d81053ff9410de81803e9b08
parent 9be192cc
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -83,8 +83,8 @@ public class ApnSettingUtils {
     */
    public static boolean mvnoMatches(IccRecords r, int mvnoType, String mvnoMatchData) {
        if (mvnoType == ApnSetting.MVNO_TYPE_SPN) {
            if ((r.getServiceProviderName() != null)
                    && r.getServiceProviderName().equalsIgnoreCase(mvnoMatchData)) {
            String spn = r.getServiceProviderNameWithBrandOverride();
            if ((spn != null) && spn.equalsIgnoreCase(mvnoMatchData)) {
                return true;
            }
        } else if (mvnoType == ApnSetting.MVNO_TYPE_IMSI) {
+18 −0
Original line number Diff line number Diff line
@@ -17,6 +17,7 @@
package com.android.internal.telephony.uicc;

import android.annotation.IntDef;
import android.annotation.Nullable;
import android.annotation.UnsupportedAppUsage;
import android.content.Context;
import android.os.AsyncResult;
@@ -694,6 +695,23 @@ public abstract class IccRecords extends Handler implements IccConstants {
        return mSpn;
    }

    /**
     * Return Service Provider Name stored in SIM (EF_SPN=0x6F46) or in RUIM (EF_RUIM_SPN=0x6F41) or
     * the brand override. The brand override has higher priority than the SPN from SIM.
     *
     * @return service provider name.
     */
    @Nullable
    public String getServiceProviderNameWithBrandOverride() {
        if (mParentApp != null && mParentApp.getUiccProfile() != null) {
            String brandOverride = mParentApp.getUiccProfile().getOperatorBrandOverride();
            if (!TextUtils.isEmpty(brandOverride)) {
                return brandOverride;
            }
        }
        return mSpn;
    }

    protected void setServiceProviderName(String spn) {
        if (!TextUtils.equals(mSpn, spn)) {
            mSpn = spn != null ? spn.trim() : null;