Merge "[Settings] Workaround for network and internet crash"
This commit is contained in:
committed by
Android (Google) Code Review
commit
4ae3127eaf
@@ -122,6 +122,7 @@ public class MobileDataPreferenceController extends TelephonyTogglePreferenceCon
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isChecked() {
|
public boolean isChecked() {
|
||||||
|
mTelephonyManager = getTelephonyManager();
|
||||||
return mTelephonyManager.isDataEnabled();
|
return mTelephonyManager.isDataEnabled();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -152,8 +153,21 @@ public class MobileDataPreferenceController extends TelephonyTogglePreferenceCon
|
|||||||
public void init(FragmentManager fragmentManager, int subId) {
|
public void init(FragmentManager fragmentManager, int subId) {
|
||||||
mFragmentManager = fragmentManager;
|
mFragmentManager = fragmentManager;
|
||||||
mSubId = subId;
|
mSubId = subId;
|
||||||
mTelephonyManager = mContext.getSystemService(TelephonyManager.class)
|
mTelephonyManager = null;
|
||||||
.createForSubscriptionId(mSubId);
|
mTelephonyManager = getTelephonyManager();
|
||||||
|
}
|
||||||
|
|
||||||
|
private TelephonyManager getTelephonyManager() {
|
||||||
|
if (mTelephonyManager != null) {
|
||||||
|
return mTelephonyManager;
|
||||||
|
}
|
||||||
|
TelephonyManager telMgr =
|
||||||
|
mContext.getSystemService(TelephonyManager.class);
|
||||||
|
if (mSubId != SubscriptionManager.INVALID_SUBSCRIPTION_ID) {
|
||||||
|
telMgr = telMgr.createForSubscriptionId(mSubId);
|
||||||
|
}
|
||||||
|
mTelephonyManager = telMgr;
|
||||||
|
return telMgr;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setWifiPickerTrackerHelper(WifiPickerTrackerHelper helper) {
|
public void setWifiPickerTrackerHelper(WifiPickerTrackerHelper helper) {
|
||||||
@@ -163,6 +177,7 @@ public class MobileDataPreferenceController extends TelephonyTogglePreferenceCon
|
|||||||
@VisibleForTesting
|
@VisibleForTesting
|
||||||
boolean isDialogNeeded() {
|
boolean isDialogNeeded() {
|
||||||
final boolean enableData = !isChecked();
|
final boolean enableData = !isChecked();
|
||||||
|
mTelephonyManager = getTelephonyManager();
|
||||||
final boolean isMultiSim = (mTelephonyManager.getActiveModemCount() > 1);
|
final boolean isMultiSim = (mTelephonyManager.getActiveModemCount() > 1);
|
||||||
final int defaultSubId = mSubscriptionManager.getDefaultDataSubscriptionId();
|
final int defaultSubId = mSubscriptionManager.getDefaultDataSubscriptionId();
|
||||||
final boolean needToDisableOthers = mSubscriptionManager
|
final boolean needToDisableOthers = mSubscriptionManager
|
||||||
|
Reference in New Issue
Block a user