Merge "Icon displays abnormally about FDN in the phone process"
diff --git a/src/com/android/phone/PhoneInterfaceManager.java b/src/com/android/phone/PhoneInterfaceManager.java
index 5c6dd83..17067ec 100755
--- a/src/com/android/phone/PhoneInterfaceManager.java
+++ b/src/com/android/phone/PhoneInterfaceManager.java
@@ -48,6 +48,7 @@
import android.os.RemoteException;
import android.os.ResultReceiver;
import android.os.ServiceManager;
+import android.os.ServiceSpecificException;
import android.os.ShellCallback;
import android.os.SystemProperties;
import android.os.UserHandle;
@@ -93,6 +94,7 @@
import android.telephony.data.ApnSetting.ApnType;
import android.telephony.emergency.EmergencyNumber;
import android.telephony.gsm.GsmCellLocation;
+import android.telephony.ims.ImsException;
import android.telephony.ims.ProvisioningManager;
import android.telephony.ims.aidl.IImsCapabilityCallback;
import android.telephony.ims.aidl.IImsConfig;
@@ -110,7 +112,6 @@
import android.util.Pair;
import android.util.Slog;
-import com.android.ims.ImsException;
import com.android.ims.ImsManager;
import com.android.ims.internal.IImsServiceFeatureCallback;
import com.android.internal.telephony.CallManager;
@@ -2853,6 +2854,8 @@
// TODO: Refactor to remove ImsManager dependence and query through ImsPhone directly.
ImsManager.getInstance(mApp, getSlotIndexOrException(subId))
.addRegistrationCallbackForSubscription(c, subId);
+ } catch (ImsException e) {
+ throw new ServiceSpecificException(e.getCode());
} finally {
Binder.restoreCallingIdentity(token);
}
@@ -2869,7 +2872,7 @@
// TODO: Refactor to remove ImsManager dependence and query through ImsPhone.
ImsManager.getInstance(mApp, getSlotIndexOrException(subId))
.removeRegistrationCallbackForSubscription(c, subId);
- } catch (IllegalArgumentException e) {
+ } catch (ImsException e) {
Log.i(LOG_TAG, "unregisterImsRegistrationCallback: " + subId
+ "is inactive, ignoring unregister.");
// If the subscription is no longer active, just return, since the callback
@@ -2887,6 +2890,8 @@
try {
ImsManager.getInstance(mApp, getSlotIndexOrException(subId))
.addCapabilitiesCallbackForSubscription(c, subId);
+ } catch (ImsException e) {
+ throw new ServiceSpecificException(e.getCode());
} finally {
Binder.restoreCallingIdentity(token);
}
@@ -2904,7 +2909,7 @@
// TODO: Refactor to remove ImsManager dependence and query through ImsPhone.
ImsManager.getInstance(mApp, getSlotIndexOrException(subId))
.removeCapabilitiesCallbackForSubscription(c, subId);
- } catch (IllegalArgumentException e) {
+ } catch (ImsException e) {
Log.i(LOG_TAG, "unregisterMmTelCapabilityCallback: " + subId
+ "is inactive, ignoring unregister.");
// If the subscription is no longer active, just return, since the callback
@@ -2921,10 +2926,10 @@
try {
return ImsManager.getInstance(mApp,
getSlotIndexOrException(subId)).queryMmTelCapability(capability, regTech);
- } catch (ImsException e) {
+ } catch (com.android.ims.ImsException e) {
Log.w(LOG_TAG, "IMS isCapable - service unavailable: " + e.getMessage());
return false;
- } catch (IllegalArgumentException e) {
+ } catch (ImsException e) {
Log.i(LOG_TAG, "isCapable: " + subId + " is inactive, returning false.");
return false;
} finally {
@@ -2953,6 +2958,8 @@
try {
return ImsManager.getInstance(mApp,
getSlotIndexOrException(subId)).isEnhanced4gLteModeSettingEnabledByUser();
+ } catch (ImsException e) {
+ throw new ServiceSpecificException(e.getCode());
} finally {
Binder.restoreCallingIdentity(token);
}
@@ -2967,6 +2974,8 @@
// TODO: Refactor to remove ImsManager dependence and query through ImsPhone directly.
ImsManager.getInstance(mApp,
getSlotIndexOrException(subId)).setEnhanced4gLteModeSetting(isEnabled);
+ } catch (ImsException e) {
+ throw new ServiceSpecificException(e.getCode());
} finally {
Binder.restoreCallingIdentity(identity);
}
@@ -2978,8 +2987,9 @@
final long identity = Binder.clearCallingIdentity();
try {
// TODO: Refactor to remove ImsManager dependence and query through ImsPhone directly.
- return ImsManager.getInstance(mApp,
- getSlotIndexOrException(subId)).isVtEnabledByUser();
+ return ImsManager.getInstance(mApp, getSlotIndexOrException(subId)).isVtEnabledByUser();
+ } catch (ImsException e) {
+ throw new ServiceSpecificException(e.getCode());
} finally {
Binder.restoreCallingIdentity(identity);
}
@@ -2993,6 +3003,8 @@
try {
// TODO: Refactor to remove ImsManager dependence and query through ImsPhone directly.
ImsManager.getInstance(mApp, getSlotIndexOrException(subId)).setVtSetting(isEnabled);
+ } catch (ImsException e) {
+ throw new ServiceSpecificException(e.getCode());
} finally {
Binder.restoreCallingIdentity(identity);
}
@@ -3006,6 +3018,8 @@
// TODO: Refactor to remove ImsManager dependence and query through ImsPhone directly.
return ImsManager.getInstance(mApp,
getSlotIndexOrException(subId)).isWfcEnabledByUser();
+ } catch (ImsException e) {
+ throw new ServiceSpecificException(e.getCode());
} finally {
Binder.restoreCallingIdentity(identity);
}
@@ -3019,6 +3033,8 @@
try {
// TODO: Refactor to remove ImsManager dependence and query through ImsPhone directly.
ImsManager.getInstance(mApp, getSlotIndexOrException(subId)).setWfcSetting(isEnabled);
+ } catch (ImsException e) {
+ throw new ServiceSpecificException(e.getCode());
} finally {
Binder.restoreCallingIdentity(identity);
}
@@ -3032,6 +3048,8 @@
// TODO: Refactor to remove ImsManager dependence and query through ImsPhone directly.
return ImsManager.getInstance(mApp,
getSlotIndexOrException(subId)).isWfcRoamingEnabledByUser();
+ } catch (ImsException e) {
+ throw new ServiceSpecificException(e.getCode());
} finally {
Binder.restoreCallingIdentity(identity);
}
@@ -3046,6 +3064,8 @@
// TODO: Refactor to remove ImsManager dependence and query through ImsPhone directly.
ImsManager.getInstance(mApp,
getSlotIndexOrException(subId)).setWfcRoamingSetting(isEnabled);
+ } catch (ImsException e) {
+ throw new ServiceSpecificException(e.getCode());
} finally {
Binder.restoreCallingIdentity(identity);
}
@@ -3060,6 +3080,8 @@
// TODO: Refactor to remove ImsManager dependence and query through ImsPhone directly.
ImsManager.getInstance(mApp,
getSlotIndexOrException(subId)).setWfcNonPersistent(isCapable, mode);
+ } catch (ImsException e) {
+ throw new ServiceSpecificException(e.getCode());
} finally {
Binder.restoreCallingIdentity(identity);
}
@@ -3073,6 +3095,8 @@
// TODO: Refactor to remove ImsManager dependence and query through ImsPhone directly.
return ImsManager.getInstance(mApp,
getSlotIndexOrException(subId)).getWfcMode(false /*isRoaming*/);
+ } catch (ImsException e) {
+ throw new ServiceSpecificException(e.getCode());
} finally {
Binder.restoreCallingIdentity(identity);
}
@@ -3087,6 +3111,8 @@
// TODO: Refactor to remove ImsManager dependence and query through ImsPhone directly.
ImsManager.getInstance(mApp,
getSlotIndexOrException(subId)).setWfcMode(mode, false /*isRoaming*/);
+ } catch (ImsException e) {
+ throw new ServiceSpecificException(e.getCode());
} finally {
Binder.restoreCallingIdentity(identity);
}
@@ -3100,6 +3126,8 @@
// TODO: Refactor to remove ImsManager dependence and query through ImsPhone directly.
return ImsManager.getInstance(mApp,
getSlotIndexOrException(subId)).getWfcMode(true /*isRoaming*/);
+ } catch (ImsException e) {
+ throw new ServiceSpecificException(e.getCode());
} finally {
Binder.restoreCallingIdentity(identity);
}
@@ -3114,6 +3142,8 @@
// TODO: Refactor to remove ImsManager dependence and query through ImsPhone directly.
ImsManager.getInstance(mApp,
getSlotIndexOrException(subId)).setWfcMode(mode, true /*isRoaming*/);
+ } catch (ImsException e) {
+ throw new ServiceSpecificException(e.getCode());
} finally {
Binder.restoreCallingIdentity(identity);
}
@@ -3126,8 +3156,9 @@
final long identity = Binder.clearCallingIdentity();
try {
// TODO: Refactor to remove ImsManager dependence and query through ImsPhone directly.
- ImsManager.getInstance(mApp,
- getSlotIndexOrException(subId)).setRttEnabled(isEnabled);
+ ImsManager.getInstance(mApp, getSlotIndexOrException(subId)).setRttEnabled(isEnabled);
+ } catch (ImsException e) {
+ throw new ServiceSpecificException(e.getCode());
} finally {
Binder.restoreCallingIdentity(identity);
}
@@ -3141,6 +3172,8 @@
// TODO: Refactor to remove ImsManager dependence and query through ImsPhone directly.
return ImsManager.getInstance(mApp,
getSlotIndexOrException(subId)).isTtyOnVoLteCapable();
+ } catch (ImsException e) {
+ throw new ServiceSpecificException(e.getCode());
} finally {
Binder.restoreCallingIdentity(identity);
}
@@ -3154,6 +3187,8 @@
// TODO: Refactor to remove ImsManager dependence and query through ImsPhone directly.
ImsManager.getInstance(mApp, getSlotIndexOrException(subId))
.addProvisioningCallbackForSubscription(callback, subId);
+ } catch (ImsException e) {
+ throw new ServiceSpecificException(e.getCode());
} finally {
Binder.restoreCallingIdentity(identity);
}
@@ -3170,7 +3205,7 @@
// TODO: Refactor to remove ImsManager dependence and query through ImsPhone directly.
ImsManager.getInstance(mApp, getSlotIndexOrException(subId))
.removeProvisioningCallbackForSubscription(callback, subId);
- } catch (IllegalArgumentException e) {
+ } catch (ImsException e) {
Log.i(LOG_TAG, "unregisterImsProvisioningChangedCallback: " + subId
+ "is inactive, ignoring unregister.");
// If the subscription is no longer active, just return, since the callback will already
@@ -3229,7 +3264,7 @@
cacheMmTelCapabilityProvisioning(subId, capability, tech, isProvisioned);
try {
ims.changeMmTelCapability(capability, tech, isProvisioned);
- } catch (ImsException e) {
+ } catch (com.android.ims.ImsException e) {
loge("setImsProvisioningStatusForCapability: couldn't change UT capability"
+ ", Exception" + e.getMessage());
}
@@ -3417,7 +3452,7 @@
return ImsConfigImplBase.CONFIG_RESULT_UNKNOWN;
}
return ImsManager.getInstance(mApp, slotId).getConfigInterface().getConfigInt(key);
- } catch (ImsException e) {
+ } catch (com.android.ims.ImsException e) {
Log.w(LOG_TAG, "getImsProvisioningInt: ImsService is not available for subscription '"
+ subId + "' for key:" + key);
return ImsConfigImplBase.CONFIG_RESULT_UNKNOWN;
@@ -3442,7 +3477,7 @@
return ProvisioningManager.STRING_QUERY_RESULT_ERROR_GENERIC;
}
return ImsManager.getInstance(mApp, slotId).getConfigInterface().getConfigString(key);
- } catch (ImsException e) {
+ } catch (com.android.ims.ImsException e) {
Log.w(LOG_TAG, "getImsProvisioningString: ImsService is not available for sub '"
+ subId + "' for key:" + key);
return ProvisioningManager.STRING_QUERY_RESULT_ERROR_NOT_READY;
@@ -3468,7 +3503,7 @@
return ImsConfigImplBase.CONFIG_RESULT_FAILED;
}
return ImsManager.getInstance(mApp, slotId).getConfigInterface().setConfig(key, value);
- } catch (ImsException e) {
+ } catch (com.android.ims.ImsException e) {
Log.w(LOG_TAG, "setImsProvisioningInt: ImsService unavailable for sub '" + subId
+ "' for key:" + key);
return ImsConfigImplBase.CONFIG_RESULT_FAILED;
@@ -3494,7 +3529,7 @@
return ImsConfigImplBase.CONFIG_RESULT_FAILED;
}
return ImsManager.getInstance(mApp, slotId).getConfigInterface().setConfig(key, value);
- } catch (ImsException e) {
+ } catch (com.android.ims.ImsException e) {
Log.w(LOG_TAG, "setImsProvisioningString: ImsService unavailable for sub '" + subId
+ "' for key:" + key);
return ImsConfigImplBase.CONFIG_RESULT_FAILED;
@@ -3503,10 +3538,11 @@
}
}
- private int getSlotIndexOrException(int subId) throws IllegalArgumentException {
+ private int getSlotIndexOrException(int subId) throws ImsException {
int slotId = SubscriptionManager.getSlotIndex(subId);
if (!SubscriptionManager.isValidSlotIndex(slotId)) {
- throw new IllegalArgumentException("Invalid Subscription Id, subId=" + subId);
+ throw new ImsException("Invalid Subscription Id, subId=" + subId,
+ ImsException.CODE_ERROR_INVALID_SUBSCRIPTION);
}
return slotId;
}