Merge "Modify the condition for showing DSDS dialog" into main
This commit is contained in:
committed by
Android (Google) Code Review
commit
10373c67c0
@@ -74,8 +74,11 @@ class SimOnboardingService {
|
|||||||
}
|
}
|
||||||
var isEsimProfileEnabled: Boolean = false
|
var isEsimProfileEnabled: Boolean = false
|
||||||
get() {
|
get() {
|
||||||
activeSubInfoList.stream().anyMatch { it.isEmbedded }
|
return activeSubInfoList.stream().anyMatch { it.isEmbedded }
|
||||||
return false
|
}
|
||||||
|
var isRemovableSimProfileEnabled: Boolean = false
|
||||||
|
get() {
|
||||||
|
return activeSubInfoList.stream().anyMatch { !it.isEmbedded }
|
||||||
}
|
}
|
||||||
var doesTargetSimActive = false
|
var doesTargetSimActive = false
|
||||||
get() {
|
get() {
|
||||||
@@ -288,8 +291,8 @@ class SimOnboardingService {
|
|||||||
Log.d(TAG, "Hardware does not support DSDS.")
|
Log.d(TAG, "Hardware does not support DSDS.")
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
val isActiveSim = activeSubInfoList.isNotEmpty()
|
val anyActiveSim = activeSubInfoList.isNotEmpty()
|
||||||
if (isMultipleEnabledProfilesSupported && isActiveSim) {
|
if (isMultipleEnabledProfilesSupported && anyActiveSim) {
|
||||||
Log.d(TAG,
|
Log.d(TAG,
|
||||||
"Device supports MEP and eSIM operation and eSIM profile is enabled."
|
"Device supports MEP and eSIM operation and eSIM profile is enabled."
|
||||||
+ " DSDS condition satisfied."
|
+ " DSDS condition satisfied."
|
||||||
@@ -297,15 +300,13 @@ class SimOnboardingService {
|
|||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
if (doesTargetSimHaveEsimOperation) {
|
if (doesTargetSimHaveEsimOperation && isRemovableSimProfileEnabled) {
|
||||||
if (UiccSlotRepository(telephonyManager).anyRemovablePhysicalSimEnabled()) {
|
Log.d(TAG,
|
||||||
Log.d(
|
"eSIM operation and removable PSIM is enabled. DSDS condition satisfied."
|
||||||
TAG,
|
)
|
||||||
"eSIM operation and removable PSIM is enabled. DSDS condition satisfied."
|
return true
|
||||||
)
|
}
|
||||||
return true
|
if (!doesTargetSimHaveEsimOperation && isEsimProfileEnabled) {
|
||||||
}
|
|
||||||
} else if (isEsimProfileEnabled) {
|
|
||||||
Log.d(TAG,
|
Log.d(TAG,
|
||||||
"Removable SIM operation and eSIM profile is enabled. DSDS condition"
|
"Removable SIM operation and eSIM profile is enabled. DSDS condition"
|
||||||
+ " satisfied."
|
+ " satisfied."
|
||||||
|
@@ -557,15 +557,17 @@ public class ToggleSubscriptionDialogActivity extends SubscriptionActionDialogAc
|
|||||||
Log.d(TAG, "Hardware does not support DSDS.");
|
Log.d(TAG, "Hardware does not support DSDS.");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
boolean isActiveSim = SubscriptionUtil.getActiveSubscriptions(
|
boolean anyActiveSim = SubscriptionUtil.getActiveSubscriptions(
|
||||||
mSubscriptionManager).size() > 0;
|
mSubscriptionManager).size() > 0;
|
||||||
if (isMultipleEnabledProfilesSupported() && isActiveSim) {
|
if (isMultipleEnabledProfilesSupported() && anyActiveSim) {
|
||||||
Log.d(TAG,
|
Log.d(TAG,
|
||||||
"Device supports MEP and eSIM operation and eSIM profile is enabled."
|
"Device supports MEP and eSIM operation and eSIM profile is enabled."
|
||||||
+ " DSDS condition satisfied.");
|
+ " DSDS condition satisfied.");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
boolean isRemovableSimEnabled = isRemovableSimEnabled();
|
boolean isRemovableSimEnabled =
|
||||||
|
SubscriptionUtil.getActiveSubscriptions(mSubscriptionManager).stream()
|
||||||
|
.anyMatch(subInfo-> !subInfo.isEmbedded());
|
||||||
if (mIsEsimOperation && isRemovableSimEnabled) {
|
if (mIsEsimOperation && isRemovableSimEnabled) {
|
||||||
Log.d(TAG, "eSIM operation and removable SIM is enabled. DSDS condition satisfied.");
|
Log.d(TAG, "eSIM operation and removable SIM is enabled. DSDS condition satisfied.");
|
||||||
return true;
|
return true;
|
||||||
@@ -583,7 +585,7 @@ public class ToggleSubscriptionDialogActivity extends SubscriptionActionDialogAc
|
|||||||
}
|
}
|
||||||
|
|
||||||
private boolean isRemovableSimEnabled() {
|
private boolean isRemovableSimEnabled() {
|
||||||
return new UiccSlotRepository(mTelMgr).anyRemovablePhysicalSimEnabled();
|
return new UiccSlotRepository(mTelMgr).anyRemovablePhysicalSimSlotActiveAndInserted();
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean isMultipleEnabledProfilesSupported() {
|
private boolean isMultipleEnabledProfilesSupported() {
|
||||||
|
@@ -22,17 +22,17 @@ import android.util.Log
|
|||||||
|
|
||||||
class UiccSlotRepository(private val telephonyManager: TelephonyManager?) {
|
class UiccSlotRepository(private val telephonyManager: TelephonyManager?) {
|
||||||
|
|
||||||
/** Returns whether any removable physical sim is enabled. */
|
/** Returns whether any removable physical sim slot is active and the sim is inserted. */
|
||||||
fun anyRemovablePhysicalSimEnabled(): Boolean {
|
fun anyRemovablePhysicalSimSlotActiveAndInserted(): Boolean {
|
||||||
val result =
|
val result =
|
||||||
telephonyManager?.uiccSlotsInfo?.any { uiccSlotInfo: UiccSlotInfo? ->
|
telephonyManager?.uiccSlotsInfo?.any { uiccSlotInfo: UiccSlotInfo? ->
|
||||||
uiccSlotInfo.isRemovablePhysicalSimEnabled()
|
uiccSlotInfo.isRemovablePhysicalSimSlotActiveAndInserted()
|
||||||
} ?: false
|
} ?: false
|
||||||
Log.i(TAG, "anyRemovablePhysicalSimEnabled: $result")
|
Log.i(TAG, "anyRemovablePhysicalSimEnabled: $result")
|
||||||
return result
|
return result
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun UiccSlotInfo?.isRemovablePhysicalSimEnabled(): Boolean {
|
private fun UiccSlotInfo?.isRemovablePhysicalSimSlotActiveAndInserted(): Boolean {
|
||||||
return this != null &&
|
return this != null &&
|
||||||
isRemovable &&
|
isRemovable &&
|
||||||
!isEuicc &&
|
!isEuicc &&
|
||||||
|
@@ -16,21 +16,55 @@
|
|||||||
|
|
||||||
package com.android.settings.network
|
package com.android.settings.network
|
||||||
|
|
||||||
|
import android.content.Context
|
||||||
import android.telephony.SubscriptionInfo
|
import android.telephony.SubscriptionInfo
|
||||||
|
import android.telephony.SubscriptionManager
|
||||||
|
import android.telephony.TelephonyManager
|
||||||
|
import android.telephony.UiccCardInfo
|
||||||
|
import android.telephony.UiccPortInfo
|
||||||
|
import androidx.test.core.app.ApplicationProvider
|
||||||
import androidx.test.ext.junit.runners.AndroidJUnit4
|
import androidx.test.ext.junit.runners.AndroidJUnit4
|
||||||
import com.google.common.truth.Truth.assertThat
|
import com.google.common.truth.Truth.assertThat
|
||||||
import org.junit.Rule
|
import kotlinx.coroutines.delay
|
||||||
|
import kotlinx.coroutines.runBlocking
|
||||||
import org.junit.Test
|
import org.junit.Test
|
||||||
import org.junit.runner.RunWith
|
import org.junit.runner.RunWith
|
||||||
|
import org.mockito.kotlin.doReturn
|
||||||
|
import org.mockito.kotlin.mock
|
||||||
|
import org.mockito.kotlin.spy
|
||||||
|
import org.mockito.kotlin.stub
|
||||||
|
|
||||||
|
|
||||||
@RunWith(AndroidJUnit4::class)
|
@RunWith(AndroidJUnit4::class)
|
||||||
class SimOnboardingServiceTest {
|
class SimOnboardingServiceTest {
|
||||||
|
val simOnboardingService = SimOnboardingService()
|
||||||
|
|
||||||
|
private val mockTelephonyManager = mock<TelephonyManager> {
|
||||||
|
on { activeModemCount } doReturn 2
|
||||||
|
on { isMultiSimSupported } doReturn TelephonyManager.MULTISIM_ALLOWED
|
||||||
|
on { uiccCardsInfo } doReturn mepUiccCardInfoList
|
||||||
|
}
|
||||||
|
|
||||||
|
private val mockSubscriptionManager = mock<SubscriptionManager> {
|
||||||
|
on { activeSubscriptionInfoList } doReturn listOf(
|
||||||
|
SUB_INFO_1,
|
||||||
|
SUB_INFO_2
|
||||||
|
)
|
||||||
|
on { availableSubscriptionInfoList } doReturn listOf(
|
||||||
|
SUB_INFO_1,
|
||||||
|
SUB_INFO_2,
|
||||||
|
SUB_INFO_3,
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
private val context: Context = spy(ApplicationProvider.getApplicationContext()) {
|
||||||
|
on { getSystemService(SubscriptionManager::class.java) } doReturn mockSubscriptionManager
|
||||||
|
on { getSystemService(TelephonyManager::class.java) } doReturn mockTelephonyManager
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun addItemForRenaming_addItemWithNewName_findItem() {
|
fun addItemForRenaming_addItemWithNewName_findItem() {
|
||||||
val simOnboardingService = SimOnboardingService()
|
|
||||||
val newName = "NewName"
|
val newName = "NewName"
|
||||||
|
|
||||||
simOnboardingService.addItemForRenaming(SUB_INFO_1, newName)
|
simOnboardingService.addItemForRenaming(SUB_INFO_1, newName)
|
||||||
|
|
||||||
assertThat(simOnboardingService.renameMutableMap)
|
assertThat(simOnboardingService.renameMutableMap)
|
||||||
@@ -39,8 +73,6 @@ class SimOnboardingServiceTest {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun addItemForRenaming_sameNameAndItemNotInList_removeItem() {
|
fun addItemForRenaming_sameNameAndItemNotInList_removeItem() {
|
||||||
val simOnboardingService = SimOnboardingService()
|
|
||||||
|
|
||||||
simOnboardingService.addItemForRenaming(SUB_INFO_1, DISPLAY_NAME_1)
|
simOnboardingService.addItemForRenaming(SUB_INFO_1, DISPLAY_NAME_1)
|
||||||
|
|
||||||
assertThat(simOnboardingService.renameMutableMap)
|
assertThat(simOnboardingService.renameMutableMap)
|
||||||
@@ -49,7 +81,6 @@ class SimOnboardingServiceTest {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun addItemForRenaming_sameNameAndItemInList_removeItem() {
|
fun addItemForRenaming_sameNameAndItemInList_removeItem() {
|
||||||
val simOnboardingService = SimOnboardingService()
|
|
||||||
simOnboardingService.renameMutableMap[SUB_INFO_1.subscriptionId] = "NewName"
|
simOnboardingService.renameMutableMap[SUB_INFO_1.subscriptionId] = "NewName"
|
||||||
|
|
||||||
simOnboardingService.addItemForRenaming(SUB_INFO_1, DISPLAY_NAME_1)
|
simOnboardingService.addItemForRenaming(SUB_INFO_1, DISPLAY_NAME_1)
|
||||||
@@ -58,13 +89,205 @@ class SimOnboardingServiceTest {
|
|||||||
.doesNotContainKey(SUB_INFO_1.subscriptionId)
|
.doesNotContainKey(SUB_INFO_1.subscriptionId)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
fun isDsdsConditionSatisfied_isMultiSimEnabled_returnFalse(){
|
||||||
|
simOnboardingService.initData(SUB_ID_3, context, {})
|
||||||
|
|
||||||
|
assertThat(simOnboardingService.isDsdsConditionSatisfied()).isFalse()
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
fun isDsdsConditionSatisfied_isNotMultiSimSupported_returnFalse() {
|
||||||
|
mockTelephonyManager.stub {
|
||||||
|
on { activeModemCount } doReturn 1
|
||||||
|
on {
|
||||||
|
isMultiSimSupported
|
||||||
|
} doReturn TelephonyManager.MULTISIM_NOT_SUPPORTED_BY_HARDWARE
|
||||||
|
}
|
||||||
|
simOnboardingService.initData(SUB_ID_3, context, {})
|
||||||
|
|
||||||
|
assertThat(simOnboardingService.isDsdsConditionSatisfied()).isFalse()
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
fun isDsdsConditionSatisfied_mepAndOneActiveSim_returnTrue() = runBlocking {
|
||||||
|
mockTelephonyManager.stub {
|
||||||
|
on { activeModemCount } doReturn 1
|
||||||
|
}
|
||||||
|
simOnboardingService.initData(SUB_ID_3, context, {})
|
||||||
|
delay(100)
|
||||||
|
|
||||||
|
assertThat(simOnboardingService.isDsdsConditionSatisfied()).isTrue()
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
fun isDsdsConditionSatisfied_mepAndNoActiveSim_returnFalse() = runBlocking {
|
||||||
|
mockTelephonyManager.stub {
|
||||||
|
on { activeModemCount } doReturn 1
|
||||||
|
}
|
||||||
|
mockSubscriptionManager.stub {
|
||||||
|
on { activeSubscriptionInfoList } doReturn listOf()
|
||||||
|
}
|
||||||
|
simOnboardingService.initData(SUB_ID_3, context, {})
|
||||||
|
delay(100)
|
||||||
|
|
||||||
|
assertThat(simOnboardingService.isDsdsConditionSatisfied()).isFalse()
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
fun isDsdsConditionSatisfied_insertEsimAndOneActivePsimNoMep_returnTrue() = runBlocking {
|
||||||
|
mockTelephonyManager.stub {
|
||||||
|
on { getActiveModemCount() } doReturn 1
|
||||||
|
on { uiccCardsInfo } doReturn noMepUiccCardInfoList
|
||||||
|
}
|
||||||
|
simOnboardingService.initData(SUB_ID_3, context, {})
|
||||||
|
delay(100)
|
||||||
|
|
||||||
|
assertThat(simOnboardingService.isDsdsConditionSatisfied()).isTrue()
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
fun isDsdsConditionSatisfied_insertEsimAndNoPsimNoMep_returnFalse() = runBlocking {
|
||||||
|
mockTelephonyManager.stub {
|
||||||
|
on { getActiveModemCount() } doReturn 1
|
||||||
|
on { uiccCardsInfo } doReturn noMepUiccCardInfoList
|
||||||
|
}
|
||||||
|
mockSubscriptionManager.stub {
|
||||||
|
on { activeSubscriptionInfoList } doReturn listOf()
|
||||||
|
}
|
||||||
|
simOnboardingService.initData(SUB_ID_3, context, {})
|
||||||
|
delay(100)
|
||||||
|
|
||||||
|
assertThat(simOnboardingService.isDsdsConditionSatisfied()).isFalse()
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
fun isDsdsConditionSatisfied_insertPsimAndOneActiveEsimNoMep_returnTrue() = runBlocking {
|
||||||
|
mockTelephonyManager.stub {
|
||||||
|
on { getActiveModemCount() } doReturn 1
|
||||||
|
on { uiccCardsInfo } doReturn noMepUiccCardInfoList
|
||||||
|
}
|
||||||
|
mockSubscriptionManager.stub {
|
||||||
|
on { activeSubscriptionInfoList } doReturn listOf(
|
||||||
|
SUB_INFO_2
|
||||||
|
)
|
||||||
|
}
|
||||||
|
simOnboardingService.initData(SUB_ID_1, context, {})
|
||||||
|
delay(100)
|
||||||
|
|
||||||
|
assertThat(simOnboardingService.isDsdsConditionSatisfied()).isTrue()
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
fun isDsdsConditionSatisfied_insertPsimAndNoEsimNoMep_returnFalse() = runBlocking {
|
||||||
|
mockTelephonyManager.stub {
|
||||||
|
on { getActiveModemCount() } doReturn 1
|
||||||
|
on { uiccCardsInfo } doReturn noMepUiccCardInfoList
|
||||||
|
}
|
||||||
|
mockSubscriptionManager.stub {
|
||||||
|
on { activeSubscriptionInfoList } doReturn listOf()
|
||||||
|
}
|
||||||
|
simOnboardingService.initData(SUB_ID_1, context, {})
|
||||||
|
delay(100)
|
||||||
|
|
||||||
|
assertThat(simOnboardingService.isDsdsConditionSatisfied()).isFalse()
|
||||||
|
}
|
||||||
|
|
||||||
private companion object {
|
private companion object {
|
||||||
const val SUB_ID_1 = 1
|
const val SUB_ID_1 = 1
|
||||||
|
const val SUB_ID_2 = 2
|
||||||
|
const val SUB_ID_3 = 3
|
||||||
|
const val SUB_ID_4 = 4
|
||||||
const val DISPLAY_NAME_1 = "Sub 1"
|
const val DISPLAY_NAME_1 = "Sub 1"
|
||||||
|
|
||||||
val SUB_INFO_1: SubscriptionInfo = SubscriptionInfo.Builder().apply {
|
val SUB_INFO_1: SubscriptionInfo = SubscriptionInfo.Builder().apply {
|
||||||
setId(SUB_ID_1)
|
setId(SUB_ID_1)
|
||||||
setDisplayName(DISPLAY_NAME_1)
|
setDisplayName(DISPLAY_NAME_1)
|
||||||
}.build()
|
}.build()
|
||||||
|
|
||||||
|
val SUB_INFO_2: SubscriptionInfo = SubscriptionInfo.Builder().apply {
|
||||||
|
setId(SUB_ID_2)
|
||||||
|
setEmbedded(true)
|
||||||
|
}.build()
|
||||||
|
|
||||||
|
val SUB_INFO_3: SubscriptionInfo = SubscriptionInfo.Builder().apply {
|
||||||
|
setId(SUB_ID_3)
|
||||||
|
setEmbedded(true)
|
||||||
|
}.build()
|
||||||
|
|
||||||
|
val SUB_INFO_4: SubscriptionInfo = SubscriptionInfo.Builder().apply {
|
||||||
|
setId(SUB_ID_4)
|
||||||
|
}.build()
|
||||||
|
|
||||||
|
private const val REMOVABLE_CARD_ID_1: Int = 25
|
||||||
|
private const val REMOVABLE_CARD_ID_2: Int = 26
|
||||||
|
private const val EUICC_CARD_ID_3: Int = 27
|
||||||
|
private const val EUICC_CARD_ID_4: Int = 28
|
||||||
|
|
||||||
|
val noMepUiccCardInfoList: List<UiccCardInfo> = listOf(
|
||||||
|
createUiccCardInfo(
|
||||||
|
isEuicc = true,
|
||||||
|
cardId = EUICC_CARD_ID_3,
|
||||||
|
physicalSlotIndex = 0,
|
||||||
|
isRemovable = false,
|
||||||
|
isMultipleEnabledProfileSupported = false,
|
||||||
|
logicalSlotIndex = -1,
|
||||||
|
portIndex = -1
|
||||||
|
),
|
||||||
|
createUiccCardInfo(
|
||||||
|
isEuicc = false,
|
||||||
|
cardId = REMOVABLE_CARD_ID_1,
|
||||||
|
physicalSlotIndex = 1,
|
||||||
|
isRemovable = true,
|
||||||
|
isMultipleEnabledProfileSupported = false,
|
||||||
|
logicalSlotIndex = -1,
|
||||||
|
portIndex = -1
|
||||||
|
)
|
||||||
|
)
|
||||||
|
val mepUiccCardInfoList: List<UiccCardInfo> = listOf(
|
||||||
|
createUiccCardInfo(
|
||||||
|
isEuicc = true,
|
||||||
|
cardId = EUICC_CARD_ID_3,
|
||||||
|
physicalSlotIndex = 0,
|
||||||
|
isRemovable = false,
|
||||||
|
logicalSlotIndex = -1,
|
||||||
|
portIndex = -1
|
||||||
|
),
|
||||||
|
createUiccCardInfo(
|
||||||
|
isEuicc = false,
|
||||||
|
cardId = REMOVABLE_CARD_ID_1,
|
||||||
|
physicalSlotIndex = 1,
|
||||||
|
isRemovable = true,
|
||||||
|
logicalSlotIndex = -1,
|
||||||
|
portIndex = -1
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
|
private fun createUiccCardInfo(
|
||||||
|
isEuicc: Boolean,
|
||||||
|
cardId: Int,
|
||||||
|
physicalSlotIndex: Int,
|
||||||
|
isRemovable: Boolean,
|
||||||
|
logicalSlotIndex: Int,
|
||||||
|
portIndex: Int,
|
||||||
|
isMultipleEnabledProfileSupported:Boolean = true,
|
||||||
|
): UiccCardInfo {
|
||||||
|
return UiccCardInfo(
|
||||||
|
isEuicc, /* isEuicc */
|
||||||
|
cardId, /* cardId */
|
||||||
|
null, /* eid */
|
||||||
|
physicalSlotIndex, /* physicalSlotIndex */
|
||||||
|
isRemovable, /* isRemovable */
|
||||||
|
isMultipleEnabledProfileSupported, /* isMultipleEnabledProfileSupported */
|
||||||
|
listOf(
|
||||||
|
UiccPortInfo(
|
||||||
|
"123451234567890", /* iccId */
|
||||||
|
portIndex, /* portIdx */
|
||||||
|
logicalSlotIndex, /* logicalSlotIdx */
|
||||||
|
true /* isActive */
|
||||||
|
)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
@@ -44,7 +44,7 @@ class UiccSlotRepositoryTest {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
val result = repository.anyRemovablePhysicalSimEnabled()
|
val result = repository.anyRemovablePhysicalSimSlotActiveAndInserted()
|
||||||
|
|
||||||
assertThat(result).isFalse()
|
assertThat(result).isFalse()
|
||||||
}
|
}
|
||||||
@@ -61,7 +61,7 @@ class UiccSlotRepositoryTest {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
val result = repository.anyRemovablePhysicalSimEnabled()
|
val result = repository.anyRemovablePhysicalSimSlotActiveAndInserted()
|
||||||
|
|
||||||
assertThat(result).isFalse()
|
assertThat(result).isFalse()
|
||||||
}
|
}
|
||||||
@@ -78,7 +78,7 @@ class UiccSlotRepositoryTest {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
val result = repository.anyRemovablePhysicalSimEnabled()
|
val result = repository.anyRemovablePhysicalSimSlotActiveAndInserted()
|
||||||
|
|
||||||
assertThat(result).isTrue()
|
assertThat(result).isTrue()
|
||||||
}
|
}
|
||||||
@@ -95,7 +95,7 @@ class UiccSlotRepositoryTest {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
val result = repository.anyRemovablePhysicalSimEnabled()
|
val result = repository.anyRemovablePhysicalSimSlotActiveAndInserted()
|
||||||
|
|
||||||
assertThat(result).isTrue()
|
assertThat(result).isTrue()
|
||||||
}
|
}
|
||||||
@@ -116,7 +116,7 @@ class UiccSlotRepositoryTest {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
val result = repository.anyRemovablePhysicalSimEnabled()
|
val result = repository.anyRemovablePhysicalSimSlotActiveAndInserted()
|
||||||
|
|
||||||
assertThat(result).isFalse()
|
assertThat(result).isFalse()
|
||||||
}
|
}
|
||||||
@@ -137,13 +137,13 @@ class UiccSlotRepositoryTest {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
val result = repository.anyRemovablePhysicalSimEnabled()
|
val result = repository.anyRemovablePhysicalSimSlotActiveAndInserted()
|
||||||
|
|
||||||
assertThat(result).isTrue()
|
assertThat(result).isTrue()
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun anyRemovablePhysicalSimEnabled_activePsim_returnsTrue() {
|
fun anyRemovablePhysicalSimSlotActiveAndInserted_activePsim_returnsTrue() {
|
||||||
mockTelephonyManager.stub {
|
mockTelephonyManager.stub {
|
||||||
on { uiccSlotsInfo } doReturn
|
on { uiccSlotsInfo } doReturn
|
||||||
arrayOf(
|
arrayOf(
|
||||||
@@ -152,13 +152,13 @@ class UiccSlotRepositoryTest {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
val result = repository.anyRemovablePhysicalSimEnabled()
|
val result = repository.anyRemovablePhysicalSimSlotActiveAndInserted()
|
||||||
|
|
||||||
assertThat(result).isTrue()
|
assertThat(result).isTrue()
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun anyRemovablePhysicalSimEnabled_inactivePsim_returnsFalse() {
|
fun anyRemovablePhysicalSimSlotActiveAndInserted_inactivePsim_returnsFalse() {
|
||||||
mockTelephonyManager.stub {
|
mockTelephonyManager.stub {
|
||||||
on { uiccSlotsInfo } doReturn
|
on { uiccSlotsInfo } doReturn
|
||||||
arrayOf(
|
arrayOf(
|
||||||
@@ -167,13 +167,13 @@ class UiccSlotRepositoryTest {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
val result = repository.anyRemovablePhysicalSimEnabled()
|
val result = repository.anyRemovablePhysicalSimSlotActiveAndInserted()
|
||||||
|
|
||||||
assertThat(result).isFalse()
|
assertThat(result).isFalse()
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun anyRemovablePhysicalSimEnabled_activeEsimAndActivePsim_returnsTrue() {
|
fun anyRemovablePhysicalSimSlotActiveAndInserted_activeEsimAndActivePsim_returnsTrue() {
|
||||||
mockTelephonyManager.stub {
|
mockTelephonyManager.stub {
|
||||||
on { uiccSlotsInfo } doReturn
|
on { uiccSlotsInfo } doReturn
|
||||||
arrayOf(
|
arrayOf(
|
||||||
@@ -184,13 +184,13 @@ class UiccSlotRepositoryTest {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
val result = repository.anyRemovablePhysicalSimEnabled()
|
val result = repository.anyRemovablePhysicalSimSlotActiveAndInserted()
|
||||||
|
|
||||||
assertThat(result).isTrue()
|
assertThat(result).isTrue()
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun anyRemovablePhysicalSimEnabled_activeEsimAndInactivePsim_returnsFalse() {
|
fun anyRemovablePhysicalSimSlotActiveAndInserted_activeEsimAndInactivePsim_returnsFalse() {
|
||||||
mockTelephonyManager.stub {
|
mockTelephonyManager.stub {
|
||||||
on { uiccSlotsInfo } doReturn
|
on { uiccSlotsInfo } doReturn
|
||||||
arrayOf(
|
arrayOf(
|
||||||
@@ -201,16 +201,16 @@ class UiccSlotRepositoryTest {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
val result = repository.anyRemovablePhysicalSimEnabled()
|
val result = repository.anyRemovablePhysicalSimSlotActiveAndInserted()
|
||||||
|
|
||||||
assertThat(result).isFalse()
|
assertThat(result).isFalse()
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun anyRemovablePhysicalSimEnabled_uiccSlotInfoIsNull_returnsFalse() {
|
fun anyRemovablePhysicalSimSlotActiveAndInserted_uiccSlotInfoIsNull_returnsFalse() {
|
||||||
mockTelephonyManager.stub { on { uiccSlotsInfo } doReturn arrayOf(null) }
|
mockTelephonyManager.stub { on { uiccSlotsInfo } doReturn arrayOf(null) }
|
||||||
|
|
||||||
val result = repository.anyRemovablePhysicalSimEnabled()
|
val result = repository.anyRemovablePhysicalSimSlotActiveAndInserted()
|
||||||
|
|
||||||
assertThat(result).isFalse()
|
assertThat(result).isFalse()
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user