Add the condition to hide the MMS messages preference
If the carrier config KEY_MMS_MMS_ENABLED_BOOL is false, then the settings hide the MMS messages preference Test: atest MmsMessagePreferenceControllerTest Bug: 371965435 Flag: EXEMPT bugfix Change-Id: I93479bba28120f7b6cc5449f4a8277945d308e40
This commit is contained in:
@@ -224,7 +224,10 @@ class CarrierConfigRepository(private val context: Context) {
|
||||
}
|
||||
|
||||
private val BooleanKeysWhichNotFollowingsNamingConventions =
|
||||
listOf(CarrierConfigManager.KEY_IGNORE_DATA_ENABLED_CHANGED_FOR_VIDEO_CALLS)
|
||||
listOf(
|
||||
CarrierConfigManager.KEY_IGNORE_DATA_ENABLED_CHANGED_FOR_VIDEO_CALLS,
|
||||
CarrierConfigManager.KEY_MMS_MMS_ENABLED_BOOL,
|
||||
)
|
||||
|
||||
private fun checkBooleanKey(key: String) {
|
||||
check(key.endsWith("_bool") || key in BooleanKeysWhichNotFollowingsNamingConventions) {
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
package com.android.settings.network.telephony
|
||||
|
||||
import android.content.Context
|
||||
import android.telephony.CarrierConfigManager
|
||||
import android.telephony.SubscriptionManager
|
||||
import android.telephony.TelephonyManager
|
||||
import android.telephony.data.ApnSetting
|
||||
@@ -45,7 +46,7 @@ constructor(
|
||||
private var subId = SubscriptionManager.INVALID_SUBSCRIPTION_ID
|
||||
private var telephonyManager: TelephonyManager =
|
||||
context.getSystemService(TelephonyManager::class.java)!!
|
||||
|
||||
private val carrierConfigRepository = CarrierConfigRepository(context)
|
||||
private var preferenceScreen: PreferenceScreen? = null
|
||||
|
||||
fun init(subId: Int) {
|
||||
@@ -54,7 +55,13 @@ constructor(
|
||||
}
|
||||
|
||||
override fun getAvailabilityStatus() =
|
||||
if (getAvailabilityStatus(telephonyManager, subId, getDefaultDataSubId)) AVAILABLE
|
||||
if (getAvailabilityStatus(
|
||||
telephonyManager,
|
||||
subId,
|
||||
getDefaultDataSubId,
|
||||
carrierConfigRepository
|
||||
)
|
||||
) AVAILABLE
|
||||
else CONDITIONALLY_UNAVAILABLE
|
||||
|
||||
override fun displayPreference(screen: PreferenceScreen) {
|
||||
@@ -92,11 +99,14 @@ constructor(
|
||||
telephonyManager: TelephonyManager,
|
||||
subId: Int,
|
||||
getDefaultDataSubId: () -> Int,
|
||||
carrierConfigRepository: CarrierConfigRepository,
|
||||
): Boolean {
|
||||
return SubscriptionManager.isValidSubscriptionId(subId) &&
|
||||
!telephonyManager.isDataEnabled &&
|
||||
telephonyManager.isApnMetered(ApnSetting.TYPE_MMS) &&
|
||||
!isFallbackDataEnabled(telephonyManager, subId, getDefaultDataSubId())
|
||||
!isFallbackDataEnabled(telephonyManager, subId, getDefaultDataSubId()) &&
|
||||
carrierConfigRepository.getBoolean(
|
||||
subId, CarrierConfigManager.KEY_MMS_MMS_ENABLED_BOOL)
|
||||
}
|
||||
|
||||
private fun isFallbackDataEnabled(
|
||||
@@ -118,11 +128,16 @@ constructor(
|
||||
) : MobileNetworkSettingsSearchItem {
|
||||
private var telephonyManager: TelephonyManager =
|
||||
context.getSystemService(TelephonyManager::class.java)!!
|
||||
private val carrierConfigRepository = CarrierConfigRepository(context)
|
||||
|
||||
@VisibleForTesting
|
||||
fun isAvailable(subId: Int): Boolean =
|
||||
getAvailabilityStatus(
|
||||
telephonyManager.createForSubscriptionId(subId), subId, getDefaultDataSubId)
|
||||
telephonyManager.createForSubscriptionId(subId),
|
||||
subId,
|
||||
getDefaultDataSubId,
|
||||
carrierConfigRepository
|
||||
)
|
||||
|
||||
override fun getSearchResult(subId: Int): MobileNetworkSettingsSearchResult? {
|
||||
if (!isAvailable(subId)) return null
|
||||
|
||||
Reference in New Issue
Block a user