Merge "Fix Robo test failure in NrDisabledInDsdsFooterPreferenceControllerTest."
diff --git a/MODULE_LICENSE_APACHE2 b/MODULE_LICENSE_APACHE2
deleted file mode 100644
index e69de29..0000000
--- a/MODULE_LICENSE_APACHE2
+++ /dev/null
diff --git a/res/values/strings.xml b/res/values/strings.xml
index cb6bf90..3209da9 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -10893,6 +10893,9 @@
<string name="mobile_data_settings_summary_auto_switch">
Phone will automatically switch to this carrier when in range
</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
that will be used for calls. This only appears in multi-SIM mode. [CHAR LIMIT=NONE] -->
diff --git a/src/com/android/settings/IccLockSettings.java b/src/com/android/settings/IccLockSettings.java
index dea915a..2ee804e 100644
--- a/src/com/android/settings/IccLockSettings.java
+++ b/src/com/android/settings/IccLockSettings.java
@@ -246,7 +246,7 @@
if (componenterList.size() == 0) {
Log.e(TAG, "onCreateView: no sim info");
- return null;
+ return super.onCreateView(inflater, container, savedInstanceState);
}
if (componenterList.size() > 1) {
diff --git a/src/com/android/settings/datetime/timezone/TimeZoneInfo.java b/src/com/android/settings/datetime/timezone/TimeZoneInfo.java
index c036eac..f74614d 100644
--- a/src/com/android/settings/datetime/timezone/TimeZoneInfo.java
+++ b/src/com/android/settings/datetime/timezone/TimeZoneInfo.java
@@ -149,22 +149,31 @@
* @return TimeZoneInfo containing time zone names, exemplar locations and GMT offset
*/
public TimeZoneInfo format(TimeZone timeZone) {
- final String id = timeZone.getID();
+ String canonicalZoneId = getCanonicalZoneId(timeZone);
final TimeZoneNames timeZoneNames = mTimeZoneFormat.getTimeZoneNames();
- final java.util.TimeZone javaTimeZone = java.util.TimeZone.getTimeZone(id);
+ final java.util.TimeZone javaTimeZone = java.util.TimeZone.getTimeZone(canonicalZoneId);
final CharSequence gmtOffset = ZoneGetter.getGmtOffsetText(mTimeZoneFormat, mLocale,
javaTimeZone, mNow);
return new TimeZoneInfo.Builder(timeZone)
- .setGenericName(timeZoneNames.getDisplayName(id,
+ .setGenericName(timeZoneNames.getDisplayName(canonicalZoneId,
TimeZoneNames.NameType.LONG_GENERIC, mNow.getTime()))
- .setStandardName(timeZoneNames.getDisplayName(id,
+ .setStandardName(timeZoneNames.getDisplayName(canonicalZoneId,
TimeZoneNames.NameType.LONG_STANDARD, mNow.getTime()))
- .setDaylightName(timeZoneNames.getDisplayName(id,
+ .setDaylightName(timeZoneNames.getDisplayName(canonicalZoneId,
TimeZoneNames.NameType.LONG_DAYLIGHT, mNow.getTime()))
- .setExemplarLocation(timeZoneNames.getExemplarLocationName(id))
+ .setExemplarLocation(timeZoneNames.getExemplarLocationName(canonicalZoneId))
.setGmtOffset(gmtOffset)
.build();
}
+
+ private static String getCanonicalZoneId(TimeZone timeZone) {
+ final String id = timeZone.getID();
+ final String canonicalId = TimeZone.getCanonicalID(id);
+ if (canonicalId != null) {
+ return canonicalId;
+ }
+ return id;
+ }
}
}
diff --git a/src/com/android/settings/network/telephony/MobileDataPreferenceController.java b/src/com/android/settings/network/telephony/MobileDataPreferenceController.java
index daee6ab..e5d0169 100644
--- a/src/com/android/settings/network/telephony/MobileDataPreferenceController.java
+++ b/src/com/android/settings/network/telephony/MobileDataPreferenceController.java
@@ -128,6 +128,13 @@
preference.setEnabled(true);
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() {