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

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

Merge changes from topic...

Merge changes from topic "revert-26317647-revert-25956237-simultaneous-calling-tracker-YHCVTCWNNX-LZEWCBLOAY" into main

* changes:
  Resolve infinite getPhoneCapability loop.
  Revert^2 "Add SimultaneousCallingTracker"
parents e4e33e20 bb1f5f2d
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() {
    }

+59 −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,15 @@ public class PhoneConfigurationManager {
        return mStaticCapability.getMaxActiveDataSubscriptions();
    }

    public int getNumberOfModemsWithSimultaneousVoiceConnections() {
        return maybeOverrideMaxActiveVoiceSubscriptions(mStaticCapability)
                .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;
@@ -288,6 +289,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;

@@ -311,6 +314,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;

@@ -1662,6 +1666,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);
@@ -2468,7 +2480,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);
        }
    }

@@ -2476,13 +2488,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);
@@ -2490,7 +2502,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
@@ -2506,6 +2521,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
@@ -2540,13 +2557,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
@@ -2685,6 +2704,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) {
@@ -2735,7 +2759,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.
@@ -2761,6 +2786,7 @@ public class ImsPhone extends ImsPhoneBase {
                mDefaultPhone.mCi.updateImsRegistrationInfo(regState, imsRadioTech, 0,
                        mImsRegistrationCapabilities, null);
                mImsRegistrationTech = imsRadioTech;
                mTransportType = transportType;
                mNotifiedRegisteredState = true;
                return;
            }
@@ -2768,6 +2794,7 @@ public class ImsPhone extends ImsPhoneBase {

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