Merge "[Settings] Replace TelephonyManager#from()" am: 19cebd9eca
am: fb72a1094f
Change-Id: Ib6869f626d9cb5f085ab77c150e245dec904b6fb
This commit is contained in:
@@ -103,7 +103,7 @@ public class SettingsDumpService extends Service {
|
||||
DataUsageController controller = new DataUsageController(this);
|
||||
ConnectivityManager connectivityManager = getSystemService(ConnectivityManager.class);
|
||||
SubscriptionManager manager = SubscriptionManager.from(this);
|
||||
TelephonyManager telephonyManager = TelephonyManager.from(this);
|
||||
TelephonyManager telephonyManager = this.getSystemService(TelephonyManager.class);
|
||||
if (connectivityManager.isNetworkSupported(ConnectivityManager.TYPE_MOBILE)) {
|
||||
JSONArray array = new JSONArray();
|
||||
for (SubscriptionInfo info : manager.getAllSubscriptionInfoList()) {
|
||||
|
@@ -51,7 +51,7 @@ public abstract class DataUsageBaseFragment extends DashboardFragment {
|
||||
|
||||
services.mPolicyEditor = new NetworkPolicyEditor(services.mPolicyManager);
|
||||
|
||||
services.mTelephonyManager = TelephonyManager.from(context);
|
||||
services.mTelephonyManager = context.getSystemService(TelephonyManager.class);
|
||||
services.mSubscriptionManager = SubscriptionManager.from(context);
|
||||
services.mUserManager = UserManager.get(context);
|
||||
}
|
||||
|
@@ -33,7 +33,6 @@ import android.text.format.Formatter;
|
||||
import android.text.format.Formatter.BytesResult;
|
||||
import android.util.Log;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
@@ -72,7 +71,7 @@ public final class DataUsageUtils extends com.android.settingslib.net.DataUsageU
|
||||
return false;
|
||||
}
|
||||
|
||||
final TelephonyManager telephonyManager = TelephonyManager.from(context);
|
||||
final TelephonyManager telephonyManager = context.getSystemService(TelephonyManager.class);
|
||||
final NetworkStatsManager networkStatsManager =
|
||||
context.getSystemService(NetworkStatsManager.class);
|
||||
boolean hasEthernetUsage = false;
|
||||
@@ -115,7 +114,7 @@ public final class DataUsageUtils extends com.android.settingslib.net.DataUsageU
|
||||
}
|
||||
return false;
|
||||
}
|
||||
final TelephonyManager tele = TelephonyManager.from(context);
|
||||
final TelephonyManager tele = context.getSystemService(TelephonyManager.class);
|
||||
// require both supported network and ready SIM
|
||||
boolean isReady = true;
|
||||
for (SubscriptionInfo subInfo : subInfoList) {
|
||||
|
@@ -63,7 +63,8 @@ public class DataServiceSetupPreferenceController extends TelephonyBasePreferenc
|
||||
|
||||
public void init(int subId) {
|
||||
mSubId = subId;
|
||||
mTelephonyManager = TelephonyManager.from(mContext).createForSubscriptionId(mSubId);
|
||||
mTelephonyManager = mContext.getSystemService(TelephonyManager.class)
|
||||
.createForSubscriptionId(mSubId);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@@ -27,7 +27,6 @@ import android.os.PersistableBundle;
|
||||
import android.provider.Settings;
|
||||
import android.telephony.CarrierConfigManager;
|
||||
import android.telephony.RadioAccessFamily;
|
||||
import android.telephony.ServiceState;
|
||||
import android.telephony.SubscriptionManager;
|
||||
import android.telephony.TelephonyManager;
|
||||
import android.text.TextUtils;
|
||||
@@ -148,7 +147,8 @@ public class EnabledNetworkModePreferenceController extends
|
||||
public void init(Lifecycle lifecycle, int subId) {
|
||||
mSubId = subId;
|
||||
final PersistableBundle carrierConfig = mCarrierConfigManager.getConfigForSubId(mSubId);
|
||||
mTelephonyManager = TelephonyManager.from(mContext).createForSubscriptionId(mSubId);
|
||||
mTelephonyManager = mContext.getSystemService(TelephonyManager.class)
|
||||
.createForSubscriptionId(mSubId);
|
||||
|
||||
final boolean isLteOnCdma =
|
||||
mTelephonyManager.getLteOnCdmaMode() == PhoneConstants.LTE_ON_CDMA_TRUE;
|
||||
|
@@ -82,7 +82,8 @@ public class MmsMessagePreferenceController extends TelephonyTogglePreferenceCon
|
||||
|
||||
public void init(int subId) {
|
||||
mSubId = subId;
|
||||
mTelephonyManager = TelephonyManager.from(mContext).createForSubscriptionId(mSubId);
|
||||
mTelephonyManager = mContext.getSystemService(TelephonyManager.class)
|
||||
.createForSubscriptionId(mSubId);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@@ -138,7 +138,8 @@ public class MobileDataPreferenceController extends TelephonyTogglePreferenceCon
|
||||
public void init(FragmentManager fragmentManager, int subId) {
|
||||
mFragmentManager = fragmentManager;
|
||||
mSubId = subId;
|
||||
mTelephonyManager = TelephonyManager.from(mContext).createForSubscriptionId(mSubId);
|
||||
mTelephonyManager = mContext.getSystemService(TelephonyManager.class)
|
||||
.createForSubscriptionId(mSubId);
|
||||
}
|
||||
|
||||
@VisibleForTesting
|
||||
|
@@ -187,7 +187,8 @@ public class MobileNetworkSettings extends RestrictedDashboardFragment {
|
||||
final Context context = getContext();
|
||||
|
||||
mUserManager = (UserManager) context.getSystemService(Context.USER_SERVICE);
|
||||
mTelephonyManager = TelephonyManager.from(context).createForSubscriptionId(mSubId);
|
||||
mTelephonyManager = context.getSystemService(TelephonyManager.class)
|
||||
.createForSubscriptionId(mSubId);
|
||||
|
||||
onRestoreInstance(icicle);
|
||||
}
|
||||
|
@@ -20,7 +20,6 @@ import android.content.Context;
|
||||
import android.os.PersistableBundle;
|
||||
import android.provider.Settings;
|
||||
import android.telephony.CarrierConfigManager;
|
||||
import android.telephony.ServiceState;
|
||||
import android.telephony.SubscriptionManager;
|
||||
import android.telephony.TelephonyManager;
|
||||
|
||||
@@ -97,7 +96,8 @@ public class PreferredNetworkModePreferenceController extends TelephonyBasePrefe
|
||||
public void init(int subId) {
|
||||
mSubId = subId;
|
||||
final PersistableBundle carrierConfig = mCarrierConfigManager.getConfigForSubId(mSubId);
|
||||
mTelephonyManager = TelephonyManager.from(mContext).createForSubscriptionId(mSubId);
|
||||
mTelephonyManager = mContext.getSystemService(TelephonyManager.class)
|
||||
.createForSubscriptionId(mSubId);
|
||||
|
||||
final boolean isLteOnCdma =
|
||||
mTelephonyManager.getLteOnCdmaMode() == PhoneConstants.LTE_ON_CDMA_TRUE;
|
||||
|
@@ -73,7 +73,8 @@ public abstract class CdmaBasePreferenceController extends TelephonyBasePreferen
|
||||
public void init(PreferenceManager preferenceManager, int subId) {
|
||||
mPreferenceManager = preferenceManager;
|
||||
mSubId = subId;
|
||||
mTelephonyManager = TelephonyManager.from(mContext).createForSubscriptionId(mSubId);
|
||||
mTelephonyManager = mContext.getSystemService(TelephonyManager.class)
|
||||
.createForSubscriptionId(mSubId);
|
||||
}
|
||||
|
||||
public void init(int subId) {
|
||||
|
@@ -41,6 +41,7 @@ public class CdmaListPreference extends ListPreference {
|
||||
}
|
||||
|
||||
public void setSubId(int subId) {
|
||||
mTelephonyManager = TelephonyManager.from(getContext()).createForSubscriptionId(subId);
|
||||
mTelephonyManager = getContext().getSystemService(TelephonyManager.class)
|
||||
.createForSubscriptionId(subId);
|
||||
}
|
||||
}
|
||||
|
@@ -144,7 +144,8 @@ public class AutoSelectPreferenceController extends TelephonyTogglePreferenceCon
|
||||
|
||||
public AutoSelectPreferenceController init(int subId) {
|
||||
mSubId = subId;
|
||||
mTelephonyManager = TelephonyManager.from(mContext).createForSubscriptionId(mSubId);
|
||||
mTelephonyManager = mContext.getSystemService(TelephonyManager.class)
|
||||
.createForSubscriptionId(mSubId);
|
||||
final PersistableBundle carrierConfig = mContext.getSystemService(
|
||||
CarrierConfigManager.class).getConfigForSubId(mSubId);
|
||||
mOnlyAutoSelectInHome = carrierConfig != null
|
||||
|
@@ -29,7 +29,6 @@ import androidx.preference.Preference;
|
||||
import androidx.preference.PreferenceScreen;
|
||||
|
||||
import com.android.settings.R;
|
||||
import com.android.settings.core.BasePreferenceController;
|
||||
import com.android.settings.core.SubSettingLauncher;
|
||||
import com.android.settings.network.telephony.MobileNetworkUtils;
|
||||
import com.android.settings.network.telephony.NetworkSelectSettings;
|
||||
@@ -100,7 +99,8 @@ public class OpenNetworkSelectPagePreferenceController extends
|
||||
|
||||
public OpenNetworkSelectPagePreferenceController init(int subId) {
|
||||
mSubId = subId;
|
||||
mTelephonyManager = TelephonyManager.from(mContext).createForSubscriptionId(mSubId);
|
||||
mTelephonyManager = mContext.getSystemService(TelephonyManager.class)
|
||||
.createForSubscriptionId(mSubId);
|
||||
return this;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user