Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit de616afc authored by Sarah Chin's avatar Sarah Chin
Browse files

Rename references to getLteOnCdmaMode

Use @SystemApi TelephonyManager#isGlobalModeEnabled()

Test: build
Bug: 147335742
Change-Id: Ie1b01a97cf163d68e4a5529f1718a9a782d44bb0
parent 66349e21
Loading
Loading
Loading
Loading
+1 −4
Original line number Original line Diff line number Diff line
@@ -60,7 +60,6 @@ import android.widget.Button;
import android.widget.ProgressBar;
import android.widget.ProgressBar;
import android.widget.TextView;
import android.widget.TextView;


import com.android.internal.telephony.PhoneConstants;
import com.android.internal.widget.LockPatternUtils;
import com.android.internal.widget.LockPatternUtils;
import com.android.internal.widget.LockPatternView;
import com.android.internal.widget.LockPatternView;
import com.android.internal.widget.LockPatternView.Cell;
import com.android.internal.widget.LockPatternView.Cell;
@@ -916,9 +915,7 @@ public class CryptKeeper extends Activity implements TextView.OnEditorActionList
     *    phone that has no encryption.
     *    phone that has no encryption.
     */
     */
    private final void setAirplaneModeIfNecessary() {
    private final void setAirplaneModeIfNecessary() {
        final boolean isLteDevice =
        if (!getTelephonyManager().isGlobalModeEnabled()) {
                getTelephonyManager().getLteOnCdmaMode() == PhoneConstants.LTE_ON_CDMA_TRUE;
        if (!isLteDevice) {
            Log.d(TAG, "Going into airplane mode.");
            Log.d(TAG, "Going into airplane mode.");
            Settings.Global.putInt(getContentResolver(), Settings.Global.AIRPLANE_MODE_ON, 1);
            Settings.Global.putInt(getContentResolver(), Settings.Global.AIRPLANE_MODE_ON, 1);
            final Intent intent = new Intent(Intent.ACTION_AIRPLANE_MODE_CHANGED);
            final Intent intent = new Intent(Intent.ACTION_AIRPLANE_MODE_CHANGED);
+1 −3
Original line number Original line Diff line number Diff line
@@ -31,7 +31,6 @@ import android.util.Log;
import androidx.annotation.NonNull;
import androidx.annotation.NonNull;
import androidx.annotation.VisibleForTesting;
import androidx.annotation.VisibleForTesting;


import com.android.internal.telephony.PhoneConstants;
import com.android.settings.R;
import com.android.settings.R;


public class ImeiInfoDialogController {
public class ImeiInfoDialogController {
@@ -147,8 +146,7 @@ public class ImeiInfoDialogController {


    @VisibleForTesting
    @VisibleForTesting
    boolean isCdmaLteEnabled() {
    boolean isCdmaLteEnabled() {
        return mTelephonyManager.getLteOnCdmaMode(mSubscriptionInfo.getSubscriptionId())
        return mTelephonyManager.isGlobalModeEnabled();
                == PhoneConstants.LTE_ON_CDMA_TRUE;
    }
    }


    @VisibleForTesting
    @VisibleForTesting
+1 −5
Original line number Original line Diff line number Diff line
@@ -28,8 +28,6 @@ import android.text.TextUtils;


import androidx.preference.Preference;
import androidx.preference.Preference;


import com.android.internal.telephony.PhoneConstants;

/**
/**
 * Preference controller for "Data service setup"
 * Preference controller for "Data service setup"
 */
 */
@@ -49,14 +47,12 @@ public class DataServiceSetupPreferenceController extends TelephonyBasePreferenc


    @Override
    @Override
    public int getAvailabilityStatus(int subId) {
    public int getAvailabilityStatus(int subId) {
        final boolean isLteOnCdma = mTelephonyManager.getLteOnCdmaMode()
                == PhoneConstants.LTE_ON_CDMA_TRUE;
        final PersistableBundle carrierConfig = mCarrierConfigManager.getConfigForSubId(subId);
        final PersistableBundle carrierConfig = mCarrierConfigManager.getConfigForSubId(subId);
        return subId != SubscriptionManager.INVALID_SUBSCRIPTION_ID
        return subId != SubscriptionManager.INVALID_SUBSCRIPTION_ID
                && carrierConfig != null
                && carrierConfig != null
                && !carrierConfig.getBoolean(
                && !carrierConfig.getBoolean(
                CarrierConfigManager.KEY_HIDE_CARRIER_NETWORK_SETTINGS_BOOL)
                CarrierConfigManager.KEY_HIDE_CARRIER_NETWORK_SETTINGS_BOOL)
                && isLteOnCdma && !TextUtils.isEmpty(mSetupUrl)
                && mTelephonyManager.isGlobalModeEnabled() && !TextUtils.isEmpty(mSetupUrl)
                ? AVAILABLE
                ? AVAILABLE
                : CONDITIONALLY_UNAVAILABLE;
                : CONDITIONALLY_UNAVAILABLE;
    }
    }
+2 −7
Original line number Original line Diff line number Diff line
@@ -39,7 +39,6 @@ import androidx.preference.ListPreference;
import androidx.preference.Preference;
import androidx.preference.Preference;
import androidx.preference.PreferenceScreen;
import androidx.preference.PreferenceScreen;


import com.android.internal.telephony.PhoneConstants;
import com.android.settings.R;
import com.android.settings.R;
import com.android.settings.network.telephony.TelephonyConstants.TelephonyManagerConstants;
import com.android.settings.network.telephony.TelephonyConstants.TelephonyManagerConstants;


@@ -148,9 +147,7 @@ public class EnabledNetworkModePreferenceController extends
        mTelephonyManager = mContext.getSystemService(TelephonyManager.class)
        mTelephonyManager = mContext.getSystemService(TelephonyManager.class)
                .createForSubscriptionId(mSubId);
                .createForSubscriptionId(mSubId);


        final boolean isLteOnCdma =
        mIsGlobalCdma = mTelephonyManager.isGlobalModeEnabled()
                mTelephonyManager.getLteOnCdmaMode() == PhoneConstants.LTE_ON_CDMA_TRUE;
        mIsGlobalCdma = isLteOnCdma
                && carrierConfig.getBoolean(CarrierConfigManager.KEY_SHOW_CDMA_CHOICES_BOOL);
                && carrierConfig.getBoolean(CarrierConfigManager.KEY_SHOW_CDMA_CHOICES_BOOL);
        mShow4GForLTE = carrierConfig != null
        mShow4GForLTE = carrierConfig != null
                ? carrierConfig.getBoolean(
                ? carrierConfig.getBoolean(
@@ -178,13 +175,11 @@ public class EnabledNetworkModePreferenceController extends
                    mContext.getContentResolver(),
                    mContext.getContentResolver(),
                    android.provider.Settings.Global.LTE_SERVICE_FORCED + mSubId,
                    android.provider.Settings.Global.LTE_SERVICE_FORCED + mSubId,
                    0);
                    0);
            final boolean isLteOnCdma = mTelephonyManager.getLteOnCdmaMode()
                    == PhoneConstants.LTE_ON_CDMA_TRUE;
            final int settingsNetworkMode = android.provider.Settings.Global.getInt(
            final int settingsNetworkMode = android.provider.Settings.Global.getInt(
                    mContext.getContentResolver(),
                    mContext.getContentResolver(),
                    android.provider.Settings.Global.PREFERRED_NETWORK_MODE + mSubId,
                    android.provider.Settings.Global.PREFERRED_NETWORK_MODE + mSubId,
                    TelephonyManager.DEFAULT_PREFERRED_NETWORK_MODE);
                    TelephonyManager.DEFAULT_PREFERRED_NETWORK_MODE);
            if (isLteOnCdma) {
            if (mTelephonyManager.isGlobalModeEnabled()) {
                if (lteForced == 0) {
                if (lteForced == 0) {
                    preference.setEntries(
                    preference.setEntries(
                            R.array.enabled_networks_cdma_choices);
                            R.array.enabled_networks_cdma_choices);
+4 −10
Original line number Original line Diff line number Diff line
@@ -26,7 +26,6 @@ import android.telephony.TelephonyManager;
import androidx.preference.ListPreference;
import androidx.preference.ListPreference;
import androidx.preference.Preference;
import androidx.preference.Preference;


import com.android.internal.telephony.PhoneConstants;
import com.android.settings.R;
import com.android.settings.R;
import com.android.settings.network.telephony.TelephonyConstants.TelephonyManagerConstants;
import com.android.settings.network.telephony.TelephonyConstants.TelephonyManagerConstants;


@@ -98,9 +97,7 @@ public class PreferredNetworkModePreferenceController extends TelephonyBasePrefe
        mTelephonyManager = mContext.getSystemService(TelephonyManager.class)
        mTelephonyManager = mContext.getSystemService(TelephonyManager.class)
                .createForSubscriptionId(mSubId);
                .createForSubscriptionId(mSubId);


        final boolean isLteOnCdma =
        mIsGlobalCdma = mTelephonyManager.isGlobalModeEnabled()
                mTelephonyManager.getLteOnCdmaMode() == PhoneConstants.LTE_ON_CDMA_TRUE;
        mIsGlobalCdma = isLteOnCdma
                && carrierConfig.getBoolean(CarrierConfigManager.KEY_SHOW_CDMA_CHOICES_BOOL);
                && carrierConfig.getBoolean(CarrierConfigManager.KEY_SHOW_CDMA_CHOICES_BOOL);
    }
    }


@@ -127,12 +124,9 @@ public class PreferredNetworkModePreferenceController extends TelephonyBasePrefe
            case TelephonyManagerConstants.NETWORK_MODE_GSM_UMTS:
            case TelephonyManagerConstants.NETWORK_MODE_GSM_UMTS:
                return R.string.preferred_network_mode_gsm_wcdma_summary;
                return R.string.preferred_network_mode_gsm_wcdma_summary;
            case TelephonyManagerConstants.NETWORK_MODE_CDMA_EVDO:
            case TelephonyManagerConstants.NETWORK_MODE_CDMA_EVDO:
                switch (mTelephonyManager.getLteOnCdmaMode()) {
                return mTelephonyManager.isGlobalModeEnabled()
                    case PhoneConstants.LTE_ON_CDMA_TRUE:
                        ? R.string.preferred_network_mode_cdma_summary
                        return R.string.preferred_network_mode_cdma_summary;
                        : R.string.preferred_network_mode_cdma_evdo_summary;
                    default:
                        return R.string.preferred_network_mode_cdma_evdo_summary;
                }
            case TelephonyManagerConstants.NETWORK_MODE_CDMA_NO_EVDO:
            case TelephonyManagerConstants.NETWORK_MODE_CDMA_NO_EVDO:
                return R.string.preferred_network_mode_cdma_only_summary;
                return R.string.preferred_network_mode_cdma_only_summary;
            case TelephonyManagerConstants.NETWORK_MODE_EVDO_NO_CDMA:
            case TelephonyManagerConstants.NETWORK_MODE_EVDO_NO_CDMA:
Loading