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

Commit 3b0272b6 authored by Grant Menke's avatar Grant Menke Committed by Android (Google) Code Review
Browse files

Revert^2 "Add SimultaneousCallingTracker"

bf371a94

Change-Id: Ia0481d9c5d245a77b3670f3d873e931d5701b0bc
parent bf371a94
Loading
Loading
Loading
Loading
+15 −0
Original line number Diff line number Diff line
@@ -17,6 +17,7 @@
package com.android.internal.telephony;

import static android.telephony.TelephonyManager.HAL_SERVICE_RADIO;
import static android.telephony.ims.ImsService.CAPABILITY_SUPPORTS_SIMULTANEOUS_CALLING;

import android.annotation.NonNull;
import android.annotation.Nullable;
@@ -4620,6 +4621,20 @@ public abstract class Phone extends Handler implements PhoneInternalInterface {
        }
    }

    public boolean isImsServiceSimultaneousCallingSupportCapable(Context context) {
        if (!mFeatureFlags.simultaneousCallingIndications()) return false;
        boolean capable = false;
        ImsManager imsManager = ImsManager.getInstance(context, mPhoneId);
        if (imsManager != null) {
            try {
                capable = imsManager.isCapable(CAPABILITY_SUPPORTS_SIMULTANEOUS_CALLING);
            } catch (ImsException e) {
                loge("initializeTerminalBasedCallWaiting : exception " + e);
            }
        }
        return capable;
    }

    public void startRingbackTone() {
    }

+58 −1
Original line number Diff line number Diff line
@@ -49,6 +49,7 @@ import java.util.Map;
import java.util.NoSuchElementException;
import java.util.Optional;
import java.util.Set;
import java.util.concurrent.CopyOnWriteArraySet;
import java.util.function.Consumer;
import java.util.stream.Collectors;

@@ -74,6 +75,25 @@ public class PhoneConfigurationManager {
    private static final int EVENT_GET_SIMULTANEOUS_CALLING_SUPPORT_DONE = 105;
    private static final int EVENT_SIMULTANEOUS_CALLING_SUPPORT_CHANGED = 106;

    /**
     * Listener interface for events related to the {@link PhoneConfigurationManager} which should
     * be reported to the {@link SimultaneousCallingTracker}.
     */
    public interface Listener {
        public void onPhoneCapabilityChanged();
        public void onDeviceConfigChanged();
    }

    /**
     * Base listener implementation.
     */
    public abstract static class ListenerBase implements Listener {
        @Override
        public void onPhoneCapabilityChanged() {}
        @Override
        public void onDeviceConfigChanged() {}
    }


    private static PhoneConfigurationManager sInstance = null;
    private final Context mContext;
@@ -95,6 +115,8 @@ public class PhoneConfigurationManager {
    @NonNull
    private final FeatureFlags mFeatureFlags;
    private final DefaultPhoneNotifier mNotifier;
    public Set<Listener> mListeners = new CopyOnWriteArraySet<>();

    /**
     * True if 'Virtual DSDA' i.e., in-call IMS connectivity on both subs with only single logical
     * modem, is enabled.
@@ -155,6 +177,24 @@ public class PhoneConfigurationManager {
        }
    }

    /**
     * Assign a listener to be notified of state changes.
     *
     * @param listener A listener.
     */
    public void addListener(Listener listener) {
        mListeners.add(listener);
    }

    /**
     * Removes a listener.
     *
     * @param listener A listener.
     */
    public final void removeListener(Listener listener) {
        mListeners.remove(listener);
    }

    /**
     * Updates the mapping between the slot IDs that support simultaneous calling and the
     * associated sub IDs as well as notifies listeners.
@@ -305,6 +345,9 @@ public class PhoneConfigurationManager {
                    if (ar != null && ar.exception == null) {
                        mStaticCapability = (PhoneCapability) ar.result;
                        notifyCapabilityChanged();
                        for (Listener l : mListeners) {
                            l.onPhoneCapabilityChanged();
                        }
                        maybeEnableCellularDSDASupport();
                    } else {
                        log(msg.what + " failure. Not getting phone capability." + ar.exception);
@@ -317,6 +360,9 @@ public class PhoneConfigurationManager {
                        log("EVENT_DEVICE_CONFIG_CHANGED: from " + mVirtualDsdaEnabled + " to "
                                + isVirtualDsdaEnabled);
                        mVirtualDsdaEnabled = isVirtualDsdaEnabled;
                        for (Listener l : mListeners) {
                            l.onDeviceConfigChanged();
                        }
                    }
                    break;
                case EVENT_SIMULTANEOUS_CALLING_SUPPORT_CHANGED:
@@ -463,7 +509,10 @@ public class PhoneConfigurationManager {
        return mTelephonyManager.getActiveModemCount();
    }

    @VisibleForTesting
    /**
     * @return The updated list of logical slots that support simultaneous cellular calling from the
     * modem based on current network conditions.
     */
    public Set<Integer> getSlotsSupportingSimultaneousCellularCalls() {
        return mSlotsSupportingSimultaneousCellularCalls;
    }
@@ -510,6 +559,14 @@ public class PhoneConfigurationManager {
        return mStaticCapability.getMaxActiveDataSubscriptions();
    }

    public int getNumberOfModemsWithSimultaneousVoiceConnections() {
        return getStaticPhoneCapability().getMaxActiveVoiceSubscriptions();
    }

    public boolean isVirtualDsdaEnabled() {
        return mVirtualDsdaEnabled;
    }

    /**
     * Register to listen to changes in the Phone slots that support simultaneous calling.
     * @param consumer A consumer that will be used to consume the new slots supporting simultaneous
+5 −0
Original line number Diff line number Diff line
@@ -98,6 +98,7 @@ public class PhoneFactory {
    @UnsupportedAppUsage
    static private Context sContext;
    static private PhoneConfigurationManager sPhoneConfigurationManager;
    static private SimultaneousCallingTracker sSimultaneousCallingTracker;
    static private PhoneSwitcher sPhoneSwitcher;
    static private TelephonyNetworkFactory[] sTelephonyNetworkFactories;
    static private NotificationChannelController sNotificationChannelController;
@@ -257,6 +258,10 @@ public class PhoneFactory {
                }

                sPhoneConfigurationManager = PhoneConfigurationManager.init(sContext, featureFlags);
                if (featureFlags.simultaneousCallingIndications()) {
                    sSimultaneousCallingTracker =
                            SimultaneousCallingTracker.init(sContext, featureFlags);
                }

                sCellularNetworkValidator = CellularNetworkValidator.make(sContext);

+517 −0

File added.

Preview size limit exceeded, changes collapsed.

+36 −9
Original line number Diff line number Diff line
@@ -16,6 +16,7 @@

package com.android.internal.telephony.imsphone;

import static android.telephony.AccessNetworkConstants.TRANSPORT_TYPE_INVALID;
import static android.telephony.ims.ImsManager.EXTRA_WFC_REGISTRATION_FAILURE_MESSAGE;
import static android.telephony.ims.ImsManager.EXTRA_WFC_REGISTRATION_FAILURE_TITLE;
import static android.telephony.ims.RegistrationManager.REGISTRATION_STATE_NOT_REGISTERED;
@@ -290,6 +291,8 @@ public class ImsPhone extends ImsPhoneBase {

    private final RegistrantList mSilentRedialRegistrants = new RegistrantList();

    private final RegistrantList mImsRegistrationUpdateRegistrants = new RegistrantList();

    private final LocalLog mRegLocalLog = new LocalLog(64);
    private TelephonyMetrics mMetrics;

@@ -313,6 +316,7 @@ public class ImsPhone extends ImsPhoneBase {
    private @RegistrationManager.SuggestedAction int mImsRegistrationSuggestedAction;
    private @ImsRegistrationImplBase.ImsRegistrationTech int mImsDeregistrationTech =
            REGISTRATION_TECH_NONE;
    private @AccessNetworkConstants.TransportType int mTransportType = TRANSPORT_TYPE_INVALID;
    private int mImsRegistrationCapabilities;
    private boolean mNotifiedRegisteredState;

@@ -1664,6 +1668,14 @@ public class ImsPhone extends ImsPhoneBase {
        }
    }

    public void registerForImsRegistrationChanges(Handler h, int what, Object obj) {
        mImsRegistrationUpdateRegistrants.addUnique(h, what, obj);
    }

    public void unregisterForImsRegistrationChanges(Handler h) {
        mImsRegistrationUpdateRegistrants.remove(h);
    }

    @Override
    public void registerForSilentRedial(Handler h, int what, Object obj) {
        mSilentRedialRegistrants.addUnique(h, what, obj);
@@ -2470,7 +2482,7 @@ public class ImsPhone extends ImsPhoneBase {
        int subId = getSubId();
        if (SubscriptionManager.isValidSubscriptionId(subId)) {
            updateImsRegistrationInfo(REGISTRATION_STATE_NOT_REGISTERED,
                    REGISTRATION_TECH_NONE, SUGGESTED_ACTION_NONE);
                    REGISTRATION_TECH_NONE, SUGGESTED_ACTION_NONE, TRANSPORT_TYPE_INVALID);
        }
    }

@@ -2478,13 +2490,13 @@ public class ImsPhone extends ImsPhoneBase {
            ImsRegistrationCallbackHelper.ImsRegistrationUpdate() {
        @Override
        public void handleImsRegistered(@NonNull ImsRegistrationAttributes attributes) {
            int imsRadioTech = attributes.getTransportType();
            int imsTransportType = attributes.getTransportType();
            if (DBG) {
                logd("handleImsRegistered: onImsMmTelConnected imsRadioTech="
                        + AccessNetworkConstants.transportTypeToString(imsRadioTech));
                logd("handleImsRegistered: onImsMmTelConnected imsTransportType="
                        + AccessNetworkConstants.transportTypeToString(imsTransportType));
            }
            mRegLocalLog.log("handleImsRegistered: onImsMmTelConnected imsRadioTech="
                    + AccessNetworkConstants.transportTypeToString(imsRadioTech));
            mRegLocalLog.log("handleImsRegistered: onImsMmTelConnected imsTransportType="
                    + AccessNetworkConstants.transportTypeToString(imsTransportType));
            setServiceState(ServiceState.STATE_IN_SERVICE);
            getDefaultPhone().setImsRegistrationState(true);
            mMetrics.writeOnImsConnectionState(mPhoneId, ImsConnectionState.State.CONNECTED, null);
@@ -2492,7 +2504,10 @@ public class ImsPhone extends ImsPhoneBase {
            mImsNrSaModeHandler.onImsRegistered(
                    attributes.getRegistrationTechnology(), attributes.getFeatureTags());
            updateImsRegistrationInfo(REGISTRATION_STATE_REGISTERED,
                    attributes.getRegistrationTechnology(), SUGGESTED_ACTION_NONE);
                    attributes.getRegistrationTechnology(), SUGGESTED_ACTION_NONE,
                    imsTransportType);
            AsyncResult ar = new AsyncResult(null, null, null);
            mImsRegistrationUpdateRegistrants.notifyRegistrants(ar);
        }

        @Override
@@ -2508,6 +2523,8 @@ public class ImsPhone extends ImsPhoneBase {
            mMetrics.writeOnImsConnectionState(mPhoneId, ImsConnectionState.State.PROGRESSING,
                    null);
            mImsStats.onImsRegistering(imsRadioTech);
            AsyncResult ar = new AsyncResult(null, null, null);
            mImsRegistrationUpdateRegistrants.notifyRegistrants(ar);
        }

        @Override
@@ -2542,13 +2559,15 @@ public class ImsPhone extends ImsPhoneBase {
                }
            }
            updateImsRegistrationInfo(REGISTRATION_STATE_NOT_REGISTERED,
                    imsRadioTech, suggestedModemAction);
                    imsRadioTech, suggestedModemAction, TRANSPORT_TYPE_INVALID);

            if (mFeatureFlags.clearCachedImsPhoneNumberWhenDeviceLostImsRegistration()) {
                // Clear the phone number from P-Associated-Uri
                setCurrentSubscriberUris(null);
                clearPhoneNumberForSourceIms();
            }
            AsyncResult ar = new AsyncResult(null, null, null);
            mImsRegistrationUpdateRegistrants.notifyRegistrants(ar);
        }

        @Override
@@ -2688,6 +2707,11 @@ public class ImsPhone extends ImsPhoneBase {
        return mImsStats;
    }

    /** Returns the {@link AccessNetworkConstants.TransportType} used to register this IMS phone. */
    public @AccessNetworkConstants.TransportType int getTransportType() {
        return mTransportType;
    }

    /** Sets the {@link ImsStats} mock for this IMS phone during unit testing. */
    @VisibleForTesting
    public void setImsStats(ImsStats imsStats) {
@@ -2738,7 +2762,8 @@ public class ImsPhone extends ImsPhoneBase {
    private void updateImsRegistrationInfo(
            @RegistrationManager.ImsRegistrationState int regState,
            @ImsRegistrationImplBase.ImsRegistrationTech int imsRadioTech,
            @RegistrationManager.SuggestedAction int suggestedAction) {
            @RegistrationManager.SuggestedAction int suggestedAction,
            @AccessNetworkConstants.TransportType int transportType) {

        if (regState == mImsRegistrationState) {
            // In NOT_REGISTERED state, the current PLMN can be blocked with a suggested action.
@@ -2764,6 +2789,7 @@ public class ImsPhone extends ImsPhoneBase {
                mDefaultPhone.mCi.updateImsRegistrationInfo(regState, imsRadioTech, 0,
                        mImsRegistrationCapabilities, null);
                mImsRegistrationTech = imsRadioTech;
                mTransportType = transportType;
                mNotifiedRegisteredState = true;
                return;
            }
@@ -2771,6 +2797,7 @@ public class ImsPhone extends ImsPhoneBase {

        mImsRegistrationState = regState;
        mImsRegistrationTech = imsRadioTech;
        mTransportType = transportType;
        mImsRegistrationSuggestedAction = suggestedAction;
        if (regState == REGISTRATION_STATE_NOT_REGISTERED) {
            mImsDeregistrationTech = imsRadioTech;
Loading