Modify the condition for showing DSDS dialog
Previous condition: there is the psim when the user enable esim New condition: there is an active psim when the user enable esim Bug: 362368874 Test: Test UI, atest SimOnboardingServiceTest Flag: EXEMPT bugfix Change-Id: I4260674794a961080b1f49e0f3d07ca9f2cf6ab6
This commit is contained in:
@@ -74,8 +74,11 @@ class SimOnboardingService {
|
||||
}
|
||||
var isEsimProfileEnabled: Boolean = false
|
||||
get() {
|
||||
activeSubInfoList.stream().anyMatch { it.isEmbedded }
|
||||
return false
|
||||
return activeSubInfoList.stream().anyMatch { it.isEmbedded }
|
||||
}
|
||||
var isRemovableSimProfileEnabled: Boolean = false
|
||||
get() {
|
||||
return activeSubInfoList.stream().anyMatch { !it.isEmbedded }
|
||||
}
|
||||
var doesTargetSimActive = false
|
||||
get() {
|
||||
@@ -288,8 +291,8 @@ class SimOnboardingService {
|
||||
Log.d(TAG, "Hardware does not support DSDS.")
|
||||
return false
|
||||
}
|
||||
val isActiveSim = activeSubInfoList.isNotEmpty()
|
||||
if (isMultipleEnabledProfilesSupported && isActiveSim) {
|
||||
val anyActiveSim = activeSubInfoList.isNotEmpty()
|
||||
if (isMultipleEnabledProfilesSupported && anyActiveSim) {
|
||||
Log.d(TAG,
|
||||
"Device supports MEP and eSIM operation and eSIM profile is enabled."
|
||||
+ " DSDS condition satisfied."
|
||||
@@ -297,15 +300,13 @@ class SimOnboardingService {
|
||||
return true
|
||||
}
|
||||
|
||||
if (doesTargetSimHaveEsimOperation) {
|
||||
if (UiccSlotRepository(telephonyManager).anyRemovablePhysicalSimEnabled()) {
|
||||
Log.d(
|
||||
TAG,
|
||||
"eSIM operation and removable PSIM is enabled. DSDS condition satisfied."
|
||||
)
|
||||
return true
|
||||
}
|
||||
} else if (isEsimProfileEnabled) {
|
||||
if (doesTargetSimHaveEsimOperation && isRemovableSimProfileEnabled) {
|
||||
Log.d(TAG,
|
||||
"eSIM operation and removable PSIM is enabled. DSDS condition satisfied."
|
||||
)
|
||||
return true
|
||||
}
|
||||
if (!doesTargetSimHaveEsimOperation && isEsimProfileEnabled) {
|
||||
Log.d(TAG,
|
||||
"Removable SIM operation and eSIM profile is enabled. DSDS condition"
|
||||
+ " satisfied."
|
||||
|
||||
@@ -557,15 +557,17 @@ public class ToggleSubscriptionDialogActivity extends SubscriptionActionDialogAc
|
||||
Log.d(TAG, "Hardware does not support DSDS.");
|
||||
return false;
|
||||
}
|
||||
boolean isActiveSim = SubscriptionUtil.getActiveSubscriptions(
|
||||
boolean anyActiveSim = SubscriptionUtil.getActiveSubscriptions(
|
||||
mSubscriptionManager).size() > 0;
|
||||
if (isMultipleEnabledProfilesSupported() && isActiveSim) {
|
||||
if (isMultipleEnabledProfilesSupported() && anyActiveSim) {
|
||||
Log.d(TAG,
|
||||
"Device supports MEP and eSIM operation and eSIM profile is enabled."
|
||||
+ " DSDS condition satisfied.");
|
||||
return true;
|
||||
}
|
||||
boolean isRemovableSimEnabled = isRemovableSimEnabled();
|
||||
boolean isRemovableSimEnabled =
|
||||
SubscriptionUtil.getActiveSubscriptions(mSubscriptionManager).stream()
|
||||
.anyMatch(subInfo-> !subInfo.isEmbedded());
|
||||
if (mIsEsimOperation && isRemovableSimEnabled) {
|
||||
Log.d(TAG, "eSIM operation and removable SIM is enabled. DSDS condition satisfied.");
|
||||
return true;
|
||||
@@ -583,7 +585,7 @@ public class ToggleSubscriptionDialogActivity extends SubscriptionActionDialogAc
|
||||
}
|
||||
|
||||
private boolean isRemovableSimEnabled() {
|
||||
return new UiccSlotRepository(mTelMgr).anyRemovablePhysicalSimEnabled();
|
||||
return new UiccSlotRepository(mTelMgr).anyRemovablePhysicalSimSlotActiveAndInserted();
|
||||
}
|
||||
|
||||
private boolean isMultipleEnabledProfilesSupported() {
|
||||
|
||||
@@ -22,17 +22,17 @@ import android.util.Log
|
||||
|
||||
class UiccSlotRepository(private val telephonyManager: TelephonyManager?) {
|
||||
|
||||
/** Returns whether any removable physical sim is enabled. */
|
||||
fun anyRemovablePhysicalSimEnabled(): Boolean {
|
||||
/** Returns whether any removable physical sim slot is active and the sim is inserted. */
|
||||
fun anyRemovablePhysicalSimSlotActiveAndInserted(): Boolean {
|
||||
val result =
|
||||
telephonyManager?.uiccSlotsInfo?.any { uiccSlotInfo: UiccSlotInfo? ->
|
||||
uiccSlotInfo.isRemovablePhysicalSimEnabled()
|
||||
uiccSlotInfo.isRemovablePhysicalSimSlotActiveAndInserted()
|
||||
} ?: false
|
||||
Log.i(TAG, "anyRemovablePhysicalSimEnabled: $result")
|
||||
return result
|
||||
}
|
||||
|
||||
private fun UiccSlotInfo?.isRemovablePhysicalSimEnabled(): Boolean {
|
||||
private fun UiccSlotInfo?.isRemovablePhysicalSimSlotActiveAndInserted(): Boolean {
|
||||
return this != null &&
|
||||
isRemovable &&
|
||||
!isEuicc &&
|
||||
|
||||
Reference in New Issue
Block a user