diff options
| author | Diogo Ferreira <diogo@underdev.org> | 2016-01-29 14:10:08 +0000 |
|---|---|---|
| committer | Gerrit Code Review <gerrit@cyanogenmod.org> | 2016-02-01 08:00:52 -0800 |
| commit | 646e12057f00a0dcafa8d94ed368ea93b780ab1a (patch) | |
| tree | b889e0fbc7414b5d1ff8b6fc8d961a51fb8e6da1 /src | |
| parent | 0352eee716d4d217ee5f5427322679a1dba42b53 (diff) | |
| download | packages_apps_Settings-646e12057f00a0dcafa8d94ed368ea93b780ab1a.tar.gz packages_apps_Settings-646e12057f00a0dcafa8d94ed368ea93b780ab1a.tar.bz2 packages_apps_Settings-646e12057f00a0dcafa8d94ed368ea93b780ab1a.zip | |
SimSettings: Disable entry for missing sim
Clicking on a missing SIM card will show incorrect information
because the user network preference is indexed by subscription id.
This means that when the SIM is not present we cannot infer which
subscription settings we are actually showing or changing so the
whole screen is effectively useless.
This patch disables configuration entries for invalid subscriptions.
Ticket: CYNGNOS-1794
Change-Id: Ic5125f66f4cdaafe06d03b3b20b80341525d6c87
Diffstat (limited to 'src')
| -rw-r--r-- | src/com/android/settings/sim/SimSettings.java | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/src/com/android/settings/sim/SimSettings.java b/src/com/android/settings/sim/SimSettings.java index 9102e7e08..5f7ca310f 100644 --- a/src/com/android/settings/sim/SimSettings.java +++ b/src/com/android/settings/sim/SimSettings.java @@ -187,6 +187,9 @@ public class SimSettings extends RestrictedSettingsFragment implements Indexable for (int i = 0; i < mNumSlots; ++i) { final SubscriptionInfo sir = mSubscriptionManager .getActiveSubscriptionInfoForSimSlotIndex(i); + int subscriptionId = sir != null ? + sir.getSubscriptionId() : + SubscriptionManager.INVALID_SUBSCRIPTION_ID; SimPreference simPreference = new SimEnablerPreference(mContext, sir, i); simPreference.setOrder(i-mNumSlots); mSimCards.addPreference(simPreference); @@ -194,16 +197,16 @@ public class SimSettings extends RestrictedSettingsFragment implements Indexable if (sir != null && (isSubProvisioned(i))) { mSelectableSubInfos.add(sir); } - Intent mobileNetworkIntent = new Intent(); mobileNetworkIntent.setComponent(new ComponentName( "com.android.phone", "com.android.phone.MobileNetworkSettings")); - SubscriptionManager.putPhoneIdAndSubIdExtra(mobileNetworkIntent, - i, sir != null ? sir.getSubscriptionId() : -1); + SubscriptionManager.putPhoneIdAndSubIdExtra(mobileNetworkIntent, i, subscriptionId); Preference mobileNetworkPref = new Preference(getActivity()); mobileNetworkPref.setTitle( getString(R.string.sim_mobile_network_settings_title, (i + 1))); mobileNetworkPref.setIntent(mobileNetworkIntent); + mobileNetworkPref.setEnabled( + subscriptionId != SubscriptionManager.INVALID_SUBSCRIPTION_ID); mMobileNetwork.addPreference(mobileNetworkPref); } updateAllOptions(); |
