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

Commit a6453618 authored by Shishir Agrawal's avatar Shishir Agrawal Committed by Android Git Automerger
Browse files

am ec15371b: Allow non-persistent manual network selection.

* commit 'ec15371b':
  Allow non-persistent manual network selection.
parents 6570ee7b ec15371b
Loading
Loading
Loading
Loading
+1 −2
Original line number Diff line number Diff line
@@ -1156,8 +1156,7 @@ public interface Phone {
     *
     * @see #setNetworkSelectionModeAutomatic(Message)
     */
    void selectNetworkManually(OperatorInfo network,
                            Message response);
    void selectNetworkManually(OperatorInfo network, boolean persistSelection, Message response);

    /**
     * Query the radio for the current network selection mode.
+19 −3
Original line number Diff line number Diff line
@@ -1044,7 +1044,8 @@ public abstract class PhoneBase extends Handler implements Phone {
    }

    @Override
    public void selectNetworkManually(OperatorInfo network, Message response) {
    public void selectNetworkManually(OperatorInfo network, boolean persistSelection,
            Message response) {
        // wrap the response message in our own message along with
        // the operator's id.
        NetworkSelectMessage nsm = new NetworkSelectMessage();
@@ -1056,7 +1057,11 @@ public abstract class PhoneBase extends Handler implements Phone {
        Message msg = obtainMessage(EVENT_SET_NETWORK_MANUAL_COMPLETE, nsm);
        mCi.setNetworkSelectionModeManual(network.getOperatorNumeric(), msg);

        if (persistSelection) {
            updateSavedNetworkOperator(nsm);
        } else {
            clearSavedNetworkSelection();
        }
    }

    /**
@@ -1130,6 +1135,17 @@ public abstract class PhoneBase extends Handler implements Phone {
        return new OperatorInfo(numeric, name, shrt);
    }

    /**
     * Clears the saved network selection.
     */
    private void clearSavedNetworkSelection() {
        // open the shared preferences and search with our key.
        PreferenceManager.getDefaultSharedPreferences(getContext()).edit().
                remove(NETWORK_SELECTION_KEY + getSubId()).
                remove(NETWORK_SELECTION_NAME_KEY + getSubId()).
                remove(NETWORK_SELECTION_SHORT_KEY + getSubId()).commit();
    }

    /**
     * Method to restore the previously saved operator id, or reset to
     * automatic selection, all depending upon the value in the shared
@@ -1143,7 +1159,7 @@ public abstract class PhoneBase extends Handler implements Phone {
        if (networkSelection == null || TextUtils.isEmpty(networkSelection.getOperatorNumeric())) {
            setNetworkSelectionModeAutomatic(response);
        } else {
            selectNetworkManually(networkSelection, response);
            selectNetworkManually(networkSelection, true, response);
        }
    }

+3 −2
Original line number Diff line number Diff line
@@ -945,8 +945,9 @@ public class PhoneProxy extends Handler implements Phone {
    }

    @Override
    public void selectNetworkManually(OperatorInfo network, Message response) {
        mActivePhone.selectNetworkManually(network, response);
    public void selectNetworkManually(OperatorInfo network, boolean persistSelection,
            Message response) {
        mActivePhone.selectNetworkManually(network, persistSelection, response);
    }

    @Override
+1 −2
Original line number Diff line number Diff line
@@ -423,8 +423,7 @@ abstract class ImsPhoneBase extends PhoneBase {
    }

    @Override
    public void selectNetworkManually(
            OperatorInfo network,
    public void selectNetworkManually(OperatorInfo network, boolean persistSelection,
            Message response) {
    }

+1 −2
Original line number Diff line number Diff line
@@ -393,8 +393,7 @@ abstract class SipPhoneBase extends PhoneBase {
    }

    @Override
    public void selectNetworkManually(
            OperatorInfo network,
    public void selectNetworkManually(OperatorInfo network, boolean persistSelection,
            Message response) {
    }