Check subscription's validness for network selection's APIs
We should not continue processing the network selection's APIs in underlying
if the given subscription is inactive.
Bug: 111453847
Test: build
Change-Id: I8fc7dcc8479614d49d4ad9c50bfd89e1bd49b618
diff --git a/src/com/android/phone/PhoneInterfaceManager.java b/src/com/android/phone/PhoneInterfaceManager.java
index abfa8d7..cdee4ea 100755
--- a/src/com/android/phone/PhoneInterfaceManager.java
+++ b/src/com/android/phone/PhoneInterfaceManager.java
@@ -1172,9 +1172,6 @@
private Phone getPhone(int subId) {
return PhoneFactory.getPhone(mSubscriptionController.getPhoneId(subId));
}
- //
- // Implementation of the ITelephony interface.
- //
public void dial(String number) {
dialForSubscriber(getPreferredVoiceSubscription(), number);
@@ -2591,6 +2588,10 @@
@Override
public int getNetworkSelectionMode(int subId) {
+ if (!isActiveSubscription(subId)) {
+ return TelephonyManager.NETWORK_SELECTION_MODE_UNKNOWN;
+ }
+
return (int) sendRequest(CMD_GET_NETWORK_SELECTION_MODE, null /* argument */, subId);
}
@@ -2752,6 +2753,10 @@
return mSubscriptionController.getDefaultVoiceSubId();
}
+ private boolean isActiveSubscription(int subId) {
+ return mSubscriptionController.isActiveSubId(subId);
+ }
+
/**
* @see android.telephony.TelephonyManager.WifiCallingChoices
*/
@@ -3279,6 +3284,10 @@
TelephonyPermissions.enforceCallingOrSelfModifyPermissionOrCarrierPrivilege(
mApp, subId, "setNetworkSelectionModeAutomatic");
+ if (!isActiveSubscription(subId)) {
+ return;
+ }
+
final long identity = Binder.clearCallingIdentity();
try {
if (DBG) log("setNetworkSelectionModeAutomatic: subId " + subId);
@@ -3304,6 +3313,11 @@
int subId, OperatorInfo operatorInfo, boolean persistSelection) {
TelephonyPermissions.enforceCallingOrSelfModifyPermissionOrCarrierPrivilege(
mApp, subId, "setNetworkSelectionModeManual");
+
+ if (!isActiveSubscription(subId)) {
+ return false;
+ }
+
final long identity = Binder.clearCallingIdentity();
try {
ManualNetworkSelectionArgument arg = new ManualNetworkSelectionArgument(operatorInfo,