diff options
author | Brad Ebinger <breadley@google.com> | 2020-05-18 17:47:53 -0700 |
---|---|---|
committer | Brad Ebinger <breadley@google.com> | 2020-05-19 13:22:51 -0700 |
commit | 4800b6c94cbf27f53451410abc86b6d1061254f4 (patch) | |
tree | 72779ae2ca5561cc5dd8d33394ff43a185837d56 /tests/telephonytests | |
parent | 80d12d989a818a36e55b8f11fc2c56d4e5a99b1e (diff) | |
download | telephony-4800b6c94cbf27f53451410abc86b6d1061254f4.tar.gz |
Add the ability to remove FeatureConnection callbacks
FeatureConnection status callbacks were not being cleaned up and
were staying around indefinitely, even after the FeatureConnection
was destroyed.
Bug: 156893040
Test: atest FrameworksTelephonyTests
Change-Id: I28dc51b10dc230bc8f7a03b7373510cf3a29e93a
Diffstat (limited to 'tests/telephonytests')
-rw-r--r-- | tests/telephonytests/src/com/android/internal/telephony/ims/FeatureConnectionTest.java | 33 |
1 files changed, 29 insertions, 4 deletions
diff --git a/tests/telephonytests/src/com/android/internal/telephony/ims/FeatureConnectionTest.java b/tests/telephonytests/src/com/android/internal/telephony/ims/FeatureConnectionTest.java index 267f1f99fb..bac45efdb1 100644 --- a/tests/telephonytests/src/com/android/internal/telephony/ims/FeatureConnectionTest.java +++ b/tests/telephonytests/src/com/android/internal/telephony/ims/FeatureConnectionTest.java @@ -28,7 +28,9 @@ import android.content.Context; import android.content.pm.PackageManager; import android.os.IBinder; import android.os.RemoteException; +import android.telephony.ims.aidl.IImsRegistration; import android.telephony.ims.feature.ImsFeature; +import android.telephony.ims.stub.ImsRegistrationImplBase; import android.test.suitebuilder.annotation.SmallTest; import com.android.ims.FeatureConnection; @@ -59,8 +61,8 @@ public class FeatureConnectionTest extends TelephonyTest { public boolean isFeatureRemovedCalled = false; public int mNewStatus = ImsFeature.STATE_UNAVAILABLE; - TestFeatureConnection(Context context, int slotId, int featureType) { - super(context, slotId, featureType); + TestFeatureConnection(Context context, int slotId) { + super(context, slotId); if (!ImsManager.isImsSupportedOnDevice(context)) { sImsSupportedOnDevice = false; } @@ -91,6 +93,11 @@ public class FeatureConnectionTest extends TelephonyTest { return mFeatureState; } + @Override + protected IImsRegistration getRegistrationBinder() { + return getTestRegistrationBinder(); + } + public void setFeatureState(int state) { mFeatureState = state; } @@ -99,6 +106,7 @@ public class FeatureConnectionTest extends TelephonyTest { private int mPhoneId; private TestFeatureConnection mTestFeatureConnection; @Mock IBinder mBinder; + @Mock IImsRegistration mRegistrationBinder; @Before public void setUp() throws Exception { @@ -108,8 +116,7 @@ public class FeatureConnectionTest extends TelephonyTest { doReturn(null).when(mContext).getMainLooper(); doReturn(true).when(mPackageManager).hasSystemFeature(PackageManager.FEATURE_TELEPHONY_IMS); - mTestFeatureConnection = new TestFeatureConnection( - mContext, mPhoneId, ImsFeature.FEATURE_RCS); + mTestFeatureConnection = new TestFeatureConnection(mContext, mPhoneId); mTestFeatureConnection.mExecutor = mSimpleExecutor; mTestFeatureConnection.setBinder(mBinder); } @@ -164,6 +171,20 @@ public class FeatureConnectionTest extends TelephonyTest { } /** + * Test registration tech callbacks. + */ + @Test + @SmallTest + public void testRegistrationTech() throws Exception { + when(mRegistrationBinder.getRegistrationTechnology()).thenReturn( + ImsRegistrationImplBase.REGISTRATION_TECH_IWLAN); + + assertEquals(ImsRegistrationImplBase.REGISTRATION_TECH_IWLAN, + mTestFeatureConnection.getRegistrationTech()); + + } + + /** * Test callback is called when IMS feature created/removed/changed. */ @Test @@ -192,4 +213,8 @@ public class FeatureConnectionTest extends TelephonyTest { throw new AssertionFailedError("testListenerCallback(Changed): " + e); } } + + private IImsRegistration getTestRegistrationBinder() { + return mRegistrationBinder; + } } |