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

Commit fcb15016 authored by Srikanth Chintala's avatar Srikanth Chintala Committed by Brad Ebinger
Browse files

Emergency redial implementation

Define connection event to notify
Telecom/InCallUi about change in
account handle after redial and extra
for emergency phone handle.

Bug: 27059146
Change-Id: Ie72ab2901ec05d972204ed11f115a05b79173c1d
parent 0172ce8d
Loading
Loading
Loading
Loading
+14 −0
Original line number Diff line number Diff line
@@ -806,6 +806,8 @@ public abstract class Connection extends Conferenceable {
        public void onRttInitiationFailure(Connection c, int reason) {}
        public void onRttSessionRemotelyTerminated(Connection c) {}
        public void onRemoteRttRequest(Connection c) {}
        /** @hide */
        public void onPhoneAccountChanged(Connection c, PhoneAccountHandle pHandle) {}
    }

    /**
@@ -3043,6 +3045,18 @@ public abstract class Connection extends Conferenceable {
        }
    }

    /**
     * Notifies listeners when phone account is changed. For example, when the PhoneAccount is
     * changed due to an emergency call being redialed.
     * @param pHandle The new PhoneAccountHandle for this connection.
     * @hide
     */
    public void notifyPhoneAccountChanged(PhoneAccountHandle pHandle) {
        for (Listener l : mListeners) {
            l.onPhoneAccountChanged(this, pHandle);
        }
    }

    /**
     * Sends an event associated with this {@code Connection} with associated event extras to the
     * {@link InCallService}.
+8 −0
Original line number Diff line number Diff line
@@ -1314,6 +1314,14 @@ public abstract class ConnectionService extends Service {
                mAdapter.onRemoteRttRequest(id);
            }
        }

        @Override
        public void onPhoneAccountChanged(Connection c, PhoneAccountHandle pHandle) {
            String id = mIdByConnection.get(c);
            if (id != null) {
                mAdapter.onPhoneAccountChanged(id, pHandle);
            }
        }
    };

    /** {@inheritDoc} */
+16 −0
Original line number Diff line number Diff line
@@ -609,4 +609,20 @@ final class ConnectionServiceAdapter implements DeathRecipient {
            }
        }
    }

    /**
     * Notifies Telecom that a call's PhoneAccountHandle has changed.
     *
     * @param callId The unique ID of the call.
     * @param pHandle The new PhoneAccountHandle associated with the call.
     */
    void onPhoneAccountChanged(String callId, PhoneAccountHandle pHandle) {
        for (IConnectionServiceAdapter adapter : mAdapters) {
            try {
                Log.d(this, "onPhoneAccountChanged %s", callId);
                adapter.onPhoneAccountChanged(callId, pHandle, Log.getExternalSession());
            } catch (RemoteException ignored) {
            }
        }
    }
}
+20 −0
Original line number Diff line number Diff line
@@ -72,6 +72,7 @@ final class ConnectionServiceAdapterServant {
    private static final int MSG_ON_RTT_INITIATION_FAILURE = 31;
    private static final int MSG_ON_RTT_REMOTELY_TERMINATED = 32;
    private static final int MSG_ON_RTT_UPGRADE_REQUEST = 33;
    private static final int MSG_SET_PHONE_ACCOUNT_CHANGED = 34;

    private final IConnectionServiceAdapter mDelegate;

@@ -318,6 +319,16 @@ final class ConnectionServiceAdapterServant {
                case MSG_ON_RTT_UPGRADE_REQUEST:
                    mDelegate.onRemoteRttRequest((String) msg.obj, null /*Session.Info*/);
                    break;
                case MSG_SET_PHONE_ACCOUNT_CHANGED: {
                    SomeArgs args = (SomeArgs) msg.obj;
                    try {
                        mDelegate.onPhoneAccountChanged((String) args.arg1,
                                (PhoneAccountHandle) args.arg2, null /*Session.Info*/);
                    } finally {
                        args.recycle();
                    }
                    break;
                }
            }
        }
    };
@@ -581,6 +592,15 @@ final class ConnectionServiceAdapterServant {
                throws RemoteException {
            mHandler.obtainMessage(MSG_ON_RTT_UPGRADE_REQUEST, connectionId).sendToTarget();
        }

        @Override
        public void onPhoneAccountChanged(String callId, PhoneAccountHandle pHandle,
                Session.Info sessionInfo) {
            SomeArgs args = SomeArgs.obtain();
            args.arg1 = callId;
            args.arg2 = pHandle;
            mHandler.obtainMessage(MSG_SET_PHONE_ACCOUNT_CHANGED, args).sendToTarget();
        }
    };

    public ConnectionServiceAdapterServant(IConnectionServiceAdapter delegate) {
+5 −0
Original line number Diff line number Diff line
@@ -207,6 +207,11 @@ final class RemoteConnectionService {
            // in the underlying connection or conference objects
        }

        @Override
        public void onPhoneAccountChanged(String callId, PhoneAccountHandle pHandle,
                Session.Info sessionInfo) {
        }

        @Override
        public void addConferenceCall(
                final String callId, ParcelableConference parcel, Session.Info sessionInfo) {
Loading