Merge "Do not get CM instance in getActiveModemCount unless needed."

am: 31bbebe179

Change-Id: I3f297869c9b6a2109cd1115cdd447c774fd9d308
This commit is contained in:
Xiangyu/Malcolm Chen
2019-12-13 10:34:22 -08:00
committed by android-build-merger

View File

@@ -416,14 +416,14 @@ public class TelephonyManager {
int modemCount = 1; int modemCount = 1;
switch (getMultiSimConfiguration()) { switch (getMultiSimConfiguration()) {
case UNKNOWN: case UNKNOWN:
ConnectivityManager cm = mContext == null ? null : (ConnectivityManager) mContext modemCount = MODEM_COUNT_SINGLE_MODEM;
.getSystemService(Context.CONNECTIVITY_SERVICE);
// check for voice and data support, 0 if not supported // check for voice and data support, 0 if not supported
if (!isVoiceCapable() && !isSmsCapable() && cm != null if (!isVoiceCapable() && !isSmsCapable() && mContext != null) {
&& !cm.isNetworkSupported(ConnectivityManager.TYPE_MOBILE)) { ConnectivityManager cm = (ConnectivityManager) mContext
modemCount = MODEM_COUNT_NO_MODEM; .getSystemService(Context.CONNECTIVITY_SERVICE);
} else { if (cm != null && !cm.isNetworkSupported(ConnectivityManager.TYPE_MOBILE)) {
modemCount = MODEM_COUNT_SINGLE_MODEM; modemCount = MODEM_COUNT_NO_MODEM;
}
} }
break; break;
case DSDS: case DSDS: