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

Commit 781e73bc authored by Danny Baumann's avatar Danny Baumann Committed by Gerrit Code Review
Browse files

Merge "Proper supplementary service notification handling (3/5)" into cm-12.0

parents 9bc14456 37336f0a
Loading
Loading
Loading
Loading
+19 −18
Original line number Diff line number Diff line
@@ -75,6 +75,7 @@ final class Call implements CreateConnectionResponse {
        void onRingbackRequested(Call call, boolean ringbackRequested);
        void onPostDialWait(Call call, String remaining);
        void onCallCapabilitiesChanged(Call call);
        void onCallPropertiesChanged(Call call);
        void onParentChanged(Call call);
        void onChildrenChanged(Call call);
        void onCannedSmsResponsesLoaded(Call call);
@@ -111,6 +112,8 @@ final class Call implements CreateConnectionResponse {
        @Override
        public void onCallCapabilitiesChanged(Call call) {}
        @Override
        public void onCallPropertiesChanged(Call call) {}
        @Override
        public void onParentChanged(Call call) {}
        @Override
        public void onChildrenChanged(Call call) {}
@@ -269,6 +272,7 @@ final class Call implements CreateConnectionResponse {
    private boolean mDirectToVoicemailQueryPending;

    private int mCallCapabilities;
    private int mCallProperties;

    private boolean mIsConference = false;

@@ -288,8 +292,6 @@ final class Call implements CreateConnectionResponse {
    private StatusHints mStatusHints;
    private final ConnectionServiceRepository mRepository;
    private final Context mContext;
    private int mNotificationType;
    private int mCode;
    boolean mIsActiveSub = false;

    private boolean mWasConferencePreviouslyMerged = false;
@@ -463,22 +465,6 @@ final class Call implements CreateConnectionResponse {
        return mCallerInfo == null ? null : mCallerInfo.cachedPhoto;
    }

    public void setNotificationType(int notification) {
        mNotificationType = notification;
    }

    public void setNotificationCode(int code) {
        mCode = code;
    }

    public int getNotificationType() {
        return mNotificationType;
    }

    public int getNotificationCode() {
        return mCode;
    }

    /**
     * @param disconnectCause The reason for the disconnection, represented by
     *         {@link android.telecom.DisconnectCause}.
@@ -602,6 +588,20 @@ final class Call implements CreateConnectionResponse {
        }
    }

    int getCallProperties() {
        return mCallProperties;
    }

    void setCallProperties(int callProperties) {
        Log.v(this, "setCallProperties: 0x%x", callProperties);
        if (mCallProperties != callProperties) {
            mCallProperties = callProperties;
            for (Listener l : mListeners) {
                l.onCallPropertiesChanged(this);
            }
        }
    }

    Call getParentCall() {
        return mParentCall;
    }
@@ -706,6 +706,7 @@ final class Call implements CreateConnectionResponse {
        setCallerDisplayName(
                connection.getCallerDisplayName(), connection.getCallerDisplayNamePresentation());
        setCallCapabilities(connection.getCapabilities());
        setCallProperties(connection.getProperties());
        setVideoProvider(connection.getVideoProvider());
        setVideoState(connection.getVideoState());
        setRingbackRequested(connection.isRingbackRequested());
+23 −40
Original line number Diff line number Diff line
@@ -80,8 +80,8 @@ final class ConnectionServiceWrapper extends ServiceBinder<IConnectionService> {
    private static final int MSG_SET_CALLER_DISPLAY_NAME = 18;
    private static final int MSG_SET_VIDEO_STATE = 19;
    private static final int MSG_SET_CONFERENCEABLE_CONNECTIONS = 20;
    private static final int MSG_SET_DISCONNECTED_WITH_SUPP_NOTIFICATION = 22;
    private static final int MSG_SET_PHONE_ACCOUNT = 23;
    private static final int MSG_SET_PHONE_ACCOUNT = 21;
    private static final int MSG_SET_CALL_PROPERTIES = 22;

    private final Handler mHandler = new Handler() {
        @Override
@@ -140,28 +140,6 @@ final class ConnectionServiceWrapper extends ServiceBinder<IConnectionService> {
                    }
                    break;
                }
                case MSG_SET_DISCONNECTED_WITH_SUPP_NOTIFICATION: {
                    SomeArgs args = (SomeArgs) msg.obj;
                    try {
                        call = mCallIdMapper.getCall(args.arg1);
                        String disconnectMessage = (String) args.arg2;
                        int disconnectCause = args.argi1;
                        int type = args.argi2;
                        int code = args.argi3;
                        if (call != null) {
                            call.setNotificationType(type);
                            call.setNotificationCode(code);
                            // FIXME this needs to be realigned
                            mCallsManager.markCallAsDisconnected(call,
                                    new DisconnectCause(disconnectCause));
                        } else {
                            //Log.w(this, "setDisconnected, unknown call id: %s", args.arg1);
                        }
                    } finally {
                        args.recycle();
                    }
                    break;
                }
                case MSG_SET_ON_HOLD:
                    call = mCallIdMapper.getCall(msg.obj);
                    if (call != null) {
@@ -189,6 +167,16 @@ final class ConnectionServiceWrapper extends ServiceBinder<IConnectionService> {
                    }
                    break;
                }
                case MSG_SET_CALL_PROPERTIES: {
                    call = mCallIdMapper.getCall(msg.obj);
                    if (call != null) {
                        call.setCallProperties(msg.arg1);
                    } else {
                        //Log.w(ConnectionServiceWrapper.this,
                        //      "setCallProperties, unknown call id: %s", msg.obj);
                    }
                    break;
                }
                case MSG_SET_IS_CONFERENCED: {
                    SomeArgs args = (SomeArgs) msg.obj;
                    try {
@@ -458,22 +446,6 @@ final class ConnectionServiceWrapper extends ServiceBinder<IConnectionService> {
            }
        }

        @Override
        public void setDisconnectedWithSsNotification(
                String callId, int disconnectCause, String disconnectMessage, int type, int code) {
            logIncoming("setDisconnected %s %d %s", callId, disconnectCause, disconnectMessage);
            if (mCallIdMapper.isValidCallId(callId)) {
                SomeArgs args = SomeArgs.obtain();
                args.arg1 = callId;
                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 callId) {
            logIncoming("setOnHold %s", callId);
@@ -510,6 +482,17 @@ final class ConnectionServiceWrapper extends ServiceBinder<IConnectionService> {
            }
        }

        @Override
        public void setCallProperties(String callId, int callProperties) {
            logIncoming("setCallProperties %s %x", callId, callProperties);
            if (mCallIdMapper.isValidCallId(callId) || mCallIdMapper.isValidConferenceId(callId)) {
                mHandler.obtainMessage(MSG_SET_CALL_PROPERTIES, callProperties, 0, callId)
                        .sendToTarget();
            } else {
                Log.w(this, "ID not valid for setCallProperties");
            }
        }

        @Override
        public void setIsConferenced(String callId, String conferenceCallId) {
            logIncoming("setIsConferenced %s %s", callId, conferenceCallId);
+9 −3
Original line number Diff line number Diff line
@@ -78,6 +78,11 @@ public final class InCallController extends CallsManagerListenerBase {
            updateCall(call);
        }

        @Override
        public void onCallPropertiesChanged(Call call) {
            updateCall(call);
        }

        @Override
        public void onCannedSmsResponsesLoaded(Call call) {
            updateCall(call);
@@ -438,7 +443,10 @@ public final class InCallController extends CallsManagerListenerBase {
            capabilities &= ~PhoneCapabilities.ADD_CALL;
        }

        int properties = call.isConference() ? CallProperties.CONFERENCE : 0;
        int properties = call.getCallProperties();
        if (call.isConference()) {
            properties |= CallProperties.CONFERENCE;
        }

        int state = call.getState();
        if (state == CallState.ABORTED) {
@@ -507,8 +515,6 @@ public final class InCallController extends CallsManagerListenerBase {
                call.getVideoState(),
                conferenceableCallIds,
                call.getExtras(),
                call.getNotificationType(),
                call.getNotificationCode(),
                call.mIsActiveSub);
    }