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

Commit cd8f9413 authored by Amit Mahajan's avatar Amit Mahajan Committed by Android (Google) Code Review
Browse files

Merge "Update saved network operator on manual network selection req instead...

Merge "Update saved network operator on manual network selection req instead of resp." into lmp-mr1-dev
parents 5f9b2cea 8cef6eea
Loading
Loading
Loading
Loading
+18 −12
Original line number Diff line number Diff line
@@ -859,6 +859,8 @@ public abstract class PhoneBase extends Handler implements Phone {

        Message msg = obtainMessage(EVENT_SET_NETWORK_AUTOMATIC_COMPLETE, nsm);
        mCi.setNetworkSelectionModeAutomatic(msg);

        updateSavedNetworkOperator(nsm);
    }

    @Override
@@ -872,6 +874,22 @@ public abstract class PhoneBase extends Handler implements Phone {

        Message msg = obtainMessage(EVENT_SET_NETWORK_MANUAL_COMPLETE, nsm);
        mCi.setNetworkSelectionModeManual(network.getOperatorNumeric(), msg);

        updateSavedNetworkOperator(nsm);
    }

    private void updateSavedNetworkOperator(NetworkSelectMessage nsm) {
        // open the shared preferences editor, and write the value.
        // nsm.operatorNumeric is "" if we're in automatic.selection.
        SharedPreferences sp = PreferenceManager.getDefaultSharedPreferences(getContext());
        SharedPreferences.Editor editor = sp.edit();
        editor.putString(NETWORK_SELECTION_KEY, nsm.operatorNumeric);
        editor.putString(NETWORK_SELECTION_NAME_KEY, nsm.operatorAlphaLong);

        // commit and log the result.
        if (!editor.commit()) {
            Rlog.e(LOG_TAG, "failed to commit network selection preference");
        }
    }

    /**
@@ -893,18 +911,6 @@ public abstract class PhoneBase extends Handler implements Phone {
            AsyncResult.forMessage(nsm.message, ar.result, ar.exception);
            nsm.message.sendToTarget();
        }

        // open the shared preferences editor, and write the value.
        // nsm.operatorNumeric is "" if we're in automatic.selection.
        SharedPreferences sp = PreferenceManager.getDefaultSharedPreferences(getContext());
        SharedPreferences.Editor editor = sp.edit();
        editor.putString(NETWORK_SELECTION_KEY, nsm.operatorNumeric);
        editor.putString(NETWORK_SELECTION_NAME_KEY, nsm.operatorAlphaLong);

        // commit and log the result.
        if (!editor.commit()) {
            Rlog.e(LOG_TAG, "failed to commit network selection preference");
        }
    }

    /**