Fix "isInCallWithVideo()" check

The call flags should be checked using bitwise operators; otherwise a
call with phone ("in call | with phone" / "in call + with phone", that
is, "0001 + 1000 = 1001" or "1 + 8 = 9") would be seen as a call with
video ("in call | with video" / "in call + with video",
"0001 + 0100 = 0101" or "1 + 4 = 5"), as "9 >= 5". On the other hand,
using bitwise operators (and only checking against "with video")
succeeds only when the call flags contain "with video" (in the previous
example, "1001 and 0100 = 0000", so it does not succeed).

The "IN_CALL" flag is no longer checked, as "WITH_VIDEO" will be set
only during calls, and therefore checking for "IN_CALL" is not needed.

Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
This commit is contained in:
Daniel Calviño Sánchez 2022-11-16 12:09:25 +01:00 committed by Tim Krüger (Rebase PR Action)
parent 2f5638be68
commit b409f89616

View File

@ -350,7 +350,7 @@ class CallNotificationActivity : CallBaseActivity() {
}
private fun isInCallWithVideo(callFlag: Int): Boolean {
return callFlag >= Participant.InCallFlags.IN_CALL + Participant.InCallFlags.WITH_VIDEO
return (callFlag and Participant.InCallFlags.WITH_VIDEO) > 0
}
private fun setUpAfterConversationIsKnown() {