Ensure access to mobile network configs is restricted.
This CL check if access to mobile network configurations are restricted before initializing and enabling CallFeaturesSetting, PhoneAccountSettingsActivity, and VoicemailSettingsActivity. This reolves a security vulnerability where users were able to configure the various mobile network settings (Call, voicemail, phone accounts, FDN, etc.) even after the device owner had applied the no_config_mobile_networks restriction.
Fixes: 277589443
Test: Manual using the POC apks
Flag: com.android.internal.telephony.flags.ensure_access_to_call_settings_is_restricted
Change-Id: Id288879bfe9384472e3701e455c5ed607430a967
diff --git a/src/com/android/phone/CallFeaturesSetting.java b/src/com/android/phone/CallFeaturesSetting.java
index 145df41..1dfcde7 100644
--- a/src/com/android/phone/CallFeaturesSetting.java
+++ b/src/com/android/phone/CallFeaturesSetting.java
@@ -58,6 +58,7 @@
import com.android.ims.ImsManager;
import com.android.internal.telephony.Phone;
import com.android.internal.telephony.PhoneConstants;
+import com.android.internal.telephony.flags.Flags;
import com.android.phone.settings.PhoneAccountSettingsFragment;
import com.android.phone.settings.SuppServicesUiUtil;
import com.android.phone.settings.VoicemailSettingsActivity;
@@ -113,6 +114,7 @@
private PreferenceScreen mVoicemailSettingsScreen;
private SwitchPreference mEnableVideoCalling;
private Preference mButtonWifiCalling;
+ private boolean mDisallowedConfig = false;
/*
* Click Listeners, handle click based on objects attached to UI.
@@ -263,6 +265,14 @@
return;
}
+ // Check if mobile network configs are restricted.
+ if (Flags.ensureAccessToCallSettingsIsRestricted() &&
+ userManager.hasUserRestriction(UserManager.DISALLOW_CONFIG_MOBILE_NETWORKS)) {
+ mDisallowedConfig = true;
+ Log.i(LOG_TAG, "Mobile network configs are restricted, disabling mobile network "
+ + "settings");
+ }
+
mSubscriptionInfoHelper = new SubscriptionInfoHelper(this, getIntent());
mPhone = mSubscriptionInfoHelper.getPhone();
mSubscriptionInfoHelper.setActionBarTitle(
@@ -467,7 +477,7 @@
if (mImsMgr.isVtEnabledByPlatform() && mImsMgr.isVtProvisionedOnDevice()
&& (carrierConfig.getBoolean(
CarrierConfigManager.KEY_IGNORE_DATA_ENABLED_CHANGED_FOR_VIDEO_CALLS)
- || isDataEnabled)) {
+ || isDataEnabled) && !mDisallowedConfig) {
boolean currentValue =
mImsMgr.isEnhanced4gLteModeSettingEnabledByUser()
? mImsMgr.isVtEnabledByUser() : false;