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

Commit 98b7abc4 authored by Qing Zhong's avatar Qing Zhong Committed by Android (Google) Code Review
Browse files

Merge "Make default sms response loading configurable" into main

parents 2a7bf22f 6b7e359f
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -83,6 +83,9 @@
    <!-- System bluetooth stack package name -->
    <string name="system_bluetooth_stack">com.android.bluetooth</string>

    <!-- When true, skip fetching quick reply response -->
    <bool name="skip_loading_canned_text_response">false</bool>

    <!-- When true, skip fetching incoming caller info -->
    <bool name="skip_incoming_caller_info_query">false</bool>
</resources>
+5 −0
Original line number Diff line number Diff line
@@ -3730,6 +3730,11 @@ public class Call implements CreateConnectionResponse, EventManager.Loggable,
     * SMSes to that number will silently fail.
     */
    public boolean isRespondViaSmsCapable() {
        if (mContext.getResources().getBoolean(R.bool.skip_loading_canned_text_response)) {
            Log.d(this, "maybeLoadCannedSmsResponses: skip loading due to setting");
            return false;
        }

        if (mState != CallState.RINGING) {
            return false;
        }
+14 −0
Original line number Diff line number Diff line
@@ -128,6 +128,8 @@ public class CallTest extends TelecomTestCase {
                .when(mMockConnectionService).getComponentName();
        doReturn(UserHandle.CURRENT).when(mMockCallsManager).getCurrentUserHandle();
        Resources mockResources = mContext.getResources();
        when(mockResources.getBoolean(R.bool.skip_loading_canned_text_response))
                .thenReturn(false);
        when(mockResources.getBoolean(R.bool.skip_incoming_caller_info_query))
                .thenReturn(false);
        EmergencyCallHelper helper = mock(EmergencyCallHelper.class);
@@ -964,6 +966,18 @@ public class CallTest extends TelecomTestCase {
        assertTrue(call.getExtras().containsKey(TelecomManager.EXTRA_DO_NOT_LOG_CALL));
    }

    @Test
    @SmallTest
    public void testSkipLoadingCannedTextResponse() {
        Call call = createCall("any");
        Resources mockResources = mContext.getResources();
        when(mockResources.getBoolean(R.bool.skip_loading_canned_text_response))
                .thenReturn(true);


        assertFalse(call.isRespondViaSmsCapable());
    }

    private Call createCall(String id) {
        return createCall(id, Call.CALL_DIRECTION_UNDEFINED);
    }