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

Commit 75835bbf authored by Brad Ebinger's avatar Brad Ebinger Committed by android-build-merger
Browse files

Remove dependencies on old ImsMmtelManager.RegistrationCallback

am: 9029b716

Change-Id: Iba4305511ed099a7e5bc90d0661160ac72debf59
parents ec7acd9a 9029b716
Loading
Loading
Loading
Loading
+2 −1
Original line number Original line Diff line number Diff line
@@ -262,7 +262,8 @@ public abstract class FeatureConnection {
            // Cache only non-null value for feature status.
            // Cache only non-null value for feature status.
            mFeatureStateCached = state;
            mFeatureStateCached = state;
        }
        }
        Log.i(TAG, "getFeatureState - returning " + ImsFeature.STATE_LOG_MAP.get(state));
        Log.i(TAG + " [" + mSlotId + "]", "getFeatureState - returning "
                + ImsFeature.STATE_LOG_MAP.get(state));
        return state;
        return state;
    }
    }


+16 −15
Original line number Original line Diff line number Diff line
@@ -17,6 +17,7 @@
package com.android.ims;
package com.android.ims;


import android.content.Context;
import android.content.Context;
import android.content.pm.PackageManager;
import android.os.Handler;
import android.os.Handler;
import android.os.Looper;
import android.os.Looper;
import android.telephony.ims.feature.ImsFeature;
import android.telephony.ims.feature.ImsFeature;
@@ -73,7 +74,7 @@ public class FeatureConnector<T extends IFeatureConnector> extends Handler {
    protected final String mLogPrefix;
    protected final String mLogPrefix;


    @VisibleForTesting
    @VisibleForTesting
    public Listener mListener;
    public Listener<T> mListener;


    // The IMS feature manager which interacts with ImsService
    // The IMS feature manager which interacts with ImsService
    @VisibleForTesting
    @VisibleForTesting
@@ -92,7 +93,7 @@ public class FeatureConnector<T extends IFeatureConnector> extends Handler {
        }
        }
    };
    };


    public FeatureConnector(Context context, int phoneId, Listener listener) {
    public FeatureConnector(Context context, int phoneId, Listener<T> listener) {
        mContext = context;
        mContext = context;
        mPhoneId = phoneId;
        mPhoneId = phoneId;
        mListener = listener;
        mListener = listener;
@@ -100,7 +101,7 @@ public class FeatureConnector<T extends IFeatureConnector> extends Handler {
        mLogPrefix = "?";
        mLogPrefix = "?";
    }
    }


    public FeatureConnector(Context context, int phoneId, Listener listener,
    public FeatureConnector(Context context, int phoneId, Listener<T> listener,
            String logPrefix) {
            String logPrefix) {
        mContext = context;
        mContext = context;
        mPhoneId = phoneId;
        mPhoneId = phoneId;
@@ -110,7 +111,7 @@ public class FeatureConnector<T extends IFeatureConnector> extends Handler {
    }
    }


    @VisibleForTesting
    @VisibleForTesting
    public FeatureConnector(Context context, int phoneId, Listener listener,
    public FeatureConnector(Context context, int phoneId, Listener<T> listener,
            Executor executor, String logPrefix) {
            Executor executor, String logPrefix) {
        mContext = context;
        mContext = context;
        mPhoneId = phoneId;
        mPhoneId = phoneId;
@@ -120,7 +121,7 @@ public class FeatureConnector<T extends IFeatureConnector> extends Handler {
    }
    }


    @VisibleForTesting
    @VisibleForTesting
    public FeatureConnector(Context context, int phoneId, Listener listener,
    public FeatureConnector(Context context, int phoneId, Listener<T> listener,
            Executor executor, Looper looper) {
            Executor executor, Looper looper) {
        super(looper);
        super(looper);
        mContext = context;
        mContext = context;
@@ -132,16 +133,16 @@ public class FeatureConnector<T extends IFeatureConnector> extends Handler {


    /**
    /**
     * Start the creation of a connection to the underlying ImsService implementation. When the
     * Start the creation of a connection to the underlying ImsService implementation. When the
     * service is connected, {@link FeatureConnector.Listener#connectionReady(T manager)} will be
     * service is connected, {@link FeatureConnector.Listener#connectionReady(Object)} will be
     * called with an active instance.
     * called with an active instance.
     *
     *
     * If this device does not support an ImsStack (i.e. doesn't support
     * If this device does not support an ImsStack (i.e. doesn't support
     * {@link PackageManager#FEATURE_TELEPHONY_IMS} feature), this method will do nothing.
     * {@link PackageManager#FEATURE_TELEPHONY_IMS} feature), this method will do nothing.
     */
     */
    public void connect() {
    public void connect() {
        Log.i(TAG, "connect");
        Log.i(TAG, getLogMessage("connect"));
        if (!isSupported()) {
        if (!isSupported()) {
            Log.i(TAG, "connect: NOT support!");
            Log.i(TAG, getLogMessage("connect: not supported."));
            return;
            return;
        }
        }
        mRetryCount = 0;
        mRetryCount = 0;
@@ -160,7 +161,7 @@ public class FeatureConnector<T extends IFeatureConnector> extends Handler {
     * {@link FeatureConnector.Listener#connectionUnavailable()} will be called one last time.
     * {@link FeatureConnector.Listener#connectionUnavailable()} will be called one last time.
     */
     */
    public void disconnect() {
    public void disconnect() {
        Log.i(TAG, "disconnect");
        Log.i(TAG, getLogMessage("disconnect"));
        removeCallbacks(mGetServiceRunnable);
        removeCallbacks(mGetServiceRunnable);
        synchronized (mLock) {
        synchronized (mLock) {
            if (mManager != null) {
            if (mManager != null) {
@@ -181,8 +182,8 @@ public class FeatureConnector<T extends IFeatureConnector> extends Handler {
    @VisibleForTesting
    @VisibleForTesting
    public void createImsService() throws ImsException {
    public void createImsService() throws ImsException {
        synchronized (mLock) {
        synchronized (mLock) {
            Log.d(TAG, "createImsService");
            Log.d(TAG, getLogMessage("createImsService"));
            mManager = (T) mListener.getFeatureManager();
            mManager = mListener.getFeatureManager();
            // Adding to set, will be safe adding multiple times. If the ImsService is not
            // Adding to set, will be safe adding multiple times. If the ImsService is not
            // active yet, this method will throw an ImsException.
            // active yet, this method will throw an ImsException.
            mManager.addNotifyStatusChangedCallbackIfAvailable(mNotifyStatusChangedCallback);
            mManager.addNotifyStatusChangedCallbackIfAvailable(mNotifyStatusChangedCallback);
@@ -238,7 +239,7 @@ public class FeatureConnector<T extends IFeatureConnector> extends Handler {
                                    break;
                                    break;
                                }
                                }
                                default: {
                                default: {
                                    Log.w(TAG, "Unexpected State!");
                                    Log.w(TAG, getLogMessage("Unexpected State!"));
                                }
                                }
                            }
                            }
                        } catch (ImsException e) {
                        } catch (ImsException e) {
@@ -264,7 +265,7 @@ public class FeatureConnector<T extends IFeatureConnector> extends Handler {
            manager = mManager;
            manager = mManager;
        }
        }
        try {
        try {
            Log.i(TAG, "notifyReady");
            Log.i(TAG, getLogMessage("notifyReady"));
            mListener.connectionReady(manager);
            mListener.connectionReady(manager);
        }
        }
        catch (ImsException e) {
        catch (ImsException e) {
@@ -278,11 +279,11 @@ public class FeatureConnector<T extends IFeatureConnector> extends Handler {
    }
    }


    protected void notifyNotReady() {
    protected void notifyNotReady() {
        Log.i(TAG, "notifyNotReady");
        Log.i(TAG, getLogMessage("notifyNotReady"));
        mListener.connectionUnavailable();
        mListener.connectionUnavailable();
    }
    }


    protected String getLogMessage(String message) {
    protected String getLogMessage(String message) {
        return "Connector-[" + mLogPrefix + "] " + message;
        return "Connector-[" + mLogPrefix + ", " + mPhoneId + "] " + message;
    }
    }
}
}
+3 −4
Original line number Original line Diff line number Diff line
@@ -17,9 +17,8 @@
package com.android.ims;
package com.android.ims;


import android.net.Uri;
import android.net.Uri;
import android.telephony.ims.ImsMmTelManager;
import android.telephony.ims.RegistrationManager;
import android.telephony.ims.ImsReasonInfo;
import android.telephony.ims.ImsReasonInfo;
import android.telephony.ims.feature.ImsFeature;
import android.telephony.ims.feature.MmTelFeature;
import android.telephony.ims.feature.MmTelFeature;
import android.telephony.ims.stub.ImsRegistrationImplBase;
import android.telephony.ims.stub.ImsRegistrationImplBase;


@@ -29,10 +28,10 @@ import java.util.Arrays;
 * Listener for receiving notifications about changes to the IMS connection.
 * Listener for receiving notifications about changes to the IMS connection.
 * It provides a state of IMS registration between UE and IMS network, the service
 * It provides a state of IMS registration between UE and IMS network, the service
 * availability of the local device during IMS registered.
 * availability of the local device during IMS registered.
 * @Deprecated Use {@link ImsMmTelManager.RegistrationCallback} instead.
 * @Deprecated Use {@link RegistrationManager.RegistrationCallback} instead.
 * @hide
 * @hide
 */
 */
public class ImsConnectionStateListener extends ImsMmTelManager.RegistrationCallback {
public class ImsConnectionStateListener extends RegistrationManager.RegistrationCallback {


    @Override
    @Override
    public final void onRegistered(@ImsRegistrationImplBase.ImsRegistrationTech int imsRadioTech) {
    public final void onRegistered(@ImsRegistrationImplBase.ImsRegistrationTech int imsRadioTech) {
+75 −58
Original line number Original line Diff line number Diff line
@@ -20,7 +20,6 @@ import android.annotation.Nullable;
import android.app.PendingIntent;
import android.app.PendingIntent;
import android.content.Context;
import android.content.Context;
import android.content.pm.PackageManager;
import android.content.pm.PackageManager;
import android.os.Bundle;
import android.os.Handler;
import android.os.Handler;
import android.os.HandlerThread;
import android.os.HandlerThread;
import android.os.Looper;
import android.os.Looper;
@@ -34,6 +33,7 @@ import android.provider.Settings;
import android.telecom.TelecomManager;
import android.telecom.TelecomManager;
import android.telephony.AccessNetworkConstants;
import android.telephony.AccessNetworkConstants;
import android.telephony.CarrierConfigManager;
import android.telephony.CarrierConfigManager;
import android.telephony.ims.RegistrationManager;
import android.telephony.ims.ImsMmTelManager;
import android.telephony.ims.ImsMmTelManager;
import android.telephony.ims.ImsService;
import android.telephony.ims.ImsService;
import android.telephony.ims.ProvisioningManager;
import android.telephony.ims.ProvisioningManager;
@@ -53,7 +53,6 @@ import android.telephony.ims.aidl.IImsSmsListener;
import android.telephony.ims.feature.CapabilityChangeRequest;
import android.telephony.ims.feature.CapabilityChangeRequest;
import android.telephony.ims.feature.ImsFeature;
import android.telephony.ims.feature.ImsFeature;
import android.telephony.ims.feature.MmTelFeature;
import android.telephony.ims.feature.MmTelFeature;
import android.util.Log;


import com.android.ims.internal.IImsCallSession;
import com.android.ims.internal.IImsCallSession;
import com.android.ims.internal.IImsEcbm;
import com.android.ims.internal.IImsEcbm;
@@ -294,7 +293,8 @@ public class ImsManager implements IFeatureConnector {
        if (mgr != null) {
        if (mgr != null) {
            return mgr.isEnhanced4gLteModeSettingEnabledByUser();
            return mgr.isEnhanced4gLteModeSettingEnabledByUser();
        }
        }
        loge("isEnhanced4gLteModeSettingEnabledByUser: ImsManager null, returning default value.");
        Rlog.e(TAG, "isEnhanced4gLteModeSettingEnabledByUser: ImsManager null, returning default"
                + " value.");
        return false;
        return false;
    }
    }


@@ -338,7 +338,7 @@ public class ImsManager implements IFeatureConnector {
        if (mgr != null) {
        if (mgr != null) {
            mgr.setEnhanced4gLteModeSetting(enabled);
            mgr.setEnhanced4gLteModeSetting(enabled);
        }
        }
        loge("setEnhanced4gLteModeSetting: ImsManager null, value not set.");
        Rlog.e(TAG, "setEnhanced4gLteModeSetting: ImsManager null, value not set.");
    }
    }


    /**
    /**
@@ -398,7 +398,7 @@ public class ImsManager implements IFeatureConnector {
        if (mgr != null) {
        if (mgr != null) {
            return mgr.isNonTtyOrTtyOnVolteEnabled();
            return mgr.isNonTtyOrTtyOnVolteEnabled();
        }
        }
        loge("isNonTtyOrTtyOnVolteEnabled: ImsManager null, returning default value.");
        Rlog.e(TAG, "isNonTtyOrTtyOnVolteEnabled: ImsManager null, returning default value.");
        return false;
        return false;
    }
    }


@@ -413,7 +413,7 @@ public class ImsManager implements IFeatureConnector {


        TelecomManager tm = (TelecomManager) mContext.getSystemService(Context.TELECOM_SERVICE);
        TelecomManager tm = (TelecomManager) mContext.getSystemService(Context.TELECOM_SERVICE);
        if (tm == null) {
        if (tm == null) {
            Log.w(TAG, "isNonTtyOrTtyOnVolteEnabled: telecom not available");
            logw("isNonTtyOrTtyOnVolteEnabled: telecom not available");
            return true;
            return true;
        }
        }
        return tm.getCurrentTtyMode() == TelecomManager.TTY_MODE_OFF;
        return tm.getCurrentTtyMode() == TelecomManager.TTY_MODE_OFF;
@@ -434,7 +434,7 @@ public class ImsManager implements IFeatureConnector {
        if (mgr != null) {
        if (mgr != null) {
            return mgr.isVolteEnabledByPlatform();
            return mgr.isVolteEnabledByPlatform();
        }
        }
        loge("isVolteEnabledByPlatform: ImsManager null, returning default value.");
        Rlog.e(TAG, "isVolteEnabledByPlatform: ImsManager null, returning default value.");
        return false;
        return false;
    }
    }


@@ -524,7 +524,7 @@ public class ImsManager implements IFeatureConnector {
        if (mgr != null) {
        if (mgr != null) {
            return mgr.isVolteProvisionedOnDevice();
            return mgr.isVolteProvisionedOnDevice();
        }
        }
        loge("isVolteProvisionedOnDevice: ImsManager null, returning default value.");
        Rlog.e(TAG, "isVolteProvisionedOnDevice: ImsManager null, returning default value.");
        return true;
        return true;
    }
    }


@@ -555,7 +555,7 @@ public class ImsManager implements IFeatureConnector {
        if (mgr != null) {
        if (mgr != null) {
            return mgr.isWfcProvisionedOnDevice();
            return mgr.isWfcProvisionedOnDevice();
        }
        }
        loge("isWfcProvisionedOnDevice: ImsManager null, returning default value.");
        Rlog.e(TAG, "isWfcProvisionedOnDevice: ImsManager null, returning default value.");
        return true;
        return true;
    }
    }


@@ -593,7 +593,7 @@ public class ImsManager implements IFeatureConnector {
        if (mgr != null) {
        if (mgr != null) {
            return mgr.isVtProvisionedOnDevice();
            return mgr.isVtProvisionedOnDevice();
        }
        }
        loge("isVtProvisionedOnDevice: ImsManager null, returning default value.");
        Rlog.e(TAG, "isVtProvisionedOnDevice: ImsManager null, returning default value.");
        return true;
        return true;
    }
    }


@@ -624,7 +624,7 @@ public class ImsManager implements IFeatureConnector {
        if (mgr != null) {
        if (mgr != null) {
            return mgr.isVtEnabledByPlatform();
            return mgr.isVtEnabledByPlatform();
        }
        }
        loge("isVtEnabledByPlatform: ImsManager null, returning default value.");
        Rlog.e(TAG, "isVtEnabledByPlatform: ImsManager null, returning default value.");
        return false;
        return false;
    }
    }


@@ -661,7 +661,7 @@ public class ImsManager implements IFeatureConnector {
        if (mgr != null) {
        if (mgr != null) {
            return mgr.isVtEnabledByUser();
            return mgr.isVtEnabledByUser();
        }
        }
        loge("isVtEnabledByUser: ImsManager null, returning default value.");
        Rlog.e(TAG, "isVtEnabledByUser: ImsManager null, returning default value.");
        return false;
        return false;
    }
    }


@@ -690,7 +690,7 @@ public class ImsManager implements IFeatureConnector {
        if (mgr != null) {
        if (mgr != null) {
            mgr.setVtSetting(enabled);
            mgr.setVtSetting(enabled);
        }
        }
        loge("setVtSetting: ImsManager null, can not set value.");
        Rlog.e(TAG, "setVtSetting: ImsManager null, can not set value.");
    }
    }


    /**
    /**
@@ -745,7 +745,7 @@ public class ImsManager implements IFeatureConnector {
        if (mgr != null) {
        if (mgr != null) {
            return mgr.isTurnOffImsAllowedByPlatform();
            return mgr.isTurnOffImsAllowedByPlatform();
        }
        }
        loge("isTurnOffImsAllowedByPlatform: ImsManager null, returning default value.");
        Rlog.e(TAG, "isTurnOffImsAllowedByPlatform: ImsManager null, returning default value.");
        return true;
        return true;
    }
    }


@@ -779,7 +779,7 @@ public class ImsManager implements IFeatureConnector {
        if (mgr != null) {
        if (mgr != null) {
            return mgr.isWfcEnabledByUser();
            return mgr.isWfcEnabledByUser();
        }
        }
        loge("isWfcEnabledByUser: ImsManager null, returning default value.");
        Rlog.e(TAG, "isWfcEnabledByUser: ImsManager null, returning default value.");
        return true;
        return true;
    }
    }


@@ -812,7 +812,7 @@ public class ImsManager implements IFeatureConnector {
        if (mgr != null) {
        if (mgr != null) {
            mgr.setWfcSetting(enabled);
            mgr.setWfcSetting(enabled);
        }
        }
        loge("setWfcSetting: ImsManager null, can not set value.");
        Rlog.e(TAG, "setWfcSetting: ImsManager null, can not set value.");
    }
    }


    /**
    /**
@@ -887,7 +887,7 @@ public class ImsManager implements IFeatureConnector {
        if (mgr != null) {
        if (mgr != null) {
            return mgr.getWfcMode();
            return mgr.getWfcMode();
        }
        }
        loge("getWfcMode: ImsManager null, returning default value.");
        Rlog.e(TAG, "getWfcMode: ImsManager null, returning default value.");
        return ImsMmTelManager.WIFI_MODE_WIFI_ONLY;
        return ImsMmTelManager.WIFI_MODE_WIFI_ONLY;
    }
    }


@@ -910,7 +910,7 @@ public class ImsManager implements IFeatureConnector {
        if (mgr != null) {
        if (mgr != null) {
            mgr.setWfcMode(wfcMode);
            mgr.setWfcMode(wfcMode);
        }
        }
        loge("setWfcMode: ImsManager null, can not set value.");
        Rlog.e(TAG, "setWfcMode: ImsManager null, can not set value.");
    }
    }


    /**
    /**
@@ -934,7 +934,7 @@ public class ImsManager implements IFeatureConnector {
        if (mgr != null) {
        if (mgr != null) {
            return mgr.getWfcMode(roaming);
            return mgr.getWfcMode(roaming);
        }
        }
        loge("getWfcMode: ImsManager null, returning default value.");
        Rlog.e(TAG, "getWfcMode: ImsManager null, returning default value.");
        return ImsMmTelManager.WIFI_MODE_WIFI_ONLY;
        return ImsMmTelManager.WIFI_MODE_WIFI_ONLY;
    }
    }


@@ -1006,7 +1006,7 @@ public class ImsManager implements IFeatureConnector {
        if (mgr != null) {
        if (mgr != null) {
            mgr.setWfcMode(wfcMode, roaming);
            mgr.setWfcMode(wfcMode, roaming);
        }
        }
        loge("setWfcMode: ImsManager null, can not set value.");
        Rlog.e(TAG, "setWfcMode: ImsManager null, can not set value.");
    }
    }


    /**
    /**
@@ -1074,7 +1074,7 @@ public class ImsManager implements IFeatureConnector {
        if (mgr != null) {
        if (mgr != null) {
            return mgr.isWfcRoamingEnabledByUser();
            return mgr.isWfcRoamingEnabledByUser();
        }
        }
        loge("isWfcRoamingEnabledByUser: ImsManager null, returning default value.");
        Rlog.e(TAG, "isWfcRoamingEnabledByUser: ImsManager null, returning default value.");
        return false;
        return false;
    }
    }


@@ -1103,7 +1103,7 @@ public class ImsManager implements IFeatureConnector {
        if (mgr != null) {
        if (mgr != null) {
            mgr.setWfcRoamingSetting(enabled);
            mgr.setWfcRoamingSetting(enabled);
        }
        }
        loge("setWfcRoamingSetting: ImsManager null, value not set.");
        Rlog.e(TAG, "setWfcRoamingSetting: ImsManager null, value not set.");
    }
    }


    /**
    /**
@@ -1145,7 +1145,7 @@ public class ImsManager implements IFeatureConnector {
        if (mgr != null) {
        if (mgr != null) {
            return mgr.isWfcEnabledByPlatform();
            return mgr.isWfcEnabledByPlatform();
        }
        }
        loge("isWfcEnabledByPlatform: ImsManager null, returning default value.");
        Rlog.e(TAG, "isWfcEnabledByPlatform: ImsManager null, returning default value.");
        return false;
        return false;
    }
    }


@@ -1240,7 +1240,7 @@ public class ImsManager implements IFeatureConnector {
            ImsConfig config = getConfigInterface();
            ImsConfig config = getConfigInterface();
            return getProvisionedBool(config, item);
            return getProvisionedBool(config, item);
        } catch (ImsException ex) {
        } catch (ImsException ex) {
            Log.w(TAG, "getProvisionedBoolNoException: operation failed for item=" + item
            logw("getProvisionedBoolNoException: operation failed for item=" + item
                    + ". Exception:" + ex.getMessage() + ". Returning false.");
                    + ". Exception:" + ex.getMessage() + ". Returning false.");
            return false;
            return false;
        }
        }
@@ -1255,7 +1255,7 @@ public class ImsManager implements IFeatureConnector {
            ImsConfig config = getConfigInterface();
            ImsConfig config = getConfigInterface();
            setProvisionedBool(config, item, value);
            setProvisionedBool(config, item, value);
        } catch (ImsException ex) {
        } catch (ImsException ex) {
            Log.w(TAG, "setProvisionedBoolNoException: operation failed for item=" + item
            logw("setProvisionedBoolNoException: operation failed for item=" + item
                    + ", value=" + value + ". Exception:" + ex.getMessage());
                    + ", value=" + value + ". Exception:" + ex.getMessage());
            return false;
            return false;
        }
        }
@@ -1277,7 +1277,7 @@ public class ImsManager implements IFeatureConnector {
        if (mgr != null) {
        if (mgr != null) {
            mgr.updateImsServiceConfig(force);
            mgr.updateImsServiceConfig(force);
        }
        }
        loge("updateImsServiceConfig: ImsManager null, returning without update.");
        Rlog.e(TAG, "updateImsServiceConfig: ImsManager null, returning without update.");
    }
    }


    /**
    /**
@@ -1454,7 +1454,7 @@ public class ImsManager implements IFeatureConnector {
                            ImsRegistrationImplBase.REGISTRATION_TECH_LTE);
                            ImsRegistrationImplBase.REGISTRATION_TECH_LTE);
                }
                }
            } catch (RemoteException e) {
            } catch (RemoteException e) {
                Log.e(TAG, "updateUtFeatureValue: couldn't reach telephony! returning provisioned");
                loge("updateUtFeatureValue: couldn't reach telephony! returning provisioned");
            }
            }
        }
        }
        boolean isFeatureOn = isCarrierSupported && isProvisioned;
        boolean isFeatureOn = isCarrierSupported && isProvisioned;
@@ -1550,7 +1550,7 @@ public class ImsManager implements IFeatureConnector {
        if (c != null) {
        if (c != null) {
            mStatusCallbacks.remove(c);
            mStatusCallbacks.remove(c);
        } else {
        } else {
            Log.w(TAG, "removeNotifyStatusChangedCallback: callback is null!");
            logw("removeNotifyStatusChangedCallback: callback is null!");
        }
        }
    }
    }


@@ -1602,7 +1602,7 @@ public class ImsManager implements IFeatureConnector {
     * @param listener To listen to IMS registration events; It cannot be null
     * @param listener To listen to IMS registration events; It cannot be null
     * @throws NullPointerException if {@code listener} is null
     * @throws NullPointerException if {@code listener} is null
     * @throws ImsException if calling the IMS service results in an error
     * @throws ImsException if calling the IMS service results in an error
     * @deprecated use {@link #addRegistrationCallback(ImsMmTelManager.RegistrationCallback)}
     * @deprecated use {@link #addRegistrationCallback(RegistrationManager.RegistrationCallback)}
     * instead.
     * instead.
     */
     */
    public void addRegistrationListener(ImsConnectionStateListener listener) throws ImsException {
    public void addRegistrationListener(ImsConnectionStateListener listener) throws ImsException {
@@ -1624,11 +1624,11 @@ public class ImsManager implements IFeatureConnector {
    /**
    /**
     * Adds a callback that gets called when IMS registration has changed for the slot ID
     * Adds a callback that gets called when IMS registration has changed for the slot ID
     * associated with this ImsManager.
     * associated with this ImsManager.
     * @param callback A {@link ImsMmTelManager.RegistrationCallback} that will notify the caller
     * @param callback A {@link RegistrationManager.RegistrationCallback} that will notify the
     *                 when IMS registration status has changed.
     *                 caller when IMS registration status has changed.
     * @throws ImsException when the ImsService connection is not available.
     * @throws ImsException when the ImsService connection is not available.
     */
     */
    public void addRegistrationCallback(ImsMmTelManager.RegistrationCallback callback)
    public void addRegistrationCallback(RegistrationManager.RegistrationCallback callback)
            throws ImsException {
            throws ImsException {
        if (callback == null) {
        if (callback == null) {
            throw new NullPointerException("registration callback can't be null");
            throw new NullPointerException("registration callback can't be null");
@@ -1647,10 +1647,10 @@ public class ImsManager implements IFeatureConnector {


    /**
    /**
     * Removes a previously added registration callback that was added via
     * Removes a previously added registration callback that was added via
     * {@link #addRegistrationCallback(ImsMmTelManager.RegistrationCallback)} .
     * {@link #addRegistrationCallback(RegistrationManager.RegistrationCallback)} .
     * @param callback A {@link ImsMmTelManager.RegistrationCallback} that was previously added.
     * @param callback A {@link RegistrationManager.RegistrationCallback} that was previously added.
     */
     */
    public void removeRegistrationListener(ImsMmTelManager.RegistrationCallback callback) {
    public void removeRegistrationListener(RegistrationManager.RegistrationCallback callback) {
        if (callback == null) {
        if (callback == null) {
            throw new NullPointerException("registration callback can't be null");
            throw new NullPointerException("registration callback can't be null");
        }
        }
@@ -1663,8 +1663,8 @@ public class ImsManager implements IFeatureConnector {
     * Adds a callback that gets called when IMS registration has changed for a specific
     * Adds a callback that gets called when IMS registration has changed for a specific
     * subscription.
     * subscription.
     *
     *
     * @param callback A {@link ImsMmTelManager.RegistrationCallback} that will notify the caller
     * @param callback A {@link RegistrationManager.RegistrationCallback} that will notify the
     *                 when IMS registration status has changed.
     *                 caller when IMS registration status has changed.
     * @param subId The subscription ID to register this registration callback for.
     * @param subId The subscription ID to register this registration callback for.
     * @throws RemoteException when the ImsService connection is not available.
     * @throws RemoteException when the ImsService connection is not available.
     */
     */
@@ -1679,8 +1679,8 @@ public class ImsManager implements IFeatureConnector {
    }
    }


    /**
    /**
     * Removes a previously registered {@link ImsMmTelManager.RegistrationCallback} callback that is
     * Removes a previously registered {@link RegistrationManager.RegistrationCallback} callback
     * associated with a specific subscription.
     * that is associated with a specific subscription.
     */
     */
    public void removeRegistrationCallbackForSubscription(IImsRegistrationCallback callback,
    public void removeRegistrationCallbackForSubscription(IImsRegistrationCallback callback,
            int subId) {
            int subId) {
@@ -1816,11 +1816,23 @@ public class ImsManager implements IFeatureConnector {
        try {
        try {
            return mMmTelFeatureConnection.getRegistrationTech();
            return mMmTelFeatureConnection.getRegistrationTech();
        } catch (RemoteException e) {
        } catch (RemoteException e) {
            Log.w(TAG, "getRegistrationTech: no connection to ImsService.");
            logw("getRegistrationTech: no connection to ImsService.");
            return ImsRegistrationImplBase.REGISTRATION_TECH_NONE;
            return ImsRegistrationImplBase.REGISTRATION_TECH_NONE;
        }
        }
    }
    }


    public void getRegistrationTech(Consumer<Integer> callback) {
        mExecutorFactory.executeRunnable(() -> {
            try {
                int tech = mMmTelFeatureConnection.getRegistrationTech();
                callback.accept(tech);
            } catch (RemoteException e) {
                logw("getRegistrationTech(C): no connection to ImsService.");
                callback.accept(ImsRegistrationImplBase.REGISTRATION_TECH_NONE);
            }
        });
    }

    /**
    /**
     * Closes the connection and removes all active callbacks.
     * Closes the connection and removes all active callbacks.
     * All the resources that were allocated to the service are also released.
     * All the resources that were allocated to the service are also released.
@@ -1986,7 +1998,7 @@ public class ImsManager implements IFeatureConnector {
    public void changeMmTelCapability(CapabilityChangeRequest r) throws ImsException {
    public void changeMmTelCapability(CapabilityChangeRequest r) throws ImsException {
        checkAndThrowExceptionIfServiceUnavailable();
        checkAndThrowExceptionIfServiceUnavailable();
        try {
        try {
            Log.i(TAG, "changeMmTelCapability: changing capabilities for sub: " + getSubId()
            logi("changeMmTelCapability: changing capabilities for sub: " + getSubId()
                    + ", request: " + r);
                    + ", request: " + r);
            mMmTelFeatureConnection.changeEnabledCapabilities(r, null);
            mMmTelFeatureConnection.changeEnabledCapabilities(r, null);
            if (mImsConfigListener == null) {
            if (mImsConfigListener == null) {
@@ -2018,8 +2030,7 @@ public class ImsManager implements IFeatureConnector {
                CarrierConfigManager.KEY_IGNORE_RTT_MODE_SETTING_BOOL);
                CarrierConfigManager.KEY_IGNORE_RTT_MODE_SETTING_BOOL);


        boolean shouldImsRttBeOn = isRttUiSettingEnabled || isRttAlwaysOnCarrierConfig;
        boolean shouldImsRttBeOn = isRttUiSettingEnabled || isRttAlwaysOnCarrierConfig;
        Log.i(ImsManager.class.getSimpleName(), "update RTT: settings value: "
        logi("update RTT: settings value: " + isRttUiSettingEnabled + " always-on carrierconfig: "
                + isRttUiSettingEnabled + " always-on carrierconfig: "
                + isRttAlwaysOnCarrierConfig);
                + isRttAlwaysOnCarrierConfig);


        if (isCarrierSupported) {
        if (isCarrierSupported) {
@@ -2033,12 +2044,11 @@ public class ImsManager implements IFeatureConnector {
                ProvisioningManager.PROVISIONING_VALUE_DISABLED;
                ProvisioningManager.PROVISIONING_VALUE_DISABLED;
        mExecutorFactory.executeRunnable(() -> {
        mExecutorFactory.executeRunnable(() -> {
            try {
            try {
                Log.i(ImsManager.class.getSimpleName(), "Setting RTT enabled to " + enabled);
                logi("Setting RTT enabled to " + enabled);
                getConfigInterface().setProvisionedValue(
                getConfigInterface().setProvisionedValue(
                        ImsConfig.ConfigConstants.RTT_SETTING_ENABLED, value);
                        ImsConfig.ConfigConstants.RTT_SETTING_ENABLED, value);
            } catch (ImsException e) {
            } catch (ImsException e) {
                Log.e(ImsManager.class.getSimpleName(), "Unable to set RTT value enabled to "
                loge("Unable to set RTT value enabled to " + enabled + ": " + e);
                        + enabled + ": " + e);
            }
            }
        });
        });
    }
    }
@@ -2080,7 +2090,7 @@ public class ImsManager implements IFeatureConnector {
        try {
        try {
            return result.poll(RESPONSE_WAIT_TIME_MS, TimeUnit.MILLISECONDS);
            return result.poll(RESPONSE_WAIT_TIME_MS, TimeUnit.MILLISECONDS);
        } catch (InterruptedException e) {
        } catch (InterruptedException e) {
            Log.w(TAG, "queryMmTelCapability: interrupted while waiting for response");
            logw("queryMmTelCapability: interrupted while waiting for response");
        }
        }
        return false;
        return false;
    }
    }
@@ -2094,8 +2104,7 @@ public class ImsManager implements IFeatureConnector {
            }
            }
            setRttConfig(enabled);
            setRttConfig(enabled);
        } catch (ImsException e) {
        } catch (ImsException e) {
            Log.e(ImsManager.class.getSimpleName(), "Unable to set RTT enabled to " + enabled
            loge("Unable to set RTT enabled to " + enabled + ": " + e);
                    + ": " + e);
        }
        }
    }
    }


@@ -2279,23 +2288,31 @@ public class ImsManager implements IFeatureConnector {
            // Throws an exception if the ImsService Feature is not ready to accept commands.
            // Throws an exception if the ImsService Feature is not ready to accept commands.
            return new ImsCallSession(mMmTelFeatureConnection.createCallSession(profile));
            return new ImsCallSession(mMmTelFeatureConnection.createCallSession(profile));
        } catch (RemoteException e) {
        } catch (RemoteException e) {
            Rlog.w(TAG, "CreateCallSession: Error, remote exception: " + e.getMessage());
            logw("CreateCallSession: Error, remote exception: " + e.getMessage());
            throw new ImsException("createCallSession()", e,
            throw new ImsException("createCallSession()", e,
                    ImsReasonInfo.CODE_LOCAL_IMS_SERVICE_DOWN);
                    ImsReasonInfo.CODE_LOCAL_IMS_SERVICE_DOWN);


        }
        }
    }
    }


    private static void log(String s) {
    private void log(String s) {
        Rlog.d(TAG, s);
        Rlog.d(TAG + " [" + mPhoneId + "]", s);
    }

    private void logi(String s) {
        Rlog.i(TAG + " [" + mPhoneId + "]", s);
    }
    
    private void logw(String s) {
        Rlog.w(TAG + " [" + mPhoneId + "]", s);
    }
    }


    private static void loge(String s) {
    private void loge(String s) {
        Rlog.e(TAG, s);
        Rlog.e(TAG + " [" + mPhoneId + "]", s);
    }
    }


    private static void loge(String s, Throwable t) {
    private void loge(String s, Throwable t) {
        Rlog.e(TAG, s, t);
        Rlog.e(TAG + " [" + mPhoneId + "]", s, t);
    }
    }


    /**
    /**
@@ -2344,7 +2361,7 @@ public class ImsManager implements IFeatureConnector {
        try {
        try {
            mMmTelFeatureConnection.changeEnabledCapabilities(request, null);
            mMmTelFeatureConnection.changeEnabledCapabilities(request, null);
        } catch (RemoteException e) {
        } catch (RemoteException e) {
            Log.e(TAG, "setLteFeatureValues: Exception: " + e.getMessage());
            loge("setLteFeatureValues: Exception: " + e.getMessage());
        }
        }
    }
    }


@@ -2529,7 +2546,7 @@ public class ImsManager implements IFeatureConnector {
        if (mgr != null) {
        if (mgr != null) {
            mgr.factoryReset();
            mgr.factoryReset();
        }
        }
        loge("factoryReset: ImsManager null.");
        Rlog.e(TAG, "factoryReset: ImsManager null.");
    }
    }


    /**
    /**