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

Commit abeac54c authored by Automerger Merge Worker's avatar Automerger Merge Worker
Browse files

Merge "Manual network selection by RAN type" am: 6b86cf78 am: 69038fbb

Change-Id: I0973dc1394cd0b9baa8d928e2f8b6cf2758e18f5
parents b148570e 69038fbb
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -9573,6 +9573,7 @@ package android.telephony {
    method @Deprecated @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public void setDataEnabled(int, boolean);
    method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public void setDataRoamingEnabled(boolean);
    method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public void setMultiSimCarrierRestriction(boolean);
    method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public boolean setNetworkSelectionModeManual(@NonNull String, int, boolean);
    method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public boolean setOpportunisticNetworkState(boolean);
    method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public boolean setPreferredNetworkTypeBitmask(long);
    method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public boolean setRadio(boolean);
+30 −0
Original line number Diff line number Diff line
@@ -7645,6 +7645,36 @@ public class TelephonyManager {
                persistSelection);
    }

    /**
     * Ask the radio to connect to the input network and change selection mode to manual.
     *
     * <p>If this object has been created with {@link #createForSubscriptionId}, applies to the
     * given subId. Otherwise, applies to {@link SubscriptionManager#getDefaultSubscriptionId()}
     *
     * <p>Requires Permission:
     * {@link android.Manifest.permission#MODIFY_PHONE_STATE MODIFY_PHONE_STATE} or that the calling
     * app has carrier privileges (see {@link #hasCarrierPrivileges}).
     *
     * @param operatorNumeric the PLMN ID of the network to select.
     * @param ran the initial suggested radio access network type.
     *         If registration fails, the RAN is not available after, the RAN is not within the
     *         network types specified by {@link #setPreferredNetworkTypeBitmask}, or the value is
     *         {@link AccessNetworkConstants.AccessNetworkType#UNKNOWN}, modem will select
     *         the next best RAN for network registration.
     * @param persistSelection whether the selection will persist until reboot.
     *         If true, only allows attaching to the selected PLMN until reboot; otherwise,
     *         attach to the chosen PLMN and resume normal network selection next time.
     * @return {@code true} on success; {@code false} on any failure.
     * @hide
     */
    @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE)
    @SystemApi
    public boolean setNetworkSelectionModeManual(@NonNull String operatorNumeric,
            @AccessNetworkConstants.RadioAccessNetworkType int ran, boolean persistSelection) {
        return setNetworkSelectionModeManual(new OperatorInfo("" /* operatorAlphaLong */,
                "" /* operatorAlphaShort */, operatorNumeric, ran), persistSelection);
    }

    /**
     * Ask the radio to connect to the input network and change selection mode to manual.
     *
+42 −17
Original line number Diff line number Diff line
@@ -20,6 +20,7 @@ import android.compat.annotation.UnsupportedAppUsage;
import android.os.Build;
import android.os.Parcel;
import android.os.Parcelable;
import android.telephony.AccessNetworkConstants.AccessNetworkType;

/**
 * @hide
@@ -43,6 +44,7 @@ public class OperatorInfo implements Parcelable {

    @UnsupportedAppUsage
    private State mState = State.UNKNOWN;
    private int mRan = AccessNetworkType.UNKNOWN;


    @UnsupportedAppUsage
@@ -69,6 +71,10 @@ public class OperatorInfo implements Parcelable {
        return mState;
    }

    public int getRan() {
        return mRan;
    }

    @UnsupportedAppUsage
    OperatorInfo(String operatorAlphaLong,
                String operatorAlphaShort,
@@ -82,6 +88,14 @@ public class OperatorInfo implements Parcelable {
        mState = state;
    }

    OperatorInfo(String operatorAlphaLong,
                String operatorAlphaShort,
                String operatorNumeric,
                State state,
                int ran) {
        this (operatorAlphaLong, operatorAlphaShort, operatorNumeric, state);
        mRan = ran;
    }

    @UnsupportedAppUsage
    public OperatorInfo(String operatorAlphaLong,
@@ -92,6 +106,14 @@ public class OperatorInfo implements Parcelable {
                operatorNumeric, rilStateToState(stateString));
    }

    public OperatorInfo(String operatorAlphaLong,
                String operatorAlphaShort,
                String operatorNumeric,
                int ran) {
        this (operatorAlphaLong, operatorAlphaShort, operatorNumeric);
        mRan = ran;
    }

    @UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.P, trackingBug = 115609023)
    public OperatorInfo(String operatorAlphaLong,
            String operatorAlphaShort,
@@ -124,7 +146,8 @@ public class OperatorInfo implements Parcelable {
        return "OperatorInfo " + mOperatorAlphaLong
                + "/" + mOperatorAlphaShort
                + "/" + mOperatorNumeric
                + "/" + mState;
                + "/" + mState
                + "/" + mRan;
    }

    /**
@@ -150,6 +173,7 @@ public class OperatorInfo implements Parcelable {
        dest.writeString(mOperatorAlphaShort);
        dest.writeString(mOperatorNumeric);
        dest.writeSerializable(mState);
        dest.writeInt(mRan);
    }

    /**
@@ -165,7 +189,8 @@ public class OperatorInfo implements Parcelable {
                            in.readString(), /*operatorAlphaLong*/
                            in.readString(), /*operatorAlphaShort*/
                            in.readString(), /*operatorNumeric*/
                        (State) in.readSerializable()); /*state*/
                            (State) in.readSerializable(), /*state*/
                            in.readInt()); /*ran*/
                    return opInfo;
                }