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

Commit 99a39bd3 authored by Sandeep Gutta's avatar Sandeep Gutta Committed by Ricardo Cerqueira
Browse files

MSIM: Interface changes to set phoneaccount

Interface changes to set the phone account handle
in emergency call scenario.

Conflicts:
        telecomm/java/android/telecom/Connection.java
        telecomm/java/com/android/internal/telecom/IConnectionServiceAdapter.aidl

Change-Id: I7b5ff58b5667e3c04f58bb586e1a4590d2fcfe7f
CRs-Fixed: 722205
parent 7fd2ff30
Loading
Loading
Loading
Loading
+19 −0
Original line number Diff line number Diff line
@@ -86,6 +86,7 @@ public abstract class Connection {
        public void onConferenceableConnectionsChanged(
                Connection c, List<Connection> conferenceableConnections) {}
        public void onConferenceChanged(Connection c, Conference conference) {}
        public void onPhoneAccountChanged(Connection c, PhoneAccountHandle pHandle) {}
    }

    /** @hide */
@@ -479,6 +480,7 @@ public abstract class Connection {
    private DisconnectCause mDisconnectCause;
    private Conference mConference;
    private ConnectionService mConnectionService;
    private PhoneAccountHandle mPhoneAccountHandle = null;

    /**
     * Create a new Connection.
@@ -886,6 +888,23 @@ public abstract class Connection {
    }

    /**
     * @hide.
     */
    public final void setPhoneAccountHandle(PhoneAccountHandle pHandle) {
        mPhoneAccountHandle = pHandle;
        for (Listener l : mListeners) {
            l.onPhoneAccountChanged(this, pHandle);
        }
    }

    /**
     * @hide.
     */
    public final PhoneAccountHandle getPhoneAccountHandle() {
        return mPhoneAccountHandle;
    }

    /*
     * @hide
     */
    public final void setConnectionService(ConnectionService connectionService) {
+20 −1
Original line number Diff line number Diff line
@@ -520,6 +520,13 @@ public abstract class ConnectionService extends Service {
            mSsNotificationType = type;
            mSsNotificationCode = code;
        }

        @Override
        public void onPhoneAccountChanged(Connection c, PhoneAccountHandle pHandle) {
            String id = mIdByConnection.get(c);
            Log.i(this, "Adapter onPhoneAccountChanged %s, %s", c, pHandle);
            mAdapter.setPhoneAccountHandle(id, pHandle);
        }
    };

    /** {@inheritDoc} */
@@ -575,7 +582,7 @@ public abstract class ConnectionService extends Service {
                callId,
                request,
                new ParcelableConnection(
                        request.getAccountHandle(),
                        getAccountHandle(request, connection),
                        connection.getState(),
                        connection.getCallCapabilities(),
                        connection.getAddress(),
@@ -592,6 +599,18 @@ public abstract class ConnectionService extends Service {
                        createConnectionIdList(connection.getConferenceableConnections())));
    }

    /** @hide */
    public PhoneAccountHandle getAccountHandle(
            final ConnectionRequest request, Connection connection) {
        PhoneAccountHandle pHandle = connection.getPhoneAccountHandle();
        if (pHandle != null) {
            Log.i(this, "getAccountHandle, return account handle from local, %s", pHandle);
            return pHandle;
        } else {
            return request.getAccountHandle();
        }
    }

    private void abort(String callId) {
        Log.d(this, "abort %s", callId);
        findConnectionForAction(callId, "abort").onAbort();
+10 −0
Original line number Diff line number Diff line
@@ -365,4 +365,14 @@ final class ConnectionServiceAdapter implements DeathRecipient {
            }
        }
    }

    void setPhoneAccountHandle(String callId, PhoneAccountHandle pHandle) {
        Log.v(this, "setPhoneAccountHandle: %s, %s", callId, pHandle);
        for (IConnectionServiceAdapter adapter : mAdapters) {
            try {
                adapter.setPhoneAccountHandle(callId, pHandle);
            } catch (RemoteException ignored) {
            }
        }
    }
}
+19 −0
Original line number Diff line number Diff line
@@ -58,6 +58,7 @@ final class ConnectionServiceAdapterServant {
    private static final int MSG_SET_CALLER_DISPLAY_NAME = 19;
    private static final int MSG_SET_CONFERENCEABLE_CONNECTIONS = 20;
    private static final int MSG_SET_DISCONNECTED_WITH_SUPP_NOTIFICATION = 21;
    private static final int MSG_SET_PHONE_ACCOUNT = 22;

    private final IConnectionServiceAdapter mDelegate;

@@ -211,6 +212,16 @@ final class ConnectionServiceAdapterServant {
                    }
                    break;
                }
                case MSG_SET_PHONE_ACCOUNT: {
                    SomeArgs args = (SomeArgs) msg.obj;
                    try {
                        mDelegate.setPhoneAccountHandle(
                                (String) args.arg1, (PhoneAccountHandle) args.arg2);
                    } finally {
                        args.recycle();
                    }
                    break;
                }
            }
        }
    };
@@ -371,6 +382,14 @@ final class ConnectionServiceAdapterServant {
            args.arg2 = conferenceableConnectionIds;
            mHandler.obtainMessage(MSG_SET_CONFERENCEABLE_CONNECTIONS, args).sendToTarget();
        }

        @Override
        public final void setPhoneAccountHandle(String connectionId, PhoneAccountHandle pHandle) {
            SomeArgs args = SomeArgs.obtain();
            args.arg1 = connectionId;
            args.arg2 = pHandle;
            mHandler.obtainMessage(MSG_SET_PHONE_ACCOUNT, args).sendToTarget();
        }
    };

    public ConnectionServiceAdapterServant(IConnectionServiceAdapter delegate) {
+12 −0
Original line number Diff line number Diff line
@@ -191,6 +191,11 @@ public final class RemoteConnection {
        public void onConferenceChanged(
                RemoteConnection connection,
                RemoteConference conference) {}

        /** @hide */
        public void setPhoneAccountHandle(
                RemoteConnection connection,
                PhoneAccountHandle pHandle) {}
    }

    /** {@hide} */
@@ -899,6 +904,13 @@ public final class RemoteConnection {
        }
    }

    /** @hide */
    void setPhoneAccountHandle(PhoneAccountHandle pHandle) {
        for (Listener l : mListeners) {
            l.setPhoneAccountHandle(this, pHandle);
        }
    }

    /**
     * Create a RemoteConnection represents a failure, and which will be in
     * {@link Connection#STATE_DISCONNECTED}. Attempting to use it for anything will almost
Loading