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

Commit ccc90f7a authored by Jorge Ruesga's avatar Jorge Ruesga Committed by Steve Kondik
Browse files

systemui: don't use SIM display name if there isn't available info

If there is no SIM info, then don't try to use SIM name.
Also don't try to process all the network info data to obtain a network name, if we
are able to extract it from SIM.

Change-Id: I2f252670608bc6bcbde6af46a0a975e0de3f9285
parent 1ce2abb9
Loading
Loading
Loading
Loading
+44 −35
Original line number Diff line number Diff line
@@ -28,6 +28,7 @@ import android.content.ContentResolver;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.content.res.Resources;
import android.database.ContentObserver;
import android.net.ConnectivityManager;
import android.net.NetworkInfo;
@@ -960,14 +961,26 @@ public class MSimNetworkControllerImpl extends NetworkControllerImpl {

    void updateNetworkName(boolean showSpn, String spn, boolean showPlmn, String plmn,
            int phoneId) {
        final Resources res = mContext.getResources();
        if (DEBUG) {
            Slog.d(TAG, "updateNetworkName showSpn=" + showSpn + " spn=" + spn
                    + " showPlmn=" + showPlmn + " plmn=" + plmn);
        }
        try {
            if (mPhoneIdSubIdMapping.indexOfKey(phoneId) >= 0) {
                int sub = mPhoneIdSubIdMapping.get(phoneId);
                SubscriptionInfo info = SubscriptionManager.from(mContext)
                    .getActiveSubscriptionInfo(sub);
                if (info != null) {
                    mMSimNetworkName[phoneId] = info.getDisplayName().toString();
                    return;
                }
            }

            StringBuilder str = new StringBuilder();
            boolean something = false;
            if (showPlmn && plmn != null) {
            if(mContext.getResources().getBoolean(com.android.internal.R.bool.config_display_rat) &&
                if (res.getBoolean(com.android.internal.R.bool.config_display_rat) &&
                        mMSimServiceState[phoneId] != null) {
                    plmn = appendRatToNetworkName(plmn, mMSimServiceState[phoneId]);
                }
@@ -975,8 +988,7 @@ public class MSimNetworkControllerImpl extends NetworkControllerImpl {
                something = true;
            }
            if (showSpn && spn != null) {
            if(mContext.getResources().getBoolean(
                    com.android.internal.R.bool.config_spn_display_control)
                if (res.getBoolean(com.android.internal.R.bool.config_spn_display_control)
                        && something) {
                   Slog.d(TAG,"Do not display spn string when showPlmn and showSpn are both true"
                           + "and plmn string is not null");
@@ -984,7 +996,7 @@ public class MSimNetworkControllerImpl extends NetworkControllerImpl {
                    if (something) {
                        str.append(mNetworkNameSeparator);
                    }
                if(mContext.getResources().getBoolean(com.android.internal.R.bool.
                    if (res.getBoolean(com.android.internal.R.bool.
                            config_display_rat) && mMSimServiceState[phoneId] != null) {
                        spn = appendRatToNetworkName(spn, mMSimServiceState[phoneId]);
                    }
@@ -992,19 +1004,16 @@ public class MSimNetworkControllerImpl extends NetworkControllerImpl {
                    something = true;
                }
            }
        if (mPhoneIdSubIdMapping.indexOfKey(phoneId) >= 0) {
            int sub = mPhoneIdSubIdMapping.get(phoneId);
            SubscriptionInfo info = SubscriptionManager.from(mContext)
                    .getActiveSubscriptionInfo(sub);
            mMSimNetworkName[phoneId] = info.getDisplayName().toString();
        } else if (something) {
            if (something) {
                mMSimNetworkName[phoneId] = str.toString();
            } else {
                mMSimNetworkName[phoneId] = mNetworkNameDefault;
            }
        } finally {
            Slog.d(TAG, "mMSimNetworkName[phoneId] " + mMSimNetworkName[phoneId]
                                                     + "phoneId " + phoneId);
        }
    }

    // ===== Full or limited Internet connectivity ==================================
    @Override