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

Commit ddc48c4b authored by Grace Jia's avatar Grace Jia
Browse files

Fix CallScreeningService notification request issue.

3rd-party CallScreeningService can't skip call logging but should have
proper way to request show the notification of a rejected call.

Bug: 167559117
Test: CallsManagerTest
Change-Id: Ia51e55010e8d3490eb6e369b44eb948933d65155
parent 2c5bb03a
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);
    }