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

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

am b4a5bf15: am 8d1784e1: am ec15371b: Allow non-persistent manual network selection.

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


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


    @Override
    @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
        // wrap the response message in our own message along with
        // the operator's id.
        // the operator's id.
        NetworkSelectMessage nsm = new NetworkSelectMessage();
        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);
        Message msg = obtainMessage(EVENT_SET_NETWORK_MANUAL_COMPLETE, nsm);
        mCi.setNetworkSelectionModeManual(network.getOperatorNumeric(), msg);
        mCi.setNetworkSelectionModeManual(network.getOperatorNumeric(), msg);


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


    /**
    /**
@@ -1130,6 +1135,17 @@ public abstract class PhoneBase extends Handler implements Phone {
        return new OperatorInfo(numeric, name, shrt);
        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
     * Method to restore the previously saved operator id, or reset to
     * automatic selection, all depending upon the value in the shared
     * 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())) {
        if (networkSelection == null || TextUtils.isEmpty(networkSelection.getOperatorNumeric())) {
            setNetworkSelectionModeAutomatic(response);
            setNetworkSelectionModeAutomatic(response);
        } else {
        } else {
            selectNetworkManually(networkSelection, response);
            selectNetworkManually(networkSelection, true, response);
        }
        }
    }
    }


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


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


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


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


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


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