element-hq / riot-android

A glossy Matrix collaboration client for Android
Apache License 2.0
1.4k stars 394 forks source link

Incoming call notification eternal #2453

Open dva-re opened 6 years ago

dva-re commented 6 years ago

If someone calls me and I start talking on the PC, and at this point, Android receives the event about the call with a little delay, the notification remains forever.

screenshot_20180720-123348

on develop build G-b2266 Android 7.1.2 room is encrypted.

bmarty commented 6 years ago

Hi @dva-re thanks, we will invertigate

dva-re commented 6 years ago

Android 8.0 too

danry25 commented 6 years ago

I've run into this bug on an LG V30 running Android 8.0, the notification of an incoming call cannot be dismissed (even if you accepted or rejected the call). I have to kill Riot to get rid of the notification in the main pulldown menu.

bmarty commented 6 years ago

Not sure I will have time to handle this, but I will do my best

kristbaum commented 5 years ago

I can confirm this happens on the F-Droid version, does it happen on the Google version too?

lascapi commented 5 years ago

Same issue on LineageOs, with Riot from fdroid without Google Play services !

Screenshot_20190720-192947

danry25 commented 5 years ago

@lascapi F-Droid's version of Riot is quite a bit behind what is in Google Play IIRC, it has not been updated since 2019-04-26. Sideloading a newer build wouldn't be the worst idea, this issue of unmaintained apps in F-Droid is quite common.

GammaPi commented 5 years ago

Found the same issue on my device (Latest F-Droid Version 0.9.4). This will happen in two cases:

  1. There is a missing call
  2. Have multiple phones, but only pick up the call in one phone.
GammaPi commented 5 years ago

I inspected some code and found the pull request doesn't work. But I do find more details about this bug.

The notification starts from here [Call service] (https://github.com/vector-im/riot-android/blob/c93e3a7f047a5919ae8a0c973af065222404e340/vector/src/main/java/im/vector/services/CallService.kt)

        fun onIncomingCall(context: Context,
                           isVideo: Boolean,
                           roomName: String,
                           roomId: String,
                           matrixId: String,
                           callId: String) {
            val intent = Intent(context, CallService::class.java)
                    .apply {
                        action = ACTION_INCOMING_CALL
                        putExtra(EXTRA_IS_VIDEO, isVideo)
                        putExtra(EXTRA_ROOM_NAME, roomName)
                        putExtra(EXTRA_ROOM_ID, roomId)
                        putExtra(EXTRA_MATRIX_ID, matrixId)
                        putExtra(EXTRA_CALL_ID, callId)
                    }

            ContextCompat.startForegroundService(context, intent)

The problem is. If there was an incoming call but has already been cancelled, riot-android will still think it's an incoming call and this function will be called. But now other mechanisms used to stop this notification service will not work when the app is in background.

So the way to solve this is try to distinguish past incoming call request and real incoming call request.

GammaPi commented 5 years ago

I tried to make some changes in the code, and managed to fix this notification in EventStreamService.kt by checking whether there is such notification displayed but the activecall object in CallsManager.java is null (which means no active call but this notification call still displays).

However, such fix doesn't fix all the problem. If I do this, there will be no notification about unanswered call.

The expected behaviour would be:

  1. When there's an incoming call, display a incoming call notification that is not dismissible.
  2. From the call ringing to ending, the persist incoming call notification needs to be displayed.
  3. If the call is unanswered by the user, the persist incoming call notification should be removed and the app should display an non-persistant Call answered notification. 4.If riot-android find incoming call has ended before it gets the call, it should display an unanswered call notification immediately.