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

Commit 2707808f authored by Shishir Agrawal's avatar Shishir Agrawal Committed by Android (Google) Code Review
Browse files

Merge "Adding slotId to certain Telephony broadcasts." into nyc-dev

parents 13568574 bd315836
Loading
Loading
Loading
Loading
+6 −3
Original line number Diff line number Diff line
@@ -56,13 +56,14 @@ public class DefaultPhoneNotifier implements PhoneNotifier {
    public void notifyPhoneState(Phone sender) {
        Call ringingCall = sender.getRingingCall();
        int subId = sender.getSubId();
        int phoneId = sender.getPhoneId();
        String incomingNumber = "";
        if (ringingCall != null && ringingCall.getEarliestConnection() != null) {
            incomingNumber = ringingCall.getEarliestConnection().getAddress();
        }
        try {
            if (mRegistry != null) {
                  mRegistry.notifyCallStateForSubscriber(subId,
                  mRegistry.notifyCallStateForPhoneId(phoneId, subId,
                        convertCallState(sender.getState()), incomingNumber);
            }
        } catch (RemoteException ex) {
@@ -93,6 +94,7 @@ public class DefaultPhoneNotifier implements PhoneNotifier {

    @Override
    public void notifySignalStrength(Phone sender) {
        int phoneId = sender.getPhoneId();
        int subId = sender.getSubId();
        if (DBG) {
            // too chatty to log constantly
@@ -101,7 +103,8 @@ public class DefaultPhoneNotifier implements PhoneNotifier {
        }
        try {
            if (mRegistry != null) {
                mRegistry.notifySignalStrengthForSubscriber(subId, sender.getSignalStrength());
                mRegistry.notifySignalStrengthForPhoneId(phoneId, subId,
                        sender.getSignalStrength());
            }
        } catch (RemoteException ex) {
            // system process is dead
+3 −2
Original line number Diff line number Diff line
@@ -108,13 +108,14 @@ public class DefaultPhoneNotifierTest extends TelephonyTest {
                ArgumentCaptor.forClass(SignalStrength.class);

        mDefaultPhoneNotifierUT.notifySignalStrength(mPhone);
        verify(mTelephonyRegisteryMock).notifySignalStrengthForSubscriber(eq(0),
        verify(mTelephonyRegisteryMock).notifySignalStrengthForPhoneId(eq(0), eq(0),
                signalStrengthArgumentCaptor.capture());
        assertEquals(99, signalStrengthArgumentCaptor.getValue().getGsmSignalStrength());

        doReturn(1).when(mPhone).getSubId();
        doReturn(2).when(mPhone).getPhoneId();
        mDefaultPhoneNotifierUT.notifySignalStrength(mPhone);
        verify(mTelephonyRegisteryMock).notifySignalStrengthForSubscriber(eq(1),
        verify(mTelephonyRegisteryMock).notifySignalStrengthForPhoneId(eq(2), eq(1),
                signalStrengthArgumentCaptor.capture());
        assertEquals(99, signalStrengthArgumentCaptor.getValue().getGsmSignalStrength());
    }
+4 −7
Original line number Diff line number Diff line
@@ -189,7 +189,8 @@ public class TelephonyRegistryMock extends ITelephonyRegistry.Stub {
    }

    @Override
    public void notifyCallStateForSubscriber(int subId, int state, String incomingNumber) {
    public void notifyCallStateForPhoneId(int phoneId, int subId, int state,
                String incomingNumber) {
        throw new RuntimeException("Not implemented");
    }

@@ -199,12 +200,8 @@ public class TelephonyRegistryMock extends ITelephonyRegistry.Stub {
    }

    @Override
    public void notifySignalStrength(SignalStrength signalStrength) {
        throw new RuntimeException("Not implemented");
    }

    @Override
    public void notifySignalStrengthForSubscriber(int subId, SignalStrength signalStrength) {
    public void notifySignalStrengthForPhoneId(int phoneId, int subId,
                SignalStrength signalStrength) {
        throw new RuntimeException("Not implemented");
    }