Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit edece0c1 authored by Aleksander Morgado's avatar Aleksander Morgado
Browse files

Use isMobileDataCapable helper in NetworkAndInternet

Disabling telephony support may be done either with the
config_show_sim_info config option, or based on whether
TelephonyManager reports data capabilities. The isMobileDataCapable()
helper method ensures both ways are supported.

With this change, if config_show_sim_info=false, the "Network and
Internet" page menu entry won't make any reference to "Mobile", in the
same way as if FEATURE_TELEPHONY_DATA is not set.

Bug: 395714454
Test: mm && atest
Flag: EXEMPT bugfix
Change-Id: I223b5c0c5f04a45f899b4d22a578a262d93108ad
parent 161c389b
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -27,8 +27,8 @@ import androidx.compose.runtime.Composable
import androidx.compose.runtime.remember
import androidx.compose.ui.res.stringResource
import com.android.settings.R
import com.android.settings.Utils
import com.android.settingslib.RestrictedLockUtilsInternal
import com.android.settingslib.Utils
import com.android.settingslib.spa.framework.common.SettingsEntryBuilder
import com.android.settingslib.spa.framework.common.SettingsPageProvider
import com.android.settingslib.spa.framework.common.SpaEnvironmentFactory
@@ -84,7 +84,7 @@ object NetworkAndInternetPageProvider : SettingsPageProvider {

    private fun isMobileAvailable(): Boolean {
        val context = SpaEnvironmentFactory.instance.appContext
        return !isUserRestricted(context) && !Utils.isWifiOnly(context)
        return !isUserRestricted(context) && Utils.isMobileDataCapable(context)
    }

    private fun isUserRestricted(context: Context): Boolean {