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

Commit 887d7c45 authored by Amit Mahajan's avatar Amit Mahajan Committed by Android Git Automerger
Browse files

am 1783ee45: Merge "Change to update carrier text after subId is updated." into lmp-mr1-dev

* commit '1783ee45':
  Change to update carrier text after subId is updated.
parents 5d966792 1783ee45
Loading
Loading
Loading
Loading
+14 −0
Original line number Diff line number Diff line
@@ -224,6 +224,14 @@ public abstract class ServiceStateTracker extends Handler {
    protected static final String ACTION_RADIO_OFF = "android.intent.action.ACTION_RADIO_OFF";
    protected boolean mPowerOffDelayNeed = true;
    protected boolean mDeviceShuttingDown = false;
    /** Keep track of SPN display rules, so we only broadcast intent if something changes. */
    protected boolean mSpnUpdatePending = false;
    protected String mCurSpn = null;
    protected String mCurPlmn = null;
    protected boolean mCurShowPlmn = false;
    protected boolean mCurShowSpn = false;


    private boolean mImsRegistered = false;

    protected SubscriptionManager mSubscriptionManager;
@@ -277,6 +285,12 @@ public abstract class ServiceStateTracker extends Handler {
                    }
                    mPhoneBase.setSystemProperty(TelephonyProperties.PROPERTY_DATA_NETWORK_TYPE,
                        ServiceState.rilRadioTechnologyToString(mSS.getRilDataRadioTechnology()));

                    if (mSpnUpdatePending) {
                        mSubscriptionController.setPlmnSpn(phoneId, mCurShowPlmn, mCurPlmn,
                                mCurShowSpn, mCurSpn);
                        mSpnUpdatePending = false;
                    }
                }
            }
        }
+16 −4
Original line number Diff line number Diff line
@@ -733,14 +733,26 @@ public class SubscriptionController extends ISub.Stub {
        }
    }

    public void setPlmnSpn(int slotId, boolean showPlmn, String plmn, boolean showSpn, String spn) {
    /**
     * Generate and set carrier text based on input parameters
     * @param showPlmn flag to indicate if plmn should be included in carrier text
     * @param plmn plmn to be included in carrier text
     * @param showSpn flag to indicate if spn should be included in carrier text
     * @param spn spn to be included in carrier text
     * @return true if carrier text is set, false otherwise
     */
    public boolean setPlmnSpn(int slotId, boolean showPlmn, String plmn, boolean showSpn,
                              String spn) {
        synchronized (mLock) {
            int[] subIds = getSubId(slotId);
            if (mContext.getPackageManager().resolveContentProvider(
                    SubscriptionManager.CONTENT_URI.getAuthority(), 0) == null) {
                    SubscriptionManager.CONTENT_URI.getAuthority(), 0) == null ||
                    subIds == null ||
                    !SubscriptionManager.isValidSubscriptionId(subIds[0])) {
                // No place to store this info, we are done.
                // TODO: This can be removed once SubscriptionController is not running on devices
                // that don't need it, such as TVs.
                return;
                return false;
            }
            String carrierText = "";
            if (showPlmn) {
@@ -755,10 +767,10 @@ public class SubscriptionController extends ISub.Stub {
            } else if (showSpn) {
                carrierText = spn;
            }
            int[] subIds = getSubId(slotId);
            for (int i = 0; i < subIds.length; i++) {
                setCarrierText(carrierText, subIds[i]);
            }
            return true;
        }
    }

+9 −6
Original line number Diff line number Diff line
@@ -126,9 +126,6 @@ public class CdmaServiceStateTracker extends ServiceStateTracker {
    private PowerManager.WakeLock mWakeLock;
    private static final String WAKELOCK_TAG = "ServiceStateTracker";

    /** Contains the name of the registered network in CDMA (either ONS or ERI text). */
    protected String mCurPlmn = null;

    protected String mMdn;
    protected int mHomeSystemId[] = null;
    protected int mHomeNetworkId[] = null;
@@ -569,13 +566,14 @@ public class CdmaServiceStateTracker extends ServiceStateTracker {
    protected void updateSpnDisplay() {
        // mOperatorAlphaLong contains the ERI text
        String plmn = mSS.getOperatorAlphaLong();
        boolean showPlmn = false;

        if (!TextUtils.equals(plmn, mCurPlmn)) {
            // Allow A blank plmn, "" to set showPlmn to true. Previously, we
            // would set showPlmn to true only if plmn was not empty, i.e. was not
            // null and not blank. But this would cause us to incorrectly display
            // "No Service". Now showPlmn is set to true for any non null string.
            boolean showPlmn = plmn != null;
            showPlmn = plmn != null;
            if (DBG) {
                log(String.format("updateSpnDisplay: changed sending intent" +
                            " showPlmn='%b' plmn='%s'", showPlmn, plmn));
@@ -589,10 +587,15 @@ public class CdmaServiceStateTracker extends ServiceStateTracker {
            SubscriptionManager.putPhoneIdAndSubIdExtra(intent, mPhone.getPhoneId());
            mPhone.getContext().sendStickyBroadcastAsUser(intent, UserHandle.ALL);

            mSubscriptionController.setPlmnSpn(mPhone.getPhoneId(),
                    showPlmn, plmn, false, "");
            if (!mSubscriptionController.setPlmnSpn(mPhone.getPhoneId(),
                    showPlmn, plmn, false, "")) {
                mSpnUpdatePending = true;
            }
        }

        mCurShowSpn = false;
        mCurShowPlmn = showPlmn;
        mCurSpn = "";
        mCurPlmn = plmn;
    }

+4 −8
Original line number Diff line number Diff line
@@ -157,12 +157,6 @@ final class GsmServiceStateTracker extends ServiceStateTracker {
    private PowerManager.WakeLock mWakeLock;
    private static final String WAKELOCK_TAG = "ServiceStateTracker";

    /** Keep track of SPN display rules, so we only broadcast intent if something changes. */
    private String mCurSpn = null;
    private String mCurPlmn = null;
    private boolean mCurShowPlmn = false;
    private boolean mCurShowSpn = false;

    /** Notification type. */
    static final int PS_ENABLED = 1001;            // Access Control blocks data service
    static final int PS_DISABLED = 1002;           // Access Control enables data service
@@ -673,8 +667,10 @@ final class GsmServiceStateTracker extends ServiceStateTracker {
            SubscriptionManager.putPhoneIdAndSubIdExtra(intent, mPhone.getPhoneId());
            mPhone.getContext().sendStickyBroadcastAsUser(intent, UserHandle.ALL);

            mSubscriptionController.setPlmnSpn(mPhone.getPhoneId(),
                    showPlmn, plmn, showSpn, spn);
            if (!mSubscriptionController.setPlmnSpn(mPhone.getPhoneId(),
                    showPlmn, plmn, showSpn, spn)) {
                mSpnUpdatePending = true;
            }
        }

        mCurShowSpn = showSpn;