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

Commit e9a8f9ff authored by Brad Ebinger's avatar Brad Ebinger
Browse files

When the associated subId indication comes in, do not destroy UCE

When the associated subid indication comes in for the same subId,
this means that the carrier configuration may have changed. Do not
tear down and bring down the enture UCE stack for this indication,
instead, handle the carrier config changed indication properly and
notify all controllers of the change.

Bug: 181258463
Test: atest ImsCommonTests
Merged-In: If6233e59b49ca305d0720c18d0c25ae9e1494c5f
Change-Id: If6233e59b49ca305d0720c18d0c25ae9e1494c5f
parent 685a2fce
Loading
Loading
Loading
Loading
+13 −14
Original line number Diff line number Diff line
@@ -206,12 +206,12 @@ public class RcsFeatureManager implements FeatureUpdates {
    /**
     * Update the capabilities for this RcsFeature.
     */
    public void updateCapabilities() throws android.telephony.ims.ImsException {
        boolean optionsSupport = isOptionsSupported();
        boolean presenceSupported = isPresenceSupported();
    public void updateCapabilities(int newSubId) throws android.telephony.ims.ImsException {
        boolean optionsSupport = isOptionsSupported(newSubId);
        boolean presenceSupported = isPresenceSupported(newSubId);

        logi("Update capabilities for slot " + mSlotId + ": options=" + optionsSupport
                + ", presence=" + presenceSupported);
        logi("Update capabilities for slot " + mSlotId + " and sub " + newSubId + ": options="
                + optionsSupport+ ", presence=" + presenceSupported);

        if (optionsSupport || presenceSupported) {
            CapabilityChangeRequest request = new CapabilityChangeRequest();
@@ -458,36 +458,35 @@ public class RcsFeatureManager implements FeatureUpdates {
        }
    }

    private boolean isOptionsSupported() {
        return isCapabilityTypeSupported(mContext, mSlotId, CAPABILITY_OPTIONS);
    private boolean isOptionsSupported(int subId) {
        return isCapabilityTypeSupported(mContext, subId, CAPABILITY_OPTIONS);
    }

    private boolean isPresenceSupported() {
        return isCapabilityTypeSupported(mContext, mSlotId, CAPABILITY_PRESENCE);
    private boolean isPresenceSupported(int subId) {
        return isCapabilityTypeSupported(mContext, subId, CAPABILITY_PRESENCE);
    }

    /*
     * Check if the given type of capability is supported.
     */
    private static boolean isCapabilityTypeSupported(
        Context context, int slotId, int capabilityType) {
        Context context, int subId, int capabilityType) {

        int subId = sSubscriptionManagerProxy.getSubId(slotId);
        if (subId == SubscriptionManager.INVALID_SUBSCRIPTION_ID) {
            Log.e(TAG, "isCapabilityTypeSupported: Getting subIds is failure! slotId=" + slotId);
            Log.e(TAG, "isCapabilityTypeSupported: Invalid subId=" + subId);
            return false;
        }

        CarrierConfigManager configManager =
            (CarrierConfigManager) context.getSystemService(Context.CARRIER_CONFIG_SERVICE);
        if (configManager == null) {
            Log.e(TAG, "isCapabilityTypeSupported: CarrierConfigManager is null, " + slotId);
            Log.e(TAG, "isCapabilityTypeSupported: CarrierConfigManager is null, " + subId);
            return false;
        }

        PersistableBundle b = configManager.getConfigForSubId(subId);
        if (b == null) {
            Log.e(TAG, "isCapabilityTypeSupported: PersistableBundle is null, " + slotId);
            Log.e(TAG, "isCapabilityTypeSupported: PersistableBundle is null, " + subId);
            return false;
        }

+5 −0
Original line number Diff line number Diff line
@@ -36,4 +36,9 @@ public interface ControllerBase {
     * Notify to destroy this instance. The UceController instance is unusable after destroyed.
     */
    void onDestroy();

    /**
     * Notify the controller that the Carrier Config has changed.
     */
    void onCarrierConfigChanged();
}
+10 −0
Original line number Diff line number Diff line
@@ -301,6 +301,16 @@ public class UceController {
        mLooper.quit();
    }

    /**
     * Notify all associated classes that the carrier configuration has changed for the subId.
     */
    public void onCarrierConfigChanged() {
        mEabController.onCarrierConfigChanged();
        mPublishController.onCarrierConfigChanged();
        mSubscribeController.onCarrierConfigChanged();
        mOptionsController.onCarrierConfigChanged();
    }

    /*
     * The implementation of the interface UceControllerCallback. These methods are called by other
     * controllers.
+7 −0
Original line number Diff line number Diff line
@@ -113,6 +113,13 @@ public class EabControllerImpl implements EabController {
        mEabBulkCapabilityUpdater.onDestroy();
    }

    @Override
    public void onCarrierConfigChanged() {
        // Pick up changes to CarrierConfig and run any applicable cleanup tasks associated with
        // that configuration.
        mCapabilityCleanupRunnable.run();
    }

    /**
     * Set the callback for sending the request to UceController.
     */
+5 −0
Original line number Diff line number Diff line
@@ -62,6 +62,11 @@ public class OptionsControllerImpl implements OptionsController {
        mRcsFeatureManager = null;
    }

    @Override
    public void onCarrierConfigChanged() {
        // Nothing required here.
    }

    @Override
    public void sendCapabilitiesRequest(Uri contactUri, @NonNull List<String> deviceFeatureTags,
            IOptionsResponseCallback c) throws RemoteException {
Loading