[Settings] Avoid from accessing IMS with invalid subscription id
Check subscription ID before accessing to IMS APIs Bug: 149190278 Test: make and manual test Change-Id: I0561529ccaf23c84d7d6dd3e268386ab82f17418
This commit is contained in:
@@ -83,6 +83,9 @@ abstract class ImsQueryController {
|
||||
|
||||
@VisibleForTesting
|
||||
boolean isProvisionedOnDevice(int subId) {
|
||||
if (!SubscriptionManager.isValidSubscriptionId(subId)) {
|
||||
return false;
|
||||
}
|
||||
return (new ImsQueryProvisioningStat(subId, mCapability, mTech)).query();
|
||||
}
|
||||
|
||||
|
@@ -60,6 +60,9 @@ public class VolteQueryImsState extends ImsQueryController {
|
||||
*/
|
||||
@VisibleForTesting
|
||||
boolean isEnabledByUser(int subId) {
|
||||
if (!SubscriptionManager.isValidSubscriptionId(subId)) {
|
||||
return false;
|
||||
}
|
||||
return (new ImsQueryEnhanced4gLteModeUserSetting(subId)).query();
|
||||
}
|
||||
|
||||
@@ -75,6 +78,9 @@ public class VolteQueryImsState extends ImsQueryController {
|
||||
* @return true when VoLTE has been enabled, otherwise false
|
||||
*/
|
||||
public boolean isVoLteProvisioned() {
|
||||
if (!SubscriptionManager.isValidSubscriptionId(mSubId)) {
|
||||
return false;
|
||||
}
|
||||
if (!isProvisionedOnDevice(mSubId)) {
|
||||
return false;
|
||||
}
|
||||
@@ -92,6 +98,9 @@ public class VolteQueryImsState extends ImsQueryController {
|
||||
* @return true when VoLTE can be performed, otherwise false
|
||||
*/
|
||||
public boolean isReadyToVoLte() {
|
||||
if (!SubscriptionManager.isValidSubscriptionId(mSubId)) {
|
||||
return false;
|
||||
}
|
||||
return isVoLteProvisioned()
|
||||
&& MobileNetworkUtils.isImsServiceStateReady(getImsManager(mSubId));
|
||||
}
|
||||
|
@@ -59,6 +59,9 @@ public class VtQueryImsState extends ImsQueryController {
|
||||
*/
|
||||
@VisibleForTesting
|
||||
boolean isEnabledByUser(int subId) {
|
||||
if (!SubscriptionManager.isValidSubscriptionId(subId)) {
|
||||
return false;
|
||||
}
|
||||
return (new ImsQueryVtUserSetting(subId)).query();
|
||||
}
|
||||
|
||||
|
@@ -56,6 +56,9 @@ public class WifiCallingQueryImsState extends ImsQueryController {
|
||||
*/
|
||||
@VisibleForTesting
|
||||
boolean isEnabledByUser(int subId) {
|
||||
if (!SubscriptionManager.isValidSubscriptionId(subId)) {
|
||||
return false;
|
||||
}
|
||||
return (new ImsQueryWfcUserSetting(subId)).query();
|
||||
}
|
||||
|
||||
@@ -71,6 +74,9 @@ public class WifiCallingQueryImsState extends ImsQueryController {
|
||||
* @return true when Wifi Calling has been enabled, otherwise false
|
||||
*/
|
||||
public boolean isWifiCallingProvisioned() {
|
||||
if (!SubscriptionManager.isValidSubscriptionId(mSubId)) {
|
||||
return false;
|
||||
}
|
||||
final ImsManager imsManager = getImsManager(mSubId);
|
||||
if (imsManager == null) {
|
||||
return false;
|
||||
@@ -86,6 +92,9 @@ public class WifiCallingQueryImsState extends ImsQueryController {
|
||||
* @return true when Wifi Calling can be performed, otherwise false
|
||||
*/
|
||||
public boolean isReadyToWifiCalling() {
|
||||
if (!SubscriptionManager.isValidSubscriptionId(mSubId)) {
|
||||
return false;
|
||||
}
|
||||
return isWifiCallingProvisioned()
|
||||
&& MobileNetworkUtils.isImsServiceStateReady(getImsManager(mSubId));
|
||||
}
|
||||
|
Reference in New Issue
Block a user