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

Commit bd315836 authored by Shishir Agrawal's avatar Shishir Agrawal
Browse files

Adding slotId to certain Telephony broadcasts.

These particular boradcasts need to expose phoneId since they are valid even
when there is no SIM.

ACTION_SERVICE_STATE_CHANGED
  - Added phoneId to broadcast.
  - Removed TelephonyRegistry non subId call.
ACTION_SIGNAL_STRENGTH_CHANGED
  - Added phoneId to broadcast.
  - Removed TelephonyRegistry non subId call.
ACTION_PHONE_STATE_CHANGED
  - Added phoneId to broadcast.
  - The non-subId version is called by Telecomm to communicate overall state.
    Telephony sends its own version, so only the Telephony call needs to add
    phoneId.

Bug: 27378995
Change-Id: Ib24ea6accc265170c5d3938e2cb2c518edfcf8a8
parent f83b2ff8
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");
    }