Filter out empty phone number

Prevent flicker.

Bug: 318310357
Test: manual - on SIMs
Test: unit test
Change-Id: Ie44ec8bad58b59368099d0fe3f277c12855f8bd4
This commit is contained in:
Chaohui Wang
2024-03-14 17:42:34 +08:00
parent 307c2e995c
commit d85494bd0c
2 changed files with 19 additions and 1 deletions

View File

@@ -141,10 +141,27 @@ class SubscriptionRepositoryTest {
assertThat(subInfos.map { it.subscriptionId }).containsExactly(SUB_ID_1)
}
@Test
fun phoneNumberFlow() = runBlocking {
mockSubscriptionManager.stub {
on { getPhoneNumber(SUB_ID_1) } doReturn NUMBER_1
}
val subInfo = SubscriptionInfo.Builder().apply {
setId(SUB_ID_1)
setMcc(MCC)
}.build()
val phoneNumber = context.phoneNumberFlow(subInfo).firstWithTimeoutOrNull()
assertThat(phoneNumber).isEqualTo(NUMBER_1)
}
private companion object {
const val SUB_ID_1 = 1
const val SUB_ID_2 = 2
val GROUP_UUID = UUID.randomUUID().toString()
const val SIM_SLOT_INDEX = 1
const val NUMBER_1 = "000000001"
const val MCC = "310"
}
}