[Apn] Copy network type into lingering network type
The lingering network type is actually the bit that controls network torn down. UNKNOWN here means the APN can work on any RAT. Just copy network type into lingering network type, so network torn down can work normally. Fix: 341006308 Test: unit test Change-Id: Ia60ad3e012bec7364aa35535de1363cd7c0ccdda
This commit is contained in:
@@ -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,
|
||||
)
|
||||
|
@@ -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())
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user