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

Commit 6b7e359f authored by qing's avatar qing Committed by Qing Zhong
Browse files

Make default sms response loading configurable

Add a config to skip loading canned text response. Wear dialer is not using this feature but its own database.

Test: e2e test on wear device , no impact on wear dialer quick response
Change-Id: I04cb1c859829d2b935bb005572ba72dd51c1df9f
parent 8607aff3
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);
    }