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

Commit be2ab20f authored by Harshad Ulhas Dhabu's avatar Harshad Ulhas Dhabu Committed by Md Shahriar Hossain Sajib
Browse files

Add new resource for time delay of CLCC polling

Bug: 143946839
Bug: 199827901
Test: gd/cert/run
Tag: #feature

Change-Id: If0c20f08fe8240ef6b0c0ff8c2711ebc758e0bb9
(cherry picked from commit da005aaaf41f80fad20d38b22266d2b1459c171b)
parent b57d03c6
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -125,6 +125,9 @@
    <!-- Flag whether or not to keep polling AG with CLCC for call information every 2 seconds -->
    <bool name="hfp_clcc_poll_during_call">true</bool>

    <!-- Time delay in milliseconds between consecutive polling AG with CLCC for call info -->
    <integer name="hfp_clcc_poll_interval_during_call">2000</integer>

    <!-- Package that is providing the exposure notification service -->
    <string name="exposure_notification_package">com.google.android.gms</string>

+13 −4
Original line number Diff line number Diff line
@@ -483,7 +483,9 @@ public class HeadsetClientStateMachine extends StateMachine {

        if (mCalls.size() > 0) {
            if (mService.getResources().getBoolean(R.bool.hfp_clcc_poll_during_call)) {
                sendMessageDelayed(QUERY_CURRENT_CALLS, QUERY_CURRENT_CALLS_WAIT_MILLIS);
                sendMessageDelayed(QUERY_CURRENT_CALLS,
                        mService.getResources().getInteger(
                        R.integer.hfp_clcc_poll_interval_during_call));
            } else {
                if (getCall(BluetoothHeadsetClientCall.CALL_STATE_INCOMING) != null) {
                    logD("Still have incoming call; polling");
@@ -1330,9 +1332,16 @@ public class HeadsetClientStateMachine extends StateMachine {
                    break;
                case QUERY_CURRENT_CALLS:
                    removeMessages(QUERY_CURRENT_CALLS);
                    if (mCalls.size() > 0) {
                    // If there are ongoing calls periodically check their status.
                        sendMessageDelayed(QUERY_CURRENT_CALLS, QUERY_CURRENT_CALLS_WAIT_MILLIS);
                    if (mCalls.size() > 1
                            && mService.getResources().getBoolean(
                            R.bool.hfp_clcc_poll_during_call)) {
                        sendMessageDelayed(QUERY_CURRENT_CALLS,
                                mService.getResources().getInteger(
                                R.integer.hfp_clcc_poll_interval_during_call));
                    } else if (mCalls.size() > 0) {
                        sendMessageDelayed(QUERY_CURRENT_CALLS,
                                QUERY_CURRENT_CALLS_WAIT_MILLIS);
                    }
                    queryCallsStart();
                    break;
+2 −0
Original line number Diff line number Diff line
@@ -83,6 +83,8 @@ public class HeadsetClientStateMachineTest {
                mAudioManager);
        when(mHeadsetClientService.getResources()).thenReturn(mMockHfpResources);
        when(mMockHfpResources.getBoolean(R.bool.hfp_clcc_poll_during_call)).thenReturn(true);
        when(mMockHfpResources.getInteger(R.integer.hfp_clcc_poll_interval_during_call))
                .thenReturn(2000);
        mNativeInterface = spy(NativeInterface.getInstance());

        // This line must be called to make sure relevant objects are initialized properly