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

Commit 6b258fa4 authored by Ravindra Thattahalli Javaraiah's avatar Ravindra Thattahalli Javaraiah Committed by Ricardo Cerqueira
Browse files

Display Supplementary Service Notification

New interface added to support supplementary service notification
messages.

Conflicts:
telecomm/java/android/telecom/Connection.java
telecomm/java/android/telecom/ConnectionService.java
telecomm/java/android/telecom/ParcelableCall.java
Change-Id: I13dc423873e474b87f614ee2473bd997d6d48ffc
parent 2ec3d353
Loading
Loading
Loading
Loading
+15 −0
Original line number Diff line number Diff line
@@ -387,6 +387,8 @@ public final class Call {
    private String mRemainingPostDialSequence;
    private InCallService.VideoCall mVideoCall;
    private Details mDetails;
    private int mNotificationType;
    private int mNotificationCode;

    /**
     * Obtains the post-dial sequence remaining to be emitted by this {@code Call}, if any.
@@ -398,6 +400,16 @@ public final class Call {
        return mRemainingPostDialSequence;
    }

    /** @hide */
    public int getNotificationType() {
        return mNotificationType;
    }

    /** @hide */
    public int getNotificationCode() {
        return mNotificationCode;
    }

    /**
     * Instructs this {@link #STATE_RINGING} {@code Call} to answer.
     * @param videoState The video state in which to answer the call.
@@ -667,6 +679,9 @@ public final class Call {
            mDetails = details;
        }

        mNotificationType = parcelableCall.getNotificationType();
        mNotificationCode = parcelableCall.getNotificationCode();

        boolean cannedTextResponsesChanged = false;
        if (mCannedTextResponses == null && parcelableCall.getCannedSmsResponses() != null
                && !parcelableCall.getCannedSmsResponses().isEmpty()) {
+9 −0
Original line number Diff line number Diff line
@@ -74,6 +74,7 @@ public abstract class Connection {
                Connection c, String callerDisplayName, int presentation) {}
        public void onVideoStateChanged(Connection c, int videoState) {}
        public void onDisconnected(Connection c, DisconnectCause disconnectCause) {}
        public void onSsNotificationData(int type, int code) {}
        public void onPostDialWait(Connection c, String remaining) {}
        public void onRingbackRequested(Connection c, boolean ringback) {}
        public void onDestroyed(Connection c) {}
@@ -780,6 +781,14 @@ public abstract class Connection {
        }
    }

    /** @hide */
    public final void setSsNotificationData(int type, int code) {
        Log.d(this, "setSsNotificationData = "+ type +" "+ code);
        for (Listener l : mListeners) {
            l.onSsNotificationData(type, code);
        }
    }

    /**
     * TODO: Needs documentation.
     */
+17 −1
Original line number Diff line number Diff line
@@ -85,6 +85,8 @@ public abstract class ConnectionService extends Service {
            new RemoteConnectionManager(this);
    private final List<Runnable> mPreInitializationConnectionRequests = new ArrayList<>();
    private final ConnectionServiceAdapter mAdapter = new ConnectionServiceAdapter();
    private int mSsNotificationType = 0xFF;
    private int mSsNotificationCode = 0xFF;

    private boolean mAreAccountsInitialized = false;
    private Conference sNullConference;
@@ -417,7 +419,15 @@ public abstract class ConnectionService extends Service {
        public void onDisconnected(Connection c, DisconnectCause disconnectCause) {
            String id = mIdByConnection.get(c);
            Log.d(this, "Adapter set disconnected %s", disconnectCause);
            if (mSsNotificationType == 0xFF && mSsNotificationCode == 0xFF) {
                mAdapter.setDisconnected(id, disconnectCause);
            } else {
                mAdapter.setDisconnectedWithSsNotification(id, disconnectCause.getCode(),
                        disconnectCause.getReason(),
                        mSsNotificationType, mSsNotificationCode);
                mSsNotificationType = 0xFF;
                mSsNotificationCode = 0xFF;
            }
        }

        @Override
@@ -504,6 +514,12 @@ public abstract class ConnectionService extends Service {
                mAdapter.setIsConferenced(id, conferenceId);
            }
        }

        @Override
        public void onSsNotificationData(int type, int code) {
            mSsNotificationType = type;
            mSsNotificationCode = code;
        }
    };

    /** {@inheritDoc} */
+21 −0
Original line number Diff line number Diff line
@@ -146,6 +146,27 @@ final class ConnectionServiceAdapter implements DeathRecipient {
        }
    }

     /**
     * Sets a call's state to disconnected.
     *
     * @param callId The unique ID of the call whose state is changing to disconnected.
     * @param disconnectCause The reason for the disconnection, any of
     *            {@link android.telephony.DisconnectCause}.
     * @param disconnectMessage Optional call-service-provided message about the disconnect.
     * @param type Supplementary service notification type
     * @param code Supplementary service notification code
     */
    void setDisconnectedWithSsNotification(String callId, int disconnectCause,
            String disconnectMessage, int type, int code) {
        for (IConnectionServiceAdapter adapter : mAdapters) {
            try {
                adapter.setDisconnectedWithSsNotification(callId, disconnectCause,
                        disconnectMessage, type, code);
            } catch (RemoteException e) {
            }
        }
    }

    /**
     * Sets a call's state to be on hold.
     *
+26 −0
Original line number Diff line number Diff line
@@ -57,6 +57,7 @@ final class ConnectionServiceAdapterServant {
    private static final int MSG_SET_ADDRESS = 18;
    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 final IConnectionServiceAdapter mDelegate;

@@ -102,6 +103,17 @@ final class ConnectionServiceAdapterServant {
                    }
                    break;
                }
                case MSG_SET_DISCONNECTED_WITH_SUPP_NOTIFICATION: {
                    SomeArgs args = (SomeArgs) msg.obj;
                    try {
                        mDelegate.setDisconnectedWithSsNotification(
                                (String) args.arg1, args.argi1, (String) args.arg2,
                                 args.argi2, args.argi3);
                    } finally {
                        args.recycle();
                    }
                    break;
                }
                case MSG_SET_ON_HOLD:
                    mDelegate.setOnHold((String) msg.obj);
                    break;
@@ -240,6 +252,20 @@ final class ConnectionServiceAdapterServant {
            mHandler.obtainMessage(MSG_SET_DISCONNECTED, args).sendToTarget();
        }

        @Override
        public void setDisconnectedWithSsNotification(
                String connectionId, int disconnectCause, String disconnectMessage,
                        int type, int code) {
            SomeArgs args = SomeArgs.obtain();
            args.arg1 = connectionId;
            args.arg2 = disconnectMessage;
            args.argi1 = disconnectCause;
            args.argi2 = type;
            args.argi3 = code;
            mHandler.obtainMessage(MSG_SET_DISCONNECTED_WITH_SUPP_NOTIFICATION,
                    args).sendToTarget();
        }

        @Override
        public void setOnHold(String connectionId) {
            mHandler.obtainMessage(MSG_SET_ON_HOLD, connectionId).sendToTarget();
Loading