Loading src/com/android/server/telecom/InCallController.java +2 −1 Original line number Diff line number Diff line Loading @@ -233,7 +233,8 @@ public class InCallController extends CallsManagerListenerBase { Log.i(this, "Attempting to bind to InCall %s, with %s", mInCallServiceInfo, intent); mIsConnected = true; if (!mContext.bindServiceAsUser(intent, mServiceConnection, Context.BIND_AUTO_CREATE | Context.BIND_FOREGROUND_SERVICE, Context.BIND_AUTO_CREATE | Context.BIND_FOREGROUND_SERVICE | Context.BIND_ALLOW_BACKGROUND_ACTIVITY_STARTS, UserHandle.CURRENT)) { Log.w(this, "Failed to connect."); mIsConnected = false; Loading src/com/android/server/telecom/callredirection/CallRedirectionProcessor.java +2 −1 Original line number Diff line number Diff line Loading @@ -81,7 +81,8 @@ public class CallRedirectionProcessor implements CallRedirectionCallback { if (mContext.bindServiceAsUser( intent, connection, Context.BIND_AUTO_CREATE | Context.BIND_FOREGROUND_SERVICE, Context.BIND_AUTO_CREATE | Context.BIND_FOREGROUND_SERVICE | Context.BIND_ALLOW_BACKGROUND_ACTIVITY_STARTS, UserHandle.CURRENT)) { Log.d(this, "bindService, found " + mServiceType + " call redirection service," + " waiting for it to connect"); Loading tests/src/com/android/server/telecom/tests/InCallControllerTests.java +26 −13 Original line number Diff line number Diff line Loading @@ -187,7 +187,8 @@ public class InCallControllerTests extends TelecomTestCase { verify(mMockContext).bindServiceAsUser( bindIntentCaptor.capture(), any(ServiceConnection.class), eq(Context.BIND_AUTO_CREATE | Context.BIND_FOREGROUND_SERVICE), eq(Context.BIND_AUTO_CREATE | Context.BIND_FOREGROUND_SERVICE | Context.BIND_ALLOW_BACKGROUND_ACTIVITY_STARTS), eq(UserHandle.CURRENT)); Intent bindIntent = bindIntentCaptor.getValue(); Loading Loading @@ -221,7 +222,8 @@ public class InCallControllerTests extends TelecomTestCase { verify(mMockContext).bindServiceAsUser( bindIntentCaptor.capture(), any(ServiceConnection.class), eq(Context.BIND_AUTO_CREATE | Context.BIND_FOREGROUND_SERVICE), eq(Context.BIND_AUTO_CREATE | Context.BIND_FOREGROUND_SERVICE | Context.BIND_ALLOW_BACKGROUND_ACTIVITY_STARTS), eq(UserHandle.CURRENT)); Intent bindIntent = bindIntentCaptor.getValue(); Loading Loading @@ -272,7 +274,8 @@ public class InCallControllerTests extends TelecomTestCase { verify(mMockContext, times(1)).bindServiceAsUser( bindIntentCaptor.capture(), any(ServiceConnection.class), eq(Context.BIND_AUTO_CREATE | Context.BIND_FOREGROUND_SERVICE), eq(Context.BIND_AUTO_CREATE | Context.BIND_FOREGROUND_SERVICE | Context.BIND_ALLOW_BACKGROUND_ACTIVITY_STARTS), eq(UserHandle.CURRENT)); Intent bindIntent = bindIntentCaptor.getValue(); Loading Loading @@ -302,7 +305,8 @@ 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), eq(Context.BIND_AUTO_CREATE | Context.BIND_FOREGROUND_SERVICE | Context.BIND_ALLOW_BACKGROUND_ACTIVITY_STARTS), eq(UserHandle.CURRENT))).thenReturn(true); when(mTimeoutsAdapter.getEmergencyCallbackWindowMillis(any(ContentResolver.class))) .thenReturn(300_000L); Loading @@ -329,7 +333,8 @@ public class InCallControllerTests extends TelecomTestCase { verify(mMockContext, times(1)).bindServiceAsUser( bindIntentCaptor.capture(), any(ServiceConnection.class), eq(Context.BIND_AUTO_CREATE | Context.BIND_FOREGROUND_SERVICE), eq(Context.BIND_AUTO_CREATE | Context.BIND_FOREGROUND_SERVICE | Context.BIND_ALLOW_BACKGROUND_ACTIVITY_STARTS), eq(UserHandle.CURRENT)); Intent bindIntent = bindIntentCaptor.getValue(); Loading Loading @@ -398,7 +403,8 @@ public class InCallControllerTests extends TelecomTestCase { verify(mMockContext, times(1)).bindServiceAsUser( bindIntentCaptor.capture(), serviceConnectionCaptor.capture(), eq(Context.BIND_AUTO_CREATE | Context.BIND_FOREGROUND_SERVICE), eq(Context.BIND_AUTO_CREATE | Context.BIND_FOREGROUND_SERVICE | Context.BIND_ALLOW_BACKGROUND_ACTIVITY_STARTS), eq(UserHandle.CURRENT)); Intent bindIntent = bindIntentCaptor.getValue(); Loading Loading @@ -430,7 +436,8 @@ public class InCallControllerTests extends TelecomTestCase { verify(mMockContext, times(2)).bindServiceAsUser( bindIntentCaptor2.capture(), any(ServiceConnection.class), eq(Context.BIND_AUTO_CREATE | Context.BIND_FOREGROUND_SERVICE), eq(Context.BIND_AUTO_CREATE | Context.BIND_FOREGROUND_SERVICE | Context.BIND_ALLOW_BACKGROUND_ACTIVITY_STARTS), eq(UserHandle.CURRENT)); bindIntent = bindIntentCaptor2.getValue(); Loading Loading @@ -466,7 +473,8 @@ public class InCallControllerTests extends TelecomTestCase { verify(mMockContext, times(1)).bindServiceAsUser( bindIntentCaptor.capture(), any(ServiceConnection.class), eq(Context.BIND_AUTO_CREATE | Context.BIND_FOREGROUND_SERVICE), eq(Context.BIND_AUTO_CREATE | Context.BIND_FOREGROUND_SERVICE | Context.BIND_ALLOW_BACKGROUND_ACTIVITY_STARTS), eq(UserHandle.CURRENT)); Intent bindIntent = bindIntentCaptor.getValue(); Loading Loading @@ -504,7 +512,8 @@ public class InCallControllerTests extends TelecomTestCase { verify(mMockContext, times(1)).bindServiceAsUser( bindIntentCaptor.capture(), serviceConnectionCaptor.capture(), eq(Context.BIND_AUTO_CREATE | Context.BIND_FOREGROUND_SERVICE), eq(Context.BIND_AUTO_CREATE | Context.BIND_FOREGROUND_SERVICE | Context.BIND_ALLOW_BACKGROUND_ACTIVITY_STARTS), eq(UserHandle.CURRENT)); // Pretend that the call has gone away. Loading Loading @@ -568,7 +577,8 @@ public class InCallControllerTests extends TelecomTestCase { verify(mMockContext, times(3)).bindServiceAsUser( bindIntentCaptor.capture(), any(ServiceConnection.class), eq(Context.BIND_AUTO_CREATE | Context.BIND_FOREGROUND_SERVICE), eq(Context.BIND_AUTO_CREATE | Context.BIND_FOREGROUND_SERVICE | Context.BIND_ALLOW_BACKGROUND_ACTIVITY_STARTS), eq(UserHandle.CURRENT)); // Verify bind dialer Intent bindIntent = bindIntentCaptor.getAllValues().get(0); Loading Loading @@ -620,7 +630,8 @@ public class InCallControllerTests extends TelecomTestCase { verify(mMockContext, times(1)).bindServiceAsUser( bindIntentCaptor.capture(), any(ServiceConnection.class), eq(Context.BIND_AUTO_CREATE | Context.BIND_FOREGROUND_SERVICE), eq(Context.BIND_AUTO_CREATE | Context.BIND_FOREGROUND_SERVICE | Context.BIND_ALLOW_BACKGROUND_ACTIVITY_STARTS), eq(UserHandle.CURRENT)); // Verify bind car mode ui assertEquals(1, bindIntentCaptor.getAllValues().size()); Loading Loading @@ -663,7 +674,8 @@ public class InCallControllerTests extends TelecomTestCase { verify(mMockContext, times(1)).bindServiceAsUser( bindIntentCaptor.capture(), any(ServiceConnection.class), eq(Context.BIND_AUTO_CREATE | Context.BIND_FOREGROUND_SERVICE), eq(Context.BIND_AUTO_CREATE | Context.BIND_FOREGROUND_SERVICE | Context.BIND_ALLOW_BACKGROUND_ACTIVITY_STARTS), eq(UserHandle.CURRENT)); // Verify bind to default package, instead of the invalid car mode ui. assertEquals(1, bindIntentCaptor.getAllValues().size()); Loading Loading @@ -702,7 +714,8 @@ public class InCallControllerTests extends TelecomTestCase { verify(mMockContext, times(1)).bindServiceAsUser( bindIntentCaptor.capture(), serviceConnectionCaptor.capture(), eq(Context.BIND_AUTO_CREATE | Context.BIND_FOREGROUND_SERVICE), eq(Context.BIND_AUTO_CREATE | Context.BIND_FOREGROUND_SERVICE | Context.BIND_ALLOW_BACKGROUND_ACTIVITY_STARTS), eq(UserHandle.CURRENT)); CompletableFuture<Boolean> bindTimeout = mInCallController.getBindingFuture(); Loading Loading
src/com/android/server/telecom/InCallController.java +2 −1 Original line number Diff line number Diff line Loading @@ -233,7 +233,8 @@ public class InCallController extends CallsManagerListenerBase { Log.i(this, "Attempting to bind to InCall %s, with %s", mInCallServiceInfo, intent); mIsConnected = true; if (!mContext.bindServiceAsUser(intent, mServiceConnection, Context.BIND_AUTO_CREATE | Context.BIND_FOREGROUND_SERVICE, Context.BIND_AUTO_CREATE | Context.BIND_FOREGROUND_SERVICE | Context.BIND_ALLOW_BACKGROUND_ACTIVITY_STARTS, UserHandle.CURRENT)) { Log.w(this, "Failed to connect."); mIsConnected = false; Loading
src/com/android/server/telecom/callredirection/CallRedirectionProcessor.java +2 −1 Original line number Diff line number Diff line Loading @@ -81,7 +81,8 @@ public class CallRedirectionProcessor implements CallRedirectionCallback { if (mContext.bindServiceAsUser( intent, connection, Context.BIND_AUTO_CREATE | Context.BIND_FOREGROUND_SERVICE, Context.BIND_AUTO_CREATE | Context.BIND_FOREGROUND_SERVICE | Context.BIND_ALLOW_BACKGROUND_ACTIVITY_STARTS, UserHandle.CURRENT)) { Log.d(this, "bindService, found " + mServiceType + " call redirection service," + " waiting for it to connect"); Loading
tests/src/com/android/server/telecom/tests/InCallControllerTests.java +26 −13 Original line number Diff line number Diff line Loading @@ -187,7 +187,8 @@ public class InCallControllerTests extends TelecomTestCase { verify(mMockContext).bindServiceAsUser( bindIntentCaptor.capture(), any(ServiceConnection.class), eq(Context.BIND_AUTO_CREATE | Context.BIND_FOREGROUND_SERVICE), eq(Context.BIND_AUTO_CREATE | Context.BIND_FOREGROUND_SERVICE | Context.BIND_ALLOW_BACKGROUND_ACTIVITY_STARTS), eq(UserHandle.CURRENT)); Intent bindIntent = bindIntentCaptor.getValue(); Loading Loading @@ -221,7 +222,8 @@ public class InCallControllerTests extends TelecomTestCase { verify(mMockContext).bindServiceAsUser( bindIntentCaptor.capture(), any(ServiceConnection.class), eq(Context.BIND_AUTO_CREATE | Context.BIND_FOREGROUND_SERVICE), eq(Context.BIND_AUTO_CREATE | Context.BIND_FOREGROUND_SERVICE | Context.BIND_ALLOW_BACKGROUND_ACTIVITY_STARTS), eq(UserHandle.CURRENT)); Intent bindIntent = bindIntentCaptor.getValue(); Loading Loading @@ -272,7 +274,8 @@ public class InCallControllerTests extends TelecomTestCase { verify(mMockContext, times(1)).bindServiceAsUser( bindIntentCaptor.capture(), any(ServiceConnection.class), eq(Context.BIND_AUTO_CREATE | Context.BIND_FOREGROUND_SERVICE), eq(Context.BIND_AUTO_CREATE | Context.BIND_FOREGROUND_SERVICE | Context.BIND_ALLOW_BACKGROUND_ACTIVITY_STARTS), eq(UserHandle.CURRENT)); Intent bindIntent = bindIntentCaptor.getValue(); Loading Loading @@ -302,7 +305,8 @@ 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), eq(Context.BIND_AUTO_CREATE | Context.BIND_FOREGROUND_SERVICE | Context.BIND_ALLOW_BACKGROUND_ACTIVITY_STARTS), eq(UserHandle.CURRENT))).thenReturn(true); when(mTimeoutsAdapter.getEmergencyCallbackWindowMillis(any(ContentResolver.class))) .thenReturn(300_000L); Loading @@ -329,7 +333,8 @@ public class InCallControllerTests extends TelecomTestCase { verify(mMockContext, times(1)).bindServiceAsUser( bindIntentCaptor.capture(), any(ServiceConnection.class), eq(Context.BIND_AUTO_CREATE | Context.BIND_FOREGROUND_SERVICE), eq(Context.BIND_AUTO_CREATE | Context.BIND_FOREGROUND_SERVICE | Context.BIND_ALLOW_BACKGROUND_ACTIVITY_STARTS), eq(UserHandle.CURRENT)); Intent bindIntent = bindIntentCaptor.getValue(); Loading Loading @@ -398,7 +403,8 @@ public class InCallControllerTests extends TelecomTestCase { verify(mMockContext, times(1)).bindServiceAsUser( bindIntentCaptor.capture(), serviceConnectionCaptor.capture(), eq(Context.BIND_AUTO_CREATE | Context.BIND_FOREGROUND_SERVICE), eq(Context.BIND_AUTO_CREATE | Context.BIND_FOREGROUND_SERVICE | Context.BIND_ALLOW_BACKGROUND_ACTIVITY_STARTS), eq(UserHandle.CURRENT)); Intent bindIntent = bindIntentCaptor.getValue(); Loading Loading @@ -430,7 +436,8 @@ public class InCallControllerTests extends TelecomTestCase { verify(mMockContext, times(2)).bindServiceAsUser( bindIntentCaptor2.capture(), any(ServiceConnection.class), eq(Context.BIND_AUTO_CREATE | Context.BIND_FOREGROUND_SERVICE), eq(Context.BIND_AUTO_CREATE | Context.BIND_FOREGROUND_SERVICE | Context.BIND_ALLOW_BACKGROUND_ACTIVITY_STARTS), eq(UserHandle.CURRENT)); bindIntent = bindIntentCaptor2.getValue(); Loading Loading @@ -466,7 +473,8 @@ public class InCallControllerTests extends TelecomTestCase { verify(mMockContext, times(1)).bindServiceAsUser( bindIntentCaptor.capture(), any(ServiceConnection.class), eq(Context.BIND_AUTO_CREATE | Context.BIND_FOREGROUND_SERVICE), eq(Context.BIND_AUTO_CREATE | Context.BIND_FOREGROUND_SERVICE | Context.BIND_ALLOW_BACKGROUND_ACTIVITY_STARTS), eq(UserHandle.CURRENT)); Intent bindIntent = bindIntentCaptor.getValue(); Loading Loading @@ -504,7 +512,8 @@ public class InCallControllerTests extends TelecomTestCase { verify(mMockContext, times(1)).bindServiceAsUser( bindIntentCaptor.capture(), serviceConnectionCaptor.capture(), eq(Context.BIND_AUTO_CREATE | Context.BIND_FOREGROUND_SERVICE), eq(Context.BIND_AUTO_CREATE | Context.BIND_FOREGROUND_SERVICE | Context.BIND_ALLOW_BACKGROUND_ACTIVITY_STARTS), eq(UserHandle.CURRENT)); // Pretend that the call has gone away. Loading Loading @@ -568,7 +577,8 @@ public class InCallControllerTests extends TelecomTestCase { verify(mMockContext, times(3)).bindServiceAsUser( bindIntentCaptor.capture(), any(ServiceConnection.class), eq(Context.BIND_AUTO_CREATE | Context.BIND_FOREGROUND_SERVICE), eq(Context.BIND_AUTO_CREATE | Context.BIND_FOREGROUND_SERVICE | Context.BIND_ALLOW_BACKGROUND_ACTIVITY_STARTS), eq(UserHandle.CURRENT)); // Verify bind dialer Intent bindIntent = bindIntentCaptor.getAllValues().get(0); Loading Loading @@ -620,7 +630,8 @@ public class InCallControllerTests extends TelecomTestCase { verify(mMockContext, times(1)).bindServiceAsUser( bindIntentCaptor.capture(), any(ServiceConnection.class), eq(Context.BIND_AUTO_CREATE | Context.BIND_FOREGROUND_SERVICE), eq(Context.BIND_AUTO_CREATE | Context.BIND_FOREGROUND_SERVICE | Context.BIND_ALLOW_BACKGROUND_ACTIVITY_STARTS), eq(UserHandle.CURRENT)); // Verify bind car mode ui assertEquals(1, bindIntentCaptor.getAllValues().size()); Loading Loading @@ -663,7 +674,8 @@ public class InCallControllerTests extends TelecomTestCase { verify(mMockContext, times(1)).bindServiceAsUser( bindIntentCaptor.capture(), any(ServiceConnection.class), eq(Context.BIND_AUTO_CREATE | Context.BIND_FOREGROUND_SERVICE), eq(Context.BIND_AUTO_CREATE | Context.BIND_FOREGROUND_SERVICE | Context.BIND_ALLOW_BACKGROUND_ACTIVITY_STARTS), eq(UserHandle.CURRENT)); // Verify bind to default package, instead of the invalid car mode ui. assertEquals(1, bindIntentCaptor.getAllValues().size()); Loading Loading @@ -702,7 +714,8 @@ public class InCallControllerTests extends TelecomTestCase { verify(mMockContext, times(1)).bindServiceAsUser( bindIntentCaptor.capture(), serviceConnectionCaptor.capture(), eq(Context.BIND_AUTO_CREATE | Context.BIND_FOREGROUND_SERVICE), eq(Context.BIND_AUTO_CREATE | Context.BIND_FOREGROUND_SERVICE | Context.BIND_ALLOW_BACKGROUND_ACTIVITY_STARTS), eq(UserHandle.CURRENT)); CompletableFuture<Boolean> bindTimeout = mInCallController.getBindingFuture(); Loading