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

Commit a79810b5 authored by Yorke Lee's avatar Yorke Lee
Browse files

Don't call TelephonyNotifyCallState from DefaultPhoneNotifier anymore

Telecom now sends out this consolidated call state so this  method is now
unnecessary.

Bug: 17553837
Change-Id: I76f67939a35add5f84f1e7f9d5727d2537a70e09
parent f3e102d8
Loading
Loading
Loading
Loading
+0 −41
Original line number Diff line number Diff line
@@ -70,47 +70,6 @@ public class DefaultPhoneNotifier implements PhoneNotifier {
        } catch (RemoteException ex) {
            // system process is dead
        }
        notifyCallStateToTelephonyRegistry(sender);
    }

    /*
     *  Suppose, some third party app e.g. FM app registers for a call state changed indication
     *  through TelephonyManager/PhoneStateListener and an incoming call is received on sub1 or
     *  sub2. Then ir-respective of sub1/sub2 FM app should be informed of call state
     *  changed(onCallStateChanged()) indication so that FM app can be paused.
     *  Hence send consolidated call state information to apps. (i.e. sub1 or sub2 active
     *  call state,  in priority order RINGING > OFFHOOK > IDLE)
     */
    public void notifyCallStateToTelephonyRegistry(Phone sender) {
        Call ringingCall = null;
        CallManager cm = CallManager.getInstance();
        PhoneConstants.State state = sender.getState();
        String incomingNumber = "";
        for (Phone phone : cm.getAllPhones()) {
            if (phone.getState() == PhoneConstants.State.RINGING) {
                ringingCall = phone.getRingingCall();
                if (ringingCall != null && ringingCall.getEarliestConnection() != null) {
                    incomingNumber = ringingCall.getEarliestConnection().getAddress();
                }
                sender = phone;
                state = PhoneConstants.State.RINGING;
                break;
            } else if (phone.getState() == PhoneConstants.State.OFFHOOK) {
                if (state == PhoneConstants.State.IDLE) {
                    state = PhoneConstants.State.OFFHOOK;
                    sender = phone;
                }
            }
        }
        if (DBG) log("notifyCallStateToTelephonyRegistry, subId = " + sender.getSubId()
                + " state = " + state);
        try {
            if (mRegistry != null) {
                mRegistry.notifyCallState(convertCallState(state), incomingNumber);
            }
        } catch (RemoteException ex) {
            // system process is dead
        }
    }

    @Override