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

Commit c34d474f authored by Brad Ebinger's avatar Brad Ebinger
Browse files

Fix SecurityException in Tests

Update tests to register a PhoneAccount with the PhoneAccountRegistrar
before trying to add a new incoming/unknown call.

Bug: 27301311
Change-Id: Ib4214603d9aa892988b8adecc36ee747e2d0853c
parent 9052bb2e
Loading
Loading
Loading
Loading
+8 −0
Original line number Original line Diff line number Diff line
@@ -541,6 +541,10 @@ public class TelecomServiceImplTest extends TelecomTestCase {


    @SmallTest
    @SmallTest
    public void testAddNewIncomingCall() throws Exception {
    public void testAddNewIncomingCall() throws Exception {
        PhoneAccount phoneAccount = makePhoneAccount(TEL_PA_HANDLE_CURRENT).build();
        phoneAccount.setIsEnabled(true);
        doReturn(phoneAccount).when(mFakePhoneAccountRegistrar).getPhoneAccount(
                eq(TEL_PA_HANDLE_CURRENT), any(UserHandle.class));
        doNothing().when(mAppOpsManager).checkPackage(anyInt(), anyString());
        doNothing().when(mAppOpsManager).checkPackage(anyInt(), anyString());
        Bundle extras = createSampleExtras();
        Bundle extras = createSampleExtras();


@@ -573,6 +577,10 @@ public class TelecomServiceImplTest extends TelecomTestCase {


    @SmallTest
    @SmallTest
    public void testAddNewUnknownCall() throws Exception {
    public void testAddNewUnknownCall() throws Exception {
        PhoneAccount phoneAccount = makePhoneAccount(TEL_PA_HANDLE_CURRENT).build();
        phoneAccount.setIsEnabled(true);
        doReturn(phoneAccount).when(mFakePhoneAccountRegistrar).getPhoneAccount(
                eq(TEL_PA_HANDLE_CURRENT), any(UserHandle.class));
        doNothing().when(mAppOpsManager).checkPackage(anyInt(), anyString());
        doNothing().when(mAppOpsManager).checkPackage(anyInt(), anyString());
        Bundle extras = createSampleExtras();
        Bundle extras = createSampleExtras();