Merge "Disable 'Mobile data' selection after removing SIM" am: 87d1e30f17

Change-Id: I14dc87ff0f185bdbfb5734b6501f727e2cb19792
This commit is contained in:
Treehugger Robot
2020-04-29 22:50:24 +00:00
committed by Automerger Merge Worker
2 changed files with 10 additions and 0 deletions

View File

@@ -10890,6 +10890,9 @@
<string name="mobile_data_settings_summary_auto_switch"> <string name="mobile_data_settings_summary_auto_switch">
Phone will automatically switch to this carrier when in range Phone will automatically switch to this carrier when in range
</string> </string>
<!-- Mobile network setting screen, summary of Mobile data switch preference when the network
is unavailable, the preference selection will be disabled. [CHAR LIMIT=NONE] -->
<string name="mobile_data_settings_summary_unavailable">No SIM card available</string>
<!-- Mobile network settings screen, title of item showing the name of the default subscription <!-- Mobile network settings screen, title of item showing the name of the default subscription
that will be used for calls. This only appears in multi-SIM mode. [CHAR LIMIT=NONE] --> that will be used for calls. This only appears in multi-SIM mode. [CHAR LIMIT=NONE] -->

View File

@@ -128,6 +128,13 @@ public class MobileDataPreferenceController extends TelephonyTogglePreferenceCon
preference.setEnabled(true); preference.setEnabled(true);
preference.setSummary(R.string.mobile_data_settings_summary); preference.setSummary(R.string.mobile_data_settings_summary);
} }
if (mSubId == SubscriptionManager.INVALID_SUBSCRIPTION_ID) {
preference.setSelectable(false);
preference.setSummary(R.string.mobile_data_settings_summary_unavailable);
} else {
preference.setSelectable(true);
}
} }
private boolean isOpportunistic() { private boolean isOpportunistic() {