diff options
author | Sekine Yasuaki <yasuaki.sekine@sony.com> | 2017-07-07 17:01:56 +0900 |
---|---|---|
committer | Michael Bestas <mkbestas@lineageos.org> | 2020-05-24 20:09:50 +0300 |
commit | d1341b4f02d3ce4b4b996895d3da8e6a841bf934 (patch) | |
tree | 9c73919defb95791c8402f0ca1d6116d91705378 /java/com/android/incallui/videotech | |
parent | a0c5bdd1a071cc593e7d67f3a48274ab5f852c8b (diff) | |
download | android_packages_apps_Dialer-d1341b4f02d3ce4b4b996895d3da8e6a841bf934.tar.gz android_packages_apps_Dialer-d1341b4f02d3ce4b4b996895d3da8e6a841bf934.tar.bz2 android_packages_apps_Dialer-d1341b4f02d3ce4b4b996895d3da8e6a841bf934.zip |
Fix error case which session change request failed when pausing video
When a user clicks the pause video button, the camera close request and
the session modify request are executed at the same time. However, the
session modify request fails occasionally by a limitation of the Network
side. In that case, the video session is continued with the camera
closed state and a user cannot open the camera again due to pause video
button disabled.
Remove camera close request triggered by the pause video button clicked
because it is handled appropriately according to the result of the
session modify request. Also, enable the pause video button and show
error message to a user if receiving the error result of the session
modify request.
Test: manual
Bug: 69235524
Change-Id: I9a2dde755a6c28edfb0ce962b55ac8a6e907ca97
Diffstat (limited to 'java/com/android/incallui/videotech')
-rw-r--r-- | java/com/android/incallui/videotech/ims/ImsVideoCallCallback.java | 42 | ||||
-rw-r--r-- | java/com/android/incallui/videotech/ims/ImsVideoTech.java | 1 |
2 files changed, 25 insertions, 18 deletions
diff --git a/java/com/android/incallui/videotech/ims/ImsVideoCallCallback.java b/java/com/android/incallui/videotech/ims/ImsVideoCallCallback.java index d254d6df6..3e6f4417b 100644 --- a/java/com/android/incallui/videotech/ims/ImsVideoCallCallback.java +++ b/java/com/android/incallui/videotech/ims/ImsVideoCallCallback.java @@ -103,8 +103,6 @@ public class ImsVideoCallCallback extends VideoCall.Callback { if (videoTech.getSessionModificationState() == SessionModificationState.WAITING_FOR_UPGRADE_TO_VIDEO_RESPONSE) { - handler.removeCallbacksAndMessages(null); // Clear everything - final int newSessionModificationState = getSessionModificationStateFromTelecomStatus(status); if (status == VideoProvider.SESSION_MODIFY_REQUEST_SUCCESS) { // Telecom manages audio route for us @@ -114,31 +112,21 @@ public class ImsVideoCallCallback extends VideoCall.Callback { videoTech.setSessionModificationState(newSessionModificationState); } - // Wait for 4 seconds and then clean the session modification state. This allows the video UI - // to stay up so that the user can read the error message. - // // If the other person accepted the upgrade request then this will keep the video UI up until // the call's video state change. Without this we would switch to the voice call and then // switch back to video UI. - handler.postDelayed( - () -> { - if (videoTech.getSessionModificationState() == newSessionModificationState) { - LogUtil.i("ImsVideoCallCallback.onSessionModifyResponseReceived", "clearing state"); - videoTech.setSessionModificationState(SessionModificationState.NO_REQUEST); - } else { - LogUtil.i( - "ImsVideoCallCallback.onSessionModifyResponseReceived", - "session modification state has changed, not clearing state"); - } - }, - CLEAR_FAILED_REQUEST_TIMEOUT_MILLIS); + clearFailedResponseState(newSessionModificationState); } else if (videoTech.getSessionModificationState() == SessionModificationState.RECEIVED_UPGRADE_TO_VIDEO_REQUEST) { requestedVideoState = VideoProfile.STATE_AUDIO_ONLY; videoTech.setSessionModificationState(SessionModificationState.NO_REQUEST); } else if (videoTech.getSessionModificationState() == SessionModificationState.WAITING_FOR_RESPONSE) { - videoTech.setSessionModificationState(getSessionModificationStateFromTelecomStatus(status)); + final int newSessionModificationState = getSessionModificationStateFromTelecomStatus(status); + videoTech.setSessionModificationState(newSessionModificationState); + if (status != VideoProvider.SESSION_MODIFY_REQUEST_SUCCESS) { + clearFailedResponseState(newSessionModificationState); + } } else { LogUtil.i( "ImsVideoCallCallback.onSessionModifyResponseReceived", @@ -146,6 +134,24 @@ public class ImsVideoCallCallback extends VideoCall.Callback { } } + private void clearFailedResponseState(final int newSessionModificationState) { + handler.removeCallbacksAndMessages(null); // Clear everything + // Wait for 4 seconds and then clean the session modification state. This allows the video UI + // to stay up so that the user can read the error message. + handler.postDelayed( + () -> { + if (videoTech.getSessionModificationState() == newSessionModificationState) { + LogUtil.i("ImsVideoCallCallback.onSessionModifyResponseReceived", "clearing state"); + videoTech.setSessionModificationState(SessionModificationState.NO_REQUEST); + } else { + LogUtil.i( + "ImsVideoCallCallback.onSessionModifyResponseReceived", + "session modification state has changed, not clearing state"); + } + }, + CLEAR_FAILED_REQUEST_TIMEOUT_MILLIS); + } + @SessionModificationState private int getSessionModificationStateFromTelecomStatus(int telecomStatus) { switch (telecomStatus) { diff --git a/java/com/android/incallui/videotech/ims/ImsVideoTech.java b/java/com/android/incallui/videotech/ims/ImsVideoTech.java index 5b733d612..1d4fe769a 100644 --- a/java/com/android/incallui/videotech/ims/ImsVideoTech.java +++ b/java/com/android/incallui/videotech/ims/ImsVideoTech.java @@ -227,6 +227,7 @@ public class ImsVideoTech implements VideoTech { call.getVideoCall() .sendSessionModifyRequest( new VideoProfile(unpausedVideoState & ~VideoProfile.STATE_TX_ENABLED)); + setSessionModificationState(SessionModificationState.WAITING_FOR_RESPONSE); } @Override |