Merge "[Settings] Avoid from accessing IMS with invalid subscription id" into rvc-dev am: 06899ffb8e

Change-Id: Ic2c5c2d409176de58ba54dce107b5f94195c4c64
This commit is contained in:
Bonian Chen
2020-03-20 11:01:30 +00:00
committed by Automerger Merge Worker
4 changed files with 24 additions and 0 deletions

View File

@@ -83,6 +83,9 @@ abstract class ImsQueryController {
@VisibleForTesting @VisibleForTesting
boolean isProvisionedOnDevice(int subId) { boolean isProvisionedOnDevice(int subId) {
if (!SubscriptionManager.isValidSubscriptionId(subId)) {
return false;
}
return (new ImsQueryProvisioningStat(subId, mCapability, mTech)).query(); return (new ImsQueryProvisioningStat(subId, mCapability, mTech)).query();
} }

View File

@@ -60,6 +60,9 @@ public class VolteQueryImsState extends ImsQueryController {
*/ */
@VisibleForTesting @VisibleForTesting
boolean isEnabledByUser(int subId) { boolean isEnabledByUser(int subId) {
if (!SubscriptionManager.isValidSubscriptionId(subId)) {
return false;
}
return (new ImsQueryEnhanced4gLteModeUserSetting(subId)).query(); return (new ImsQueryEnhanced4gLteModeUserSetting(subId)).query();
} }
@@ -75,6 +78,9 @@ public class VolteQueryImsState extends ImsQueryController {
* @return true when VoLTE has been enabled, otherwise false * @return true when VoLTE has been enabled, otherwise false
*/ */
public boolean isVoLteProvisioned() { public boolean isVoLteProvisioned() {
if (!SubscriptionManager.isValidSubscriptionId(mSubId)) {
return false;
}
if (!isProvisionedOnDevice(mSubId)) { if (!isProvisionedOnDevice(mSubId)) {
return false; return false;
} }
@@ -92,6 +98,9 @@ public class VolteQueryImsState extends ImsQueryController {
* @return true when VoLTE can be performed, otherwise false * @return true when VoLTE can be performed, otherwise false
*/ */
public boolean isReadyToVoLte() { public boolean isReadyToVoLte() {
if (!SubscriptionManager.isValidSubscriptionId(mSubId)) {
return false;
}
return isVoLteProvisioned() return isVoLteProvisioned()
&& MobileNetworkUtils.isImsServiceStateReady(getImsManager(mSubId)); && MobileNetworkUtils.isImsServiceStateReady(getImsManager(mSubId));
} }

View File

@@ -59,6 +59,9 @@ public class VtQueryImsState extends ImsQueryController {
*/ */
@VisibleForTesting @VisibleForTesting
boolean isEnabledByUser(int subId) { boolean isEnabledByUser(int subId) {
if (!SubscriptionManager.isValidSubscriptionId(subId)) {
return false;
}
return (new ImsQueryVtUserSetting(subId)).query(); return (new ImsQueryVtUserSetting(subId)).query();
} }

View File

@@ -56,6 +56,9 @@ public class WifiCallingQueryImsState extends ImsQueryController {
*/ */
@VisibleForTesting @VisibleForTesting
boolean isEnabledByUser(int subId) { boolean isEnabledByUser(int subId) {
if (!SubscriptionManager.isValidSubscriptionId(subId)) {
return false;
}
return (new ImsQueryWfcUserSetting(subId)).query(); return (new ImsQueryWfcUserSetting(subId)).query();
} }
@@ -71,6 +74,9 @@ public class WifiCallingQueryImsState extends ImsQueryController {
* @return true when Wifi Calling has been enabled, otherwise false * @return true when Wifi Calling has been enabled, otherwise false
*/ */
public boolean isWifiCallingProvisioned() { public boolean isWifiCallingProvisioned() {
if (!SubscriptionManager.isValidSubscriptionId(mSubId)) {
return false;
}
final ImsManager imsManager = getImsManager(mSubId); final ImsManager imsManager = getImsManager(mSubId);
if (imsManager == null) { if (imsManager == null) {
return false; return false;
@@ -86,6 +92,9 @@ public class WifiCallingQueryImsState extends ImsQueryController {
* @return true when Wifi Calling can be performed, otherwise false * @return true when Wifi Calling can be performed, otherwise false
*/ */
public boolean isReadyToWifiCalling() { public boolean isReadyToWifiCalling() {
if (!SubscriptionManager.isValidSubscriptionId(mSubId)) {
return false;
}
return isWifiCallingProvisioned() return isWifiCallingProvisioned()
&& MobileNetworkUtils.isImsServiceStateReady(getImsManager(mSubId)); && MobileNetworkUtils.isImsServiceStateReady(getImsManager(mSubId));
} }