Ensure create/destroy is called properly for Capability Exchange API

We were mistakenly not calling the destroy API properly for Capability
Exchange API when the listener passed in was null. Instead we were calling
destroy -> create. This was causing us to call destroy -> create
over 4 times when switching SIMs.

Bug: 228278638
Test: manual PUBLISH verification on TMO, atest FrameworksTelephonyTests
Change-Id: If374f8306add45e60f64fa4031af31c8f448bb22
This commit is contained in:
Brad Ebinger
2022-05-10 16:55:16 -07:00
parent ddb4ee4491
commit 7fd1f11059

View File

@@ -118,8 +118,10 @@ public class RcsFeature extends ImsFeature {
@Override
public void setCapabilityExchangeEventListener(
@Nullable ICapabilityExchangeEventListener listener) throws RemoteException {
CapabilityExchangeEventListener listenerWrapper =
new CapabilityExchangeAidlWrapper(listener);
// Set the listener wrapper to null if the listener passed in is null. This will notify
// the RcsFeature to trigger the destruction of active capability exchange interface.
CapabilityExchangeEventListener listenerWrapper = listener != null
? new CapabilityExchangeAidlWrapper(listener) : null;
executeMethodAsync(() -> mReference.setCapabilityExchangeEventListener(listenerWrapper),
"setCapabilityExchangeEventListener");
}