Manual network selection by RAN type
Support new API for setNetworkSelectionModeManual with ran parameter Bug: 68116277 Test: atest FrameworksTelephonyTests Change-Id: I0e8b78b1b16d4bf6a6c0f39eedc48b253ca7a810
This commit is contained in:
@@ -11925,6 +11925,7 @@ package android.telephony {
|
||||
method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public void setDataRoamingEnabled(boolean);
|
||||
method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public int setIccLockEnabled(boolean, @NonNull String);
|
||||
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 void setPolicyDataEnabled(boolean);
|
||||
method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public boolean setPreferredNetworkTypeBitmask(long);
|
||||
|
||||
@@ -7929,6 +7929,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.
|
||||
*
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -158,20 +182,21 @@ public class OperatorInfo implements Parcelable {
|
||||
*/
|
||||
@UnsupportedAppUsage
|
||||
public static final Creator<OperatorInfo> CREATOR =
|
||||
new Creator<OperatorInfo>() {
|
||||
@Override
|
||||
public OperatorInfo createFromParcel(Parcel in) {
|
||||
OperatorInfo opInfo = new OperatorInfo(
|
||||
in.readString(), /*operatorAlphaLong*/
|
||||
in.readString(), /*operatorAlphaShort*/
|
||||
in.readString(), /*operatorNumeric*/
|
||||
(State) in.readSerializable()); /*state*/
|
||||
return opInfo;
|
||||
}
|
||||
new Creator<OperatorInfo>() {
|
||||
@Override
|
||||
public OperatorInfo createFromParcel(Parcel in) {
|
||||
OperatorInfo opInfo = new OperatorInfo(
|
||||
in.readString(), /*operatorAlphaLong*/
|
||||
in.readString(), /*operatorAlphaShort*/
|
||||
in.readString(), /*operatorNumeric*/
|
||||
(State) in.readSerializable(), /*state*/
|
||||
in.readInt()); /*ran*/
|
||||
return opInfo;
|
||||
}
|
||||
|
||||
@Override
|
||||
public OperatorInfo[] newArray(int size) {
|
||||
return new OperatorInfo[size];
|
||||
}
|
||||
};
|
||||
@Override
|
||||
public OperatorInfo[] newArray(int size) {
|
||||
return new OperatorInfo[size];
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user