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

Commit 0b451c5f authored by Grace Jia's avatar Grace Jia Committed by Android (Google) Code Review
Browse files

Merge "Fix CallScreeningService notification request issue."

parents 1547a306 ddc48c4b
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -861,7 +861,8 @@ public class CallsManager extends Call.ListenerBase
                }
                mCallLogManager.logCall(incomingCall, Calls.BLOCKED_TYPE,
                        result.shouldShowNotification, result);
            } else if (result.shouldShowNotification) {
            }
            if (result.shouldShowNotification) {
                Log.i(this, "onCallScreeningCompleted: blocked call, showing notification.");
                mMissedCallNotifier.showMissedCallNotification(
                        new MissedCallNotifier.CallInfo(incomingCall));
+21 −0
Original line number Diff line number Diff line
@@ -1676,6 +1676,27 @@ public class CallsManagerTest extends TelecomTestCase {
                new UserHandle(90210)));
    }

    /**
     * Verifies that if a {@link android.telecom.CallScreeningService} app can properly request
     * notification show for rejected calls.
     */
    @SmallTest
    @Test
    public void testCallScreeningServiceRequestShowNotification() {
        Call callSpy = addSpyCall(CallState.NEW);
        CallFilteringResult result = new CallFilteringResult.Builder()
                .setShouldAllowCall(false)
                .setShouldReject(true)
                .setCallScreeningComponentName("com.foo/.Blah")
                .setCallScreeningAppName("Blah")
                .setShouldAddToCallLog(true)
                .setShouldShowNotification(true).build();

        mCallsManager.onCallFilteringComplete(callSpy, result, false /* timeout */);
        verify(mMissedCallNotifier).showMissedCallNotification(
                any(MissedCallNotifier.CallInfo.class));
    }

    private Call addSpyCall() {
        return addSpyCall(SIM_2_HANDLE, CallState.ACTIVE);
    }