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

Commit d3615e5f authored by Treehugger Robot's avatar Treehugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Fix cross profile available account determination." into main

parents bd644831 a85b4cca
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -3929,7 +3929,7 @@ public class CallsManager extends Call.ListenerBase
        for (PhoneAccountHandle callHandle : activeCallAccounts) {
            allAccounts.removeIf(candidateHandle -> {
                PhoneAccount callAcct = mPhoneAccountRegistrar.getPhoneAccount(callHandle,
                        user);
                        user, true /* acrossProfiles */);
                if (callAcct == null) {
                    Log.w(this, "constructPossiblePhoneAccountsNew: unexpected"
                            + "null PA for PAH, removing : " + candidateHandle);
+19 −3
Original line number Diff line number Diff line
@@ -408,16 +408,28 @@ public class CallsManagerTest extends TelecomTestCase {

        when(mPhoneAccountRegistrar.getPhoneAccount(
                eq(SELF_MANAGED_HANDLE), any())).thenReturn(SELF_MANAGED_ACCOUNT);
        when(mPhoneAccountRegistrar.getPhoneAccount(
                eq(SELF_MANAGED_HANDLE), any(), anyBoolean())).thenReturn(SELF_MANAGED_ACCOUNT);
        when(mPhoneAccountRegistrar.getPhoneAccount(
                eq(SIM_1_HANDLE), any())).thenReturn(SIM_1_ACCOUNT);
        when(mPhoneAccountRegistrar.getPhoneAccount(
                eq(SIM_1_HANDLE), any(), anyBoolean())).thenReturn(SIM_1_ACCOUNT);
        when(mPhoneAccountRegistrar.getPhoneAccount(
                eq(SIM_2_HANDLE), any())).thenReturn(SIM_2_ACCOUNT);
        when(mPhoneAccountRegistrar.getPhoneAccount(
                eq(SIM_2_HANDLE), any(), anyBoolean())).thenReturn(SIM_2_ACCOUNT);
        when(mPhoneAccountRegistrar.getPhoneAccount(
                eq(SIM_3_HANDLE), any())).thenReturn(SIM_3_ACCOUNT);
        when(mPhoneAccountRegistrar.getPhoneAccount(
                eq(SIM_3_HANDLE), any(), anyBoolean())).thenReturn(SIM_3_ACCOUNT);
        when(mPhoneAccountRegistrar.getPhoneAccount(
                eq(CALL_PROVIDER_HANDLE), any())).thenReturn(CALL_PROVIDER_ACCOUNT);
        when(mPhoneAccountRegistrar.getPhoneAccount(
                eq(CALL_PROVIDER_HANDLE), any(), anyBoolean())).thenReturn(CALL_PROVIDER_ACCOUNT);
        when(mPhoneAccountRegistrar.getPhoneAccount(
                eq(WORK_HANDLE), any())).thenReturn(WORK_ACCOUNT);
        when(mPhoneAccountRegistrar.getPhoneAccount(
                eq(WORK_HANDLE), any(), anyBoolean())).thenReturn(WORK_ACCOUNT);
        when(mFeatureFlags.separatelyBindToBtIncallService()).thenReturn(false);
        when(mFeatureFlags.telecomResolveHiddenDependencies()).thenReturn(true);
        when(mContext.createContextAsUser(any(UserHandle.class), eq(0)))
@@ -2298,7 +2310,8 @@ public class CallsManagerTest extends TelecomTestCase {
    public void testSpeakerDisabledWhenNoVideoCapabilities() throws Exception {
        Call outgoingCall = addSpyCall(CallState.NEW);
        when(mPhoneAccountRegistrar.getPhoneAccount(
                any(PhoneAccountHandle.class), any(UserHandle.class))).thenReturn(SIM_1_ACCOUNT);
                any(PhoneAccountHandle.class), any(UserHandle.class), anyBoolean()))
                .thenReturn(SIM_1_ACCOUNT);
        mCallsManager.placeOutgoingCall(outgoingCall, TEST_ADDRESS, null, true,
                VideoProfile.STATE_TX_ENABLED);
        assertFalse(outgoingCall.getStartWithSpeakerphoneOn());
@@ -3692,6 +3705,8 @@ public class CallsManagerTest extends TelecomTestCase {
        assertFalse(mCallsManager.isInSelfManagedCall(TEST_PACKAGE_NAME, TEST_USER_HANDLE));

        // WHEN
        when(mPhoneAccountRegistrar.getPhoneAccount(any(), any(), anyBoolean()))
                .thenReturn(SM_W_DIFFERENT_PACKAGE_AND_USER);
        when(mPhoneAccountRegistrar.getPhoneAccount(any(), any()))
                .thenReturn(SM_W_DIFFERENT_PACKAGE_AND_USER);
        // Ensure contact info lookup succeeds
@@ -3972,7 +3987,8 @@ public class CallsManagerTest extends TelecomTestCase {
        // Remap the PhoneAccounts to inherit the restriction set
        for (PhoneAccountHandle callCapableHandle : callCapableHandles) {
            PhoneAccount pa = mPhoneAccountRegistrar.getPhoneAccount(
                    callCapableHandle, callCapableHandle.getUserHandle());
                    callCapableHandle, callCapableHandle.getUserHandle(),
                    true /* across profiles */);
            assertNotNull("test setup error: could not find PA for PAH:" + callCapableHandle,
                    pa);
            // For simplicity, for testing only apply restrictions to SIM accounts
@@ -3985,7 +4001,7 @@ public class CallsManagerTest extends TelecomTestCase {
                        .setSimultaneousCallingRestriction(Collections.emptySet()).build();
            }
            when(mPhoneAccountRegistrar.getPhoneAccount(eq(callCapableHandle),
                    any())).thenReturn(pa);
                    any(), anyBoolean())).thenReturn(pa);
        }
    }