Sort in slot selectable subscriptions first
Then the ones that not in slot. Bug: 340361264 Test: manual - on SIMs Test: unit test Change-Id: If7150bd2fa5c1b7d42fe34ef2e814ba540454ed8
This commit is contained in:
@@ -124,6 +124,14 @@ fun Context.getSelectableSubscriptionInfoList(): List<SubscriptionInfo> {
|
||||
}
|
||||
}
|
||||
// Matching the sorting order in SubscriptionManagerService.getAvailableSubscriptionInfoList
|
||||
.sortedWith(compareBy({ it.simSlotIndex }, { it.subscriptionId }))
|
||||
.sortedWith(compareBy({ it.sortableSimSlotIndex }, { it.subscriptionId }))
|
||||
.also { Log.d(TAG, "getSelectableSubscriptionInfoList: $it") }
|
||||
}
|
||||
|
||||
/** Subscription with invalid sim slot index has lowest sort order. */
|
||||
private val SubscriptionInfo.sortableSimSlotIndex: Int
|
||||
get() = if (simSlotIndex != SubscriptionManager.INVALID_SIM_SLOT_INDEX) {
|
||||
simSlotIndex
|
||||
} else {
|
||||
Int.MAX_VALUE
|
||||
}
|
||||
|
Reference in New Issue
Block a user