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

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

Fix the subscribe request with the result sip code "404" doesn't map to...

Fix the subscribe request with the result sip code "404" doesn't map to RcsContactUceCapability with request result = REQUEST_RESULT_NOT_FOUND

1) Map the sip code 404 not found to the RcsContactUceCapability with request result REQUEST_RESULT_NOT_FOUND

2) Remove the CapabilityRequestResponse#copy because all the request are run in the looper and the CapabilityRequestResponse is protected by the synchronized

Bug: 181266556
Test: atest -c CtsTelephonyTestCases:android.telephony.ims.cts.RcsUceAdapterTest
Change-Id: Iabe76e17885f75355db427b965fe53047a1c4a56
parent 1d20e8b8
Loading
Loading
Loading
Loading
+11 −0
Original line number Diff line number Diff line
@@ -298,4 +298,15 @@ public class PidfParserUtils {
                        contact, RcsContactUceCapability.SOURCE_TYPE_NETWORK, requestResult);
        return builder.build();
    }

    /**
     * Get the RcsContactUceCapability instance which the request result is NOT FOUND.
     */
    public static RcsContactUceCapability getNotFoundContactCapabilities(Uri contact) {
        RcsContactUceCapability.PresenceBuilder builder =
                new RcsContactUceCapability.PresenceBuilder(contact,
                        RcsContactUceCapability.SOURCE_TYPE_NETWORK,
                        RcsContactUceCapability.REQUEST_RESULT_NOT_FOUND);
        return builder.build();
    }
}
+2 −2
Original line number Diff line number Diff line
@@ -118,10 +118,10 @@ public abstract class CapabilityRequest implements UceRequest {
    }

    /**
     * @return A copy of the RequestResponse instance associated with this request.
     * @return The RequestResponse instance associated with this request.
     */
    public CapabilityRequestResponse getRequestResponse() {
        return mRequestResponse.copy();
        return mRequestResponse;
    }

    /**
+3 −20
Original line number Diff line number Diff line
@@ -261,26 +261,6 @@ public class CapabilityRequestResponse {
        return Collections.unmodifiableSet(mRemoteCaps);
    }

    /**
     * Get a copy of the this instance.
     */
    public synchronized CapabilityRequestResponse copy() {
        CapabilityRequestResponse response = new CapabilityRequestResponse();
        response.mRequestInternalError = mRequestInternalError;
        response.mCommandError = mCommandError;
        response.mNetworkRespSipCode = mNetworkRespSipCode;
        response.mReasonPhrase = mReasonPhrase;
        response.mReasonHeaderCause = mReasonHeaderCause;
        response.mReasonHeaderText = mReasonHeaderText;
        response.mTerminatedReason = mTerminatedReason;
        response.mRetryAfterMillis = mRetryAfterMillis;
        response.mTerminatedResource.addAll(mTerminatedResource);
        response.mCachedCapabilityList.addAll(mCachedCapabilityList);
        response.mUpdatedCapabilityList.addAll(mUpdatedCapabilityList);
        response.mRemoteCaps.addAll(mRemoteCaps);
        return response;
    }

    /**
     * Check if the network response is success.
     * @return true if the network response code is OK or Accepted and the Reason header cause
@@ -395,6 +375,9 @@ public class CapabilityRequestResponse {
                    uceError = RcsUceAdapter.ERROR_FORBIDDEN;
                }
                break;
            case NetworkSipCode.SIP_CODE_NOT_FOUND:              // 404
                uceError = RcsUceAdapter.ERROR_NOT_FOUND;
                break;
            case NetworkSipCode.SIP_CODE_REQUEST_TIMEOUT:        // 408
                uceError = RcsUceAdapter.ERROR_REQUEST_TIMEOUT;
                break;
+1 −1
Original line number Diff line number Diff line
@@ -260,7 +260,7 @@ public class SubscribeRequestCoordinator extends UceRequestCoordinator {
        if (response.isNotFound()) {
            List<Uri> uriList = request.getContactUri();
            List<RcsContactUceCapability> capabilityList = uriList.stream().map(uri ->
                    PidfParserUtils.getTerminatedCapability(uri, null))
                    PidfParserUtils.getNotFoundContactCapabilities(uri))
                    .collect(Collectors.toList());
            response.addUpdatedCapabilities(capabilityList);
        }