Whatsapp and Viber Incoming Call notifications not sent to Mi band #786

Open
by lazarosfs opened 4 years ago · 8 comments
lazarosfs commented 4 years ago (Migrated from github.com)
Owner

Before opening an issue please confirm the following:

  • I have read the wiki, and I didn't find a solution to my problem / an answer to my question.
  • I have searched the issues, and I didn't find a solution to my problem / an answer to my question.
  • If you upload an image or other content, please make sure you have read and understood the github policies and terms of services

Your issue is:

In case of a bug, do not forget to attach logs!

Your wearable device is: Mi Band 2 fw 0.53

Please specify model and firmware version if possible

Your android version is: 6.0.1

Your Gadgetbridge version is: 0.20.1

Whatsapp call is intercepted as notification message instead of INCOMING_CALL.
That is probably because it is not a CallState changing event

Viber is not intercepted at all, notificaton icon is completely ignored and no call notification is forwarder.
I think we have to adjust special notification filters for those apps so that specific flag notifications are to be interpreted as incoming calls. That is extra flag 24 in whatsapp. for viber i havent found it yet, so they can be notified based on incoming call profile settings.

#### Before opening an issue please confirm the following: - [x] I have read the [wiki](https://github.com/Freeyourgadget/Gadgetbridge/wiki), and I didn't find a solution to my problem / an answer to my question. - [x] I have searched the [issues](https://github.com/Freeyourgadget/Gadgetbridge/issues), and I didn't find a solution to my problem / an answer to my question. - [x] If you upload an image or other content, please make sure you have read and understood the [github policies and terms of services](https://help.github.com/articles/github-terms-of-service/#1-responsibility-for-user-generated-content) #### Your issue is: *In case of a bug, do not forget to attach logs!* #### Your wearable device is: Mi Band 2 fw 0.53 *Please specify model and firmware version if possible* #### Your android version is: 6.0.1 #### Your Gadgetbridge version is: 0.20.1 Whatsapp call is intercepted as notification message instead of INCOMING_CALL. That is probably because it is not a CallState changing event Viber is not intercepted at all, notificaton icon is completely ignored and no call notification is forwarder. I think we have to adjust special notification filters for those apps so that specific flag notifications are to be interpreted as incoming calls. That is extra flag 24 in whatsapp. for viber i havent found it yet, so they can be notified based on incoming call profile settings.
Owner

While we personally do not care about WhatsApp and Viber, we have the same problem with Signal.

The problem is there because most messengers send an "ongoing" notification" for incoming calls, which we ignore. Most "ongoing" notifications are progress bars and would cause hundereds of notifications.

I totally agree that we need special support for specific popular apps to handle this problem. For Signal and Riot chances are good that we do that, for WhatApp and Viber we would accept PRs but cannot invest work into that. We (the core team) simply do not use proprietary apps at all. That is the reason Gadgetbridge exists ;)

While we personally do not care about WhatsApp and Viber, we have the same problem with Signal. The problem is there because most messengers send an "ongoing" notification" for incoming calls, which we ignore. Most "ongoing" notifications are progress bars and would cause hundereds of notifications. I totally agree that we need special support for specific popular apps to handle this problem. For Signal and Riot chances are good that we do that, for WhatApp and Viber we would accept PRs but cannot invest work into that. We (the core team) simply do not use proprietary apps at all. That is the reason Gadgetbridge exists ;)
lazarosfs commented 4 years ago (Migrated from github.com)
Poster
Owner

The problem seems to appear when all other people use pr apps and you need to contact them but sure i get the point. I will have to look into it myself then :)

The problem seems to appear when all other people use pr apps and you need to contact them but sure i get the point. I will have to look into it myself then :)
lazarosfs commented 4 years ago (Migrated from github.com)
Poster
Owner

I have fixed the issue for whatsapp and viber calls.
To overcome the problem, I allow specific ongoing events from whatsapp and viber to add a "call" type notification and then execute a callstate change when an incoming call from these apps occurs with phonenumber as the message title.
When the phonecall is answered or ended the ongoing notification is removed and I send a new statecall change at that point with END_CALL so it works exactly as a phonecall for these type of notifications.

I only added the code to MiBand2Support so it will not work for other devices.
My sources are available link removed (it is not ok to copy or take the code unless the author adds it to the repository. This could expose the project to long term troubles related to IP rights).

I have modified also other things like starting/ending gb when bt is changed and auto dismissing notifications from the phone when they are delivered to mi band 2.
I am sorry I don;t have the time to xreate diferent branches and upload all of these.
Feel free to use my code or benefit from it.

I have fixed the issue for whatsapp and viber calls. To overcome the problem, I allow specific ongoing events from whatsapp and viber to add a "call" type notification and then execute a callstate change when an incoming call from these apps occurs with phonenumber as the message title. When the phonecall is answered or ended the ongoing notification is removed and I send a new statecall change at that point with END_CALL so it works exactly as a phonecall for these type of notifications. I only added the code to MiBand2Support so it will not work for other devices. My sources are available **link removed** (it is **not** ok to copy or take the code unless the author adds it to the repository. This could expose the project to long term troubles related to IP rights). I have modified also other things like starting/ending gb when bt is changed and auto dismissing notifications from the phone when they are delivered to mi band 2. I am sorry I don;t have the time to xreate diferent branches and upload all of these. Feel free to use my code or benefit from it.
lazarosfs commented 4 years ago (Migrated from github.com)
Poster
Owner

I was not aware of that. Isn't gb open source licensed? Isn't free to distribute modify use as long as you distribute with original copyright and unmodified license in files? Why is there trouble?
Am I not allowed to fork and modify/ branch this?

I was not aware of that. Isn't gb open source licensed? Isn't free to distribute modify use as long as you distribute with original copyright and unmodified license in files? Why is there trouble? Am I not allowed to fork and modify/ branch this?
Owner

Premise: I am not a lawyer and this is not legal advice, but just my understanding of how licensing works.

The project codebase is licensed with a free software license (AGPLv3).
If someone modifies the codebase, the changes must be released with a compatible license.
The project doesn't ask to sign CLA / give the copyright over to some entity like other projects do.
Each contributors is therefore keeping his intellectual property over his contributions.
Problem 1)
If the code is committed to the codebase by someone other than the author, the author might legitimately object that he holds the copyright to his changes, while the attribution goes to someone else (the committer).
Problem 2)
Random rar files on random websites might contain code that wasn't originally released under a license compatible with the project, and could even taint the whole codebase (think clean room implementation). Who shares the link is perhaps not doing anything evil but whoever brings the changes in the codebase might expose himself and the project to potential problems.

Tl;dr: if someone cares for the project he is free to use the tools provided by github to share his contribution or send a git patch via email. This way the contributor is ensured proper attribution is given and the project is ensured every contribution is under its author's responsibility.

Premise: I am not a lawyer and this is not legal advice, but just my understanding of how licensing works. The project codebase is licensed with a free software license (AGPLv3). If someone modifies the codebase, the changes must be released with a compatible license. The project doesn't ask to sign CLA / give the copyright over to some entity like other projects do. Each contributors is therefore keeping his intellectual property over his contributions. Problem 1) If the code is committed to the codebase by someone other than the author, the author might legitimately object that **he** holds the copyright to **his** changes, while the attribution goes to **someone else** (the committer). Problem 2) Random rar files on random websites might contain code that wasn't originally released under a license compatible with the project, and could even taint the whole codebase (think clean room implementation). Who shares the link is perhaps not doing anything evil but whoever brings the changes in the codebase might expose himself and the project to potential problems. Tl;dr: if someone cares for the project he is free to use the tools provided by github to share his contribution or send a git patch via email. This way the contributor is ensured proper attribution is given and the project is ensured every contribution is under its author's responsibility.
Owner

So to be completely clear, in this specific case the problem is not here

Am I not allowed to fork and modify/ branch this?

Of course you are.

The problem is when user lazarosfs on github.com writes:

Feel free to use my code or benefit from it.

And then links to a rar file on another platform where there is no way to properly identify your code.

So to be completely clear, in this specific case the problem is not here > Am I not allowed to fork and modify/ branch this? Of course you are. The problem is when user **lazarosfs** on **github.com** writes: > Feel free to use **my** code or benefit from it. And then links to a rar file on *another platform* where there is no way to properly identify *your* code.
lazarosfs commented 4 years ago (Migrated from github.com)
Poster
Owner

I see the point. Thank you for clearing this Daniele, I will try to create proper branch and upload all source even if not clean. My implementation seems to work fine, the reasoning looks good. My changes in short are:

  • I added a boolean "NotificationSpec.type "call" which is false by default.
  • In NotificationListener.onNotificationPosted, I then detect and mark the ongoing flag 3 notification from com.viber.voip source package with extra flag title "Incoming Viber Call" with notificationSpec.call as true and notificationSpec.title = extra text (that is the caller). (We have to add this also to GBDeviceService.onNotification -> .putExtra)
  • I then check for that NotificationSpec.call type in MiBand2Support.onNotification and create a MiBand2Support.onSetCallState() with CALL_INCOMING command to start ringing.
  • when the phonecall is answered the notification text changes,or when is dismissed/rejected/canceled the notification is canceled and NotificationListener runs a deviceService.OnDeleteNotification() which in MiBand2Support.onDeleteNotification() then a new onSetCallState with command CallSpec.CALL_END stops the ringing.

Whatsapp notification is not ongoing, is flaged 24 and has an "Incoming voice call" extra title and source com.whatsapp and extra text as the caller name. If we have the relevant details for Signal notification same practise can follow and for pebble/other devices as well.

I see the point. Thank you for clearing this Daniele, I will try to create proper branch and upload all source even if not clean. My implementation seems to work fine, the reasoning looks good. My changes in short are: - I added a boolean "NotificationSpec.type "call" which is false by default. - In NotificationListener.onNotificationPosted, I then detect and mark the ongoing flag 3 notification from com.viber.voip source package with extra flag title "Incoming Viber Call" with notificationSpec.call as true and notificationSpec.title = extra text (that is the caller). (We have to add this also to GBDeviceService.onNotification -> .putExtra) - I then check for that NotificationSpec.call type in MiBand2Support.onNotification and create a MiBand2Support.onSetCallState() with CALL_INCOMING command to start ringing. - when the phonecall is answered the notification text changes,or when is dismissed/rejected/canceled the notification is canceled and NotificationListener runs a deviceService.OnDeleteNotification() which in MiBand2Support.onDeleteNotification() then a new onSetCallState with command CallSpec.CALL_END stops the ringing. Whatsapp notification is not ongoing, is flaged 24 and has an "Incoming voice call" extra title and source com.whatsapp and extra text as the caller name. If we have the relevant details for Signal notification same practise can follow and for pebble/other devices as well.
CBiX commented 3 years ago (Migrated from github.com)
Owner

Hey @lazarosfs would you mind creating a github PR and linking it here? I'm having the same issue of not receiving a notification on Mi Band 2 for incoming WhatsApp calls.

Hey @lazarosfs would you mind creating a github PR and linking it here? I'm having the same issue of not receiving a notification on Mi Band 2 for incoming WhatsApp calls.
vanous added
notifications
and removed
android integrations
labels 1 year ago
Sign in to join this conversation.
No Milestone
No Assignees
2 Participants
Notifications
Due Date

No due date set.

Dependencies

This issue currently doesn't have any dependencies.

Loading…
There is no content yet.