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

Commit a3b5ad86 authored by Shi Lu's avatar Shi Lu Committed by Android (Google) Code Review
Browse files

Merge "Caching Manual Network Selection Config"

parents b246be60 6d43bcd3
Loading
Loading
Loading
Loading
+27 −0
Original line number Diff line number Diff line
@@ -174,6 +174,9 @@ public class GsmCdmaPhone extends Phone {
     */
    private SIMRecords mSimRecords;

    // For non-persisted manual network selection
    private String mManualNetworkSelectionPlmn = "";

    //Common
    // Instance Variables
    @UnsupportedAppUsage
@@ -1899,6 +1902,29 @@ public class GsmCdmaPhone extends Phone {
        }
    }

    /**
     * Update non-persisited manual network selection.
     *
     * @param nsm contains Plmn info
     */
    @Override
    protected void updateManualNetworkSelection(NetworkSelectMessage nsm) {
        int subId = getSubId();
        if (SubscriptionManager.isValidSubscriptionId(subId)) {
            mManualNetworkSelectionPlmn = nsm.operatorNumeric;
        } else {
        //on Phone0 in emergency mode (no SIM), or in some races then clear the cache
            mManualNetworkSelectionPlmn = "";
            Rlog.e(LOG_TAG, "Cannot update network selection due to invalid subId "
                    + subId);
        }
    }

    @Override
    public String getManualNetworkSelectionPlmn() {
        return (mManualNetworkSelectionPlmn == null) ? "" : mManualNetworkSelectionPlmn;
    }

    @Override
    public String getCdmaPrlVersion() {
        return mSST.getPrlVersion();
@@ -3876,6 +3902,7 @@ public class GsmCdmaPhone extends Phone {
            pw.println(" isMinInfoReady()=" + isMinInfoReady());
        }
        pw.println(" isCspPlmnEnabled()=" + isCspPlmnEnabled());
        pw.println(" mManualNetworkSelectionPlmn=" + mManualNetworkSelectionPlmn);
        pw.flush();
    }

+21 −2
Original line number Diff line number Diff line
@@ -247,7 +247,7 @@ public abstract class Phone extends Handler implements PhoneInternalInterface {
     * if we are looking for automatic selection. operatorAlphaLong is the
     * corresponding operator name.
     */
    private static class NetworkSelectMessage {
    protected static class NetworkSelectMessage {
        public Message message;
        public String operatorNumeric;
        public String operatorAlphaLong;
@@ -1386,6 +1386,7 @@ public abstract class Phone extends Handler implements PhoneInternalInterface {
            updateSavedNetworkOperator(nsm);
        } else {
            clearSavedNetworkSelection();
            updateManualNetworkSelection(nsm);
        }
    }

@@ -1427,6 +1428,15 @@ public abstract class Phone extends Handler implements PhoneInternalInterface {
        }
    }

    /**
     * Update non-perisited manual network selection.
     *
     * @param nsm PLMN info of the selected network
     */
    protected void updateManualNetworkSelection(NetworkSelectMessage nsm)  {
        Rlog.e(LOG_TAG, "updateManualNetworkSelection() should be overridden");
    }

    /**
     * Used to track the settings upon completion of the network change.
     */
@@ -1451,7 +1461,8 @@ public abstract class Phone extends Handler implements PhoneInternalInterface {
    /**
     * Method to retrieve the saved operator from the Shared Preferences
     */
    private OperatorInfo getSavedNetworkSelection() {
    @NonNull
    public OperatorInfo getSavedNetworkSelection() {
        // open the shared preferences and search with our key.
        SharedPreferences sp = PreferenceManager.getDefaultSharedPreferences(getContext());
        String numeric = sp.getString(NETWORK_SELECTION_KEY + getSubId(), "");
@@ -1910,6 +1921,14 @@ public abstract class Phone extends Handler implements PhoneInternalInterface {
        return mVmCount != 0;
    }

    /**
     *  Retrieves manually selected network info.
     */
    public String getManualNetworkSelectionPlmn() {
        return "";
    }


    private int getCallForwardingIndicatorFromSharedPref() {
        int status = IccRecords.CALL_FORWARDING_STATUS_DISABLED;
        int subId = getSubId();