Merge "Fix Possible Deadlock with getFeatureState"
This commit is contained in:
@ -341,15 +341,15 @@ public abstract class ImsFeature {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** @hide */
|
||||||
|
protected Context mContext;
|
||||||
|
/** @hide */
|
||||||
|
protected final Object mLock = new Object();
|
||||||
|
|
||||||
private final Set<IImsFeatureStatusCallback> mStatusCallbacks = Collections.newSetFromMap(
|
private final Set<IImsFeatureStatusCallback> mStatusCallbacks = Collections.newSetFromMap(
|
||||||
new WeakHashMap<IImsFeatureStatusCallback, Boolean>());
|
new WeakHashMap<IImsFeatureStatusCallback, Boolean>());
|
||||||
private @ImsState int mState = STATE_UNAVAILABLE;
|
private @ImsState int mState = STATE_UNAVAILABLE;
|
||||||
private int mSlotId = SubscriptionManager.INVALID_SIM_SLOT_INDEX;
|
private int mSlotId = SubscriptionManager.INVALID_SIM_SLOT_INDEX;
|
||||||
/**
|
|
||||||
* @hide
|
|
||||||
*/
|
|
||||||
protected Context mContext;
|
|
||||||
private final Object mLock = new Object();
|
|
||||||
private final RemoteCallbackList<IImsCapabilityCallback> mCapabilityCallbacks
|
private final RemoteCallbackList<IImsCapabilityCallback> mCapabilityCallbacks
|
||||||
= new RemoteCallbackList<>();
|
= new RemoteCallbackList<>();
|
||||||
private Capabilities mCapabilityStatus = new Capabilities();
|
private Capabilities mCapabilityStatus = new Capabilities();
|
||||||
|
@ -22,25 +22,25 @@ import android.os.Bundle;
|
|||||||
import android.os.Message;
|
import android.os.Message;
|
||||||
import android.os.RemoteException;
|
import android.os.RemoteException;
|
||||||
import android.telecom.TelecomManager;
|
import android.telecom.TelecomManager;
|
||||||
import android.telephony.ims.stub.ImsRegistrationImplBase;
|
import android.telephony.ims.ImsCallProfile;
|
||||||
import android.telephony.ims.stub.ImsCallSessionImplBase;
|
import android.telephony.ims.ImsCallSession;
|
||||||
import android.telephony.ims.stub.ImsSmsImplBase;
|
import android.telephony.ims.ImsReasonInfo;
|
||||||
import android.telephony.ims.aidl.IImsCapabilityCallback;
|
import android.telephony.ims.aidl.IImsCapabilityCallback;
|
||||||
import android.telephony.ims.aidl.IImsMmTelFeature;
|
import android.telephony.ims.aidl.IImsMmTelFeature;
|
||||||
import android.telephony.ims.aidl.IImsMmTelListener;
|
import android.telephony.ims.aidl.IImsMmTelListener;
|
||||||
import android.telephony.ims.aidl.IImsSmsListener;
|
import android.telephony.ims.aidl.IImsSmsListener;
|
||||||
|
import android.telephony.ims.stub.ImsCallSessionImplBase;
|
||||||
import android.telephony.ims.stub.ImsEcbmImplBase;
|
import android.telephony.ims.stub.ImsEcbmImplBase;
|
||||||
import android.telephony.ims.stub.ImsMultiEndpointImplBase;
|
import android.telephony.ims.stub.ImsMultiEndpointImplBase;
|
||||||
|
import android.telephony.ims.stub.ImsRegistrationImplBase;
|
||||||
|
import android.telephony.ims.stub.ImsSmsImplBase;
|
||||||
import android.telephony.ims.stub.ImsUtImplBase;
|
import android.telephony.ims.stub.ImsUtImplBase;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
|
|
||||||
import android.telephony.ims.ImsCallProfile;
|
|
||||||
import android.telephony.ims.ImsReasonInfo;
|
|
||||||
import com.android.ims.internal.IImsCallSession;
|
import com.android.ims.internal.IImsCallSession;
|
||||||
import com.android.ims.internal.IImsEcbm;
|
import com.android.ims.internal.IImsEcbm;
|
||||||
import com.android.ims.internal.IImsMultiEndpoint;
|
import com.android.ims.internal.IImsMultiEndpoint;
|
||||||
import com.android.ims.internal.IImsUt;
|
import com.android.ims.internal.IImsUt;
|
||||||
import android.telephony.ims.ImsCallSession;
|
|
||||||
import com.android.internal.annotations.VisibleForTesting;
|
import com.android.internal.annotations.VisibleForTesting;
|
||||||
|
|
||||||
import java.lang.annotation.Retention;
|
import java.lang.annotation.Retention;
|
||||||
@ -61,20 +61,16 @@ public class MmTelFeature extends ImsFeature {
|
|||||||
private final IImsMmTelFeature mImsMMTelBinder = new IImsMmTelFeature.Stub() {
|
private final IImsMmTelFeature mImsMMTelBinder = new IImsMmTelFeature.Stub() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setListener(IImsMmTelListener l) throws RemoteException {
|
public void setListener(IImsMmTelListener l) {
|
||||||
synchronized (mLock) {
|
MmTelFeature.this.setListener(l);
|
||||||
MmTelFeature.this.setListener(l);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getFeatureState() throws RemoteException {
|
public int getFeatureState() throws RemoteException {
|
||||||
synchronized (mLock) {
|
try {
|
||||||
try {
|
return MmTelFeature.this.getFeatureState();
|
||||||
return MmTelFeature.this.getFeatureState();
|
} catch (Exception e) {
|
||||||
} catch (Exception e) {
|
throw new RemoteException(e.getMessage());
|
||||||
throw new RemoteException(e.getMessage());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -138,10 +134,8 @@ public class MmTelFeature extends ImsFeature {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int queryCapabilityStatus() throws RemoteException {
|
public int queryCapabilityStatus() {
|
||||||
synchronized (mLock) {
|
return MmTelFeature.this.queryCapabilityStatus().mCapabilities;
|
||||||
return MmTelFeature.this.queryCapabilityStatus().mCapabilities;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -158,7 +152,7 @@ public class MmTelFeature extends ImsFeature {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void changeCapabilitiesConfiguration(CapabilityChangeRequest request,
|
public void changeCapabilitiesConfiguration(CapabilityChangeRequest request,
|
||||||
IImsCapabilityCallback c) throws RemoteException {
|
IImsCapabilityCallback c) {
|
||||||
synchronized (mLock) {
|
synchronized (mLock) {
|
||||||
MmTelFeature.this.requestChangeEnabledCapabilities(request, c);
|
MmTelFeature.this.requestChangeEnabledCapabilities(request, c);
|
||||||
}
|
}
|
||||||
@ -173,10 +167,8 @@ public class MmTelFeature extends ImsFeature {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setSmsListener(IImsSmsListener l) throws RemoteException {
|
public void setSmsListener(IImsSmsListener l) {
|
||||||
synchronized (mLock) {
|
MmTelFeature.this.setSmsListener(l);
|
||||||
MmTelFeature.this.setSmsListener(l);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -364,9 +356,6 @@ public class MmTelFeature extends ImsFeature {
|
|||||||
@Retention(RetentionPolicy.SOURCE)
|
@Retention(RetentionPolicy.SOURCE)
|
||||||
public @interface ProcessCallResult {}
|
public @interface ProcessCallResult {}
|
||||||
|
|
||||||
|
|
||||||
// Lock for feature synchronization
|
|
||||||
private final Object mLock = new Object();
|
|
||||||
private IImsMmTelListener mListener;
|
private IImsMmTelListener mListener;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -376,9 +365,9 @@ public class MmTelFeature extends ImsFeature {
|
|||||||
private void setListener(IImsMmTelListener listener) {
|
private void setListener(IImsMmTelListener listener) {
|
||||||
synchronized (mLock) {
|
synchronized (mLock) {
|
||||||
mListener = listener;
|
mListener = listener;
|
||||||
}
|
if (mListener != null) {
|
||||||
if (mListener != null) {
|
onFeatureReady();
|
||||||
onFeatureReady();
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user