Merge "[Apn] Copy network type into lingering network type" into main

This commit is contained in:
Chaohui Wang
2024-06-04 10:16:13 +00:00
committed by Android (Google) Code Review
2 changed files with 17 additions and 0 deletions

View File

@@ -70,6 +70,8 @@ data class ApnData(
Telephony.Carriers.ROAMING_PROTOCOL to context.convertOptions2Protocol(apnRoaming),
Telephony.Carriers.TYPE to apnType,
Telephony.Carriers.NETWORK_TYPE_BITMASK to networkType,
// Copy network type into lingering network type.
Telephony.Carriers.LINGERING_NETWORK_TYPE_BITMASK to networkType,
Telephony.Carriers.CARRIER_ENABLED to apnEnable,
Telephony.Carriers.EDITED_STATUS to Telephony.Carriers.USER_EDITED,
)

View File

@@ -16,9 +16,12 @@
package com.android.settings.network.apn
import android.content.Context
import android.os.PersistableBundle
import android.provider.Telephony
import android.telephony.CarrierConfigManager
import android.telephony.TelephonyManager
import androidx.test.core.app.ApplicationProvider
import androidx.test.ext.junit.runners.AndroidJUnit4
import com.google.common.truth.Truth.assertThat
import org.junit.Test
@@ -46,6 +49,8 @@ class ApnStatusTest {
} doReturn p
}
private val context: Context = ApplicationProvider.getApplicationContext()
@Test
fun getCarrierCustomizedConfig_test() {
assert(getCarrierCustomizedConfig(apnData, configManager).isAddApnAllowed)
@@ -81,4 +86,14 @@ class ApnStatusTest {
assertThat(apnData.isFieldEnabled(Telephony.Carriers.PROXY)).isFalse()
assertThat(apnData.isFieldEnabled(Telephony.Carriers.APN)).isTrue()
}
@Test
fun getContentValueMap_copyNetworkTypeIntoLingeringNetworkType() {
val apnData = ApnData(networkType = TelephonyManager.NETWORK_TYPE_NR.toLong())
val contentValueMap = apnData.getContentValueMap(context)
assertThat(contentValueMap.getValue(Telephony.Carriers.LINGERING_NETWORK_TYPE_BITMASK))
.isEqualTo(TelephonyManager.NETWORK_TYPE_NR.toLong())
}
}