Loading src/com/android/server/telecom/callfiltering/CallScreeningServiceFilter.java +6 −1 Original line number Diff line number Diff line Loading @@ -289,7 +289,12 @@ public class CallScreeningServiceFilter extends CallFilter { public void unbindCallScreeningService() { if (mConnection != null) { try { mContext.unbindService(mConnection); } catch (IllegalArgumentException e) { Log.i(this, "Exception when unbind service %s : %s", mConnection, e.getMessage()); } } mConnection = null; } Loading tests/src/com/android/server/telecom/tests/CallScreeningServiceFilterTest.java +14 −0 Original line number Diff line number Diff line Loading @@ -23,6 +23,7 @@ import static org.mockito.ArgumentMatchers.anyString; import static org.mockito.ArgumentMatchers.eq; import static org.mockito.ArgumentMatchers.nullable; import static org.mockito.Mockito.doReturn; import static org.mockito.Mockito.doThrow; import static org.mockito.Mockito.timeout; import static org.mockito.Mockito.verify; import static org.mockito.Mockito.when; Loading Loading @@ -209,6 +210,19 @@ public class CallScreeningServiceFilterTest extends TelecomTestCase { connection.onServiceDisconnected(COMPONENT_NAME); } @SmallTest @Test public void testUnbindingException() { // Make sure that exceptions when unbinding won't make the device crash. doThrow(new IllegalArgumentException()).when(mContext) .unbindService(nullable(ServiceConnection.class)); CallScreeningServiceFilter filter = new CallScreeningServiceFilter(mCall, PKG_NAME, CallScreeningServiceFilter.PACKAGE_TYPE_CARRIER, mContext, mCallsManager, mAppLabelProxy, mParcelableCallUtilsConverter); filter.startFilterLookup(inputResult); filter.unbindCallScreeningService(); } @SmallTest @Test public void testAllowCall() throws Exception { Loading Loading
src/com/android/server/telecom/callfiltering/CallScreeningServiceFilter.java +6 −1 Original line number Diff line number Diff line Loading @@ -289,7 +289,12 @@ public class CallScreeningServiceFilter extends CallFilter { public void unbindCallScreeningService() { if (mConnection != null) { try { mContext.unbindService(mConnection); } catch (IllegalArgumentException e) { Log.i(this, "Exception when unbind service %s : %s", mConnection, e.getMessage()); } } mConnection = null; } Loading
tests/src/com/android/server/telecom/tests/CallScreeningServiceFilterTest.java +14 −0 Original line number Diff line number Diff line Loading @@ -23,6 +23,7 @@ import static org.mockito.ArgumentMatchers.anyString; import static org.mockito.ArgumentMatchers.eq; import static org.mockito.ArgumentMatchers.nullable; import static org.mockito.Mockito.doReturn; import static org.mockito.Mockito.doThrow; import static org.mockito.Mockito.timeout; import static org.mockito.Mockito.verify; import static org.mockito.Mockito.when; Loading Loading @@ -209,6 +210,19 @@ public class CallScreeningServiceFilterTest extends TelecomTestCase { connection.onServiceDisconnected(COMPONENT_NAME); } @SmallTest @Test public void testUnbindingException() { // Make sure that exceptions when unbinding won't make the device crash. doThrow(new IllegalArgumentException()).when(mContext) .unbindService(nullable(ServiceConnection.class)); CallScreeningServiceFilter filter = new CallScreeningServiceFilter(mCall, PKG_NAME, CallScreeningServiceFilter.PACKAGE_TYPE_CARRIER, mContext, mCallsManager, mAppLabelProxy, mParcelableCallUtilsConverter); filter.startFilterLookup(inputResult); filter.unbindCallScreeningService(); } @SmallTest @Test public void testAllowCall() throws Exception { Loading