Waiting for the psim subscriptionInfo ready

When the pSIM is inserted for the first time, this subscriptionInfo arrives late.
It causes the sim onboarding is closed.
We add the timer to wait the psim's subscriptionInfo.

Bug: 377171470
Flag: EXEMPT bugfix
Test: insert the psim and showing the sim onboarding flow.
Change-Id: Ib50c28d1bb1372fb822b3cf10cfa3fb22c457b3b
This commit is contained in:
songferngwang
2024-12-13 10:39:45 +00:00
parent 626017d196
commit 2575e89c8a
3 changed files with 493 additions and 432 deletions

View File

@@ -40,6 +40,7 @@ import kotlinx.coroutines.flow.map
import kotlinx.coroutines.flow.onEach
import kotlinx.coroutines.flow.onStart
import kotlinx.coroutines.flow.shareIn
import java.util.stream.Collectors
private const val TAG = "SubscriptionRepository"
@@ -154,6 +155,18 @@ class SubscriptionRepository(private val context: Context) {
.conflate()
.flowOn(Dispatchers.Default)
fun removableSubscriptionInfoListFlow(): Flow<List<SubscriptionInfo>> {
return subscriptionsChangedFlow()
.map {
subscriptionManager.availableSubscriptionInfoList?.stream()
?.filter { sub: SubscriptionInfo -> !sub.isEmbedded }
?.collect(Collectors.toList()) ?: emptyList()
}
.conflate()
.onEach { Log.d(TAG, "getRemovableSubscriptionVisibleFlow: $it") }
.flowOn(Dispatchers.Default)
}
@OptIn(ExperimentalCoroutinesApi::class)
fun phoneNumberFlow(subId: Int): Flow<String?> =
activeSubscriptionInfoFlow(subId).flatMapLatest { subInfo ->