Merge "Fix bugs around unification when no password is set"
diff --git a/src/com/android/settings/DevelopmentSettings.java b/src/com/android/settings/DevelopmentSettings.java
index a1d9750..b0a685c 100644
--- a/src/com/android/settings/DevelopmentSettings.java
+++ b/src/com/android/settings/DevelopmentSettings.java
@@ -203,6 +203,7 @@
private static final int RESULT_MOCK_LOCATION_APP = 1001;
private static final String PERSISTENT_DATA_BLOCK_PROP = "ro.frp.pst";
+ private static final String FLASH_LOCKED_PROP = "ro.boot.flash.locked";
private static final int REQUEST_CODE_ENABLE_OEM_UNLOCK = 0;
@@ -703,6 +704,7 @@
updateForceResizableOptions();
updateEnableFreeformWindowsSupportOptions();
updateWebViewProviderOptions();
+ updateOemUnlockOptions();
if (mColorTemperaturePreference != null) {
updateColorTemperature();
}
@@ -967,6 +969,17 @@
return !SystemProperties.get(PERSISTENT_DATA_BLOCK_PROP).equals("");
}
+ private static boolean enableOemUnlockPreference() {
+ String flashLocked = SystemProperties.get(FLASH_LOCKED_PROP);
+ return !"0".equals(flashLocked);
+ }
+
+ private void updateOemUnlockOptions() {
+ if (mEnableOemUnlock != null) {
+ mEnableOemUnlock.setEnabled(enableOemUnlockPreference());
+ }
+ }
+
private void updateBugreportOptions() {
mBugreport.setEnabled(true);
mBugreportInPower.setEnabled(true);
diff --git a/src/com/android/settings/datausage/DataUsageSummary.java b/src/com/android/settings/datausage/DataUsageSummary.java
index 65e0217..f9c9ba6 100644
--- a/src/com/android/settings/datausage/DataUsageSummary.java
+++ b/src/com/android/settings/datausage/DataUsageSummary.java
@@ -77,6 +77,9 @@
addPreferencesFromResource(R.xml.data_usage);
int defaultSubId = getDefaultSubscriptionId(getContext());
+ if (defaultSubId == SubscriptionManager.INVALID_SUBSCRIPTION_ID) {
+ hasMobileData = false;
+ }
mDefaultTemplate = getDefaultTemplate(getContext(), defaultSubId);
if (hasMobileData) {
mLimitPreference = findPreference(KEY_LIMIT_SUMMARY);
@@ -279,7 +282,7 @@
}
public static NetworkTemplate getDefaultTemplate(Context context, int defaultSubId) {
- if (hasMobileData(context)) {
+ if (hasMobileData(context) && defaultSubId != SubscriptionManager.INVALID_SUBSCRIPTION_ID) {
TelephonyManager telephonyManager = TelephonyManager.from(context);
NetworkTemplate mobileAll = NetworkTemplate.buildTemplateMobileAll(
telephonyManager.getSubscriberId(defaultSubId));