Delete more CDMA codes

Bug: 435270591
Test: Basic telephony functionality tests
Flag: com.android.internal.telephony.flags.delete_cdma
Change-Id: I872f43ee94b4f16245b5764ec290a9f1d21dec36
diff --git a/src/com/android/phone/CallNotifier.java b/src/com/android/phone/CallNotifier.java
index 335bcba..4c5681c 100644
--- a/src/com/android/phone/CallNotifier.java
+++ b/src/com/android/phone/CallNotifier.java
@@ -44,6 +44,7 @@
 import com.android.internal.telephony.cdma.CdmaInformationRecords.CdmaDisplayInfoRec;
 import com.android.internal.telephony.cdma.CdmaInformationRecords.CdmaSignalInfoRec;
 import com.android.internal.telephony.cdma.SignalToneUtil;
+import com.android.internal.telephony.flags.Flags;
 import com.android.internal.telephony.imsphone.ImsPhoneCallTracker;
 import com.android.internal.telephony.subscription.SubscriptionManagerService;
 
@@ -180,11 +181,13 @@
      * Register for call state notifications with the CallManager.
      */
     private void registerForNotifications() {
-        mCM.registerForDisconnect(this, PHONE_DISCONNECT, null);
-        mCM.registerForDisplayInfo(this, PHONE_STATE_DISPLAYINFO, null);
-        mCM.registerForSignalInfo(this, PHONE_STATE_SIGNALINFO, null);
-        mCM.registerForInCallVoicePrivacyOn(this, PHONE_ENHANCED_VP_ON, null);
-        mCM.registerForInCallVoicePrivacyOff(this, PHONE_ENHANCED_VP_OFF, null);
+        if (!Flags.deleteCdma()) {
+            mCM.registerForDisconnect(this, PHONE_DISCONNECT, null);
+            mCM.registerForDisplayInfo(this, PHONE_STATE_DISPLAYINFO, null);
+            mCM.registerForSignalInfo(this, PHONE_STATE_SIGNALINFO, null);
+            mCM.registerForInCallVoicePrivacyOn(this, PHONE_ENHANCED_VP_ON, null);
+            mCM.registerForInCallVoicePrivacyOff(this, PHONE_ENHANCED_VP_OFF, null);
+        }
         mCM.registerForSuppServiceFailed(this, PHONE_SUPP_SERVICE_FAILED, null);
         mCM.registerForTtyModeReceived(this, PHONE_TTY_MODE_RECEIVED, null);
     }
@@ -277,8 +280,6 @@
     private class InCallTonePlayer extends Thread {
         private int mToneId;
         private int mState;
-        // The possible tones we can play.
-        public static final int TONE_NONE = 0;
         public static final int TONE_VOICE_PRIVACY = 5;
 
         // The tone volume relative to other sounds in the stream
@@ -357,7 +358,7 @@
 
             if (toneGenerator != null) {
                 int ringerMode = mAudioManager.getRingerMode();
-                if (phoneType == PhoneConstants.PHONE_TYPE_CDMA) {
+                if (!Flags.deleteCdma() && phoneType == PhoneConstants.PHONE_TYPE_CDMA) {
                     if (toneType == ToneGenerator.TONE_CDMA_ALERT_CALL_GUARD) {
                         if ((ringerMode != AudioManager.RINGER_MODE_SILENT) &&
                                 (ringerMode != AudioManager.RINGER_MODE_VIBRATE)) {
diff --git a/src/com/android/phone/EmergencyCallbackModeService.java b/src/com/android/phone/EmergencyCallbackModeService.java
index 70eb017..acafd26 100644
--- a/src/com/android/phone/EmergencyCallbackModeService.java
+++ b/src/com/android/phone/EmergencyCallbackModeService.java
@@ -38,6 +38,7 @@
 import com.android.internal.telephony.Phone;
 import com.android.internal.telephony.PhoneConstants;
 import com.android.internal.telephony.TelephonyIntents;
+import com.android.internal.telephony.flags.Flags;
 import com.android.internal.telephony.util.NotificationChannelController;
 
 import java.text.SimpleDateFormat;
@@ -76,7 +77,8 @@
     public void onCreate() {
          Phone phoneInEcm = PhoneGlobals.getInstance().getPhoneInEcm();
         // Check if it is CDMA phone
-        if (phoneInEcm == null || ((phoneInEcm.getPhoneType() != PhoneConstants.PHONE_TYPE_CDMA)
+        if (phoneInEcm == null || ((Flags.deleteCdma()
+                || phoneInEcm.getPhoneType() != PhoneConstants.PHONE_TYPE_CDMA)
                 && (phoneInEcm.getImsPhone() == null))) {
             Log.e(LOG_TAG, "Error! Emergency Callback Mode not supported for " + phoneInEcm);
             stopSelf();
diff --git a/src/com/android/phone/FakeRil.java b/src/com/android/phone/FakeRil.java
index 58a62cd..69ef65e 100644
--- a/src/com/android/phone/FakeRil.java
+++ b/src/com/android/phone/FakeRil.java
@@ -96,21 +96,9 @@
     public void supplyIccPin(String pin, Message result) {}
 
     @Override
-    public void supplyIccPuk(String puk, String newPin, Message result) {}
-
-    @Override
-    public void supplyIccPin2(String pin, Message result) {}
-
-    @Override
-    public void supplyIccPuk2(String puk, String newPin2, Message result) {}
-
-    @Override
     public void changeIccPin(String oldPin, String newPin, Message result) {}
 
     @Override
-    public void changeIccPin2(String oldPin2, String newPin2, Message result) {}
-
-    @Override
     public void changeBarringPassword(
             String facility, String oldPwd, String newPwd, Message result) {}
 
diff --git a/src/com/android/phone/GsmUmtsCallOptions.java b/src/com/android/phone/GsmUmtsCallOptions.java
index ac4981e..6820d8b 100644
--- a/src/com/android/phone/GsmUmtsCallOptions.java
+++ b/src/com/android/phone/GsmUmtsCallOptions.java
@@ -54,7 +54,8 @@
                 getActionBar(), getResources(), R.string.labelGsmMore_with_label);
         init(getPreferenceScreen(), subInfoHelper);
 
-        if (subInfoHelper.getPhone().getPhoneType() != PhoneConstants.PHONE_TYPE_GSM) {
+        if (!Flags.deleteCdma()
+                && subInfoHelper.getPhone().getPhoneType() != PhoneConstants.PHONE_TYPE_GSM) {
             //disable the entire screen
             getPreferenceScreen().setEnabled(false);
         }
diff --git a/src/com/android/phone/MMIDialogActivity.java b/src/com/android/phone/MMIDialogActivity.java
index c9be2ac..f61f362 100644
--- a/src/com/android/phone/MMIDialogActivity.java
+++ b/src/com/android/phone/MMIDialogActivity.java
@@ -30,6 +30,7 @@
 import com.android.internal.telephony.MmiCode;
 import com.android.internal.telephony.Phone;
 import com.android.internal.telephony.PhoneConstants;
+import com.android.internal.telephony.flags.Flags;
 
 import java.util.ArrayList;
 import java.util.List;
@@ -120,9 +121,9 @@
 
         // if phone is a CDMA phone display feature code completed message
         int phoneType = mPhone.getPhoneType();
-        if (phoneType == PhoneConstants.PHONE_TYPE_CDMA) {
+        if (!Flags.deleteCdma() && phoneType == PhoneConstants.PHONE_TYPE_CDMA) {
             PhoneUtils.displayMMIComplete(mPhone, this, mmiCode, null, null);
-        } else if (phoneType == PhoneConstants.PHONE_TYPE_GSM) {
+        } else if (Flags.deleteCdma() || phoneType == PhoneConstants.PHONE_TYPE_GSM) {
             if (mmiCode.getState() != MmiCode.State.PENDING) {
                 Log.d(TAG, "onMMIComplete: Got MMI_COMPLETE, finishing dialog activity...");
                 dismissDialogsAndFinish();
diff --git a/src/com/android/phone/NotificationMgr.java b/src/com/android/phone/NotificationMgr.java
index f02ca3f..834d375 100644
--- a/src/com/android/phone/NotificationMgr.java
+++ b/src/com/android/phone/NotificationMgr.java
@@ -24,7 +24,6 @@
 import android.app.Notification;
 import android.app.NotificationManager;
 import android.app.PendingIntent;
-import android.app.StatusBarManager;
 import android.content.ComponentName;
 import android.content.Context;
 import android.content.Intent;
@@ -41,7 +40,6 @@
 import android.os.UserHandle;
 import android.os.UserManager;
 import android.preference.PreferenceManager;
-import android.provider.ContactsContract.PhoneLookup;
 import android.provider.Settings;
 import android.telecom.PhoneAccount;
 import android.telecom.PhoneAccountHandle;
@@ -57,7 +55,6 @@
 import android.util.ArrayMap;
 import android.util.Log;
 import android.util.SparseArray;
-import android.widget.Toast;
 
 import com.android.internal.annotations.VisibleForTesting;
 import com.android.internal.telephony.Phone;
@@ -89,15 +86,8 @@
     private static final String LOG_TAG = NotificationMgr.class.getSimpleName();
     private static final boolean DBG =
             (PhoneGlobals.DBG_LEVEL >= 1) && (SystemProperties.getInt("ro.debuggable", 0) == 1);
-    // Do not check in with VDBG = true, since that may write PII to the system log.
-    private static final boolean VDBG = false;
-
-    private static final String MWI_SHOULD_CHECK_VVM_CONFIGURATION_KEY_PREFIX =
-            "mwi_should_check_vvm_configuration_state_";
 
     // notification types
-    static final int MMI_NOTIFICATION = 1;
-    static final int NETWORK_SELECTION_NOTIFICATION = 2;
     static final int VOICEMAIL_NOTIFICATION = 3;
     static final int CALL_FORWARD_NOTIFICATION = 4;
     static final int DATA_ROAMING_NOTIFICATION = 5;
@@ -126,11 +116,8 @@
     private PhoneGlobals mApp;
 
     private Context mContext;
-    private StatusBarManager mStatusBarManager;
     private UserManager mUserManager;
-    private Toast mToast;
     private SubscriptionManager mSubscriptionManager;
-    private TelecomManager mTelecomManager;
     private TelephonyManager mTelephonyManager;
 
     // used to track the notification of selected network unavailable, per subscription id.
@@ -179,11 +166,8 @@
     /* package */ NotificationMgr(PhoneGlobals app) {
         mApp = app;
         mContext = app;
-        mStatusBarManager =
-                (StatusBarManager) app.getSystemService(Context.STATUS_BAR_SERVICE);
         mUserManager = (UserManager) app.getSystemService(Context.USER_SERVICE);
         mSubscriptionManager = SubscriptionManager.from(mContext);
-        mTelecomManager = app.getSystemService(TelecomManager.class);
         mTelephonyManager = (TelephonyManager) app.getSystemService(Context.TELEPHONY_SERVICE);
         mFeatureFlags = new FeatureFlagsImpl();
     }
@@ -207,13 +191,6 @@
         }
     }
 
-    /** The projection to use when querying the phones table */
-    static final String[] PHONES_PROJECTION = new String[] {
-        PhoneLookup.NUMBER,
-        PhoneLookup.DISPLAY_NAME,
-        PhoneLookup._ID
-    };
-
     /**
      * Re-creates the message waiting indicator (voicemail) notification if it is showing.  Used to
      * refresh the voicemail intent on the indicator when the user changes it via the voicemail
@@ -242,27 +219,6 @@
         }
     }
 
-    public void setShouldCheckVisualVoicemailConfigurationForMwi(int subId, boolean enabled) {
-        if (!SubscriptionManager.isValidSubscriptionId(subId)) {
-            Log.e(LOG_TAG, "setShouldCheckVisualVoicemailConfigurationForMwi: invalid subId"
-                    + subId);
-            return;
-        }
-
-        PreferenceManager.getDefaultSharedPreferences(mContext).edit()
-                .putBoolean(MWI_SHOULD_CHECK_VVM_CONFIGURATION_KEY_PREFIX + subId, enabled)
-                .apply();
-    }
-
-    private boolean shouldCheckVisualVoicemailConfigurationForMwi(int subId) {
-        if (!SubscriptionManager.isValidSubscriptionId(subId)) {
-            Log.e(LOG_TAG, "shouldCheckVisualVoicemailConfigurationForMwi: invalid subId" + subId);
-            return true;
-        }
-        return PreferenceManager
-                .getDefaultSharedPreferences(mContext)
-                .getBoolean(MWI_SHOULD_CHECK_VVM_CONFIGURATION_KEY_PREFIX + subId, true);
-    }
     /**
      * Updates the message waiting indicator (voicemail) notification.
      *
@@ -986,62 +942,6 @@
         }
     }
 
-    /**
-     * Update notification about no service of user selected operator.
-     * For dismissNetworkSelectionNotificationOnSimDisable feature disabled.
-     *
-     * @param serviceState Phone service state
-     * @param subId The subscription ID
-     */
-    private void updateNetworkSelectionForFeatureDisabled(int serviceState, int subId) {
-        int phoneId = SubscriptionManager.getPhoneId(subId);
-        Phone phone = SubscriptionManager.isValidPhoneId(phoneId)
-                ? PhoneFactory.getPhone(phoneId) : PhoneFactory.getDefaultPhone();
-        if (TelephonyCapabilities.supportsNetworkSelection(phone)) {
-            if (SubscriptionManager.isValidSubscriptionId(subId)) {
-                SharedPreferences sp = PreferenceManager.getDefaultSharedPreferences(mContext);
-                String selectedNetworkOperatorName =
-                        sp.getString(Phone.NETWORK_SELECTION_NAME_KEY + subId, "");
-                // get the shared preference of network_selection.
-                // empty is auto mode, otherwise it is the operator alpha name
-                // in case there is no operator name, check the operator numeric
-                if (TextUtils.isEmpty(selectedNetworkOperatorName)) {
-                    selectedNetworkOperatorName =
-                            sp.getString(Phone.NETWORK_SELECTION_KEY + subId, "");
-                }
-                boolean isManualSelection;
-                // if restoring manual selection is controlled by framework, then get network
-                // selection from shared preference, otherwise get from real network indicators.
-                boolean restoreSelection = !mContext.getResources().getBoolean(
-                        com.android.internal.R.bool.skip_restoring_network_selection);
-                if (restoreSelection) {
-                    isManualSelection = !TextUtils.isEmpty(selectedNetworkOperatorName);
-                } else {
-                    isManualSelection = phone.getServiceStateTracker().mSS.getIsManualSelection();
-                }
-
-                if (DBG) {
-                    log("updateNetworkSelection()..." + "state = " + serviceState + " new network "
-                            + (isManualSelection ? selectedNetworkOperatorName : ""));
-                }
-
-                if (isManualSelection
-                        && isSubscriptionVisibleToUser(
-                              mSubscriptionManager.getActiveSubscriptionInfo(subId))) {
-                    mSelectedNetworkOperatorName.put(subId, selectedNetworkOperatorName);
-                    shouldShowNotification(serviceState, subId);
-                } else {
-                    dismissNetworkSelectionNotification(subId);
-                    clearUpNetworkSelectionNotificationParam(subId);
-                }
-            } else {
-                if (DBG) log("updateNetworkSelection()..." + "state = " +
-                        serviceState + " not updating network due to invalid subId " + subId);
-                dismissNetworkSelectionNotificationForInactiveSubId();
-            }
-        }
-    }
-
     // TODO(b/261916533) This should be handled by SubscriptionManager#isSubscriptionVisible(),
     // but that method doesn't support system callers, so here we are.
     private boolean isSubscriptionVisibleToUser(SubscriptionInfo subInfo) {
diff --git a/src/com/android/phone/PhoneGlobals.java b/src/com/android/phone/PhoneGlobals.java
index ddc64f7..e9497f5 100644
--- a/src/com/android/phone/PhoneGlobals.java
+++ b/src/com/android/phone/PhoneGlobals.java
@@ -35,7 +35,6 @@
 import android.os.Handler;
 import android.os.Message;
 import android.os.PersistableBundle;
-import android.os.PowerManager;
 import android.os.SystemProperties;
 import android.preference.PreferenceManager;
 import android.provider.Settings;
@@ -146,18 +145,6 @@
     public static final int AIRPLANE_ON = 1;
     public static final int AIRPLANE_OFF = 0;
 
-    /**
-     * Allowable values for the wake lock code.
-     *   SLEEP means the device can be put to sleep.
-     *   PARTIAL means wake the processor, but we display can be kept off.
-     *   FULL means wake both the processor and the display.
-     */
-    public enum WakeState {
-        SLEEP,
-        PARTIAL,
-        FULL
-    }
-
     private static PhoneGlobals sMe;
 
     CallManager mCM;
@@ -228,19 +215,6 @@
      */
     private ArraySet<String> mShownNotificationReasons = new ArraySet<>();
 
-    // For reorganize_roaming_notification feature disabled.
-    @RoamingNotification
-    private int mPrevRoamingNotification = ROAMING_NOTIFICATION_NO_NOTIFICATION;
-
-    // For reorganize_roaming_notification feature disabled.
-    /** Operator numerics for which we've shown is-roaming notifications. **/
-    private ArraySet<String> mPrevRoamingOperatorNumerics = new ArraySet<>();
-
-    private WakeState mWakeState = WakeState.SLEEP;
-
-    private PowerManager mPowerManager;
-    private PowerManager.WakeLock mWakeLock;
-    private PowerManager.WakeLock mPartialWakeLock;
     private KeyguardManager mKeyguardManager;
 
     private int mDefaultDataSubId = SubscriptionManager.INVALID_SUBSCRIPTION_ID;
@@ -359,7 +333,6 @@
     Handler mHandler = new Handler() {
         @Override
         public void handleMessage(Message msg) {
-            PhoneConstants.State phoneState;
             if (VDBG) Log.v(LOG_TAG, "event=" + msg.what);
             switch (msg.what) {
                 // TODO: This event should be handled by the lock screen, just
@@ -621,13 +594,6 @@
             // {@link android.telephony.satellite.SatelliteManager}.
             SatelliteController.make(this, mFeatureFlags);
 
-            // before registering for phone state changes
-            mPowerManager = (PowerManager) getSystemService(Context.POWER_SERVICE);
-            mWakeLock = mPowerManager.newWakeLock(PowerManager.FULL_WAKE_LOCK, LOG_TAG);
-            // lock used to keep the processor awake, when we don't care for the display.
-            mPartialWakeLock = mPowerManager.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK
-                    | PowerManager.ON_AFTER_RELEASE, LOG_TAG);
-
             mKeyguardManager = (KeyguardManager) getSystemService(Context.KEYGUARD_SERVICE);
 
             phoneMgr = PhoneInterfaceManager.init(this, mFeatureFlags);
@@ -1203,15 +1169,6 @@
         return mCurrentRoamingNotification;
     }
 
-    /**
-     *
-     * @param subId to check roaming on
-     * @return whether we have transitioned to dataRoaming
-     */
-    private boolean dataIsNowRoaming(int subId) {
-        return getPhone(subId).getServiceState().getDataRoaming();
-    }
-
     private boolean shouldShowRoamingNotification(String roamingNumeric) {
         PersistableBundle config = getCarrierConfigForSubId(mDefaultDataSubId);
         boolean showRoamingNotification = config.getBoolean(
diff --git a/src/com/android/phone/PhoneInterfaceManager.java b/src/com/android/phone/PhoneInterfaceManager.java
index ddf6efc..3a0065e 100644
--- a/src/com/android/phone/PhoneInterfaceManager.java
+++ b/src/com/android/phone/PhoneInterfaceManager.java
@@ -172,7 +172,9 @@
 import android.telephony.satellite.SatelliteDatagram;
 import android.telephony.satellite.SatelliteDatagramCallback;
 import android.telephony.satellite.SatelliteManager;
+import android.telephony.satellite.SatelliteModemStateCallback;
 import android.telephony.satellite.SatelliteProvisionStateCallback;
+import android.telephony.satellite.SatelliteSessionStats;
 import android.telephony.satellite.SatelliteSubscriberInfo;
 import android.text.TextUtils;
 import android.util.ArraySet;
@@ -213,6 +215,7 @@
 import com.android.internal.telephony.PhoneConstantConversions;
 import com.android.internal.telephony.PhoneConstants;
 import com.android.internal.telephony.PhoneFactory;
+import com.android.internal.telephony.PhoneInternalInterface;
 import com.android.internal.telephony.ProxyController;
 import com.android.internal.telephony.RIL;
 import com.android.internal.telephony.RILConstants;
@@ -288,6 +291,7 @@
 import java.util.Objects;
 import java.util.Set;
 import java.util.UUID;
+import java.util.concurrent.Executor;
 import java.util.concurrent.Executors;
 import java.util.concurrent.atomic.AtomicBoolean;
 import java.util.function.Consumer;
@@ -441,7 +445,6 @@
     private static final String PREF_CARRIERS_ALPHATAG_PREFIX = "carrier_alphtag_";
     private static final String PREF_CARRIERS_NUMBER_PREFIX = "carrier_number_";
     private static final String PREF_CARRIERS_SUBSCRIBER_PREFIX = "carrier_subscriber_";
-    private static final String PREF_PROVISION_IMS_MMTEL_PREFIX = "provision_ims_mmtel_";
 
     // String to store multi SIM allowed
     private static final String PREF_MULTI_SIM_RESTRICTED = "multisim_restricted";
@@ -555,10 +558,6 @@
 
         public WorkSource workSource;
 
-        public MainThreadRequest(Object argument) {
-            this.argument = argument;
-        }
-
         MainThreadRequest(Object argument, Phone phone, WorkSource workSource) {
             this.argument = argument;
             if (phone != null) {
@@ -576,19 +575,6 @@
         }
     }
 
-    private static final class IncomingThirdPartyCallArgs {
-        public final ComponentName component;
-        public final String callId;
-        public final String callerDisplayName;
-
-        public IncomingThirdPartyCallArgs(ComponentName component, String callId,
-                String callerDisplayName) {
-            this.component = component;
-            this.callId = callId;
-            this.callerDisplayName = callerDisplayName;
-        }
-    }
-
     /**
      * A handler that processes messages on the main thread in the phone process. Since many
      * of the Phone calls are not thread safe this is needed to shuttle the requests from the
@@ -1698,7 +1684,8 @@
                         request.result = ar.result;
                     } else {
                         Phone phone = getPhoneFromRequest(request);
-                        request.result = (phone.getPhoneType() == PhoneConstants.PHONE_TYPE_CDMA)
+                        request.result = (!mFeatureFlags.deleteCdma()
+                                && phone.getPhoneType() == PhoneConstants.PHONE_TYPE_CDMA)
                                 ? new CellIdentityCdma() : new CellIdentityGsm();
                     }
 
@@ -2298,20 +2285,6 @@
         return request.result;
     }
 
-    /**
-     * Asynchronous ("fire and forget") version of sendRequest():
-     * Posts the specified command to be executed on the main thread, and
-     * returns immediately.
-     * @see #sendRequest
-     */
-    private void sendRequestAsync(int command) {
-        mMainThreadHandler.sendEmptyMessage(command);
-    }
-
-    /**
-     * Same as {@link #sendRequestAsync(int)} except it takes an argument.
-     * @see {@link #sendRequest(int)}
-     */
     private void sendRequestAsync(int command, Object argument) {
         sendRequestAsync(command, argument, null, null);
     }
@@ -2442,13 +2415,13 @@
         return PhoneFactory.getPhone(SubscriptionManager.getPhoneId(subId));
     }
 
-    private void sendEraseModemConfig(@NonNull Phone phone) {
+    private void sendEraseModemConfig() {
         int cmd = CMD_MODEM_REBOOT;
         Boolean success = (Boolean) sendRequest(cmd, null);
         if (DBG) log("eraseModemConfig:" + ' ' + (success ? "ok" : "fail"));
     }
 
-    private void sendEraseDataInSharedPreferences(@NonNull Phone phone) {
+    private void sendEraseDataInSharedPreferences() {
         Boolean success = (Boolean) sendRequest(CMD_ERASE_DATA_SHARED_PREFERENCES, null);
         if (DBG) log("eraseDataInSharedPreferences:" + ' ' + (success ? "ok" : "fail"));
     }
@@ -2939,27 +2912,6 @@
         }
     }
 
-    public boolean setRadioPowerForSubscriber(int subId, boolean turnOn) {
-        enforceModifyPermission();
-
-        if (!turnOn) {
-            log("setRadioPowerForSubscriber off: subId=" + subId
-                    + ",callingPackage=" + getCurrentPackageName());
-        }
-        final long identity = Binder.clearCallingIdentity();
-        try {
-            final Phone phone = getPhone(subId);
-            if (phone != null) {
-                phone.setRadioPower(turnOn);
-                return true;
-            } else {
-                return false;
-            }
-        } finally {
-            Binder.restoreCallingIdentity(identity);
-        }
-    }
-
     /**
      * Vote on powering off the radio for a reason. The radio will be turned on only when there is
      * no reason to power it off. When any of the voters want to power it off, it will be turned
@@ -2967,10 +2919,10 @@
      * powering it off, and these radio off votes will be cleared.
      * Multiple apps can vote for the same reason and the last vote will take effect. Each app is
      * responsible for its vote. A powering-off vote of a reason will be maintained until it is
-     * cleared by calling {@link clearRadioPowerOffForReason} for that reason, or an emergency call
-     * is made, or the device is rebooted. When an app comes backup from a crash, it needs to make
-     * sure if its vote is as expected. An app can use the API {@link getRadioPowerOffReasons} to
-     * check its vote.
+     * cleared by calling {@link #clearRadioPowerOffForReason(int, int)} for that reason, or an
+     * emergency call is made, or the device is rebooted. When an app comes backup from a crash, it
+     * needs to make sure if its vote is as expected. An app can use the API
+     * {@link #getRadioPowerOffReasons(int, String, String)} to check its vote.
      *
      * @param subId The subscription ID.
      * @param reason The reason for powering off radio.
@@ -3003,7 +2955,7 @@
 
     /**
      * Remove the vote on powering off the radio for a reason, as requested by
-     * {@link requestRadioPowerOffForReason}.
+     * {@link #requestRadioPowerOffForReason(int, int)}.
      *
      * @param subId The subscription ID.
      * @param reason The reason for powering off radio.
@@ -3033,7 +2985,8 @@
     }
 
     /**
-     * Get reasons for powering off radio, as requested by {@link requestRadioPowerOffForReason}.
+     * Get reasons for powering off radio, as requested by
+     * {@link #requestRadioPowerOffForReason(int, int)}.
      *
      * @param subId The subscription ID.
      * @param callingPackage The package making the call.
@@ -3292,7 +3245,8 @@
             case DENIED_HARD:
                 throw new SecurityException("Not allowed to access cell location");
             case DENIED_SOFT:
-                return (getDefaultPhone().getPhoneType() == PhoneConstants.PHONE_TYPE_CDMA)
+                return (!mFeatureFlags.deleteCdma()
+                        && getDefaultPhone().getPhoneType() == PhoneConstants.PHONE_TYPE_CDMA)
                         ? new CellIdentityCdma() : new CellIdentityGsm();
         }
 
@@ -3326,7 +3280,6 @@
                 // Get default phone in this case.
                 phoneId = SubscriptionManager.DEFAULT_PHONE_INDEX;
             }
-            final int subId = SubscriptionManager.getSubscriptionId(phoneId);
             Phone phone = PhoneFactory.getPhone(phoneId);
             if (phone == null) return "";
             ServiceStateTracker sst = phone.getServiceStateTracker();
@@ -5530,10 +5483,6 @@
         return SubscriptionManager.getDefaultSubscriptionId();
     }
 
-    private int getSlotForDefaultSubscription() {
-        return SubscriptionManager.getPhoneId(getDefaultSubscription());
-    }
-
     private int getPreferredVoiceSubscription() {
         return SubscriptionManager.getDefaultVoiceSubscriptionId();
     }
@@ -6180,7 +6129,7 @@
 
     /**
      * Clears any carrier ImsService overrides for the slot index specified that were previously
-     * set with {@link #setBoundImsServiceOverride(int, boolean, int[], String)}.
+     * set with {@link #setBoundImsServiceOverride(int, int, boolean, int[], String)}.
      *
      * This should only be used for testing.
      *
@@ -7506,7 +7455,6 @@
         try {
             final Context context = mApp;
             final TelephonyManager tele = TelephonyManager.from(context);
-            final SubscriptionManager sub = SubscriptionManager.from(context);
 
             // Figure out what subscribers are currently active
             final ArraySet<String> activeSubscriberIds = new ArraySet<>();
@@ -8132,10 +8080,10 @@
             String configValue = DeviceConfig.getProperty(DeviceConfig.NAMESPACE_TELEPHONY,
                     RESET_NETWORK_ERASE_MODEM_CONFIG_ENABLED);
             if (configValue != null && Boolean.parseBoolean(configValue)) {
-                sendEraseModemConfig(defaultPhone);
+                sendEraseModemConfig();
             }
 
-            sendEraseDataInSharedPreferences(defaultPhone);
+            sendEraseDataInSharedPreferences();
         } finally {
             Binder.restoreCallingIdentity(identity);
         }
@@ -8278,8 +8226,6 @@
                 (int) (info.getTimestampMillis() - mLastModemActivityInfo.getTimestampMillis());
         activityDurationMs += MODEM_ACTIVITY_TIME_OFFSET_CORRECTION_MS;
 
-        int totalTxTimeMs = Arrays.stream(info.getTransmitTimeMillis()).sum();
-
         return (info.isValid()
                 && (info.getSleepTimeMillis() <= activityDurationMs)
                 && (info.getIdleTimeMillis() <= activityDurationMs));
@@ -9665,19 +9611,6 @@
         return TelephonyProperties.mobile_data().orElse(true);
     }
 
-    /**
-     * Returns the default network type for the given {@code subId}, if the default network type is
-     * not set, return {@link Phone#PREFERRED_NT_MODE}.
-     */
-    private int getDefaultNetworkType(int subId) {
-        List<Integer> list = TelephonyProperties.default_network();
-        int phoneId = SubscriptionManager.getPhoneId(subId);
-        if (phoneId >= 0 && phoneId < list.size() && list.get(phoneId) != null) {
-            return list.get(phoneId);
-        }
-        return Phone.PREFERRED_NT_MODE;
-    }
-
     @Override
     public void setCarrierTestOverride(int subId, String mccmnc, String imsi, String iccid, String
             gid1, String gid2, String plmn, String spn, String carrierPrivilegeRules, String apn) {
@@ -9846,8 +9779,9 @@
         try {
             for (Phone phone : PhoneFactory.getPhones()) {
                 Rlog.d(LOG_TAG, "startEmergencyCallbackMode phone type: " + phone.getPhoneType());
-                if (phone != null && ((phone.getPhoneType() == PHONE_TYPE_GSM)
-                        || (phone.getPhoneType() == PHONE_TYPE_CDMA))) {
+                if (phone != null && (mFeatureFlags.deleteCdma()
+                        || (phone.getPhoneType() == PHONE_TYPE_GSM
+                        || phone.getPhoneType() == PHONE_TYPE_CDMA))) {
                     GsmCdmaPhone gsmCdmaPhone = (GsmCdmaPhone) phone;
                     gsmCdmaPhone.obtainMessage(
                             GsmCdmaPhone.EVENT_EMERGENCY_CALLBACK_MODE_ENTER).sendToTarget();
@@ -10886,7 +10820,7 @@
      * Attempts to set the radio power state for all phones for thermal reason.
      * This does not guarantee that the
      * requested radio power state will actually be set. See {@link
-     * PhoneInternalInterface#setRadioPowerForReason} for more details.
+     * PhoneInternalInterface#setRadioPowerForReason(boolean, int)} for more details.
      *
      * @param enable {@code true} if trying to turn radio on.
      * @return {@code true} if phone setRadioPowerForReason was called. Otherwise, returns {@code
@@ -11019,7 +10953,6 @@
                     + "calling package: " + callingPackage);
         }
 
-        WorkSource workSource = getWorkSource(Binder.getCallingUid());
         final long identity = Binder.clearCallingIdentity();
 
         int thermalMitigationResult = TelephonyManager.THERMAL_MITIGATION_RESULT_UNKNOWN_ERROR;
@@ -12095,10 +12028,7 @@
 
         final long token = Binder.clearCallingIdentity();
         try {
-            int slotId = getSlotIndexOrException(subId);
             controller.registerImsStateCallback(subId, feature, cb, callingPackage);
-        } catch (ImsException e) {
-            throw new ServiceSpecificException(e.getCode());
         } finally {
             Binder.restoreCallingIdentity(token);
         }
@@ -12992,7 +12922,7 @@
      * If callback was not registered before, the request will be ignored.
      *
      * @param callback The callback that was passed to
-     * {@link #registerForModemStateChanged(int, ISatelliteModemStateCallback)}.
+     * {@link SatelliteManager#registerForModemStateChanged(Executor, SatelliteModemStateCallback)}
      *
      * @throws SecurityException if the caller doesn't have the required permission.
      */
@@ -14664,7 +14594,7 @@
      * Get list of applications that are optimized for low bandwidth satellite data.
      *
      * @return List of Application Name with data optimized network property.
-     * {@link #PROPERTY_SATELLITE_DATA_OPTIMIZED}
+     * {@link SatelliteManager#PROPERTY_SATELLITE_DATA_OPTIMIZED}
      */
     @Override
     public List<String> getSatelliteDataOptimizedApps() {
diff --git a/src/com/android/phone/PhoneUtils.java b/src/com/android/phone/PhoneUtils.java
index bf8fdab..74ecbae 100644
--- a/src/com/android/phone/PhoneUtils.java
+++ b/src/com/android/phone/PhoneUtils.java
@@ -500,7 +500,7 @@
      *         if the current pending MMI wasn't cancelable
      *         or if there was no current pending MMI at all.
      *
-     * @see displayMMIInitiate
+     * @see #displayMMIInitiate(Context, MmiCode, Message, Dialog)
      */
     static boolean cancelMmiCode(Phone phone) {
         List<? extends MmiCode> pendingMmis = phone.getPendingMmiCodes();
diff --git a/src/com/android/phone/settings/VoicemailSettingsActivity.java b/src/com/android/phone/settings/VoicemailSettingsActivity.java
index 9e6b418..d475b61 100644
--- a/src/com/android/phone/settings/VoicemailSettingsActivity.java
+++ b/src/com/android/phone/settings/VoicemailSettingsActivity.java
@@ -51,6 +51,7 @@
 import com.android.internal.telephony.CommandsInterface;
 import com.android.internal.telephony.Phone;
 import com.android.internal.telephony.PhoneConstants;
+import com.android.internal.telephony.flags.Flags;
 import com.android.internal.telephony.util.NotificationChannelController;
 import com.android.phone.EditPhoneNumberPreference;
 import com.android.phone.PhoneGlobals;
@@ -755,7 +756,7 @@
         mNewFwdSettings = newSettings.getForwardingSettings();
 
         // Call forwarding is not suppported on CDMA.
-        if (mPhone.getPhoneType() == PhoneConstants.PHONE_TYPE_CDMA) {
+        if (!Flags.deleteCdma() && mPhone.getPhoneType() == PhoneConstants.PHONE_TYPE_CDMA) {
             if (DBG) log("Ignoring forwarding setting since this is CDMA phone");
             mNewFwdSettings = VoicemailProviderSettings.NO_FORWARDING;
         }
diff --git a/src/com/android/services/telephony/ImsConference.java b/src/com/android/services/telephony/ImsConference.java
index ba66f3b..62b29ea 100644
--- a/src/com/android/services/telephony/ImsConference.java
+++ b/src/com/android/services/telephony/ImsConference.java
@@ -1497,7 +1497,8 @@
                 }
             }
 
-            if (mConferenceHost.getPhone().getPhoneType() == PhoneConstants.PHONE_TYPE_GSM) {
+            if (Flags.deleteCdma() || mConferenceHost.getPhone().getPhoneType()
+                    == PhoneConstants.PHONE_TYPE_GSM) {
                 GsmConnection c = new GsmConnection(originalConnection, getTelecomCallId(),
                         mConferenceHost.getCallDirection());
                 Log.i(this, "handleOriginalConnectionChange : SRVCC to GSM."
diff --git a/src/com/android/services/telephony/TelephonyConferenceBase.java b/src/com/android/services/telephony/TelephonyConferenceBase.java
index 1e7f956..f49273e 100644
--- a/src/com/android/services/telephony/TelephonyConferenceBase.java
+++ b/src/com/android/services/telephony/TelephonyConferenceBase.java
@@ -30,7 +30,7 @@
 import java.util.concurrent.ConcurrentHashMap;
 
 /**
- * Base class for the various Telephony {@link Conference} implementations ({@link CdmaConference},
+ * Base class for the various Telephony {@link Conference}
  * {@link TelephonyConference}, and {@link ImsConference}).  Adds some common listener code which
  * all of these conferences use.
  */
@@ -79,14 +79,6 @@
     }
 
     /**
-     * Removes a listener from this conference.
-     * @param listener The listener.
-     */
-    public void removeTelephonyConferenceListener(@NonNull TelephonyConferenceListener listener) {
-        mListeners.remove(listener);
-    }
-
-    /**
      * Constructs a new Conference with a mandatory {@link PhoneAccountHandle}
      *
      * @param phoneAccount The {@code PhoneAccountHandle} associated with the conference.
diff --git a/src/com/android/services/telephony/TelephonyConnection.java b/src/com/android/services/telephony/TelephonyConnection.java
index c4a977b..e01640e 100644
--- a/src/com/android/services/telephony/TelephonyConnection.java
+++ b/src/com/android/services/telephony/TelephonyConnection.java
@@ -83,6 +83,7 @@
 import com.android.internal.telephony.d2d.RtpTransport;
 import com.android.internal.telephony.d2d.Timeouts;
 import com.android.internal.telephony.d2d.TransportProtocol;
+import com.android.internal.telephony.flags.Flags;
 import com.android.internal.telephony.gsm.SuppServiceNotification;
 import com.android.internal.telephony.imsphone.ImsPhone;
 import com.android.internal.telephony.imsphone.ImsPhoneCall;
@@ -1603,8 +1604,10 @@
         phone.registerForRingbackTone(mHandler, MSG_RINGBACK_TONE, null);
         phone.registerForSuppServiceNotification(mHandler, MSG_SUPP_SERVICE_NOTIFY, null);
         phone.registerForOnHoldTone(mHandler, MSG_ON_HOLD_TONE, null);
-        phone.registerForInCallVoicePrivacyOn(mHandler, MSG_CDMA_VOICE_PRIVACY_ON, null);
-        phone.registerForInCallVoicePrivacyOff(mHandler, MSG_CDMA_VOICE_PRIVACY_OFF, null);
+        if (!Flags.deleteCdma()) {
+            phone.registerForInCallVoicePrivacyOn(mHandler, MSG_CDMA_VOICE_PRIVACY_ON, null);
+            phone.registerForInCallVoicePrivacyOff(mHandler, MSG_CDMA_VOICE_PRIVACY_OFF, null);
+        }
         mPhoneForEvents = phone;
     }
 
@@ -3057,10 +3060,6 @@
         return mWasImsConnection;
     }
 
-    boolean getIsUsingAssistedDialing() {
-        return mIsUsingAssistedDialing;
-    }
-
     void setIsUsingAssistedDialing(Boolean isUsingAssistedDialing) {
         mIsUsingAssistedDialing = isUsingAssistedDialing;
         updateConnectionProperties();
@@ -3291,7 +3290,8 @@
     private boolean isShowingOriginalDialString() {
         boolean showOrigDialString = false;
         Phone phone = getPhone();
-        if (phone != null && (phone.getPhoneType() == TelephonyManager.PHONE_TYPE_CDMA)
+        if (phone != null && (!Flags.deleteCdma()
+                && phone.getPhoneType() == TelephonyManager.PHONE_TYPE_CDMA)
                 && !mOriginalConnection.isIncoming()) {
             showOrigDialString = getCarrierConfig().getBoolean(CarrierConfigManager
                     .KEY_CONFIG_SHOW_ORIG_DIAL_STRING_FOR_CDMA_BOOL);
diff --git a/src/com/android/services/telephony/TelephonyConnectionService.java b/src/com/android/services/telephony/TelephonyConnectionService.java
index fae53a2..81e7dd2 100644
--- a/src/com/android/services/telephony/TelephonyConnectionService.java
+++ b/src/com/android/services/telephony/TelephonyConnectionService.java
@@ -72,7 +72,6 @@
 import android.view.WindowManager;
 import android.widget.Toast;
 
-import com.android.ims.ImsManager;
 import com.android.internal.annotations.VisibleForTesting;
 import com.android.internal.telephony.Call;
 import com.android.internal.telephony.CallFailCause;
@@ -236,9 +235,6 @@
             new TelephonyConferenceController(mTelephonyConnectionServiceProxy);
     private final CdmaConferenceController mCdmaConferenceController =
             new CdmaConferenceController(this);
-
-    private com.android.server.telecom.flags.FeatureFlags mTelecomFlags =
-            new com.android.server.telecom.flags.FeatureFlagsImpl();
     private FeatureFlags mFeatureFlags = new FeatureFlagsImpl();
 
     private ImsConferenceController mImsConferenceController;
@@ -269,7 +265,6 @@
     private TelephonyConnection mAlternateEmergencyConnection;
     private TelephonyConnection mNormalRoutingEmergencyConnection;
     private Executor mDomainSelectionMainExecutor;
-    private ImsManager mImsManager = null;
     private DomainSelectionConnection mDomainSelectionConnection;
     private TelephonyConnection mNormalCallConnection;
     private SatelliteController mSatelliteController;
@@ -2048,11 +2043,6 @@
             return Connection.createCanceledConnection();
         }
 
-        // We should rely on the originalConnection to get the video state.  The request coming
-        // from Telecom does not know the video state of the unknown call.
-        int videoState = unknownConnection != null ? unknownConnection.getVideoState() :
-                VideoProfile.STATE_AUDIO_ONLY;
-
         TelephonyConnection connection =
                 createConnectionFor(phone, unknownConnection,
                         !unknownConnection.isIncoming() /* isOutgoing */,
@@ -2492,7 +2482,7 @@
 
     private int handleMmiCode(Phone phone, int telephonyDisconnectCause) {
         int disconnectCause = telephonyDisconnectCause;
-        if (phone.getPhoneType() == PhoneConstants.PHONE_TYPE_GSM
+        if ((mFeatureFlags.deleteCdma() || phone.getPhoneType() == PhoneConstants.PHONE_TYPE_GSM)
                 || phone.isUtEnabled()) {
             Log.d(this, "dialed MMI code");
             int subId = phone.getSubId();
@@ -3628,12 +3618,6 @@
 
     @VisibleForTesting
     public TelephonyConnection.TelephonyConnectionListener
-            getNormalRoutingEmergencyConnectionListener() {
-        return mNormalRoutingEmergencyConnectionListener;
-    }
-
-    @VisibleForTesting
-    public TelephonyConnection.TelephonyConnectionListener
             getEmergencyConnectionSatelliteListener() {
         return mEmergencyConnectionSatelliteListener;
     }
@@ -3718,7 +3702,7 @@
         int phoneType = phone.getPhoneType();
         int callDirection = isOutgoing ? android.telecom.Call.Details.DIRECTION_OUTGOING
                 : android.telecom.Call.Details.DIRECTION_INCOMING;
-        if (phoneType == TelephonyManager.PHONE_TYPE_GSM) {
+        if (mFeatureFlags.deleteCdma() || phoneType == TelephonyManager.PHONE_TYPE_GSM) {
             returnConnection = new GsmConnection(originalConnection, telecomCallId, callDirection);
         } else if (phoneType == TelephonyManager.PHONE_TYPE_CDMA) {
             boolean allowsMute = allowsMute(phone);
@@ -3968,41 +3952,6 @@
         }
     }
 
-    private CompletableFuture<Boolean> listenForHoldStateChanged(
-            @NonNull Conferenceable conferenceable) {
-        CompletableFuture<Boolean> future = new CompletableFuture<>();
-        final StateHoldingListener stateHoldingListener = new StateHoldingListener(future);
-        addTelephonyConnectionListener(conferenceable, stateHoldingListener);
-        return future;
-    }
-
-    // Returns a future that waits for the STATE_HOLDING confirmation on the input
-    // {@link Conferenceable}, or times out.
-    private CompletableFuture<Void> delayDialForOtherSubHold(Phone phone, Conferenceable c,
-            Consumer<Boolean> completeConsumer) {
-        if (c == null || phone == null) {
-            // Unexpected inputs
-            completeConsumer.accept(false);
-            return CompletableFuture.completedFuture(null);
-        }
-
-        try {
-            CompletableFuture<Boolean> stateHoldingFuture = listenForHoldStateChanged(c);
-            // a timeout that will complete the future to not block the outgoing call indefinitely.
-            CompletableFuture<Boolean> timeout = new CompletableFuture<>();
-            phone.getContext().getMainThreadHandler().postDelayed(
-                    () -> timeout.complete(false), DEFAULT_DSDA_CALL_STATE_CHANGE_TIMEOUT_MS);
-            // Ensure that the Consumer is completed on the main thread.
-            return stateHoldingFuture.acceptEitherAsync(timeout, completeConsumer,
-                    phone.getContext().getMainExecutor());
-        } catch (Exception e) {
-            Log.w(this, "delayDialForOtherSubHold - exception= "
-                    + e.getMessage());
-            completeConsumer.accept(false);
-            return CompletableFuture.completedFuture(null);
-        }
-    }
-
     /**
      * For DSDA devices, block until the connections passed in are disconnected (STATE_DISCONNECTED)
      * or time out.
@@ -4410,6 +4359,7 @@
     private boolean allowsMute(Phone phone) {
         // For CDMA phones, check if we are in Emergency Callback Mode (ECM).  Mute is disallowed
         // in ECM mode.
+        if (mFeatureFlags.deleteCdma()) return true;
         if (phone.getPhoneType() == TelephonyManager.PHONE_TYPE_CDMA) {
             if (phone.isInEcm()) {
                 return false;
@@ -4447,7 +4397,7 @@
             }
         } else {
             int phoneType = connection.getCall().getPhone().getPhoneType();
-            if (phoneType == TelephonyManager.PHONE_TYPE_GSM) {
+            if (mFeatureFlags.deleteCdma() || phoneType == TelephonyManager.PHONE_TYPE_GSM) {
                 Log.d(this, "Adding GSM connection to conference controller: " + connection);
                 mTelephonyConferenceController.add(connection);
                 if (!mFeatureFlags.deleteCdma()) {
@@ -4477,6 +4427,7 @@
      * the right circumstances to support adding a call.
      */
     private Connection checkAdditionalOutgoingCallLimits(Phone phone) {
+        if (mFeatureFlags.deleteCdma()) return null;
         if (phone.getPhoneType() == TelephonyManager.PHONE_TYPE_CDMA) {
             // Check to see if any CDMA conference calls exist, and if they do, check them for
             // limitations.
@@ -4956,7 +4907,6 @@
     public void setFeatureFlags(FeatureFlags featureFlags,
             com.android.server.telecom.flags.FeatureFlags telecomFlags) {
         mFeatureFlags = featureFlags;
-        mTelecomFlags = telecomFlags;
     }
 
     private void loge(String s) {
diff --git a/tests/src/com/android/services/telephony/TelephonyConnectionServiceTest.java b/tests/src/com/android/services/telephony/TelephonyConnectionServiceTest.java
index 1402339..f12348f 100644
--- a/tests/src/com/android/services/telephony/TelephonyConnectionServiceTest.java
+++ b/tests/src/com/android/services/telephony/TelephonyConnectionServiceTest.java
@@ -2265,8 +2265,6 @@
 
         ImsManager imsManager = Mockito.mock(ImsManager.class);
         doReturn(false).when(imsManager).isNonTtyOrTtyOnVolteEnabled();
-        replaceInstance(TelephonyConnectionService.class,
-                "mImsManager", mTestConnectionService, imsManager);
 
         int selectedDomain = DOMAIN_PS;