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

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

Fix the resource in the PublishController have not been released.

The resource released process of the PUBLISH was send to the looper for processing.
However, the loop has be destroyed before the released process.

Bug: 185322224
Test: atest ImsServiceTest RcsUceAdapter
Change-Id: I813bc2111a7aee1572d53e15605bad825fbcee0d
parent bf6db2cf
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -406,7 +406,9 @@ public class UceController {
        mPublishController.onDestroy();
        mSubscribeController.onDestroy();
        mOptionsController.onDestroy();
        mLooper.quit();

        // Execute all the existing requests before quitting the looper.
        mLooper.quitSafely();
    }

    /**
+11 −0
Original line number Diff line number Diff line
@@ -20,9 +20,11 @@ import android.annotation.Nullable;
import android.telephony.ims.RcsUceAdapter;
import android.telephony.ims.aidl.IPublishResponseCallback;
import android.telephony.ims.stub.RcsCapabilityExchangeImplBase;
import android.util.Log;

import com.android.ims.rcs.uce.presence.publish.PublishController.PublishControllerCallback;
import com.android.ims.rcs.uce.util.NetworkSipCode;
import com.android.ims.rcs.uce.util.UceUtils;

import java.time.Instant;
import java.util.Optional;
@@ -32,6 +34,8 @@ import java.util.Optional;
 */
public class PublishRequestResponse {

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

    private final long mTaskId;
    private final String mPidfXml;
    private volatile boolean mNeedRetry;
@@ -165,6 +169,8 @@ public class PublishRequestResponse {
        PublishControllerCallback ctrlCallback = mPublishCtrlCallback;
        if (ctrlCallback != null) {
            ctrlCallback.onRequestCommandError(this);
        } else {
            Log.d(LOG_TAG, "onCommandError: already destroyed. error code=" + errorCode);
        }
    }

@@ -177,6 +183,8 @@ public class PublishRequestResponse {
        PublishControllerCallback ctrlCallback = mPublishCtrlCallback;
        if (ctrlCallback != null) {
            ctrlCallback.onRequestNetworkResp(this);
        } else {
            Log.d(LOG_TAG, "onNetworkResponse: already destroyed. sip code=" + sipCode);
        }
    }

@@ -192,6 +200,9 @@ public class PublishRequestResponse {
        PublishControllerCallback ctrlCallback = mPublishCtrlCallback;
        if (ctrlCallback != null) {
            ctrlCallback.onRequestNetworkResp(this);
        } else {
            Log.d(LOG_TAG, "onNetworkResponse: already destroyed. sipCode=" + sipCode +
                    ", reasonHeader=" + reasonHeaderCause);
        }
    }