[Settings][Back port] configuration for hidding SIM settings UI

Hide SIM settings UI based on configuraion.

Bug: 240515161
Test: test cases and local testing
Merged-In: If1df99a79e51125d03f534cdfc9408b01c61024f
Merged-In: I3d8b9b02998f09122a63f2262817acff3ca84d2e
Change-Id: I32169dc7d21164ca40297e75ca9122ecb9ade039
This commit is contained in:
Bonian Chen
2022-10-24 01:42:24 +00:00
parent 6d2a0cdf0d
commit b4a8672dd9
5 changed files with 33 additions and 2 deletions

View File

@@ -60,6 +60,10 @@ public class MobileNetworkListFragment extends DashboardFragment {
@Override
protected List<AbstractPreferenceController> createPreferenceControllers(Context context) {
final List<AbstractPreferenceController> controllers = new ArrayList<>();
if (!SubscriptionUtil.isSimHardwareVisible(getContext())) {
finish();
return controllers;
}
NetworkProviderSimsCategoryController simCategoryPrefCtrl =
new NetworkProviderSimsCategoryController(context, KEY_PREFERENCE_CATEGORY_SIM,
@@ -88,7 +92,8 @@ public class MobileNetworkListFragment extends DashboardFragment {
@Override
protected boolean isPageSearchEnabled(Context context) {
return context.getSystemService(UserManager.class).isAdminUser();
return SubscriptionUtil.isSimHardwareVisible(context) &&
context.getSystemService(UserManager.class).isAdminUser();
}
};
}

View File

@@ -120,6 +120,10 @@ public class MobileNetworkSettings extends AbstractMobileNetworkSettings {
@Override
protected List<AbstractPreferenceController> createPreferenceControllers(Context context) {
if (!SubscriptionUtil.isSimHardwareVisible(context)) {
finish();
return Arrays.asList();
}
if (getArguments() == null) {
Intent intent = getIntent();
if (intent != null) {
@@ -398,7 +402,8 @@ public class MobileNetworkSettings extends AbstractMobileNetworkSettings {
/** suppress full page if user is not admin */
@Override
protected boolean isPageSearchEnabled(Context context) {
return context.getSystemService(UserManager.class).isAdminUser();
return SubscriptionUtil.isSimHardwareVisible(context) &&
context.getSystemService(UserManager.class).isAdminUser();
}
};

View File

@@ -263,6 +263,9 @@ public class MobileNetworkUtils {
* the user has enabled development mode.
*/
public static boolean showEuiccSettings(Context context) {
if (!SubscriptionUtil.isSimHardwareVisible(context)) {
return false;
}
long timeForAccess = SystemClock.elapsedRealtime();
try {
Boolean isShow = ((Future<Boolean>) ThreadUtils.postOnBackgroundThread(() -> {