Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 7a642cb2 authored by Android Build Coastguard Worker's avatar Android Build Coastguard Worker
Browse files

Snap for 9070148 from fd4d7c2d to tm-qpr1-release

Change-Id: Ica5c9320dc35cc4583196b302c0754d06d8541c8
parents 5afd3c02 fd4d7c2d
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -210,7 +210,8 @@ public class CallScreeningServiceHelper {
        if (context.bindServiceAsUser(
                intent,
                serviceConnection,
                Context.BIND_AUTO_CREATE | Context.BIND_FOREGROUND_SERVICE,
                Context.BIND_AUTO_CREATE | Context.BIND_FOREGROUND_SERVICE
                | Context.BIND_SCHEDULE_LIKE_TOP_APP,
                UserHandle.CURRENT)) {
            Log.d(TAG, "bindService, found service, waiting for it to connect");
            return true;
+2 −1
Original line number Diff line number Diff line
@@ -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;
+2 −1
Original line number Diff line number Diff line
@@ -395,7 +395,8 @@ public class CallScreeningServiceFilterTest extends TelecomTestCase {
                .forClass(ServiceConnection.class);
        verify(mContext, timeout(CallScreeningServiceFilter.CALL_SCREENING_FILTER_TIMEOUT))
                .bindServiceAsUser(intentCaptor.capture(), serviceCaptor.capture(),
                eq(Context.BIND_AUTO_CREATE | Context.BIND_FOREGROUND_SERVICE),
                eq(Context.BIND_AUTO_CREATE | Context.BIND_FOREGROUND_SERVICE
                        | Context.BIND_SCHEDULE_LIKE_TOP_APP),
                eq(UserHandle.CURRENT));

        Intent capturedIntent = intentCaptor.getValue();
+29 −50
Original line number Diff line number Diff line
@@ -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 {
@@ -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();
@@ -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();
@@ -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();
@@ -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);
@@ -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();
@@ -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);
@@ -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();
@@ -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.
@@ -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();
@@ -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();
@@ -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());
    }
@@ -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();
@@ -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.
@@ -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());
@@ -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());
@@ -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
@@ -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
@@ -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);
@@ -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));
    }

@@ -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());
@@ -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();
@@ -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.
@@ -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());
@@ -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.
@@ -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();