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

Commit 5894bc8a authored by Matthieu Baglin's avatar Matthieu Baglin Committed by Tyler Gunn
Browse files

Video Call Upgrade/Downgrade fixes



This is fixing multiple deficiencies affecting video call upgrade or
downgrade in the L MR1 InCallUi.

Change-Id: I61bf7efa6ac23859c900dfd059faf72184987943
Signed-off-by: default avatarMatthieu Baglin <matthieu.baglin@intel.com>
parent c4fac46c
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -258,7 +258,7 @@ public class CallButtonPresenter extends Presenter<CallButtonPresenter.CallButto
                new VideoProfile(VideoProfile.VideoState.BIDIRECTIONAL);
        videoCall.sendSessionModifyRequest(videoProfile);

        mCall.setSessionModificationState(Call.SessionModificationState.REQUEST_FAILED);
        mCall.setSessionModificationState(Call.SessionModificationState.WAITING_FOR_RESPONSE);
    }

    /**
+5 −0
Original line number Diff line number Diff line
@@ -86,9 +86,14 @@ public class InCallVideoCallListener extends VideoCall.Listener {
                VideoProfile.VideoState.isBidirectional(responseProfile.getVideoState());

        if (modifySucceeded && isVideoCall) {
            // Local Upgrade success
            InCallVideoCallListenerNotifier.getInstance().upgradeToVideoSuccess(mCall);
        } else if (!modifySucceeded || status != Connection.VideoProvider.SESSION_MODIFY_REQUEST_SUCCESS) {
            // Remote didn't accept invitation in bidirectional state or failure
            InCallVideoCallListenerNotifier.getInstance().upgradeToVideoFail(mCall);
        } else if (modifySucceeded && !isVideoCall) {
            // Local Downgrade success (should always be successful)
            InCallVideoCallListenerNotifier.getInstance().downgradeToAudio(mCall);
        }
    }

+11 −3
Original line number Diff line number Diff line
@@ -207,6 +207,14 @@ public class StatusBarNotifier implements InCallPresenter.InCallStateListener {
                (!isOutgoingWithoutIncallUi ||
                        mNotificationTimer.getState() == NotificationTimer.State.FIRED);

        // For call upgrade
        if ((call != null)
                && (call.getSessionModificationState()
                        == Call.SessionModificationState.RECEIVED_UPGRADE_TO_VIDEO_REQUEST)) {
            Log.d(this, "updateInCallNotification, notify of callupgrade to video!");
            showNotificationNow = true;
        }

        if (showNotificationNow) {
            showNotification(call);
        } else {
@@ -556,7 +564,7 @@ public class StatusBarNotifier implements InCallPresenter.InCallStateListener {
        Log.i(this, "Will show \"accept\" action in the incoming call Notification");

        PendingIntent acceptVideoPendingIntent = createNotificationPendingIntent(
                mContext, InCallApp.ACTION_ANSWER_VOICE_INCOMING_CALL);
                mContext, InCallApp.ACTION_ACCEPT_VIDEO_UPGRADE_REQUEST);
        builder.addAction(0, mContext.getText(R.string.notification_action_accept),
                acceptVideoPendingIntent);
    }
@@ -565,7 +573,7 @@ public class StatusBarNotifier implements InCallPresenter.InCallStateListener {
        Log.i(this, "Will show \"dismiss\" action in the incoming call Notification");

        PendingIntent declineVideoPendingIntent = createNotificationPendingIntent(
                mContext, InCallApp.ACTION_ANSWER_VOICE_INCOMING_CALL);
                mContext, InCallApp.ACTION_DECLINE_VIDEO_UPGRADE_REQUEST);
        builder.addAction(0, mContext.getText(R.string.notification_action_dismiss),
                declineVideoPendingIntent);
    }
+9 −1
Original line number Diff line number Diff line
@@ -173,6 +173,8 @@ public class VideoCallPresenter extends Presenter<VideoCallPresenter.VideoCallUi
        InCallPresenter.getInstance().addListener(this);
        InCallPresenter.getInstance().addIncomingCallListener(this);
        InCallPresenter.getInstance().addOrientationListener(this);
        // To get updates of video call details changes
        InCallPresenter.getInstance().addDetailsListener(this);

        // Register for surface and video events from {@link InCallVideoCallListener}s.
        InCallVideoCallListenerNotifier.getInstance().addSurfaceChangeListener(this);
@@ -443,6 +445,11 @@ public class VideoCallPresenter extends Presenter<VideoCallPresenter.VideoCallUi
        InCallPresenter.getInstance().setInCallAllowsOrientationChange(false);
        ui.showVideoUi(false);

        if (mVideoCall != null) {
            // Also disable camera otherwise it will be already in use for next upgrade
            mVideoCall.setCamera(null);
        }

        if (mPreVideoAudioMode != AudioModeProvider.AUDIO_MODE_INVALID) {
            TelecomAdapter.getInstance().setAudioRoute(mPreVideoAudioMode);
            mPreVideoAudioMode = AudioModeProvider.AUDIO_MODE_INVALID;
@@ -561,7 +568,8 @@ public class VideoCallPresenter extends Presenter<VideoCallPresenter.VideoCallUi

    @Override
    public void onDowngradeToAudio(Call call) {
        // Implementing to satsify interface.
        // exit video mode
        exitVideoMode();
    }

    /**