Merge "Removed reference to PhoneConstant PHONE_TYPE_*" am: b3b25c39c9

Original change: https://android-review.googlesource.com/c/platform/packages/apps/Settings/+/1387126

Change-Id: I9389e2226554123fd25844c27aa24e6b13466124
This commit is contained in:
Bonian Chen
2020-08-05 06:11:00 +00:00
committed by Automerger Merge Worker
4 changed files with 12 additions and 15 deletions

View File

@@ -31,7 +31,6 @@ import android.telephony.TelephonyManager;
import android.text.TextUtils;
import android.util.Log;
import androidx.annotation.VisibleForTesting;
import androidx.lifecycle.Lifecycle;
import androidx.lifecycle.LifecycleObserver;
@@ -42,8 +41,8 @@ import androidx.preference.PreferenceScreen;
import com.android.internal.telephony.Phone;
import com.android.internal.telephony.PhoneConstants;
import com.android.settings.network.telephony.TelephonyConstants.TelephonyManagerConstants;
import com.android.settings.R;
import com.android.settings.network.telephony.TelephonyConstants.TelephonyManagerConstants;
import java.util.ArrayList;
import java.util.List;
@@ -174,7 +173,7 @@ public class EnabledNetworkModePreferenceController extends
private void updatePreferenceEntries(ListPreference preference) {
final int phoneType = mTelephonyManager.getPhoneType();
final PersistableBundle carrierConfig = mCarrierConfigManager.getConfigForSubId(mSubId);
if (phoneType == PhoneConstants.PHONE_TYPE_CDMA) {
if (phoneType == TelephonyManager.PHONE_TYPE_CDMA) {
final int lteForced = android.provider.Settings.Global.getInt(
mContext.getContentResolver(),
android.provider.Settings.Global.LTE_SERVICE_FORCED + mSubId,
@@ -217,7 +216,7 @@ public class EnabledNetworkModePreferenceController extends
}
}
}
} else if (phoneType == PhoneConstants.PHONE_TYPE_GSM) {
} else if (phoneType == TelephonyManager.PHONE_TYPE_GSM) {
if (MobileNetworkUtils.isTdscdmaSupported(mContext, mSubId)) {
preference.setEntries(
R.array.enabled_networks_tdscdma_choices);
@@ -525,7 +524,7 @@ public class EnabledNetworkModePreferenceController extends
preference.setValue(
Integer.toString(TelephonyManagerConstants
.NETWORK_MODE_LTE_CDMA_EVDO_GSM_WCDMA));
if (mTelephonyManager.getPhoneType() == PhoneConstants.PHONE_TYPE_CDMA
if (mTelephonyManager.getPhoneType() == TelephonyManager.PHONE_TYPE_CDMA
|| mIsGlobalCdma
|| MobileNetworkUtils.isWorldMode(mContext, mSubId)) {
preference.setSummary(R.string.network_global);
@@ -549,7 +548,7 @@ public class EnabledNetworkModePreferenceController extends
case TelephonyManagerConstants.NETWORK_MODE_NR_LTE_CDMA_EVDO_GSM_WCDMA:
preference.setValue(
Integer.toString(TelephonyManagerConstants.NETWORK_MODE_NR_LTE_CDMA_EVDO_GSM_WCDMA));
if (mTelephonyManager.getPhoneType() == PhoneConstants.PHONE_TYPE_CDMA
if (mTelephonyManager.getPhoneType() == TelephonyManager.PHONE_TYPE_CDMA
|| mIsGlobalCdma
|| MobileNetworkUtils.isWorldMode(mContext, mSubId)) {
preference.setSummary(R.string.network_global);

View File

@@ -53,7 +53,6 @@ import androidx.annotation.VisibleForTesting;
import com.android.ims.ImsException;
import com.android.ims.ImsManager;
import com.android.internal.telephony.Phone;
import com.android.internal.telephony.PhoneConstants;
import com.android.internal.util.ArrayUtils;
import com.android.settings.R;
import com.android.settings.Utils;
@@ -375,7 +374,7 @@ public class MobileNetworkUtils {
CarrierConfigManager.class).getConfigForSubId(subId);
if (telephonyManager.getPhoneType() == PhoneConstants.PHONE_TYPE_CDMA) {
if (telephonyManager.getPhoneType() == TelephonyManager.PHONE_TYPE_CDMA) {
return true;
} else if (carrierConfig != null
&& !carrierConfig.getBoolean(
@@ -434,7 +433,7 @@ public class MobileNetworkUtils {
final PersistableBundle carrierConfig = context.getSystemService(
CarrierConfigManager.class).getConfigForSubId(subId);
if (telephonyManager.getPhoneType() == PhoneConstants.PHONE_TYPE_GSM) {
if (telephonyManager.getPhoneType() == TelephonyManager.PHONE_TYPE_GSM) {
return true;
} else if (carrierConfig != null
&& !carrierConfig.getBoolean(

View File

@@ -153,7 +153,7 @@ public class PreferredNetworkModePreferenceController extends TelephonyBasePrefe
case TelephonyManagerConstants.NETWORK_MODE_LTE_TDSCDMA_CDMA_EVDO_GSM_WCDMA:
return R.string.preferred_network_mode_lte_tdscdma_cdma_evdo_gsm_wcdma_summary;
case TelephonyManagerConstants.NETWORK_MODE_LTE_CDMA_EVDO_GSM_WCDMA:
if (mTelephonyManager.getPhoneType() == PhoneConstants.PHONE_TYPE_CDMA
if (mTelephonyManager.getPhoneType() == TelephonyManager.PHONE_TYPE_CDMA
|| mIsGlobalCdma
|| MobileNetworkUtils.isWorldMode(mContext, mSubId)) {
return R.string.preferred_network_mode_global_summary;

View File

@@ -39,7 +39,6 @@ import android.telephony.SubscriptionInfo;
import android.telephony.SubscriptionManager;
import android.telephony.TelephonyManager;
import com.android.internal.telephony.PhoneConstants;
import com.android.settings.network.telephony.TelephonyConstants.TelephonyManagerConstants;
import org.junit.Before;
@@ -169,14 +168,14 @@ public class MobileNetworkUtilsTest {
@Test
public void isCdmaOptions_phoneTypeCdma_returnTrue() {
when(mTelephonyManager.getPhoneType()).thenReturn(PhoneConstants.PHONE_TYPE_CDMA);
when(mTelephonyManager.getPhoneType()).thenReturn(TelephonyManager.PHONE_TYPE_CDMA);
assertThat(MobileNetworkUtils.isCdmaOptions(mContext, SUB_ID_1)).isTrue();
}
@Test
public void isCdmaOptions_worldModeWithGsmWcdma_returnTrue() {
when(mTelephonyManager.getPhoneType()).thenReturn(PhoneConstants.PHONE_TYPE_GSM);
when(mTelephonyManager.getPhoneType()).thenReturn(TelephonyManager.PHONE_TYPE_GSM);
mCarrierConfig.putBoolean(CarrierConfigManager.KEY_WORLD_MODE_ENABLED_BOOL, true);
Settings.Global.putInt(mContext.getContentResolver(),
@@ -188,7 +187,7 @@ public class MobileNetworkUtilsTest {
@Test
public void isCdmaOptions_carrierWorldModeWithoutHideCarrier_returnTrue() {
when(mTelephonyManager.getPhoneType()).thenReturn(PhoneConstants.PHONE_TYPE_GSM);
when(mTelephonyManager.getPhoneType()).thenReturn(TelephonyManager.PHONE_TYPE_GSM);
mCarrierConfig.putBoolean(CarrierConfigManager.KEY_HIDE_CARRIER_NETWORK_SETTINGS_BOOL,
false);
mCarrierConfig.putBoolean(CarrierConfigManager.KEY_WORLD_PHONE_BOOL, true);
@@ -226,7 +225,7 @@ public class MobileNetworkUtilsTest {
false);
mCarrierConfig.putBoolean(CarrierConfigManager.KEY_OPERATOR_SELECTION_EXPAND_BOOL, true);
mCarrierConfig.putBoolean(CarrierConfigManager.KEY_CSP_ENABLED_BOOL, false);
when(mTelephonyManager.getPhoneType()).thenReturn(PhoneConstants.PHONE_TYPE_GSM);
when(mTelephonyManager.getPhoneType()).thenReturn(TelephonyManager.PHONE_TYPE_GSM);
assertThat(MobileNetworkUtils.shouldDisplayNetworkSelectOptions(mContext, SUB_ID_1))
.isTrue();