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

Commit b25014d9 authored by James.cf Lin's avatar James.cf Lin
Browse files

[RCS UCE] Send the publish state for the new registrant

The publish state registrant may not receive the callback if the publish state doesn't change.
Send the publish state change to the new registrant.

Bug: 174187744
Test: atest UceControllerTest; atest PublishControllerImplTest
Change-Id: I91273852d4cfe71ada6b38ee3e34bdede66036e0
parent d9a06dec
Loading
Loading
Loading
Loading
+11 −1
Original line number Diff line number Diff line
@@ -140,7 +140,8 @@ public class RcsFeatureConnection extends FeatureConnection {
    public void setCapabilityExchangeEventListener(ICapabilityExchangeEventListener listener)
            throws RemoteException {
        synchronized (mLock) {
            checkServiceIsReady();
            // Only check if service is alive. The feature status may not be READY.
            checkServiceIsAlive();
            getServiceInterface(mBinder).setCapabilityExchangeEventListener(listener);
        }
    }
@@ -153,6 +154,15 @@ public class RcsFeatureConnection extends FeatureConnection {
        }
    }

    private void checkServiceIsAlive() throws RemoteException {
        if (!sImsSupportedOnDevice) {
            throw new RemoteException("IMS is not supported on this device.");
        }
        if (!isBinderAlive()) {
            throw new RemoteException("ImsServiceProxy is not alive.");
        }
    }

    public int queryCapabilityStatus() throws RemoteException {
        synchronized (mLock) {
            checkServiceIsReady();
+1 −2
Original line number Diff line number Diff line
@@ -161,8 +161,7 @@ public class RcsFeatureManager implements FeatureUpdates {

    /**
     * Opens a persistent connection to the RcsFeature. This must be called before the RcsFeature
     * can be used to communicate. Triggers a {@link RcsFeature#onFeatureReady()} call on the
     * service side.
     * can be used to communicate.
     */
    public void openConnection() throws android.telephony.ims.ImsException {
        try {
+3 −4
Original line number Diff line number Diff line
@@ -26,7 +26,6 @@ import android.telephony.ims.RcsContactUceCapability;
import android.telephony.ims.RcsUceAdapter;
import android.telephony.ims.RcsUceAdapter.PublishState;
import android.telephony.ims.RcsUceAdapter.StackPublishTriggerType;
import android.telephony.ims.RcsUceAdapter.PublishStateCallback;
import android.telephony.ims.aidl.ICapabilityExchangeEventListener;
import android.telephony.ims.aidl.IOptionsRequestCallback;
import android.telephony.ims.aidl.IOptionsResponseCallback;
@@ -45,6 +44,7 @@ import com.android.ims.rcs.uce.presence.publish.PublishControllerImpl;
import com.android.ims.rcs.uce.presence.subscribe.SubscribeController;
import com.android.ims.rcs.uce.presence.subscribe.SubscribeControllerImpl;
import com.android.ims.rcs.uce.request.UceRequestManager;
import com.android.ims.rcs.uce.util.UceUtils;
import com.android.internal.annotations.VisibleForTesting;

import java.time.Duration;
@@ -59,7 +59,7 @@ import java.util.List;
 */
public class UceController {

    private static final String LOG_TAG = "UceController";
    private static final String LOG_TAG = UceUtils.getLogPrefix() + "UceController";

    /**
     * The callback interface is called by the internal controllers to receive information from
@@ -579,8 +579,7 @@ public class UceController {
                } else {
                    mAllowedTimestamp = Instant.now().plus(retryAfterMillis, ChronoUnit.MILLIS);
                }
                Log.d(LOG_TAG, "forbidUceRequest: " + mIsForbidden
                        + ", time=" + mAllowedTimestamp);
                Log.d(LOG_TAG, "forbidUceRequest: " + mIsForbidden + ",time=" + mAllowedTimestamp);
            }
        }

+3 −3
Original line number Diff line number Diff line
@@ -18,10 +18,8 @@ package com.android.ims.rcs.uce.presence.publish;

import android.content.Context;
import android.net.Uri;
import android.telecom.PhoneAccount;
import android.telecom.TelecomManager;
import android.telephony.AccessNetworkConstants;
import android.telephony.TelephonyManager;
import android.telephony.ims.RcsContactPresenceTuple;
import android.telephony.ims.RcsContactPresenceTuple.ServiceCapabilities;
import android.telephony.ims.RcsContactUceCapability;
@@ -30,11 +28,13 @@ import android.telephony.ims.feature.MmTelFeature;
import android.telephony.ims.feature.MmTelFeature.MmTelCapabilities;
import android.util.Log;

import com.android.ims.rcs.uce.util.UceUtils;

/**
 * Stores the device's capabilities information.
 */
public class DeviceCapabilityInfo {
    private static final String LOG_TAG = "DeviceCapabilityInfo";
    private static final String LOG_TAG = UceUtils.getLogPrefix() + "DeviceCapabilityInfo";

    private final int mSubId;

+12 −4
Original line number Diff line number Diff line
@@ -40,6 +40,7 @@ import android.telephony.ims.feature.MmTelFeature.MmTelCapabilities;
import android.util.Log;

import com.android.ims.rcs.uce.presence.publish.PublishController.PublishControllerCallback;
import com.android.ims.rcs.uce.util.UceUtils;
import com.android.internal.annotations.VisibleForTesting;
import com.android.internal.telephony.util.HandlerExecutor;

@@ -49,7 +50,11 @@ import com.android.internal.telephony.util.HandlerExecutor;
 */
public class DeviceCapabilityListener {

    private static final String LOG_TAG = "DeviceCapListener";
    private static final String LOG_TAG = UceUtils.getLogPrefix() + "DeviceCapListener";

    // Delay to send the registered changed because the registered state changed of MMTEL and RCS
    // may be called at the same time.
    private static final long DELAY_SEND_IMS_REGISTERED_CHANGED_MSG = 500L;

    /**
     * Used to inject ImsMmTelManager instances for testing.
@@ -477,7 +482,8 @@ public class DeviceCapabilityListener {
    private void handleImsMmtelRegistered(int imsTransportType) {
        mCapabilityInfo.updateImsMmtelRegistered(imsTransportType);
        mCallback.requestPublishFromInternal(
                PublishController.PUBLISH_TRIGGER_MMTEL_REGISTERED, 0L);
                PublishController.PUBLISH_TRIGGER_MMTEL_REGISTERED,
                DELAY_SEND_IMS_REGISTERED_CHANGED_MSG);
    }

    /*
@@ -490,8 +496,8 @@ public class DeviceCapabilityListener {
    }

    private void handleMmtelCapabilitiesStatusChanged(MmTelCapabilities capabilities) {
        logi("MMTel capabilities status changed");
        boolean isChanged = mCapabilityInfo.updateMmtelCapabilitiesChanged(capabilities);
        logi("MMTel capabilities status changed: isChanged=" + isChanged);
        if (isChanged) {
            mCallback.requestPublishFromInternal(
                    PublishController.PUBLISH_TRIGGER_MMTEL_CAPABILITY_CHANGE, 0L);
@@ -503,7 +509,9 @@ public class DeviceCapabilityListener {
     */
    private void handleImsRcsRegistered(int imsTransportType) {
        mCapabilityInfo.updateImsRcsRegistered(imsTransportType);
        mCallback.requestPublishFromInternal(PublishController.PUBLISH_TRIGGER_RCS_REGISTERED, 0L);
        mCallback.requestPublishFromInternal(
                PublishController.PUBLISH_TRIGGER_RCS_REGISTERED,
                DELAY_SEND_IMS_REGISTERED_CHANGED_MSG);
    }

    /*
Loading