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

Commit 9197be2c authored by Hwayoung Helen Kim's avatar Hwayoung Helen Kim Committed by Android (Google) Code Review
Browse files

Merge "Update NotifyAnbr Api to deliver the unsol message to framework"

parents 61c50cbe 30f9f418
Loading
Loading
Loading
Loading
+0 −12
Original line number Diff line number Diff line
@@ -2994,18 +2994,6 @@ public interface CommandsInterface {
     */
    default void sendAnbrQuery(int mediaType, int direction, int bitsPerSecond, Message result) {}

    /**
     * Notifies the recommended bit rate for the indicated logical channel and direction.
     *
     * @param mediaType MediaType is used to identify media stream such as audio or video.
     * @param direction Direction of this packet stream (e.g. uplink or downlink).
     * @param bitsPerSecond The recommended bit rate for the UE for a specific logical channel and
     *        a specific direction by NW.
     * @param result Callback message to receive the result.
     */
    default void triggerNotifyAnbr(int mediaType, int direction, int bitsPerSecond,
                Message result) {}

    /**
     * Set the UE's ability to accept/reject null ciphered and/or null integrity-protected
     * connections.
+5 −2
Original line number Diff line number Diff line
@@ -472,6 +472,7 @@ public class GsmCdmaPhone extends Phone {
        mCi.registerForCarrierInfoForImsiEncryption(this,
                EVENT_RESET_CARRIER_KEY_IMSI_ENCRYPTION, null);
        mCi.registerForTriggerImsDeregistration(this, EVENT_IMS_DEREGISTRATION_TRIGGERED, null);
        mCi.registerForNotifyAnbr(this, EVENT_TRIGGER_NOTIFY_ANBR, null);
        IntentFilter filter = new IntentFilter(
                CarrierConfigManager.ACTION_CARRIER_CONFIG_CHANGED);
        filter.addAction(TelecomManager.ACTION_CURRENT_TTY_MODE_CHANGED);
@@ -3466,9 +3467,11 @@ public class GsmCdmaPhone extends Phone {
                logd("EVENT_TRIGGER_NOTIFY_ANBR");
                ar = (AsyncResult) msg.obj;
                if (ar.exception == null) {
                    if (mImsPhone != null) {
                        mImsPhone.triggerNotifyAnbr(((int[]) ar.result)[0], ((int[]) ar.result)[1],
                                ((int[]) ar.result)[2]);
                    }
                }
                break;
            default:
                super.handleMessage(msg);
+0 −1
Original line number Diff line number Diff line
@@ -5000,7 +5000,6 @@ public abstract class Phone extends Handler implements PhoneInternalInterface {
     *        a specific direction by NW.
     */
    public void triggerNotifyAnbr(int mediaType, int direction, int bitsPerSecond) {
        mCi.triggerNotifyAnbr(mediaType, direction, bitsPerSecond, null);
    }

    /**
+5 −1
Original line number Diff line number Diff line
@@ -4398,8 +4398,10 @@ public class ImsPhoneCallTracker extends CallTracker implements ImsPullCall {
        @Override
        public void onCallSessionSendAnbrQuery(ImsCall imsCall, int mediaType, int direction,
                int bitsPerSecond) {
            if (DBG) {
                log("onCallSessionSendAnbrQuery mediaType=" + mediaType + ", direction="
                    + direction + ", bitPerSecond=" + bitsPerSecond);
            }
            handleSendAnbrQuery(mediaType, direction, bitsPerSecond);
        }
    };
@@ -5940,6 +5942,7 @@ public class ImsPhoneCallTracker extends CallTracker implements ImsPullCall {

    /** Send the mediaType, direction, bitrate for ANBR Query to the radio */
    public void handleSendAnbrQuery(int mediaType, int direction, int bitsPerSecond) {
        if (DBG) log("handleSendAnbrQuery - mediaType=" + mediaType);
        mPhone.getDefaultPhone().mCi.sendAnbrQuery(mediaType, direction, bitsPerSecond, null);
    }

@@ -5956,6 +5959,7 @@ public class ImsPhoneCallTracker extends CallTracker implements ImsPullCall {
        ImsCall activeCall = mForegroundCall.getFirstConnection().getImsCall();

        if (activeCall != null) {
            if (DBG) log("triggerNotifyAnbr - mediaType=" + mediaType);
            activeCall.callSessionNotifyAnbr(mediaType, direction, bitsPerSecond);
        }
    }
+42 −0
Original line number Diff line number Diff line
@@ -121,6 +121,7 @@ import com.android.internal.telephony.CallStateException;
import com.android.internal.telephony.CommandsInterface;
import com.android.internal.telephony.Connection;
import com.android.internal.telephony.IccCardConstants;
import com.android.internal.telephony.Phone;
import com.android.internal.telephony.PhoneConstants;
import com.android.internal.telephony.SrvccConnection;
import com.android.internal.telephony.TelephonyTest;
@@ -169,6 +170,7 @@ public class ImsPhoneCallTrackerTest extends TelephonyTest {
    private ImsPhoneConnection mImsPhoneConnection;
    private INetworkStatsProviderCallback mVtDataUsageProviderCb;
    private ImsPhoneCallTracker.ConnectorFactory mConnectorFactory;
    private CommandsInterface mMockCi;

    private final Executor mExecutor = Runnable::run;

@@ -229,6 +231,7 @@ public class ImsPhoneCallTrackerTest extends TelephonyTest {
        mSecondImsCall = spy(new ImsCall(mContext, mImsCallProfile));
        mImsPhoneConnectionListener = mock(ImsPhoneConnection.Listener.class);
        mImsPhoneConnection = mock(ImsPhoneConnection.class);
        mMockCi = mock(CommandsInterface.class);
        imsCallMocking(mImsCall);
        imsCallMocking(mSecondImsCall);
        doReturn(ImsFeature.STATE_READY).when(mImsManager).getImsServiceState();
@@ -1458,6 +1461,45 @@ public class ImsPhoneCallTrackerTest extends TelephonyTest {
        verify(mImsPhone, never()).startOnHoldTone(nullable(Connection.class));
    }

    @Test
    @SmallTest
    public void testSendAnbrQuery() throws Exception {
        logd("ImsPhoneCallTracker testSendAnbrQuery");

        replaceInstance(Phone.class, "mCi", mPhone, mMockCi);
        //establish a MT call
        testImsMTCallAccept();

        ImsPhoneConnection connection = mCTUT.mForegroundCall.getFirstConnection();
        ImsCall imsCall = connection.getImsCall();
        imsCall.getImsCallSessionListenerProxy().callSessionSendAnbrQuery(1, 1, 24400);

        verify(mMockCi, times(1)).sendAnbrQuery(eq(1), eq(1), eq(24400), any());

        // Disconnecting and then Disconnected
        mCTUT.hangup(connection);
        mImsCallListener.onCallTerminated(imsCall,
                new ImsReasonInfo(ImsReasonInfo.CODE_USER_TERMINATED, 0));
    }

    @Test
    @SmallTest
    public void testTriggerNotifyAnbr() throws Exception {
        logd("ImsPhoneCallTracker testTriggerNotifyAnbr");

        testImsMTCallAccept();
        ImsPhoneConnection connection = mCTUT.mForegroundCall.getFirstConnection();
        ImsCall imsCall = connection.getImsCall();

        mCTUT.triggerNotifyAnbr(1, 1, 24400);
        verify(mImsCall, times(1)).callSessionNotifyAnbr(eq(1), eq(1), eq(24400));

        // Disconnecting and then Disconnected
        mCTUT.hangup(connection);
        mImsCallListener.onCallTerminated(imsCall,
                new ImsReasonInfo(ImsReasonInfo.CODE_USER_TERMINATED, 0));
    }

    /**
     * Verifies that a remote hold tone is played when the call is remotely held and the media
     * direction is inactive (i.e. the audio stream is not playing, so we should play the tone).