Loading src/com/android/server/telecom/InCallController.java +2 −1 Original line number Diff line number Diff line Loading @@ -322,7 +322,8 @@ public class InCallController extends CallsManagerListenerBase implements mInCallServiceInfo.setBindingStartTime(mClockProxy.elapsedRealtime()); if (!mContext.bindServiceAsUser(intent, mServiceConnection, Context.BIND_AUTO_CREATE | Context.BIND_FOREGROUND_SERVICE | Context.BIND_ALLOW_BACKGROUND_ACTIVITY_STARTS, | Context.BIND_ALLOW_BACKGROUND_ACTIVITY_STARTS | Context.BIND_SCHEDULE_LIKE_TOP_APP, UserHandle.CURRENT)) { Log.w(this, "Failed to connect."); mIsConnected = false; Loading tests/src/com/android/server/telecom/tests/InCallControllerTests.java +29 −50 Original line number Diff line number Diff line Loading @@ -181,6 +181,10 @@ public class InCallControllerTests extends TelecomTestCase { private SystemStateHelper.SystemStateListener mSystemStateListener; private CarModeTracker mCarModeTracker = spy(new CarModeTracker()); private final int serviceBindingFlags = Context.BIND_AUTO_CREATE | Context.BIND_FOREGROUND_SERVICE | Context.BIND_ALLOW_BACKGROUND_ACTIVITY_STARTS | Context.BIND_SCHEDULE_LIKE_TOP_APP; @Override @Before public void setUp() throws Exception { Loading Loading @@ -354,8 +358,7 @@ public class InCallControllerTests extends TelecomTestCase { verify(mMockContext).bindServiceAsUser( bindIntentCaptor.capture(), any(ServiceConnection.class), eq(Context.BIND_AUTO_CREATE | Context.BIND_FOREGROUND_SERVICE | Context.BIND_ALLOW_BACKGROUND_ACTIVITY_STARTS), eq(serviceBindingFlags), eq(UserHandle.CURRENT)); Intent bindIntent = bindIntentCaptor.getValue(); Loading Loading @@ -389,8 +392,7 @@ public class InCallControllerTests extends TelecomTestCase { verify(mMockContext).bindServiceAsUser( bindIntentCaptor.capture(), any(ServiceConnection.class), eq(Context.BIND_AUTO_CREATE | Context.BIND_FOREGROUND_SERVICE | Context.BIND_ALLOW_BACKGROUND_ACTIVITY_STARTS), eq(serviceBindingFlags), eq(UserHandle.CURRENT)); Intent bindIntent = bindIntentCaptor.getValue(); Loading Loading @@ -442,8 +444,7 @@ public class InCallControllerTests extends TelecomTestCase { verify(mMockContext, times(1)).bindServiceAsUser( bindIntentCaptor.capture(), any(ServiceConnection.class), eq(Context.BIND_AUTO_CREATE | Context.BIND_FOREGROUND_SERVICE | Context.BIND_ALLOW_BACKGROUND_ACTIVITY_STARTS), eq(serviceBindingFlags), eq(UserHandle.CURRENT)); Intent bindIntent = bindIntentCaptor.getValue(); Loading Loading @@ -473,8 +474,7 @@ public class InCallControllerTests extends TelecomTestCase { when(mDefaultDialerCache.getDefaultDialerApplication(CURRENT_USER_ID)) .thenReturn(DEF_PKG); when(mMockContext.bindServiceAsUser(any(Intent.class), any(ServiceConnection.class), eq(Context.BIND_AUTO_CREATE | Context.BIND_FOREGROUND_SERVICE | Context.BIND_ALLOW_BACKGROUND_ACTIVITY_STARTS), eq(serviceBindingFlags), eq(UserHandle.CURRENT))).thenReturn(true); when(mTimeoutsAdapter.getEmergencyCallbackWindowMillis(any(ContentResolver.class))) .thenReturn(300_000L); Loading Loading @@ -502,8 +502,7 @@ public class InCallControllerTests extends TelecomTestCase { verify(mMockContext, times(1)).bindServiceAsUser( bindIntentCaptor.capture(), any(ServiceConnection.class), eq(Context.BIND_AUTO_CREATE | Context.BIND_FOREGROUND_SERVICE | Context.BIND_ALLOW_BACKGROUND_ACTIVITY_STARTS), eq(serviceBindingFlags), eq(UserHandle.CURRENT)); Intent bindIntent = bindIntentCaptor.getValue(); Loading Loading @@ -552,8 +551,7 @@ public class InCallControllerTests extends TelecomTestCase { ArgumentCaptor<ServiceConnection> serviceConnectionCaptor = ArgumentCaptor.forClass(ServiceConnection.class); when(mMockContext.bindServiceAsUser(any(Intent.class), serviceConnectionCaptor.capture(), eq(Context.BIND_AUTO_CREATE | Context.BIND_FOREGROUND_SERVICE | Context.BIND_ALLOW_BACKGROUND_ACTIVITY_STARTS), eq(serviceBindingFlags), eq(UserHandle.CURRENT))).thenReturn(true); when(mTimeoutsAdapter.getEmergencyCallbackWindowMillis(any(ContentResolver.class))) .thenReturn(300_000L); Loading Loading @@ -581,8 +579,7 @@ public class InCallControllerTests extends TelecomTestCase { verify(mMockContext, times(1)).bindServiceAsUser( bindIntentCaptor.capture(), any(ServiceConnection.class), eq(Context.BIND_AUTO_CREATE | Context.BIND_FOREGROUND_SERVICE | Context.BIND_ALLOW_BACKGROUND_ACTIVITY_STARTS), eq(serviceBindingFlags), eq(UserHandle.CURRENT)); Intent bindIntent = bindIntentCaptor.getValue(); Loading Loading @@ -611,8 +608,7 @@ public class InCallControllerTests extends TelecomTestCase { verify(mMockContext, times(2)).bindServiceAsUser( bindIntentCaptor.capture(), any(ServiceConnection.class), eq(Context.BIND_AUTO_CREATE | Context.BIND_FOREGROUND_SERVICE | Context.BIND_ALLOW_BACKGROUND_ACTIVITY_STARTS), eq(serviceBindingFlags), eq(UserHandle.CURRENT)); // Verify we were re-granted the runtime permission. Loading Loading @@ -666,8 +662,7 @@ public class InCallControllerTests extends TelecomTestCase { verify(mMockContext, times(1)).bindServiceAsUser( bindIntentCaptor.capture(), serviceConnectionCaptor.capture(), eq(Context.BIND_AUTO_CREATE | Context.BIND_FOREGROUND_SERVICE | Context.BIND_ALLOW_BACKGROUND_ACTIVITY_STARTS), eq(serviceBindingFlags), eq(UserHandle.CURRENT)); Intent bindIntent = bindIntentCaptor.getValue(); Loading Loading @@ -699,8 +694,7 @@ public class InCallControllerTests extends TelecomTestCase { verify(mMockContext, times(2)).bindServiceAsUser( bindIntentCaptor2.capture(), any(ServiceConnection.class), eq(Context.BIND_AUTO_CREATE | Context.BIND_FOREGROUND_SERVICE | Context.BIND_ALLOW_BACKGROUND_ACTIVITY_STARTS), eq(serviceBindingFlags), eq(UserHandle.CURRENT)); bindIntent = bindIntentCaptor2.getValue(); Loading Loading @@ -756,8 +750,7 @@ public class InCallControllerTests extends TelecomTestCase { verify(mMockContext, times(2)).bindServiceAsUser( bindIntentCaptor2.capture(), any(ServiceConnection.class), eq(Context.BIND_AUTO_CREATE | Context.BIND_FOREGROUND_SERVICE | Context.BIND_ALLOW_BACKGROUND_ACTIVITY_STARTS), eq(serviceBindingFlags), eq(UserHandle.CURRENT)); assertEquals(sysDialerComponentName, bindIntentCaptor2.getValue().getComponent()); } Loading Loading @@ -791,8 +784,7 @@ public class InCallControllerTests extends TelecomTestCase { verify(mMockContext, times(1)).bindServiceAsUser( bindIntentCaptor.capture(), any(ServiceConnection.class), eq(Context.BIND_AUTO_CREATE | Context.BIND_FOREGROUND_SERVICE | Context.BIND_ALLOW_BACKGROUND_ACTIVITY_STARTS), eq(serviceBindingFlags), eq(UserHandle.CURRENT)); Intent bindIntent = bindIntentCaptor.getValue(); Loading Loading @@ -830,8 +822,7 @@ public class InCallControllerTests extends TelecomTestCase { verify(mMockContext, times(1)).bindServiceAsUser( bindIntentCaptor.capture(), serviceConnectionCaptor.capture(), eq(Context.BIND_AUTO_CREATE | Context.BIND_FOREGROUND_SERVICE | Context.BIND_ALLOW_BACKGROUND_ACTIVITY_STARTS), eq(serviceBindingFlags), eq(UserHandle.CURRENT)); // Pretend that the call has gone away. Loading Loading @@ -879,8 +870,7 @@ public class InCallControllerTests extends TelecomTestCase { verify(mMockContext, times(1)).bindServiceAsUser( bindIntentCaptor.capture(), any(ServiceConnection.class), eq(Context.BIND_AUTO_CREATE | Context.BIND_FOREGROUND_SERVICE | Context.BIND_ALLOW_BACKGROUND_ACTIVITY_STARTS), eq(serviceBindingFlags), eq(UserHandle.CURRENT)); // Verify bind car mode ui assertEquals(1, bindIntentCaptor.getAllValues().size()); Loading Loading @@ -908,8 +898,7 @@ public class InCallControllerTests extends TelecomTestCase { verify(mMockContext, times(1)).bindServiceAsUser( bindIntentCaptor.capture(), any(ServiceConnection.class), eq(Context.BIND_AUTO_CREATE | Context.BIND_FOREGROUND_SERVICE | Context.BIND_ALLOW_BACKGROUND_ACTIVITY_STARTS), eq(serviceBindingFlags), eq(UserHandle.CURRENT)); // Verify bind to default package, instead of the invalid car mode ui. assertEquals(1, bindIntentCaptor.getAllValues().size()); Loading Loading @@ -952,8 +941,7 @@ public class InCallControllerTests extends TelecomTestCase { verify(mMockContext, times(2)).bindServiceAsUser( bindIntentCaptor.capture(), any(ServiceConnection.class), eq(Context.BIND_AUTO_CREATE | Context.BIND_FOREGROUND_SERVICE | Context.BIND_ALLOW_BACKGROUND_ACTIVITY_STARTS), eq(serviceBindingFlags), eq(UserHandle.CURRENT)); // Verify bind Loading Loading @@ -997,8 +985,7 @@ public class InCallControllerTests extends TelecomTestCase { verify(mMockContext, times(1)).bindServiceAsUser( bindIntentCaptor.capture(), any(ServiceConnection.class), eq(Context.BIND_AUTO_CREATE | Context.BIND_FOREGROUND_SERVICE | Context.BIND_ALLOW_BACKGROUND_ACTIVITY_STARTS), eq(serviceBindingFlags), eq(UserHandle.CURRENT)); // Verify bind Loading Loading @@ -1031,8 +1018,7 @@ public class InCallControllerTests extends TelecomTestCase { verify(mMockContext, times(1)).bindServiceAsUser( bindIntentCaptor.capture(), serviceConnectionCaptor.capture(), eq(Context.BIND_AUTO_CREATE | Context.BIND_FOREGROUND_SERVICE | Context.BIND_ALLOW_BACKGROUND_ACTIVITY_STARTS), eq(serviceBindingFlags), eq(UserHandle.CURRENT)); assertEquals(1, bindIntentCaptor.getAllValues().size()); verifyBinding(bindIntentCaptor, 0, DEF_PKG, DEF_CLASS); Loading Loading @@ -1070,8 +1056,7 @@ public class InCallControllerTests extends TelecomTestCase { verify(mMockContext).bindServiceAsUser( bindIntentCaptor.capture(), any(ServiceConnection.class), eq(Context.BIND_AUTO_CREATE | Context.BIND_FOREGROUND_SERVICE | Context.BIND_ALLOW_BACKGROUND_ACTIVITY_STARTS), eq(serviceBindingFlags), eq(UserHandle.CURRENT)); } Loading Loading @@ -1102,8 +1087,7 @@ public class InCallControllerTests extends TelecomTestCase { verify(mMockContext, times(4)).bindServiceAsUser( bindIntentCaptor.capture(), any(ServiceConnection.class), eq(Context.BIND_AUTO_CREATE | Context.BIND_FOREGROUND_SERVICE | Context.BIND_ALLOW_BACKGROUND_ACTIVITY_STARTS), eq(serviceBindingFlags), eq(UserHandle.CURRENT)); // Verify bind car mode ui assertEquals(4, bindIntentCaptor.getAllValues().size()); Loading Loading @@ -1160,8 +1144,7 @@ public class InCallControllerTests extends TelecomTestCase { verify(mMockContext, times(2)).bindServiceAsUser( bindIntentCaptor.capture(), serviceConnectionCaptor.capture(), eq(Context.BIND_AUTO_CREATE | Context.BIND_FOREGROUND_SERVICE | Context.BIND_ALLOW_BACKGROUND_ACTIVITY_STARTS), eq(serviceBindingFlags), eq(UserHandle.CURRENT)); CompletableFuture<Boolean> bindTimeout = mInCallController.getBindingFuture(); Loading Loading @@ -1229,8 +1212,7 @@ public class InCallControllerTests extends TelecomTestCase { verify(mMockContext, never()).bindServiceAsUser( any(Intent.class), any(ServiceConnection.class), eq(Context.BIND_AUTO_CREATE | Context.BIND_FOREGROUND_SERVICE | Context.BIND_ALLOW_BACKGROUND_ACTIVITY_STARTS), eq(serviceBindingFlags), eq(UserHandle.CURRENT)); // Now switch to car mode. Loading @@ -1242,8 +1224,7 @@ public class InCallControllerTests extends TelecomTestCase { verify(mMockContext, times(1)).bindServiceAsUser( bindIntentCaptor.capture(), any(ServiceConnection.class), eq(Context.BIND_AUTO_CREATE | Context.BIND_FOREGROUND_SERVICE | Context.BIND_ALLOW_BACKGROUND_ACTIVITY_STARTS), eq(serviceBindingFlags), eq(UserHandle.CURRENT)); // Verify bind car mode ui assertEquals(1, bindIntentCaptor.getAllValues().size()); Loading @@ -1269,8 +1250,7 @@ public class InCallControllerTests extends TelecomTestCase { verify(mMockContext, never()).bindServiceAsUser( any(Intent.class), any(ServiceConnection.class), eq(Context.BIND_AUTO_CREATE | Context.BIND_FOREGROUND_SERVICE | Context.BIND_ALLOW_BACKGROUND_ACTIVITY_STARTS), eq(serviceBindingFlags), eq(UserHandle.CURRENT)); // Now switch to car mode. Loading @@ -1287,8 +1267,7 @@ public class InCallControllerTests extends TelecomTestCase { verify(mMockContext, times(1)).bindServiceAsUser( any(Intent.class), serviceConnectionCaptor.capture(), eq(Context.BIND_AUTO_CREATE | Context.BIND_FOREGROUND_SERVICE | Context.BIND_ALLOW_BACKGROUND_ACTIVITY_STARTS), eq(serviceBindingFlags), eq(UserHandle.CURRENT)); ServiceConnection serviceConnection = serviceConnectionCaptor.getValue(); Loading Loading
src/com/android/server/telecom/InCallController.java +2 −1 Original line number Diff line number Diff line Loading @@ -322,7 +322,8 @@ public class InCallController extends CallsManagerListenerBase implements mInCallServiceInfo.setBindingStartTime(mClockProxy.elapsedRealtime()); if (!mContext.bindServiceAsUser(intent, mServiceConnection, Context.BIND_AUTO_CREATE | Context.BIND_FOREGROUND_SERVICE | Context.BIND_ALLOW_BACKGROUND_ACTIVITY_STARTS, | Context.BIND_ALLOW_BACKGROUND_ACTIVITY_STARTS | Context.BIND_SCHEDULE_LIKE_TOP_APP, UserHandle.CURRENT)) { Log.w(this, "Failed to connect."); mIsConnected = false; Loading
tests/src/com/android/server/telecom/tests/InCallControllerTests.java +29 −50 Original line number Diff line number Diff line Loading @@ -181,6 +181,10 @@ public class InCallControllerTests extends TelecomTestCase { private SystemStateHelper.SystemStateListener mSystemStateListener; private CarModeTracker mCarModeTracker = spy(new CarModeTracker()); private final int serviceBindingFlags = Context.BIND_AUTO_CREATE | Context.BIND_FOREGROUND_SERVICE | Context.BIND_ALLOW_BACKGROUND_ACTIVITY_STARTS | Context.BIND_SCHEDULE_LIKE_TOP_APP; @Override @Before public void setUp() throws Exception { Loading Loading @@ -354,8 +358,7 @@ public class InCallControllerTests extends TelecomTestCase { verify(mMockContext).bindServiceAsUser( bindIntentCaptor.capture(), any(ServiceConnection.class), eq(Context.BIND_AUTO_CREATE | Context.BIND_FOREGROUND_SERVICE | Context.BIND_ALLOW_BACKGROUND_ACTIVITY_STARTS), eq(serviceBindingFlags), eq(UserHandle.CURRENT)); Intent bindIntent = bindIntentCaptor.getValue(); Loading Loading @@ -389,8 +392,7 @@ public class InCallControllerTests extends TelecomTestCase { verify(mMockContext).bindServiceAsUser( bindIntentCaptor.capture(), any(ServiceConnection.class), eq(Context.BIND_AUTO_CREATE | Context.BIND_FOREGROUND_SERVICE | Context.BIND_ALLOW_BACKGROUND_ACTIVITY_STARTS), eq(serviceBindingFlags), eq(UserHandle.CURRENT)); Intent bindIntent = bindIntentCaptor.getValue(); Loading Loading @@ -442,8 +444,7 @@ public class InCallControllerTests extends TelecomTestCase { verify(mMockContext, times(1)).bindServiceAsUser( bindIntentCaptor.capture(), any(ServiceConnection.class), eq(Context.BIND_AUTO_CREATE | Context.BIND_FOREGROUND_SERVICE | Context.BIND_ALLOW_BACKGROUND_ACTIVITY_STARTS), eq(serviceBindingFlags), eq(UserHandle.CURRENT)); Intent bindIntent = bindIntentCaptor.getValue(); Loading Loading @@ -473,8 +474,7 @@ public class InCallControllerTests extends TelecomTestCase { when(mDefaultDialerCache.getDefaultDialerApplication(CURRENT_USER_ID)) .thenReturn(DEF_PKG); when(mMockContext.bindServiceAsUser(any(Intent.class), any(ServiceConnection.class), eq(Context.BIND_AUTO_CREATE | Context.BIND_FOREGROUND_SERVICE | Context.BIND_ALLOW_BACKGROUND_ACTIVITY_STARTS), eq(serviceBindingFlags), eq(UserHandle.CURRENT))).thenReturn(true); when(mTimeoutsAdapter.getEmergencyCallbackWindowMillis(any(ContentResolver.class))) .thenReturn(300_000L); Loading Loading @@ -502,8 +502,7 @@ public class InCallControllerTests extends TelecomTestCase { verify(mMockContext, times(1)).bindServiceAsUser( bindIntentCaptor.capture(), any(ServiceConnection.class), eq(Context.BIND_AUTO_CREATE | Context.BIND_FOREGROUND_SERVICE | Context.BIND_ALLOW_BACKGROUND_ACTIVITY_STARTS), eq(serviceBindingFlags), eq(UserHandle.CURRENT)); Intent bindIntent = bindIntentCaptor.getValue(); Loading Loading @@ -552,8 +551,7 @@ public class InCallControllerTests extends TelecomTestCase { ArgumentCaptor<ServiceConnection> serviceConnectionCaptor = ArgumentCaptor.forClass(ServiceConnection.class); when(mMockContext.bindServiceAsUser(any(Intent.class), serviceConnectionCaptor.capture(), eq(Context.BIND_AUTO_CREATE | Context.BIND_FOREGROUND_SERVICE | Context.BIND_ALLOW_BACKGROUND_ACTIVITY_STARTS), eq(serviceBindingFlags), eq(UserHandle.CURRENT))).thenReturn(true); when(mTimeoutsAdapter.getEmergencyCallbackWindowMillis(any(ContentResolver.class))) .thenReturn(300_000L); Loading Loading @@ -581,8 +579,7 @@ public class InCallControllerTests extends TelecomTestCase { verify(mMockContext, times(1)).bindServiceAsUser( bindIntentCaptor.capture(), any(ServiceConnection.class), eq(Context.BIND_AUTO_CREATE | Context.BIND_FOREGROUND_SERVICE | Context.BIND_ALLOW_BACKGROUND_ACTIVITY_STARTS), eq(serviceBindingFlags), eq(UserHandle.CURRENT)); Intent bindIntent = bindIntentCaptor.getValue(); Loading Loading @@ -611,8 +608,7 @@ public class InCallControllerTests extends TelecomTestCase { verify(mMockContext, times(2)).bindServiceAsUser( bindIntentCaptor.capture(), any(ServiceConnection.class), eq(Context.BIND_AUTO_CREATE | Context.BIND_FOREGROUND_SERVICE | Context.BIND_ALLOW_BACKGROUND_ACTIVITY_STARTS), eq(serviceBindingFlags), eq(UserHandle.CURRENT)); // Verify we were re-granted the runtime permission. Loading Loading @@ -666,8 +662,7 @@ public class InCallControllerTests extends TelecomTestCase { verify(mMockContext, times(1)).bindServiceAsUser( bindIntentCaptor.capture(), serviceConnectionCaptor.capture(), eq(Context.BIND_AUTO_CREATE | Context.BIND_FOREGROUND_SERVICE | Context.BIND_ALLOW_BACKGROUND_ACTIVITY_STARTS), eq(serviceBindingFlags), eq(UserHandle.CURRENT)); Intent bindIntent = bindIntentCaptor.getValue(); Loading Loading @@ -699,8 +694,7 @@ public class InCallControllerTests extends TelecomTestCase { verify(mMockContext, times(2)).bindServiceAsUser( bindIntentCaptor2.capture(), any(ServiceConnection.class), eq(Context.BIND_AUTO_CREATE | Context.BIND_FOREGROUND_SERVICE | Context.BIND_ALLOW_BACKGROUND_ACTIVITY_STARTS), eq(serviceBindingFlags), eq(UserHandle.CURRENT)); bindIntent = bindIntentCaptor2.getValue(); Loading Loading @@ -756,8 +750,7 @@ public class InCallControllerTests extends TelecomTestCase { verify(mMockContext, times(2)).bindServiceAsUser( bindIntentCaptor2.capture(), any(ServiceConnection.class), eq(Context.BIND_AUTO_CREATE | Context.BIND_FOREGROUND_SERVICE | Context.BIND_ALLOW_BACKGROUND_ACTIVITY_STARTS), eq(serviceBindingFlags), eq(UserHandle.CURRENT)); assertEquals(sysDialerComponentName, bindIntentCaptor2.getValue().getComponent()); } Loading Loading @@ -791,8 +784,7 @@ public class InCallControllerTests extends TelecomTestCase { verify(mMockContext, times(1)).bindServiceAsUser( bindIntentCaptor.capture(), any(ServiceConnection.class), eq(Context.BIND_AUTO_CREATE | Context.BIND_FOREGROUND_SERVICE | Context.BIND_ALLOW_BACKGROUND_ACTIVITY_STARTS), eq(serviceBindingFlags), eq(UserHandle.CURRENT)); Intent bindIntent = bindIntentCaptor.getValue(); Loading Loading @@ -830,8 +822,7 @@ public class InCallControllerTests extends TelecomTestCase { verify(mMockContext, times(1)).bindServiceAsUser( bindIntentCaptor.capture(), serviceConnectionCaptor.capture(), eq(Context.BIND_AUTO_CREATE | Context.BIND_FOREGROUND_SERVICE | Context.BIND_ALLOW_BACKGROUND_ACTIVITY_STARTS), eq(serviceBindingFlags), eq(UserHandle.CURRENT)); // Pretend that the call has gone away. Loading Loading @@ -879,8 +870,7 @@ public class InCallControllerTests extends TelecomTestCase { verify(mMockContext, times(1)).bindServiceAsUser( bindIntentCaptor.capture(), any(ServiceConnection.class), eq(Context.BIND_AUTO_CREATE | Context.BIND_FOREGROUND_SERVICE | Context.BIND_ALLOW_BACKGROUND_ACTIVITY_STARTS), eq(serviceBindingFlags), eq(UserHandle.CURRENT)); // Verify bind car mode ui assertEquals(1, bindIntentCaptor.getAllValues().size()); Loading Loading @@ -908,8 +898,7 @@ public class InCallControllerTests extends TelecomTestCase { verify(mMockContext, times(1)).bindServiceAsUser( bindIntentCaptor.capture(), any(ServiceConnection.class), eq(Context.BIND_AUTO_CREATE | Context.BIND_FOREGROUND_SERVICE | Context.BIND_ALLOW_BACKGROUND_ACTIVITY_STARTS), eq(serviceBindingFlags), eq(UserHandle.CURRENT)); // Verify bind to default package, instead of the invalid car mode ui. assertEquals(1, bindIntentCaptor.getAllValues().size()); Loading Loading @@ -952,8 +941,7 @@ public class InCallControllerTests extends TelecomTestCase { verify(mMockContext, times(2)).bindServiceAsUser( bindIntentCaptor.capture(), any(ServiceConnection.class), eq(Context.BIND_AUTO_CREATE | Context.BIND_FOREGROUND_SERVICE | Context.BIND_ALLOW_BACKGROUND_ACTIVITY_STARTS), eq(serviceBindingFlags), eq(UserHandle.CURRENT)); // Verify bind Loading Loading @@ -997,8 +985,7 @@ public class InCallControllerTests extends TelecomTestCase { verify(mMockContext, times(1)).bindServiceAsUser( bindIntentCaptor.capture(), any(ServiceConnection.class), eq(Context.BIND_AUTO_CREATE | Context.BIND_FOREGROUND_SERVICE | Context.BIND_ALLOW_BACKGROUND_ACTIVITY_STARTS), eq(serviceBindingFlags), eq(UserHandle.CURRENT)); // Verify bind Loading Loading @@ -1031,8 +1018,7 @@ public class InCallControllerTests extends TelecomTestCase { verify(mMockContext, times(1)).bindServiceAsUser( bindIntentCaptor.capture(), serviceConnectionCaptor.capture(), eq(Context.BIND_AUTO_CREATE | Context.BIND_FOREGROUND_SERVICE | Context.BIND_ALLOW_BACKGROUND_ACTIVITY_STARTS), eq(serviceBindingFlags), eq(UserHandle.CURRENT)); assertEquals(1, bindIntentCaptor.getAllValues().size()); verifyBinding(bindIntentCaptor, 0, DEF_PKG, DEF_CLASS); Loading Loading @@ -1070,8 +1056,7 @@ public class InCallControllerTests extends TelecomTestCase { verify(mMockContext).bindServiceAsUser( bindIntentCaptor.capture(), any(ServiceConnection.class), eq(Context.BIND_AUTO_CREATE | Context.BIND_FOREGROUND_SERVICE | Context.BIND_ALLOW_BACKGROUND_ACTIVITY_STARTS), eq(serviceBindingFlags), eq(UserHandle.CURRENT)); } Loading Loading @@ -1102,8 +1087,7 @@ public class InCallControllerTests extends TelecomTestCase { verify(mMockContext, times(4)).bindServiceAsUser( bindIntentCaptor.capture(), any(ServiceConnection.class), eq(Context.BIND_AUTO_CREATE | Context.BIND_FOREGROUND_SERVICE | Context.BIND_ALLOW_BACKGROUND_ACTIVITY_STARTS), eq(serviceBindingFlags), eq(UserHandle.CURRENT)); // Verify bind car mode ui assertEquals(4, bindIntentCaptor.getAllValues().size()); Loading Loading @@ -1160,8 +1144,7 @@ public class InCallControllerTests extends TelecomTestCase { verify(mMockContext, times(2)).bindServiceAsUser( bindIntentCaptor.capture(), serviceConnectionCaptor.capture(), eq(Context.BIND_AUTO_CREATE | Context.BIND_FOREGROUND_SERVICE | Context.BIND_ALLOW_BACKGROUND_ACTIVITY_STARTS), eq(serviceBindingFlags), eq(UserHandle.CURRENT)); CompletableFuture<Boolean> bindTimeout = mInCallController.getBindingFuture(); Loading Loading @@ -1229,8 +1212,7 @@ public class InCallControllerTests extends TelecomTestCase { verify(mMockContext, never()).bindServiceAsUser( any(Intent.class), any(ServiceConnection.class), eq(Context.BIND_AUTO_CREATE | Context.BIND_FOREGROUND_SERVICE | Context.BIND_ALLOW_BACKGROUND_ACTIVITY_STARTS), eq(serviceBindingFlags), eq(UserHandle.CURRENT)); // Now switch to car mode. Loading @@ -1242,8 +1224,7 @@ public class InCallControllerTests extends TelecomTestCase { verify(mMockContext, times(1)).bindServiceAsUser( bindIntentCaptor.capture(), any(ServiceConnection.class), eq(Context.BIND_AUTO_CREATE | Context.BIND_FOREGROUND_SERVICE | Context.BIND_ALLOW_BACKGROUND_ACTIVITY_STARTS), eq(serviceBindingFlags), eq(UserHandle.CURRENT)); // Verify bind car mode ui assertEquals(1, bindIntentCaptor.getAllValues().size()); Loading @@ -1269,8 +1250,7 @@ public class InCallControllerTests extends TelecomTestCase { verify(mMockContext, never()).bindServiceAsUser( any(Intent.class), any(ServiceConnection.class), eq(Context.BIND_AUTO_CREATE | Context.BIND_FOREGROUND_SERVICE | Context.BIND_ALLOW_BACKGROUND_ACTIVITY_STARTS), eq(serviceBindingFlags), eq(UserHandle.CURRENT)); // Now switch to car mode. Loading @@ -1287,8 +1267,7 @@ public class InCallControllerTests extends TelecomTestCase { verify(mMockContext, times(1)).bindServiceAsUser( any(Intent.class), serviceConnectionCaptor.capture(), eq(Context.BIND_AUTO_CREATE | Context.BIND_FOREGROUND_SERVICE | Context.BIND_ALLOW_BACKGROUND_ACTIVITY_STARTS), eq(serviceBindingFlags), eq(UserHandle.CURRENT)); ServiceConnection serviceConnection = serviceConnectionCaptor.getValue(); Loading