Disable ChooseDataSimActivity if single SIM detected
Change-Id: I963a7b4f268698c048cf0eccb15198412b3e2ab3
diff --git a/src/org/lineageos/setupwizard/SimMissingActivity.java b/src/org/lineageos/setupwizard/SimMissingActivity.java
index 4ac1046..e30c92c 100644
--- a/src/org/lineageos/setupwizard/SimMissingActivity.java
+++ b/src/org/lineageos/setupwizard/SimMissingActivity.java
@@ -71,6 +71,8 @@
if (mPhoneMonitor.simMissing()) {
SetupWizardUtils.disableComponent(this, ChooseDataSimActivity.class);
SetupWizardUtils.disableComponent(this, MobileDataActivity.class);
+ } else if (!mPhoneMonitor.isMultiSimDevice() || mPhoneMonitor.singleSimInserted()) {
+ SetupWizardUtils.disableComponent(this, ChooseDataSimActivity.class);
}
super.onNavigateNext();
}
diff --git a/src/org/lineageos/setupwizard/util/PhoneMonitor.java b/src/org/lineageos/setupwizard/util/PhoneMonitor.java
index 47cc4a1..9203eb3 100644
--- a/src/org/lineageos/setupwizard/util/PhoneMonitor.java
+++ b/src/org/lineageos/setupwizard/util/PhoneMonitor.java
@@ -289,6 +289,10 @@
return true;
}
+ public boolean singleSimInserted() {
+ return mSubscriptionManager.getActiveSubscriptionInfoCount() == 1;
+ }
+
// We only care that each slot has a sim
public boolean allSimsInserted() {
int simSlotCount = mTelephony.getSimCount();
diff --git a/src/org/lineageos/setupwizard/util/SetupWizardUtils.java b/src/org/lineageos/setupwizard/util/SetupWizardUtils.java
index bd4c6ea..383895f 100644
--- a/src/org/lineageos/setupwizard/util/SetupWizardUtils.java
+++ b/src/org/lineageos/setupwizard/util/SetupWizardUtils.java
@@ -275,6 +275,10 @@
return PhoneMonitor.getInstance().simMissing();
}
+ public static boolean singleSimInserted() {
+ return PhoneMonitor.getInstance().singleSimInserted();
+ }
+
public static boolean isMultiSimDevice() {
return PhoneMonitor.getInstance().isMultiSimDevice();
}
@@ -293,7 +297,7 @@
} else if (!simMissing()) {
disableComponent(context, SimMissingActivity.class);
}
- if (!isMultiSimDevice()) {
+ if (!isMultiSimDevice() || singleSimInserted()) {
disableComponent(context, ChooseDataSimActivity.class);
}
if (!SetupWizardUtils.hasWifi(context) ||